]> git.mxchange.org Git - friendica.git/commitdiff
hopefully solve db update issues bug #182
authorFriendika <info@friendika.com>
Tue, 18 Oct 2011 07:18:21 +0000 (00:18 -0700)
committerFriendika <info@friendika.com>
Tue, 18 Oct 2011 07:18:21 +0000 (00:18 -0700)
boot.php
mod/admin.php

index 37c530e81f8b5e8bc0c6173277d56ae0e4b4a406..c2c1088e47e96939e6cd2ee1bb8d95f9b1f1f717 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -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);
                                        }
index ebef1ccb9378b784d86107789fc33f4ca218cfc6..f178e67f612587dbd2727e195696914a377d92fa 100644 (file)
@@ -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;
        }