1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-28 02:10:46 +02:00

Improve removal of deleted plugins from db

This commit is contained in:
e107steved
2007-02-08 20:09:10 +00:00
parent 5f062382c0
commit ccca2b1d10

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org). | GNU General Public License (http://gnu.org).
| |
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $ | $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
| $Revision: 1.2 $ | $Revision: 1.3 $
| $Date: 2007-02-01 22:00:41 $ | $Date: 2007-02-08 20:09:07 $
| $Author: e107steved $ | $Author: e107steved $
+----------------------------------------------------------------------------+ +----------------------------------------------------------------------------+
*/ */
@@ -77,7 +77,7 @@ class e107plugin
*/ */
function update_plugins_table() function update_plugins_table()
{ {
global $sql, $mySQLprefix, $menu_pref, $tp; global $sql, $sql2, $mySQLprefix, $menu_pref, $tp;
require_once(e_HANDLER.'file_class.php'); require_once(e_HANDLER.'file_class.php');
@@ -97,6 +97,7 @@ class e107plugin
} }
// We have to include here to set the variables, otherwise we only get uninstalled plugins // We have to include here to set the variables, otherwise we only get uninstalled plugins
// Would be nice to eval() the file contents to pick up errors better, but too many path issues
include("{$p['path']}{$p['fname']}"); include("{$p['path']}{$p['fname']}");
$plugin_path = substr(str_replace(e_PLUGIN,"",$p['path']),0,-1); $plugin_path = substr(str_replace(e_PLUGIN,"",$p['path']),0,-1);
@@ -134,10 +135,13 @@ class e107plugin
} }
$sql->db_Select("plugin"); $sql->db_Select("plugin");
while ($row = $sql->db_fetch()) { while ($row = $sql->db_fetch())
if (!is_dir(e_PLUGIN.$row['plugin_path'])) { { // Check for the actual plugin.php file - that's really the criterion for a 'proper' plugin
$sql->db_Delete('plugin', "plugin_path = '{$row['plugin_path']}'"); if (!file_exists(e_PLUGIN.$row['plugin_path'].'/plugin.php'))
} {
// echo "Deleting: ".e_PLUGIN.$row['plugin_path'].'/plugin.php'."<br />";
$sql2->db_Delete('plugin', "plugin_path = '{$row['plugin_path']}'");
}
} }
} }