Ejemplo n.º 1
0
 /**
  * Updates dir structure for all plugins
  */
 public function updateStructureforAllPlugins()
 {
     $plugins = $this->pluginService->findAllPlugins();
     /* @var $pluginDto BOL_Plugin */
     foreach ($plugins as $pluginDto) {
         $this->pluginService->addPluginDirs($pluginDto);
     }
 }
Ejemplo n.º 2
0
 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);
 }