setAliases(['october:version']); } /** * Execute the console command. * * @return void */ public function handle() { if (!$this->option('only-version')) { $this->comment('*** Detecting Winter CMS build...'); } if (!$this->laravel->hasDatabase()) { $build = UpdateManager::instance()->getBuildNumberManually($this->option('changes')); // Skip setting the build number if no database is detected to set it within if (!$this->option('only-version')) { $this->comment('*** No database detected - skipping setting the build number.'); } } else { $build = UpdateManager::instance()->setBuildNumberManually($this->option('changes')); } if ($this->option('only-version')) { $this->line($build['build']); return 0; } if (!$build['confident']) { $this->warn('*** We could not accurately determine your Winter CMS build due to the number of modifications. The closest detected build is Winter CMS build ' . $build['build'] . '.'); } elseif ($build['modified']) { $this->info('*** Detected a modified version of Winter CMS build ' . $build['build'] . '.'); } else { $this->info('*** Detected Winter CMS build ' . $build['build'] . '.'); } if (!empty($build['changes']) && $this->option('changes')) { $this->line(''); $this->comment('We have detected the following modifications:'); if (count($build['changes']['added'] ?? [])) { $this->line(''); $this->info('Files added:'); foreach (array_keys($build['changes']['added']) as $file) { $this->line(' - ' . $file); } } if (count($build['changes']['modified'] ?? [])) { $this->line(''); $this->info('Files modified:'); foreach (array_keys($build['changes']['modified']) as $file) { $this->line(' - ' . $file); } } if (count($build['changes']['removed'] ?? [])) { $this->line(''); $this->info('Files removed:'); foreach ($build['changes']['removed'] as $file) { $this->line(' - ' . $file); } } } } }