Example #1
0
 /**
  * Flags a theme as being uninstalled.
  * @param string $code Theme code
  */
 public function setUninstalled($code)
 {
     $history = Parameter::get('system::theme.history', []);
     if (array_key_exists($code, $history)) {
         unset($history[$code]);
     }
     Parameter::set('system::theme.history', $history);
 }
Example #2
0
 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');
 }
Example #3
0
 /**
  * Modifies the Network HTTP object with common attributes.
  * @param  Http $http      Network object
  * @param  array $postData Post data
  * @return void
  */
 protected function applyHttpAttributes($http, $postData)
 {
     $postData['server'] = base64_encode(serialize(['php' => PHP_VERSION, 'url' => URL::to('/')]));
     if ($projectId = Parameter::get('system::project.id')) {
         $postData['project'] = $projectId;
     }
     if (Config::get('cms.edgeUpdates', false)) {
         $postData['edge'] = 1;
     }
     if ($this->key && $this->secret) {
         $postData['nonce'] = $this->createNonce();
         $http->header('Rest-Key', $this->key);
         $http->header('Rest-Sign', $this->createSignature($postData, $this->secret));
     }
     if ($credentials = Config::get('cms.updateAuth')) {
         $http->auth($credentials);
     }
     $http->noRedirect();
     $http->data($postData);
 }
Example #4
0
 protected function getInstalledThemes()
 {
     $history = Parameter::get('system::theme.history', []);
     $manager = UpdateManager::instance();
     $installed = $manager->requestProductDetails(array_keys($history), 'theme');
     /*
      * Splice in the directory names
      */
     foreach ($installed as $key => $data) {
         $code = array_get($data, 'code');
         $installed[$key]['dirName'] = array_get($history, $code, $code);
     }
     return $installed;
 }
Example #5
0
 /**
  * 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' . Parameter::get('system::core.build', 1);
         } elseif ($pluginVersion = PluginVersion::getVersion($build)) {
             $build = 'v' . $pluginVersion;
         }
         $path .= '?' . $build;
     }
     return $path;
 }
Example #6
0
 /**
  * Sets the active theme.
  * The active theme code is stored in the database and overrides the configuration cms.activeTheme parameter. 
  * @param string $code Specifies the  active theme code.
  */
 public static function setActiveTheme($code)
 {
     self::resetCache();
     Parameter::set(self::ACTIVE_KEY, $code);
     Event::fire('cms.theme.setActiveTheme', compact('code'));
 }
 protected function getWidgetsFromUserPreferences()
 {
     $defaultWidgets = SystemParameters::get($this->getSystemParametersKey(), $this->defaultWidgets);
     $widgets = UserPreference::forUser()->get($this->getUserPreferencesKey(), $defaultWidgets);
     if (!is_array($widgets)) {
         return [];
     }
     return $widgets;
 }