コード例 #1
0
ファイル: Status.php プロジェクト: aaronleslie/aaronunix
 protected function loadData()
 {
     $manager = UpdateManager::instance();
     $this->vars['canUpdate'] = BackendAuth::getUser()->hasAccess('system.manage_updates');
     $this->vars['updates'] = $manager->check();
     $this->vars['warnings'] = $this->getSystemWarnings();
     $this->vars['coreBuild'] = Parameter::get('system::core.build');
     $this->vars['eventLog'] = EventLog::count();
     $this->vars['requestLog'] = RequestLog::count();
     $this->vars['appBirthday'] = PluginVersion::orderBy('created_at')->pluck('created_at');
 }
コード例 #2
0
ファイル: AssetMaker.php プロジェクト: Rudianasaja/october
 /**
  * Internal helper, attaches a build code to an asset path
  * @param  array $asset Stored asset array
  * @return string
  */
 protected function getAssetEntryBuildPath($asset)
 {
     $path = $asset['path'];
     if (isset($asset['attributes']['build'])) {
         $build = $asset['attributes']['build'];
         if ($build == 'core') {
             $build = 'v' . Parameters::get('system::core.build', 1);
         } elseif ($pluginVersion = PluginVersion::getVersion($build)) {
             $build = 'v' . $pluginVersion;
         }
         $path .= '?' . $build;
     }
     return $path;
 }
コード例 #3
0
ファイル: Updates.php プロジェクト: Rudianasaja/october
 public function onDisablePlugins()
 {
     $disable = post('disable', false);
     if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
         $manager = PluginManager::instance();
         foreach ($checkedIds as $objectId) {
             if (!($object = PluginVersion::find($objectId))) {
                 continue;
             }
             if ($disable) {
                 $manager->disablePlugin($object->code, true);
             } else {
                 $manager->enablePlugin($object->code, true);
             }
             $object->is_disabled = $disable;
             $object->save();
         }
     }
     if ($disable) {
         Flash::success(Lang::get('system::lang.plugins.disable_success'));
     } else {
         Flash::success(Lang::get('system::lang.plugins.enable_success'));
     }
     return Redirect::to(Backend::url('system/updates/manage'));
 }
コード例 #4
0
ファイル: Updates.php プロジェクト: nevinsm/personalSite
 protected function getInstalledPlugins()
 {
     $installed = PluginVersion::lists('code');
     $manager = UpdateManager::instance();
     return $manager->requestProductDetails($installed, 'plugin');
 }
コード例 #5
0
 /**
  * Requests an update list used for checking for new updates.
  * @param  boolean $force Request application and plugins hash list regardless of version.
  * @return array
  */
 public function requestUpdateList($force = false)
 {
     $installed = PluginVersion::all();
     $versions = $installed->lists('version', 'code');
     $names = $installed->lists('name', 'code');
     $icons = $installed->lists('icon', 'code');
     $frozen = $installed->lists('is_frozen', 'code');
     $build = Parameters::get('system::core.build');
     $params = ['core' => $this->getHash(), 'plugins' => serialize($versions), 'build' => $build, 'force' => $force];
     if ($projectId = Parameters::get('system::project.id')) {
         $params['project'] = $projectId;
     }
     $result = $this->requestServerData('core/update', $params);
     $updateCount = (int) array_get($result, 'update', 0);
     /*
      * Inject known core build
      */
     if ($core = array_get($result, 'core')) {
         $core['old_build'] = Parameters::get('system::core.build');
         $result['core'] = $core;
     }
     /*
      * Inject the application's known plugin name and version
      */
     $plugins = [];
     foreach (array_get($result, 'plugins', []) as $code => $info) {
         $info['name'] = isset($names[$code]) ? $names[$code] : $code;
         $info['old_version'] = isset($versions[$code]) ? $versions[$code] : false;
         $info['icon'] = isset($icons[$code]) ? $icons[$code] : false;
         /*
          * If plugin has updates frozen, do not add it to the list
          * and discount an update unit.
          */
         if (isset($frozen[$code]) && $frozen[$code]) {
             $updateCount = max(0, --$updateCount);
         } else {
             $plugins[$code] = $info;
         }
     }
     $result['plugins'] = $plugins;
     /*
      * Strip out themes that have been installed before
      */
     $themes = [];
     foreach (array_get($result, 'themes', []) as $code => $info) {
         if (!$this->themeManager->isInstalled($code)) {
             $themes[$code] = $info;
         }
     }
     $result['themes'] = $themes;
     /*
      * If there is a core update and core updates are disabled,
      * remove the entry and discount an update unit.
      */
     if (array_get($result, 'core') && $this->disableCoreUpdates) {
         $updateCount = max(0, --$updateCount);
         unset($result['core']);
     }
     /*
      * Recalculate the update counter
      */
     $updateCount += count($themes);
     $result['hasUpdates'] = $updateCount > 0;
     $result['update'] = $updateCount;
     Parameters::set('system::update.count', $updateCount);
     return $result;
 }
コード例 #6
0
ファイル: UpdateManager.php プロジェクト: Rudianasaja/october
 /**
  * Requests an update list used for checking for new updates.
  * @param  boolean $force Request application and plugins hash list regardless of version.
  * @return array
  */
 public function requestUpdateList($force = false)
 {
     $installed = PluginVersion::all();
     $versions = $installed->lists('version', 'code');
     $names = $installed->lists('name', 'code');
     $params = ['core' => $this->getHash(), 'plugins' => serialize($versions), 'force' => $force];
     if ($projectId = Parameters::get('system::project.id')) {
         $params['project'] = $projectId;
     }
     $result = $this->requestServerData('core/update', $params);
     /*
      * Inject known core build
      */
     if ($core = array_get($result, 'core')) {
         $core['old_build'] = Parameters::get('system::core.build');
         $result['core'] = $core;
     }
     /*
      * Inject the application's known plugin name and version
      */
     $plugins = [];
     foreach (array_get($result, 'plugins', []) as $code => $info) {
         $info['name'] = isset($names[$code]) ? $names[$code] : $code;
         $info['old_version'] = isset($versions[$code]) ? $versions[$code] : false;
         $plugins[$code] = $info;
     }
     $result['plugins'] = $plugins;
     /*
      * Strip out themes that have been installed before
      */
     $themes = [];
     foreach (array_get($result, 'themes', []) as $code => $info) {
         if (!$this->isThemeInstalled($code)) {
             $themes[$code] = $info;
         }
     }
     $result['themes'] = $themes;
     /*
      * There are updates if update count is empty
      * or if uninstalled themes are found.
      */
     $result['hasUpdates'] = array_get($result, 'update') || count($themes);
     Parameters::set('system::update.count', array_get($result, 'update', 0));
     return $result;
 }