Merge pull request #462 from octobercms/develop

* Build 129
This commit is contained in:
Samuel Georges 2014-07-25 17:52:29 +10:00
commit 92d93362db
11 changed files with 194 additions and 27 deletions

View File

@ -1,5 +1,11 @@
* **Build 129** (2014-07-25)
- Fixes a bug where the active theme is not editable in the back-end.
- Added a new console command `october:util` for performing utility and maintenance tasks.
- Added new utility command for deleting thumbs in the uploads directory `october:util purge thumbs`.
- Improved console command confirmation dialogs.
* **Build 125** (2014-07-24)
- Theme support added.
- Added support for Themes.
- 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.

View File

@ -11039,6 +11039,9 @@ body.dropdown-open .dropdown-overlay {
.flash-message.warning {
background: #f0ad4e;
}
.flash-message.info {
background: #5fb6f5;
}
.flash-message button {
float: none;
position: absolute;

View File

@ -32,6 +32,7 @@
&.success { background: @color-flash-success-bg; }
&.error { background: @color-flash-error-bg; }
&.warning { background: @color-flash-warning-bg; }
&.info { background: @color-flash-info-bg; }
button {
float: none;

View File

@ -148,6 +148,7 @@
@color-flash-success-bg: #8da85e;
@color-flash-error-bg: #cc3300;
@color-flash-warning-bg: #f0ad4e;
@color-flash-info-bg: #5fb6f5;
@color-flash-text: #ffffff;
@color-filter-text: #666666;

View File

@ -232,6 +232,11 @@
}
})
}
DataGrid.prototype.deselect = function() {
this.gridInstance.deselectCell()
}
DataGrid.prototype.setData = function(data) {
this.gridInstance.loadData(data)
}

View File

