public function checkManualUpdates() { $themes = $this->themeDao->findAll(); /* @var $theme BOL_Theme */ foreach ($themes as $theme) { $themeInfo = $this->getThemeXmlInfo($theme->getName()); if (!empty($themeInfo['build']) && $themeInfo['build'] > $theme->getBuild()) { $this->updateThemeInfo($theme->getName()); $this->processTheme($theme->getId()); } } }
/** * Cron function. */ public function checkUpdates() { if (defined('OW_PLUGIN_XP')) { return; } $pluginsRequestArray = array(array('key' => 'core', 'developerKey' => 'ow', 'build' => OW::getConfig()->getValue('base', 'soft_build'))); $plugins = $this->pluginDao->findRegularPlugins(); /* @var $plugin BOL_Plugin */ foreach ($plugins as $plugin) { $pluginsRequestArray[] = array('key' => $plugin->getKey(), 'developerKey' => $plugin->getDeveloperKey(), 'build' => $plugin->getBuild()); } $themesRequestArray = array(); $themes = $this->themeDao->findAll(); /* @var $theme BOL_Theme */ foreach ($themes as $theme) { $themesRequestArray[] = array('key' => $theme->getName(), 'developerKey' => $theme->getDeveloperKey(), 'build' => $theme->getBuild()); } $event = new OW_Event('base.on_plugin_info_update'); OW::getEventManager()->trigger($event); $data = $event->getData(); if (empty($data)) { $data = array(); } $requestUrl = OW::getRequest()->buildUrlQueryString(self::UPDATE_SERVER . 'get-items-update-info/'); $postParams = array_merge(array('plugins' => urlencode(json_encode($pluginsRequestArray)), 'themes' => urlencode(json_encode($themesRequestArray)))); $postdata = http_build_query($postParams); $options = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata)); $context = stream_context_create($options); $resultArray = json_decode(file_get_contents($requestUrl, false, $context), true); if (empty($resultArray) || !is_array($resultArray)) { return; } if (!empty($resultArray['plugins']) && is_array($resultArray['plugins'])) { foreach ($plugins as $plugin) { if (in_array($plugin->getKey(), $resultArray['plugins']) && (int) $plugin->getUpdate() === 0) { $plugin->setUpdate(1); $this->pluginDao->save($plugin); } } if (in_array('core', $resultArray['plugins'])) { OW::getConfig()->saveConfig('base', 'update_soft', 1); } } if (!empty($resultArray['themes']) && is_array($resultArray['themes'])) { foreach ($themes as $theme) { if (in_array($theme->getName(), $resultArray['themes']) && (int) $theme->getUpdate() === 0) { $theme->setUpdate(1); $this->themeDao->save($theme); } } } }
/** * Checks if source of any theme was updated and rebuilds them. */ public function checkManualUpdates() { $themes = $this->themeDao->findAll(); /* @var $theme BOL_Theme */ foreach ($themes as $theme) { $themeInfo = $this->getThemeXmlInfoForKey($theme->getKey()); if (empty($themeInfo)) { continue; } if ($themeInfo["build"] > $theme->getBuild()) { $this->updateThemeInfo($theme->getKey()); } } }
public function checkManualUpdates() { $themes = $this->themeDao->findAll(); /* @var $theme BOL_Theme */ foreach ($themes as $theme) { $themeInfo = $this->getThemeXmlInfo($theme->getName()); if (!empty($themeInfo['build']) && $themeInfo['build'] > $theme->getBuild()) { $this->updateThemeInfo($theme->getName(), true); $themeDto = $this->findThemeByName($theme->getName()); if ($themeDto !== null) { $themeDto->setBuild($themeInfo['build']); $themeDto->setUpdate(0); $this->saveTheme($themeDto); } } } }