X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fplugin.php;h=4ff78a8b4d03feffa9725651d60b0621dabf6e28;hb=c43a03e21bcd12b24be8a59741ec6591c1f651d7;hp=e37ae84357e2bba73d9a702ba3bb2fb6993d1fe9;hpb=43d5876e8b35d53a0bef5248c5d63e5bc209dbbf;p=friendica.git diff --git a/include/plugin.php b/include/plugin.php index e37ae84357..4ff78a8b4d 100644 --- a/include/plugin.php +++ b/include/plugin.php @@ -5,7 +5,7 @@ if (! function_exists('uninstall_plugin')){ function uninstall_plugin($plugin){ logger("Addons: uninstalling " . $plugin); - q("DELETE FROM `addon` WHERE `name` = '%s' LIMIT 1", + q("DELETE FROM `addon` WHERE `name` = '%s' ", dbesc($plugin) ); @@ -17,7 +17,12 @@ function uninstall_plugin($plugin){ }} if (! function_exists('install_plugin')){ -function install_plugin($plugin){ +function install_plugin($plugin) { + + // silently fail if plugin was removed + + if(! file_exists('addon/' . $plugin . '/' . $plugin . '.php')) + return false; logger("Addons: installing " . $plugin); $t = @filemtime('addon/' . $plugin . '/' . $plugin . '.php'); @include_once('addon/' . $plugin . '/' . $plugin . '.php'); @@ -32,9 +37,21 @@ function install_plugin($plugin){ intval($t), $plugin_admin ); + + // we can add the following with the previous SQL + // once most site tables have been updated. + // This way the system won't fall over dead during the update. + + if(file_exists('addon/' . $plugin . '/.hidden')) { + q("update addon set hidden = 1 where name = '%s' limit 1", + dbesc($plugin) + ); + } + return true; } else { logger("Addons: FAILED installing " . $plugin); + return false; } }}