revise auto_update system so as not to conflict with pre-existing Friendica settings

This commit is contained in:
friendica 2012-12-09 16:28:35 -08:00
parent 75ea0cfa32
commit 7f77670649
4 changed files with 19 additions and 1323 deletions

View File

@ -17,7 +17,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica Red');
define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'FRIENDICA_VERSION', trim(file_get_contents('version.inc')) . 'R');
define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'ZOT_REVISION', 1 ); define ( 'ZOT_REVISION', 1 );
define ( 'DB_UPDATE_VERSION', 1154 ); define ( 'DB_UPDATE_VERSION', 1000 );
define ( 'EOL', "<br />\r\n" ); define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );
@ -868,9 +868,9 @@ function is_ajax() {
if(! function_exists('check_config')) { if(! function_exists('check_config')) {
function check_config(&$a) { function check_config(&$a) {
$build = get_config('system','build'); $build = get_config('system','db_version');
if(! x($build)) if(! x($build))
$build = set_config('system','build',DB_UPDATE_VERSION); $build = set_config('system','db_version',DB_UPDATE_VERSION);
// $url = get_config('system','baseurl'); // $url = get_config('system','baseurl');
@ -906,7 +906,7 @@ function check_config(&$a) {
if(DB_UPDATE_VERSION == UPDATE_VERSION) { if(DB_UPDATE_VERSION == UPDATE_VERSION) {
for($x = $stored; $x < $current; $x ++) { for($x = $stored; $x < $current; $x ++) {
if(function_exists('update_' . $x)) { if(function_exists('update_r' . $x)) {
// There could be a lot of processes running or about to run. // There could be a lot of processes running or about to run.
// We want exactly one process to run the update command. // We want exactly one process to run the update command.
@ -916,13 +916,13 @@ function check_config(&$a) {
// If the update fails or times-out completely you may need to // If the update fails or times-out completely you may need to
// delete the config entry to try again. // delete the config entry to try again.
if(get_config('database','update_' . $x)) if(get_config('database','update_r' . $x))
break; break;
set_config('database','update_' . $x, '1'); set_config('database','update_r' . $x, '1');
// call the specific update // call the specific update
$func = 'update_' . $x; $func = 'update_r' . $x;
$retval = $func(); $retval = $func();
if($retval) { if($retval) {
//send the administrator an e-mail //send the administrator an e-mail
@ -943,11 +943,11 @@ function check_config(&$a) {
logger('CRITICAL: Update Failed: '. $x); logger('CRITICAL: Update Failed: '. $x);
} }
else else
set_config('database','update_' . $x, 'success'); set_config('database','update_r' . $x, 'success');
} }
} }
set_config('system','build', DB_UPDATE_VERSION); set_config('system','db_version', DB_UPDATE_VERSION);
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -189,7 +189,7 @@ function admin_page_summary(&$a) {
'$accounts' => $accounts, '$accounts' => $accounts,
'$pending' => Array( t('Pending registrations'), $pending), '$pending' => Array( t('Pending registrations'), $pending),
'$version' => Array( t('Version'), FRIENDICA_VERSION), '$version' => Array( t('Version'), FRIENDICA_VERSION),
'$build' => get_config('system','build'), '$build' => get_config('system','db_version'),
'$plugins' => Array( t('Active plugins'), $a->plugins ) '$plugins' => Array( t('Active plugins'), $a->plugins )
)); ));
} }
@ -431,14 +431,16 @@ function admin_page_dbsync(&$a) {
$o = ''; $o = '';
if(argc() > 3 && intval(argv(3)) && argv(2) === 'mark') { if(argc() > 3 && intval(argv(3)) && argv(2) === 'mark') {
set_config('database', 'update_' . intval(argv(3)), 'success'); set_config('database', 'update_r' . intval(argv(3)), 'success');
if(intval(get_config('system','db_version')) <= intval(argv(3)))
set_config('system','db_version',intval(argv(3)) + 1);
info( t('Update has been marked successful') . EOL); info( t('Update has been marked successful') . EOL);
goaway($a->get_baseurl(true) . '/admin/dbsync'); goaway($a->get_baseurl(true) . '/admin/dbsync');
} }
if(argc() > 2 && intval(argv(2))) { if(argc() > 2 && intval(argv(2))) {
require_once('install/update.php'); require_once('install/update.php');
$func = 'update_' . intval(argv(2)); $func = 'update_r' . intval(argv(2));
if(function_exists($func)) { if(function_exists($func)) {
$retval = $func(); $retval = $func();
if($retval === UPDATE_FAILED) { if($retval === UPDATE_FAILED) {
@ -460,7 +462,7 @@ function admin_page_dbsync(&$a) {
$r = q("select * from config where `cat` = 'database' "); $r = q("select * from config where `cat` = 'database' ");
if(count($r)) { if(count($r)) {
foreach($r as $rr) { foreach($r as $rr) {
$upd = intval(substr($rr['k'],7)); $upd = intval(substr($rr['k'],8));
if($upd < 1139 || $rr['v'] === 'success') if($upd < 1139 || $rr['v'] === 'success')
continue; continue;
$failed[] = $upd; $failed[] = $upd;

View File

@ -1 +1 @@
2012-12-08.163 2012-12-09.164