BUG 5978 Added uninstall method in PluginRegistry
This commit is contained in:
@@ -134,6 +134,14 @@ class PMPluginRegistry {
|
|||||||
self::$instance = $instance;
|
self::$instance = $instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save the current instance to the plugin singleton
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function save() {
|
||||||
|
file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $this->serializeInstance() );
|
||||||
|
}
|
||||||
|
|
||||||
//delete this function, it was here, only for test and debug purposes
|
//delete this function, it was here, only for test and debug purposes
|
||||||
function showArrays () {
|
function showArrays () {
|
||||||
krumo ( $this->_aPluginDetails);
|
krumo ( $this->_aPluginDetails);
|
||||||
@@ -372,6 +380,24 @@ class PMPluginRegistry {
|
|||||||
$size = file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance() );
|
$size = file_put_contents ( PATH_DATA_SITE . 'plugin.singleton', $oPluginRegistry->serializeInstance() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function uninstallPlugin($sNamespace) {
|
||||||
|
$this->enablePlugin($sNamespace);
|
||||||
|
$this->disablePlugin($sNamespace);
|
||||||
|
$this->save();
|
||||||
|
|
||||||
|
foreach ($this->_aPluginDetails as $namespace=>$detail) {
|
||||||
|
if ( $sNamespace == $namespace ) {
|
||||||
|
$pluginDir = PATH_PLUGINS . $detail->sPluginFolder;
|
||||||
|
var_dump($pluginDir);
|
||||||
|
var_dump($detail->sFilename);
|
||||||
|
if (isset($detail->sPluginFolder) && !empty($detail->sPluginFolder) && file_exists($plugin_dir))
|
||||||
|
G::rm_dir($plugin_dir);
|
||||||
|
if (isset($detail->sFilename) && !empty($detail->sFilename) && file_exists($detail->sFilename))
|
||||||
|
unlink(PATH_PLUGINS . $detail->sFilename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* install the plugin
|
* install the plugin
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user