@ -145,7 +145,7 @@ class Theme
{
$editTheme = Config::get('cms.editTheme');
if (!$editTheme)
$editTheme = Config::get('cms.activeTheme');
$editTheme = static::getActiveTheme()->getDirName();
$apiResult = Event::fire('cms.editTheme', [], true);
if ($apiResult !== null)

View File

@ -248,6 +248,7 @@ class ServiceProvider extends ModuleServiceProvider
$this->registerConsoleCommand('october.up', 'System\Console\OctoberUp');
$this->registerConsoleCommand('october.down', 'System\Console\OctoberDown');
$this->registerConsoleCommand('october.update', 'System\Console\OctoberUpdate');
$this->registerConsoleCommand('october.util', 'System\Console\OctoberUtil');
$this->registerConsoleCommand('plugin.install', 'System\Console\PluginInstall');
$this->registerConsoleCommand('plugin.remove', 'System\Console\PluginRemove');
$this->registerConsoleCommand('plugin.refresh', 'System\Console\PluginRefresh');

View File

@ -8,6 +8,8 @@ use Symfony\Component\Console\Input\InputArgument;
class OctoberDown extends Command
{
use \Illuminate\Console\ConfirmableTrait;
/**
* The console command name.
*/
@ -31,13 +33,13 @@ class OctoberDown extends Command
*/
public function fire()
{
if ($this->confirm('Destroy all database tables? [yes|no]')) {
if (!$this->confirmToProceed('This will DESTROY all database tables.'))
return;
$manager = UpdateManager::instance()->resetNotes()->uninstall();
$manager = UpdateManager::instance()->resetNotes()->uninstall();
foreach ($manager->getNotes() as $note)
$this->output->writeln($note);
}
foreach ($manager->getNotes() as $note)
$this->output->writeln($note);
}
/**
@ -53,7 +55,18 @@ class OctoberDown extends Command
*/
protected function getOptions()
{
return [];
return [
['force', null, InputOption::VALUE_NONE, 'Force the operation to run.'],
];
}
/**
* Get the default confirmation callback.
* @return \Closure
*/
protected function getDefaultConfirmCallback()
{
return function() { return true; };
}
}

View File

@ -0,0 +1,119 @@
<?php namespace System\Console;
use File;
use Config;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
/**
* Utility command
*
* Supported commands:
*
* - purge thumbs: Deletes all thumbnail files in the uploads directory.
*/
class OctoberUtil extends Command
{
use \Illuminate\Console\ConfirmableTrait;
/**
* The console command name.
*/
protected $name = 'october:util';
/**
* The console command description.
*/
protected $description = 'Utility commands for October';
/**
* Create a new command instance.
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*/
public function fire()
{
$command = implode(' ', (array) $this->argument('name'));
$method = 'util'.studly_case($command);
if (!method_exists($this, $method)) {
$this->error(sprintf('<error>Utility command "%s" does not exist!</error>', $command));
return;
}
$this->$method();
}
/**
* Get the console command arguments.
* @return array
*/
protected function getArguments()
{
return [
['name', InputArgument::IS_ARRAY, 'A utility command to perform.'],
];
}
/**
* Get the console command options.
*/
protected function getOptions()
{
return [
['force', null, InputOption::VALUE_NONE, 'Force the operation to run when in production.'],
];
}
//
// Utilties
//
protected function utilPurgeThumbs()
{
if (!$uploadsDir = Config::get('cms.uploadsDir'))
return $this->error('No uploads directory defined in config (cms.uploadsDir)');
if (!$this->confirmToProceed('This will PERMANENTLY DELETE all thumbs in the uploads directory.'))
return;
$uploadsDir = base_path() . $uploadsDir;
$totalCount = 0;
/*
* Recursive function to scan the directory for files beginning
* with "thumb_" and repeat itself on directories.
*/
$purgeFunc = function($targetDir) use (&$purgeFunc, &$totalCount) {
if ($files = File::glob($targetDir.'/thumb_*')) {
foreach ($files as $file) {
$this->info('Purged: '. basename($file));
$totalCount++;
@unlink($file);
}
}
if ($dirs = File::directories($targetDir)) {
foreach ($dirs as $dir) {
$purgeFunc($dir);
}
}
};
$purgeFunc($uploadsDir);
if ($totalCount > 0)
$this->comment(sprintf('Successfully deleted %s thumbs', $totalCount));
else
$this->comment('No thumbs found to delete');
}
}

View File

@ -10,6 +10,8 @@ use Symfony\Component\Console\Input\InputArgument;
class PluginRemove extends Command
{
use \Illuminate\Console\ConfirmableTrait;
/**
* The console command name.
* @var string
@ -37,26 +39,31 @@ class PluginRemove extends Command
*/
public function fire()
{
if ($this->confirm('Are you sure you want to uninstall this plugin? [yes|no]')) {
$pluginName = $this->argument('name');
$pluginName = PluginManager::instance()->normalizeIdentifier($pluginName);
$pluginManager = PluginManager::instance();
$pluginName = $this->argument('name');
$pluginName = $pluginManager->normalizeIdentifier($pluginName);
/*
* Rollback plugin
*/
$manager = UpdateManager::instance()->resetNotes();
$manager->rollbackPlugin($pluginName);
if (!$pluginManager->hasPlugin($pluginName))
return $this->error(sprintf('Unable to find a registered plugin called "%s"', $pluginName));
foreach ($manager->getNotes() as $note)
$this->output->writeln($note);
if (!$this->confirmToProceed(sprintf('This will DELETE "%s" from the filesystem and database.', $pluginName)))
return;
/*
* Delete from file system
*/
if ($pluginPath = PluginManager::instance()->getPluginPath($pluginName)) {
File::deleteDirectory($pluginPath);
$this->output->writeln(sprintf('<info>Deleted: %s</info>', $pluginName));
}
/*
* Rollback plugin
*/
$manager = UpdateManager::instance()->resetNotes();
$manager->rollbackPlugin($pluginName);
foreach ($manager->getNotes() as $note)
$this->output->writeln($note);
/*
* Delete from file system
*/
if ($pluginPath = $pluginManager->getPluginPath($pluginName)) {
File::deleteDirectory($pluginPath);
$this->output->writeln(sprintf('<info>Deleted: %s</info>', $pluginName));
}
}
@ -77,7 +84,18 @@ class PluginRemove extends Command
*/
protected function getOptions()
{
return [];
return [
['force', null, InputOption::VALUE_NONE, 'Force the operation to run.'],
];
}
/**
* Get the default confirmation callback.
* @return \Closure
*/
protected function getDefaultConfirmCallback()
{
return function() { return true; };
}
}

View File

@ -413,7 +413,7 @@ class Updates extends Controller
/*
* Update steps
*/
$updateSteps = $this->buildUpdateSteps(null, $plugins);
$updateSteps = $this->buildUpdateSteps(null, $plugins, []);
/*
* Finish up