[geeklog-cvs] Geeklog-1.x/public_html/admin/install index.php, 1.34, 1.35

Dirk Haun dhaun at qs1489.pair.com
Fri Mar 21 12:11:15 EDT 2008


Update of /cvsroot/geeklog/Geeklog-1.x/public_html/admin/install
In directory qs1489.pair.com:/tmp/cvs-serv44700

Modified Files:
	index.php 
Log Message:
After upgrading the database, disable any plugins that are enabled but not actually installed


Index: index.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/public_html/admin/install/index.php,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** index.php	21 Mar 2008 12:30:51 -0000	1.34
--- index.php	21 Mar 2008 16:11:13 -0000	1.35
***************
*** 576,579 ****
--- 576,581 ----
                          $config->set_default('default_photo', urldecode($site_url) . '/default.jpg');
  
+                         INST_checkPlugins();
+ 
                          // Great, installation is complete, redirect to success page
                          header('Location: success.php?type=upgrade&language=' . $language);
***************
*** 1400,1403 ****
--- 1402,1431 ----
          }
      }
+ }
+ 
+ /**
+ * Check which plugins are actually installed and disable them if needed
+ *
+ * @return   int     number of plugins that were disabled
+ *
+ */
+ function INST_checkPlugins()
+ {
+     global $_CONF, $_TABLES;
+ 
+     $disabled = 0;
+     $plugin_path = $_CONF['path'] . 'plugins/';
+ 
+     $result = DB_query("SELECT pi_name FROM {$_TABLES['plugins']} WHERE pi_enabled = 1");
+     $num_plugins = DB_numRows($result);
+     for ($i = 0; $i < $num_plugins; $i++) {
+         $A = DB_fetchArray($result);
+         if (!file_exists($plugin_path . $A['pi_name'] . '/functions.inc')) {
+             DB_query("UPDATE {$_TABLES['plugins']} SET pi_enabled = 0 WHERE pi_name = '{$A['pi_name']}'");
+             $disabled++;
+         }
+     }
+ 
+     return $disabled;
  }
  




More information about the geeklog-cvs mailing list