[geeklog-hg] geeklog: Fixed a bug where the upload of an existing plugin caus...
geeklog-cvs at lists.geeklog.net
geeklog-cvs at lists.geeklog.net
Sun Jan 5 06:26:47 EST 2014
changeset 9390:36cce0334dba
url: http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/36cce0334dba
user: Kenji ITO <mystralkk at gmail.com>
date: Sun Jan 05 20:25:09 2014 +0900
description:
Fixed a bug where the upload of an existing plugin caused an error (bug #0001715)
diffstat:
public_html/admin/plugins.php | 26 +++++++++++++++++++++-----
1 files changed, 21 insertions(+), 5 deletions(-)
diffs (62 lines):
diff -r 0d953971f8cb -r 36cce0334dba public_html/admin/plugins.php
--- a/public_html/admin/plugins.php Sun Jan 05 19:49:11 2014 +0900
+++ b/public_html/admin/plugins.php Sun Jan 05 20:25:09 2014 +0900
@@ -731,10 +731,16 @@
$pi_was_enabled = ($A['pi_enabled'] == 1);
}
+ $callback = 'plugin_enablestatechange_' . $dirname;
+
if ($pi_was_enabled) {
// disable temporarily while we move the files around
- DB_change($_TABLES['plugins'], 'pi_enabled', 0,
- 'pi_name', $dirname);
+ if (is_callable($callback)) {
+ changePluginStatus($dirname);
+ } else {
+ DB_change($_TABLES['plugins'], 'pi_enabled', 0,
+ 'pi_name', $dirname);
+ }
}
require_once 'System.php';
@@ -779,10 +785,13 @@
$fdata = fread($fhandle, filesize($plugin_inst));
fclose($fhandle);
}
-
+/*
// Remove the plugin from data/
require_once 'System.php';
@System::rm('-rf ' . $_CONF['path'] . 'data/' . $dirname);
+*/
+ // Some plugins seem to expect files under the data directory to
+ // be unchanged while they are disabled. Let's leave the files untouched.
/**
* One time I wanted to install a muffler on my car and
@@ -834,6 +843,8 @@
unset($archive); // Collect some garbage
// cleanup when uploading a new version
+ require_once 'System.php';
+
if ($pi_did_exist) {
$plugin_dir = $_CONF['path'] . 'plugins/' . $dirname;
if (file_exists($plugin_dir . '.previous')) {
@@ -851,8 +862,13 @@
}
if ($pi_was_enabled) {
- DB_change($_TABLES['plugins'], 'pi_enabled', 1,
- 'pi_name', $dirname);
+ // Enable the plugin again
+ if (is_callable($callback)) {
+ changePluginStatus($dirname);
+ } else {
+ DB_change($_TABLES['plugins'], 'pi_enabled', 1,
+ 'pi_name', $dirname);
+ }
}
}
More information about the geeklog-cvs
mailing list