diff --git a/CHANGELOG.md b/CHANGELOG.md index 15ae281d8..2e9600ac8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Added new Theme picker to the backend via Settings > Front-end theme - New shorthand method for `$this->getClassExtension('Backend.Behaviors.FormController')` becomes `$this->asExtension('FormController')`. - Buttons inside a popup support new `data-popup-load-indicator` attribute. + - Added a new config item to disable core updates completely (see config cms.disableCoreUpdates). * **Build 124** (2014-07-17) - Improvements to Twig functions and filters. diff --git a/app/config/cms.php b/app/config/cms.php index 239b96556..a0d940450 100644 --- a/app/config/cms.php +++ b/app/config/cms.php @@ -33,6 +33,20 @@ return array( */ 'disablePlugins' => [], + /* + |-------------------------------------------------------------------------- + | Prevents application updates + |-------------------------------------------------------------------------- + | + | If using composer or git to download updates to the core files, set this + | value to 'true' to prevent the update gateway from trying to download + | these files again as part of the application update process. Plugins + | and themes will still be downloaded. + | + */ + + 'disableCoreUpdates' => false, + /* |-------------------------------------------------------------------------- | Back-end URI prefix diff --git a/modules/system/console/OctoberUpdate.php b/modules/system/console/OctoberUpdate.php index 8e733615e..8d95e71ef 100644 --- a/modules/system/console/OctoberUpdate.php +++ b/modules/system/console/OctoberUpdate.php @@ -1,6 +1,7 @@ output->writeln('Updating October...'); $manager = UpdateManager::instance()->resetNotes(); $forceUpdate = $this->option('force'); - $pluginsOnly = $this->option('plugins'); - $coreOnly = $this->option('core'); + /* + * Check for disabilities + */ + $disableCore = $disablePlugins = $disableThemes = false; + + if ($this->option('plugins')) { + $disableCore = true; + $disableThemes = true; + } + + if ($this->option('core')) { + $disablePlugins = true; + $disableThemes = true; + } + + if (Config::get('cms.disableCoreUpdates', false)) { + $disableCore = true; + } + + /* + * Perform update + */ $updateList = $manager->requestUpdateList($forceUpdate); $updates = (int)array_get($updateList, 'update', 0); @@ -49,7 +70,7 @@ class OctoberUpdate extends Command $this->output->writeln(sprintf('Found %s new %s!', $updates, Str::plural('update', $updates))); } - $coreHash = $pluginsOnly ? null : array_get($updateList, 'core.hash'); + $coreHash = $disableCore ? null : array_get($updateList, 'core.hash'); $coreBuild = array_get($updateList, 'core.build'); if ($coreHash) { @@ -57,7 +78,7 @@ class OctoberUpdate extends Command $manager->downloadCore($coreHash); } - $plugins = $coreOnly ? [] : array_get($updateList, 'plugins'); + $plugins = $disablePlugins ? [] : array_get($updateList, 'plugins'); foreach ($plugins as $code => $plugin) { $pluginName = array_get($plugin, 'name'); $pluginHash = array_get($plugin, 'hash'); diff --git a/modules/system/controllers/Updates.php b/modules/system/controllers/Updates.php index 6b607b5b7..6cefab320 100644 --- a/modules/system/controllers/Updates.php +++ b/modules/system/controllers/Updates.php @@ -4,6 +4,7 @@ use Str; use Lang; use File; use Flash; +use Config; use Backend; use Redirect; use BackendMenu; @@ -31,6 +32,11 @@ 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(); @@ -38,6 +44,8 @@ class Updates extends Controller $this->addCss('/modules/system/assets/css/updates.css', 'core'); BackendMenu::setContext('October.System', 'system', 'updates'); + + $this->disableCoreUpdates = Config::get('cms.disableCoreUpdates', false); } /** @@ -98,10 +106,12 @@ 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;