1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-07 15:16:30 +02:00

Upgrade routine now separates non-core plugin sql changes into their own area.

This commit is contained in:
Cameron
2015-01-27 13:00:33 -08:00
parent 666ea246c2
commit a35f7ef171
3 changed files with 44 additions and 6 deletions

View File

@@ -216,6 +216,9 @@ class e107Update
function updatePlugin($path) function updatePlugin($path)
{ {
e107::getPlugin()->install_plugin_xml($path, 'upgrade'); e107::getPlugin()->install_plugin_xml($path, 'upgrade');
e107::getMessage()->reset(E_MESSAGE_INFO);
e107::getMessage()->addSuccess(LAN_UPDATED." : ".$path);
} }
@@ -1136,6 +1139,7 @@ function update_706_to_800($type='')
if($plugUpgradeReq = e107::getPlugin()->updateRequired()) if($plugUpgradeReq = e107::getPlugin()->updateRequired())
{ {
$exclude = array_keys($plugUpgradeReq); // search xxxxx_setup.php and check for 'upgrade_required()' == true. $exclude = array_keys($plugUpgradeReq); // search xxxxx_setup.php and check for 'upgrade_required()' == true.
asort($exclude);
} }
else else
{ {

View File

@@ -90,7 +90,7 @@ class db_verify
*/ */
function verify() function verify()
{ {
print_a($_POST);
if(vartrue($_POST['verify_table'])) if(vartrue($_POST['verify_table']))
{ {
$this->runComparison($_POST['verify_table']); $this->runComparison($_POST['verify_table']);
@@ -367,6 +367,15 @@ class db_verify
} }
/**
* Returns the number of errors
*/
public function errors()
{
return count($this->errors);
}
function renderResults() function renderResults()
{ {

View File

@@ -218,12 +218,28 @@ class e107plugin
return FALSE; return FALSE;
} }
require_once(e_HANDLER."db_verify_class.php");
$dbv = new db_verify;
foreach($plugVersions as $path=>$version) foreach($plugVersions as $path=>$version)
{ {
$fullPath = e_PLUGIN.$path."/plugin.xml"; $fullPath = e_PLUGIN.$path."/plugin.xml";
if(is_file(e_PLUGIN.$path."/plugin.xml")) if(is_file(e_PLUGIN.$path."/plugin.xml"))
{ {
$data = $xml->loadXMLfile($fullPath, true); $data = $xml->loadXMLfile($fullPath, true);
if(!in_array($path, $this->core_plugins)) // check non-core plugins for sql file changes.
{
$dbv->errors = array();
$dbv->compare($path);
if($dbv->errors())
{
$needed[$path] = $data;
}
}
$curVal = floatval($version); $curVal = floatval($version);
$fileVal = floatval($data['@attributes']['version']); $fileVal = floatval($data['@attributes']['version']);
@@ -1347,8 +1363,12 @@ class e107plugin
$error = array(); // Array of error messages $error = array(); // Array of error messages
$canContinue = TRUE; // Clear flag if must abort part way through $canContinue = TRUE; // Clear flag if must abort part way through
if(is_string($id)) // Plugin Path.
if(is_array($id)) {
$id = $this->getId($id);
$plug = $this->getinfo($id); // Get plugin info from DB
}
elseif(is_array($id))
{ {
$plug = $id; $plug = $id;
$id = $plug['plugin_id']; $id = $plug['plugin_id'];
@@ -1407,6 +1427,7 @@ class e107plugin
if (!$canContinue) if (!$canContinue)
{ {
return FALSE; return FALSE;
} }
@@ -1447,6 +1468,7 @@ class e107plugin
$mes->add($txt, $status); $mes->add($txt, $status);
break; break;
case 'upgrade': case 'upgrade':
$tmp = $dbHandler->update_table_structure($ct, FALSE, TRUE, $pref['multilanguage']); $tmp = $dbHandler->update_table_structure($ct, FALSE, TRUE, $pref['multilanguage']);
if ($tmp === FALSE) if ($tmp === FALSE)
{ {
@@ -1456,6 +1478,9 @@ class e107plugin
{ {
$error[] = $tmp; $error[] = $tmp;
} }
break; break;
case 'refresh': // Leave things alone case 'refresh': // Leave things alone
break; break;