diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index 4a7068acd..d862c2b55 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -130,8 +130,15 @@ if (!$dont_check_update) // set 'master' to true to prevent other upgrades from running before it is complete. $LAN_UPDATE_4 = deftrue('LAN_UPDATE_4',"Update from [x] to [y]"); // in case language-pack hasn't been upgraded. + $LAN_UPDATE_5 = deftrue('LAN_UPDATE_5', "Core database structure"); - $dbupdate['706_to_800'] = array('master'=>true, 'title'=> e107::getParser()->lanVars($LAN_UPDATE_4, array('1.x','2.0')), 'message'=> LAN_UPDATE_29); + + + $dbupdate['706_to_800'] = array('master'=>true, 'title'=> e107::getParser()->lanVars($LAN_UPDATE_4, array('1.x','2.0')), 'message'=> LAN_UPDATE_29, 'hide_when_complete'=>false); + + + // always run these last. + $dbupdate['core_database'] = array('master'=>false, 'title'=> $LAN_UPDATE_5); $dbupdate['core_prefs'] = array('master'=>true, 'title'=> LAN_UPDATE_13); // Prefs check // $dbupdate['70x_to_706'] = LAN_UPDATE_8.' .70x '.LAN_UPDATE_9.' .706'; } // End if (!$dont_check_update) @@ -265,18 +272,23 @@ class e107Update foreach($this->core as $func => $data) { + $text2 = ''; + if(function_exists("update_".$func)) { - $text .= "".$data['title'].""; - - - + if(call_user_func("update_".$func)) { - $text .= "".ADMIN_TRUE_ICON.""; + if(empty($data['hide_when_complete'])) + { + $text2 .= "".$data['title'].""; + $text2 .= "".ADMIN_TRUE_ICON.""; + } } else { + $text2 .= "".$data['title'].""; + if(vartrue($data['message'])) { $mes->addInfo($data['message']); @@ -284,13 +296,19 @@ class e107Update $this->updates ++; - $text .= "".$frm->admin_button('update_core['.$func.']', LAN_UPDATE, 'warning', '', "id=e-{$func}&disabled=".$this->disabled).""; + $text2 .= "".$frm->admin_button('update_core['.$func.']', LAN_UPDATE, 'warning', '', "id=e-{$func}&disabled=".$this->disabled).""; + if($data['master'] == true) { $this->disabled = 1; } } - $text .= "\n"; + + if(!empty($text2)) + { + $text .= "".$text2."\n"; + } + } } @@ -306,7 +324,7 @@ class e107Update $caption = LAN_UPDATE; $text = " -
+
{$caption} @@ -484,6 +502,46 @@ if (defined('TEST_UPDATE')) } } // End of test routine +// generic database structure update. +function update_core_database($type = '') +{ + $just_check = ($type == 'do') ? FALSE : TRUE; + require_once(e_HANDLER."db_verify_class.php"); + $dbv = new db_verify; + $log = e107::getAdminLog(); + + if($plugUpgradeReq = e107::getPlugin()->updateRequired()) + { + $exclude = array_keys($plugUpgradeReq); // search xxxxx_setup.php and check for 'upgrade_required()' == true. + asort($exclude); + } + else + { + $exclude = false; + } + + $dbv->compareAll($exclude); // core & plugins, but not plugins calling for an update with xxxxx_setup.php + + + if(count($dbv->errors)) + { + if ($just_check) + { + $mes = e107::getMessage(); + // $mes->addDebug(print_a($dbv->errors,true)); + $log->addDebug(print_a($dbv->errors,true)); + $tables = implode(", ", array_keys($dbv->errors)); + return update_needed("Database Tables require updating: ".$tables.""); + } + + $dbv->compileResults(); + $dbv->runFix(); // Fix entire core database structure and plugins too. + } + + + return $just_check; +} + @@ -1032,11 +1090,13 @@ function update_706_to_800($type='') $mes = e107::getMessage(); // $mes->addDebug(print_a($dbv->errors,true)); $log->addDebug(print_a($dbv->errors,true)); - return update_needed("Database Tables require updating."); + // return update_needed("Database Tables require updating."); // + } + else + { + $dbv->compileResults(); + $dbv->runFix(); // Fix entire core database structure and plugins too. } - - $dbv->compileResults(); - $dbv->runFix(); // Fix entire core database structure and plugins too. } // print_a($dbv->results); diff --git a/e107_core/shortcodes/batch/admin_shortcodes.php b/e107_core/shortcodes/batch/admin_shortcodes.php index 41ebd9740..bbf7bd491 100644 --- a/e107_core/shortcodes/batch/admin_shortcodes.php +++ b/e107_core/shortcodes/batch/admin_shortcodes.php @@ -723,7 +723,7 @@ class admin_shortcodes $outboxUrl = e_PLUGIN.'pm/admin_config.php?mode=outbox&action=list&iframe=1'; $composeUrl = e_PLUGIN.'pm/admin_config.php?mode=outbox&action=create&iframe=1'; - $text = '