- bugs correction in upgrade_1.7.0.php.
- only non-standard plugins are deactivated during upgrade. git-svn-id: http://piwigo.org/svn/trunk@2815 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
ae4e04da07
commit
9a7de2b6b1
@ -94,4 +94,50 @@ function create_empty_local_files()
|
||||
}
|
||||
}
|
||||
|
||||
// Deactivate all non-standard plugins
|
||||
function deactivate_non_standard_plugins()
|
||||
{
|
||||
global $page;
|
||||
|
||||
$standard_plugins = array(
|
||||
'add_index',
|
||||
'admin_advices',
|
||||
'admin_multi_view',
|
||||
'c13y_upgrade',
|
||||
'event_tracer',
|
||||
'language_switch',
|
||||
'LocalFilesEditor'
|
||||
);
|
||||
|
||||
$query = '
|
||||
SELECT id
|
||||
FROM '.PREFIX_TABLE.'plugins
|
||||
WHERE state = "active"
|
||||
AND id NOT IN ("' . implode('","', $standard_plugins) . '")
|
||||
;';
|
||||
|
||||
$result = pwg_query($query);
|
||||
$plugins = array();
|
||||
while ($row = mysql_fetch_assoc($result))
|
||||
{
|
||||
array_push($plugins, $row['id']);
|
||||
}
|
||||
|
||||
if (!empty($plugins))
|
||||
{
|
||||
$query = '
|
||||
UPDATE '.PREFIX_TABLE.'plugins
|
||||
SET state="inactive"
|
||||
WHERE id IN ("' . implode('","', $plugins) . '")
|
||||
;';
|
||||
mysql_query($query);
|
||||
|
||||
array_push(
|
||||
$page['infos'],
|
||||
'As a precaution, following plugins have been deactivated. You must check for plugins upgrade before reactiving them:
|
||||
<pre>' . implode(', ', $plugins) . '</pre>'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@ -33,7 +33,6 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
define('PREFIX_TABLE', $prefixeTable);
|
||||
define('UPGRADES_PATH', PHPWG_ROOT_PATH.'install/db');
|
||||
|
||||
list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
|
||||
@ -68,15 +67,19 @@ foreach ($to_apply as $upgrade_id)
|
||||
array(
|
||||
'id' => $upgrade_id,
|
||||
'applied' => CURRENT_DATE,
|
||||
'description' => '[migration from 1.7.0 to '.RELEASE.'] not applied',
|
||||
'description' => '[migration from 1.7.0 to '.PHPWG_VERSION.'] not applied',
|
||||
)
|
||||
);
|
||||
}
|
||||
mass_inserts(
|
||||
'`'.UPGRADE_TABLE.'`',
|
||||
array_keys($inserts[0]),
|
||||
$inserts
|
||||
);
|
||||
|
||||
if (!empty($inserts))
|
||||
{
|
||||
mass_inserts(
|
||||
'`'.UPGRADE_TABLE.'`',
|
||||
array_keys($inserts[0]),
|
||||
$inserts
|
||||
);
|
||||
}
|
||||
|
||||
// +-----------------------------------------------------------------------+
|
||||
// | Perform upgrades |
|
||||
@ -106,7 +109,7 @@ for ($upgrade_id = 61; ; $upgrade_id++)
|
||||
INSERT INTO `'.PREFIX_TABLE.'upgrade`
|
||||
(id, applied, description)
|
||||
VALUES
|
||||
(\''.$upgrade_id.'\', NOW(), \'[migration from 1.7.0 to '.RELEASE.'] '.$upgrade_description.'\')
|
||||
(\''.$upgrade_id.'\', NOW(), \'[migration from 1.7.0 to '.PHPWG_VERSION.'] '.$upgrade_description.'\')
|
||||
;';
|
||||
pwg_query($query);
|
||||
}
|
||||
|
14
upgrade.php
14
upgrade.php
@ -237,19 +237,7 @@ else
|
||||
// Plugins deactivation
|
||||
if (in_array(PREFIX_TABLE.'plugins', $tables))
|
||||
{
|
||||
$query = '
|
||||
UPDATE '.PREFIX_TABLE.'plugins SET state="inactive" WHERE state="active"
|
||||
;';
|
||||
mysql_query($query);
|
||||
|
||||
if (mysql_affected_rows() > 0)
|
||||
{
|
||||
array_push(
|
||||
$page['infos'],
|
||||
'As a precaution, all activated plugins have been deactivated.
|
||||
You must check for plugins upgrade before reactiving them.'
|
||||
);
|
||||
}
|
||||
deactivate_non_standard_plugins();
|
||||
}
|
||||
|
||||
// Create empty local files to avoid log errors
|
||||
|
Loading…
x
Reference in New Issue
Block a user