diff options
author | Friendika <info@friendika.com> | 2011-10-18 00:18:21 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-10-18 00:18:21 -0700 |
commit | 06096486d4f5a2260e48f5c0cf5fd5af71f30964 (patch) | |
tree | 79267a879a29cf9470576064ca54f4957db0351a | |
parent | cc5974e6c2af2deb4702da670331107e15fa3110 (diff) | |
download | volse-hubzilla-06096486d4f5a2260e48f5c0cf5fd5af71f30964.tar.gz volse-hubzilla-06096486d4f5a2260e48f5c0cf5fd5af71f30964.tar.bz2 volse-hubzilla-06096486d4f5a2260e48f5c0cf5fd5af71f30964.zip |
hopefully solve db update issues bug #182
-rw-r--r-- | boot.php | 17 | ||||
-rw-r--r-- | mod/admin.php | 11 |
2 files changed, 19 insertions, 9 deletions
@@ -539,6 +539,8 @@ function check_config(&$a) { $current = intval(DB_UPDATE_VERSION); if(($stored < $current) && file_exists('update.php')) { + load_config('database'); + // We're reporting a different version than what is currently installed. // Run any existing update scripts to bring the database up to current. @@ -552,6 +554,21 @@ function check_config(&$a) { for($x = $stored; $x < $current; $x ++) { if(function_exists('update_' . $x)) { + + // There could be a lot of processes running or about to run. + // We want exactly one process to run the update command. + // So store the fact that we're taking responsibility + // after first checking to see if somebody else already has. + + // If the update fails or times-out completely you may need to + // delete the config entry to try again. + + if(get_config('database','update_' . $x)) + break; + set_config('database','update_' . $x, '1'); + + // call the specific update + $func = 'update_' . $x; $func($a); } diff --git a/mod/admin.php b/mod/admin.php index ebef1ccb9..f178e67f6 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -5,16 +5,9 @@ */ require_once("include/remoteupdate.php"); -function admin_init(&$a) { - if(!is_site_admin()) { - notice( t('Permission denied.') . EOL); - return; - } -} - function admin_post(&$a){ if(!is_site_admin()) { - return login(false); + return; } // urls @@ -672,7 +665,7 @@ function admin_page_logs(&$a){ function admin_page_remoteupdate_post(&$a) { // this function should be called via ajax post if(!is_site_admin()) { - return login(false); + return; } |