[geeklog-cvs] geeklog: Got the auto install working for plugins uploaded via t...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Mon Jan 5 05:06:08 EST 2009


details:   http://project.geeklog.net/cgi-bin/hgweb.cgi/rev/c26c11b34fd9
changeset: 6588:c26c11b34fd9
user:      Dirk Haun <dirk at haun-online.de>
date:      Thu Dec 25 22:11:00 2008 +0100
description:
Got the auto install working for plugins uploaded via the Plugins panel

diffstat:

1 file changed, 16 insertions(+), 4 deletions(-)
public_html/admin/plugins.php |   20 ++++++++++++++++----

diffs (65 lines):

diff -r 027df4078405 -r c26c11b34fd9 public_html/admin/plugins.php
--- a/public_html/admin/plugins.php	Thu Dec 25 12:34:00 2008 +0100
+++ b/public_html/admin/plugins.php	Thu Dec 25 22:11:00 2008 +0100
@@ -643,6 +643,10 @@
 
                 $pi_name = $dirname;
 
+            } elseif (empty($pi_name)) {
+
+                $pi_name = $dirname;
+
             }
 
             // Extract the uploaded archive to the plugins directory
@@ -667,7 +671,7 @@
                 }
                 if (file_exists($plg_path . 'admin')) {
                     rename($plg_path . 'admin',
-                        $_CONF['path_html'] . 'admin/plugins/' . $pi_name);
+                           $_CONF['path_html'] . 'admin/plugins/' . $pi_name);
                 }
 
             }
@@ -676,7 +680,7 @@
 
             // if the plugin has an autoinstall.php, install it now
             if (file_exists($plg_path . 'autoinstall.php')) {
-                if (plugin_autoinstall($plugin)) {
+                if (plugin_autoinstall($pi_name)) {
                     $retval .= COM_refresh($_CONF['site_admin_url']
                                            . '/plugins.php?msg=44');
                 } else {
@@ -787,7 +791,7 @@
 */
 function plugin_do_autoinstall($plugin, $inst_parms, $verbose = true)
 {
-    global $_CONF, $_TABLES, $_USER, $_DB_dbms;
+    global $_CONF, $_TABLES, $_USER, $_DB_dbms, $_DB_table_prefix;
 
     $base_path = $_CONF['path'] . 'plugins/' . $plugin . '/';
 
@@ -809,6 +813,14 @@
         return false;
     }
 
+    // add plugin tables, if any
+    if (! empty($inst_parms['tables'])) {
+        $tables = $inst_parms['tables'];
+        foreach ($tables as $table) {
+            $_TABLES[$table] = $_DB_table_prefix . $table;
+        }
+    }
+
     // Create the plugin's group(s), if any
     $groups = array();
     $admin_group_id = 0;
@@ -816,7 +828,7 @@
         $groups = $inst_parms['groups'];
         foreach ($groups as $name => $desc) {
             if ($verbose) {
-                COM_errorLog("Attempting to create plugin '$name' group", 1);
+                COM_errorLog("Attempting to create '$name' group", 1);
             }
 
             $grp_name = addslashes($name);



More information about the geeklog-cvs mailing list