PluginRegistry class fix, Adding missing unregister method 'unregisterRestService()' on disablePlugin()

This commit is contained in:
Erik Amaru Ortiz
2012-08-28 12:08:55 -04:00
parent 3043fc0563
commit 9b74ddca00

View File

@@ -304,6 +304,8 @@ class PMPluginRegistry {
//unregistering javascripts from this plugin //unregistering javascripts from this plugin
$this->unregisterJavascripts($sNamespace); $this->unregisterJavascripts($sNamespace);
//unregistering rest services from this plugin
$this->unregisterRestService($sNamespace);
} }
/** /**
@@ -1265,15 +1267,15 @@ class PMPluginRegistry {
* Unregister a rest service class of a plugin * Unregister a rest service class of a plugin
* *
* @param string $sNamespace The namespace for the plugin * @param string $sNamespace The namespace for the plugin
* @param string $classname The service (api) class name
*/ */
public function unregisterRestService($sNamespace, $classname) public function unregisterRestService($sNamespace)
{ {
foreach ($this->_restServices as $i => $service) { foreach ($this->_restServices as $i => $service) {
if ($sNamespace == $service->sNamespace) { if ($sNamespace == $service->sNamespace) {
unset($this->_restServices[$i]); unset($this->_restServices[$i]);
} }
} }
// Re-index when all js were unregistered // Re-index when all js were unregistered
$this->_restServices = array_values($this->_restServices); $this->_restServices = array_values($this->_restServices);
} }