function installPlugin($name) { $plugin = false; if ($this->isNameValid($name)) { if (!$this->plugin_factory->isPluginInstalled($name)) { if (!$this->_executeSqlStatements('install', $name)) { $plugin = $this->plugin_factory->createPlugin($name); if ($plugin instanceof Plugin) { $this->_createEtc($name); $this->configureForgeUpgrade($name); $plugin->postInstall(); } else { $GLOBALS['Response']->addFeedback('error', 'Unable to create plugin'); } } else { $GLOBALS['Response']->addFeedback('error', 'DB may be corrupted'); } } } return $plugin; }