From 9a7de2b6b1b85a0642d34b24fa1daacbf119c0a9 Mon Sep 17 00:00:00 2001 From: patdenice Date: Sat, 1 Nov 2008 21:19:20 +0000 Subject: - 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 --- admin/include/functions_upgrade.php | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'admin/include/functions_upgrade.php') diff --git a/admin/include/functions_upgrade.php b/admin/include/functions_upgrade.php index 06bba375a..b21cc7c01 100644 --- a/admin/include/functions_upgrade.php +++ b/admin/include/functions_upgrade.php @@ -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: +
' . implode(', ', $plugins) . '
' + ); + } +} + ?> -- cgit v1.2.3