aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-08-14 19:31:10 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-08-14 19:31:10 -0700
commitf44a499ca710c417fb0370b3652bb78d4b09661f (patch)
treeff84830db80c52beaab64ea24ea549350fdca678 /boot.php
parentd76348575299db76d8b6aabd460d21f6b3b0edfb (diff)
downloadvolse-hubzilla-f44a499ca710c417fb0370b3652bb78d4b09661f.tar.gz
volse-hubzilla-f44a499ca710c417fb0370b3652bb78d4b09661f.tar.bz2
volse-hubzilla-f44a499ca710c417fb0370b3652bb78d4b09661f.zip
schema auto-update
Diffstat (limited to 'boot.php')
-rw-r--r--boot.php27
1 files changed, 24 insertions, 3 deletions
diff --git a/boot.php b/boot.php
index 95c0351f8..31062d175 100644
--- a/boot.php
+++ b/boot.php
@@ -175,10 +175,31 @@ function check_config(&$a) {
q("INSERT INTO `config` (`cat`,`k`,`v`) VALUES ( 'system', 'build', '%s' )",
dbesc(BUILD_ID)
);
+ return;
}
-
-
-
+ foreach($r as $rr) {
+ if($rr['k'] == 'build') {
+ $stored = intval($rr['v']);
+ $current = intval(BUILD_ID);
+ if(($stored < $current) && file_exists('update.php')) {
+
+ // We're reporting a different version than what is currently installed.
+ // Run any existing update scripts to bring the database up to current.
+
+ require_once('update.php');
+ for($x = $stored; $x <= $current; $x ++) {
+ if(function_exists('update_' . $x)) {
+ $func = 'update_' . $x;
+ $func($a);
+ }
+ }
+ q("UPDATE `config` SET `v` = '%s' WHERE `cat` = 'system' AND `k` = 'build' LIMIT 1",
+ dbesc(BUILD_ID)
+ );
+ }
+ }
+ }
+ return;
}}