/** * Deactivates plugin. * * @param array $params */ public function deactivate(array $params) { $pluginDto = $this->getPluginDtoByKey($params); $language = OW::getLanguage(); // trigger event $event = new OW_Event(OW_EventManager::ON_BEFORE_PLUGIN_DEACTIVATE, array('pluginKey' => $pluginDto->getKey())); OW::getEventManager()->trigger($event); $this->pluginService->deactivate($pluginDto->getKey()); OW::getFeedback()->info($language->text('admin', 'manage_plugins_deactivate_success_message', array('plugin' => $pluginDto->getTitle()))); $this->redirectToAction('index'); }
private function updateItemsLicenseStatus(array $items) { $invalidItems = array(self::URI_VAR_ITEM_TYPE_VAL_PLUGIN => array(), self::URI_VAR_ITEM_TYPE_VAL_THEME => array()); foreach ($items as $item) { $invalidItems[$item[self::URI_VAR_ITEM_TYPE]][$item[self::URI_VAR_KEY]] = $item[self::URI_VAR_DEV_KEY]; } $itemsToCheck = array_merge($this->pluginService->findAllPlugins(), $this->themeService->findAllThemes()); $dataForNotification = array(); /* @var $item BOL_StoreItem */ foreach ($itemsToCheck as $item) { $type = $item instanceof BOL_Plugin ? self::URI_VAR_ITEM_TYPE_VAL_PLUGIN : self::URI_VAR_ITEM_TYPE_VAL_THEME; // if the item is on DB if (isset($invalidItems[$type][$item->getKey()]) && $invalidItems[$type][$item->getKey()] == $item->getDeveloperKey()) { if ((int) $item->getLicenseCheckTimestamp() == 0) { $dataForNotification[] = array("type" => $type, "title" => $item->getTitle()); $item->setLicenseCheckTimestamp(time()); $this->saveStoreItem($item); } else { if ($this->isItemLicenseCheckPeriodExpired($item->getLicenseCheckTimestamp())) { if ($type == self::URI_VAR_ITEM_TYPE_VAL_THEME && $this->themeService->getSelectedThemeName() == $item->getKey()) { $defaultTheme = OW::getEventManager()->call("base.get_default_theme"); if (!$defaultTheme) { $defaultTheme = BOL_ThemeService::DEFAULT_THEME; } $this->themeService->setSelectedThemeName($defaultTheme); } else { if ($type == self::URI_VAR_ITEM_TYPE_VAL_PLUGIN && $item->isActive) { $this->pluginService->deactivate($item->getKey()); } } } } } else { if ($item->getLicenseCheckTimestamp() != null && $item->getLicenseCheckTimestamp() > 0) { $item->setLicenseCheckTimestamp(null); $this->saveStoreItem($item); } } } $this->notifyAdminAboutInvalidItems($dataForNotification); }