When cms.disableCoreUpdates is set to true the Backend will no longer display updates for the core.

This commit is contained in:
Sam Georges 2014-11-01 11:33:33 +11:00
parent e7c33467f3
commit 7d0a210fac
4 changed files with 21 additions and 21 deletions

View File

@ -1,5 +1,6 @@
* **Build 160** (2014-11-01)
- Various fixes to the Backend Brand settings page.
- When `cms.disableCoreUpdates` is set to **true** the Backend will no longer display updates for the core.
* **Build 158** (2014-10-23)
- Fixes an issue where new Themes attached to a project were not being installed on update.

View File

@ -63,6 +63,11 @@ class UpdateManager
*/
protected $secret;
/**
* @var boolean If set to true, core updates will not be downloaded or extracted.
*/
protected $disableCoreUpdates = false;
/**
* Initialize this singleton.
*/
@ -74,6 +79,7 @@ class UpdateManager
$this->repository = App::make('migration.repository');
$this->tempDirectory = Config::get('cms.tempDir', sys_get_temp_dir());
$this->baseDirectory = PATH_BASE;
$this->disableCoreUpdates = Config::get('cms.disableCoreUpdates', false);
/*
* Ensure temp directory exists
@ -190,6 +196,7 @@ class UpdateManager
}
$result = $this->requestServerData('core/update', $params);
$updateCount = (int) array_get($result, 'update', 0);
/*
* Inject known core build
@ -222,12 +229,21 @@ class UpdateManager
$result['themes'] = $themes;
/*
* There are updates if update count is empty
* or if uninstalled themes are found.
* If there is a core update and core updates are disabled,
* remove the entry and discount an update unit.
*/
$result['hasUpdates'] = array_get($result, 'update') || count($themes);
if (array_get($result, 'core') && $this->disableCoreUpdates) {
$updateCount = max(0, --$updateCount);
unset($result['core']);
}
Parameters::set('system::update.count', array_get($result, 'update', 0));
/*
* Recalculate the update counter
*/
$updateCount += count($themes);
$result['hasUpdates'] = $updateCount > 0;
$result['update'] = $updateCount;
Parameters::set('system::update.count', $updateCount);
return $result;
}

View File

@ -52,10 +52,6 @@ class OctoberUpdate extends Command
$disableThemes = true;
}
if (Config::get('cms.disableCoreUpdates', false)) {
$disableCore = true;
}
/*
* Perform update
*/

View File

@ -33,11 +33,6 @@ class Updates extends Controller
public $listConfig = ['list' => 'config_list.yaml', 'manage' => 'config_manage_list.yaml'];
/**
* @var boolean If set to true, core updates will not be downloaded or extracted.
*/
protected $disableCoreUpdates = false;
public function __construct()
{
parent::__construct();
@ -46,8 +41,6 @@ class Updates extends Controller
BackendMenu::setContext('October.System', 'system', 'updates');
SettingsManager::setContext('October.System', 'updates');
$this->disableCoreUpdates = Config::get('cms.disableCoreUpdates', false);
}
/**
@ -113,16 +106,10 @@ class Updates extends Controller
switch ($stepCode) {
case 'downloadCore':
if ($this->disableCoreUpdates) {
return;
}
$manager->downloadCore(post('hash'));
break;
case 'extractCore':
if ($this->disableCoreUpdates) {
return;
}
$manager->extractCore(post('hash'), post('build'));
break;