[geeklog-cvs] geeklog: Report failed plugin upgrades and prepare for nicer err...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Mon Jan 5 05:06:48 EST 2009
details: http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/33002d96c8e2
changeset: 6615:33002d96c8e2
user: Dirk Haun <dirk at haun-online.de>
date: Wed Dec 31 13:49:45 2008 +0100
description:
Report failed plugin upgrades and prepare for nicer error messages
diffstat:
3 files changed, 40 insertions(+), 7 deletions(-)
public_html/admin/install/lib-install.php | 3 --
public_html/admin/install/lib-upgrade.php | 6 ++++
public_html/admin/install/migrate.php | 38 +++++++++++++++++++++++++----
diffs (129 lines):
diff -r b82e1a0538e0 -r 33002d96c8e2 public_html/admin/install/lib-install.php
--- a/public_html/admin/install/lib-install.php Wed Dec 31 12:02:54 2008 +0100
+++ b/public_html/admin/install/lib-install.php Wed Dec 31 13:49:45 2008 +0100
@@ -46,8 +46,7 @@
if (function_exists('ini_set')) {
ini_set('display_errors', '1');
}
-//error_reporting(E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR | E_NOTICE);
-error_reporting(E_ALL);
+error_reporting(E_ERROR | E_WARNING | E_PARSE | E_COMPILE_ERROR | E_NOTICE);
if (!defined('LB')) {
define('LB', "\n");
diff -r b82e1a0538e0 -r 33002d96c8e2 public_html/admin/install/lib-upgrade.php
--- a/public_html/admin/install/lib-upgrade.php Wed Dec 31 12:02:54 2008 +0100
+++ b/public_html/admin/install/lib-upgrade.php Wed Dec 31 13:49:45 2008 +0100
@@ -718,11 +718,14 @@
*
* @note Needs a fully working Geeklog, so can only be done late in the upgrade
* process!
+* @return int number of failed plugin updates (0 = everything's fine)
*
*/
function INST_pluginUpgrades()
{
global $_CONF, $_TABLES;
+
+ $failed = 0;
$result = DB_query("SELECT pi_name, pi_version FROM {$_TABLES['plugins']} WHERE pi_enabled = 1");
$numPlugins = DB_numRows($result);
@@ -736,9 +739,12 @@
// upgrade failed - disable plugin
DB_query("UPDATE {$_TABLES['plugins']} SET pi_enabled = 0 WHERE pi_name = '$pi_name'");
COM_errorLog("Upgrade for '$pi_name' plugin failed - plugin disabled");
+ $failed++;
}
}
}
+
+ return $failed;
}
?>
diff -r b82e1a0538e0 -r 33002d96c8e2 public_html/admin/install/migrate.php
--- a/public_html/admin/install/migrate.php Wed Dec 31 12:02:54 2008 +0100
+++ b/public_html/admin/install/migrate.php Wed Dec 31 13:49:45 2008 +0100
@@ -583,11 +583,20 @@
require_once $_CONF['path_system'] . 'lib-database.php';
require_once 'lib-upgrade.php';
+ $upgrade_error = false;
+
$version = INST_identifyGeeklogVersion();
if ($version == 'empty') {
- exit("Fatal: Database import seems to have failed?!");
+
+ // "This shouldn't happen"
+ $display .= INST_getAlertMsg("Fatal error: Database import seems to have failed. Don't know how to continue.");
+ $upgrade_error = true;
+
} elseif (empty($version)) {
- exit("Could not identify version. Please perform a manual update.");
+
+ $display .= INST_getAlertMsg("Could not identify database version. Please perform a manual update.");
+ $upgrade_error = true;
+
} elseif ($version != VERSION) {
$use_innodb = false;
@@ -598,8 +607,19 @@
}
if (! INST_doDatabaseUpgrades($version)) {
- exit("Database upgrade from version $version to version " . VERSION . " failed!");
+
+ $display .= INST_getAlertMsg("Database upgrade from version $version to version " . VERSION . " failed.");
+ $upgrade_error = true;
+
}
+
+ }
+
+ if ($upgrade_error) {
+
+ $display .= INST_getFooter();
+ echo $display;
+ exit;
}
@@ -671,12 +691,13 @@
}
+ $disabled_plugins = 0;
if ($version != VERSION) {
// We did a database upgrade above. Now that any missing plugins
// have been disabled and we've loaded lib-common.php, perform
// upgrades for the remaining plugins.
- INST_pluginUpgrades();
+ $disabled_plugins = INST_pluginUpgrades();
}
@@ -749,7 +770,8 @@
*/
// Check if there are any missing files or plugins
- if ($missing_images || ($missing_plugins > 0)) {
+ if ($missing_images || ($missing_plugins > 0) ||
+ ($disabled_plugins > 0)) {
$display .= '<h2>' . $LANG_MIGRATE[37] . '</h2>' . LB
. '<p>' . $LANG_MIGRATE[38] . '</p>' . LB;
@@ -758,6 +780,12 @@
if ($missing_plugins > 0) {
$display .= INST_getAlertMsg($LANG_MIGRATE[32] . ' <code>' . $_CONF['path'] . 'plugins/</code> ' . $LANG_MIGRATE[33], 'notice');
+
+ }
+
+ if ($disabled_plugins > 0) {
+
+ $display .= INST_getAlertMsg("One or more plugins could not be updated and had to be disabled.");
}
More information about the geeklog-cvs
mailing list