function reload() { $plugins = PluginQuery::create()->find(); foreach ($plugins as $plugin) { if (file_exists($plugin->getPath() . 'package.json')) { if ($plugin->getEnabled()) { _loadPluginClass($plugin)->install(); print $plugin->getId() . " reinstalled\n"; } } } }
function uninstall($pattern) { _apply($pattern, function ($id) { $tmp = new Plugin(); $tmp->setId($id); $plugin = PluginQuery::create()->findPk($id); if (!$plugin || $plugin && !file_exists($plugin->getPath())) { print "Plugin {$id} not found. Skipping.\n"; return false; } if (!$plugin) { $plugin = new Plugin(); $plugin->setId($id); } _loadPluginClass($plugin)->uninstall(); print "Uninstalled plugin {$id}.\n"; }); exit; }