Parcourir la source

hopefully better update handling - never update the current DB version or continue with other updates if there was a failure of any individual update.

tags/3.1
friendica il y a 8 ans
Parent
révision
0d631cc08c
2 fichiers modifiés avec 10 ajouts et 5 suppressions
  1. +7
    -5
      boot.php
  2. +3
    -0
      mod/admin.php

+ 7
- 5
boot.php Voir le fichier

@@ -747,9 +747,10 @@ if(! function_exists('check_config')) {
// 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))
$t = get_config('database','update_' . $x);
if($t !== false)
break;
set_config('database','update_' . $x, '1');
set_config('database','update_' . $x, time());

// call the specific update

@@ -772,13 +773,14 @@ if(! function_exists('check_config')) {
. 'Content-transfer-encoding: 8bit' );
//try the logger
logger('CRITICAL: Update Failed: '. $x);
break;
}
else
else {
set_config('database','update_' . $x, 'success');
set_config('system','build', $x + 1);
}
}
}
set_config('system','build', DB_UPDATE_VERSION);
}
}
}


+ 3
- 0
mod/admin.php Voir le fichier

@@ -471,6 +471,9 @@ function admin_page_dbsync(&$a) {

if($a->argc > 3 && intval($a->argv[3]) && $a->argv[2] === 'mark') {
set_config('database', 'update_' . intval($a->argv[3]), 'success');
$curr = get_config('system','build');
if(intval($curr) == intval($a->argv[3]))
set_config('system','build',intval($curr) + 1);
info( t('Update has been marked successful') . EOL);
goaway($a->get_baseurl(true) . '/admin/dbsync');
}


Chargement…
Annuler
Enregistrer