diff --git a/CHANGELOG.md b/CHANGELOG.md index 3377f24d5..becbf18ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# v1.1.4 +## XX/XX/2016 + +1. [](#new) + * Added new `tmp` folder at root. Accessible via stream `tmp://`. Can be cleared with `bin/grav clear --tmp-only` as well as `--all`. + # v1.1.3 ## 08/14/2016 diff --git a/system/src/Grav/Common/Backup/ZipBackup.php b/system/src/Grav/Common/Backup/ZipBackup.php index c7d452b61..4ccea9a31 100644 --- a/system/src/Grav/Common/Backup/ZipBackup.php +++ b/system/src/Grav/Common/Backup/ZipBackup.php @@ -17,7 +17,8 @@ class ZipBackup 'backup', 'cache', 'images', - 'logs' + 'logs', + 'tmp' ]; protected static $ignoreFolders = [ diff --git a/system/src/Grav/Common/Cache.php b/system/src/Grav/Common/Cache.php index 207159ab1..8061aa8bc 100644 --- a/system/src/Grav/Common/Cache.php +++ b/system/src/Grav/Common/Cache.php @@ -65,7 +65,8 @@ class Cache extends Getters protected static $all_remove = [ 'cache://', 'cache://images', - 'asset://' + 'asset://', + 'tmp://' ]; protected static $assets_remove = [ @@ -80,6 +81,10 @@ class Cache extends Getters 'cache://' ]; + protected static $tmp_remove = [ + 'tmp://' + ]; + /** * Constructor * @@ -309,6 +314,9 @@ class Cache extends Getters case 'cache-only': $remove_paths = self::$cache_remove; break; + case 'tmp-only': + $remove_paths = self::$tmp_remove; + break; default: $remove_paths = self::$standard_remove; } diff --git a/system/src/Grav/Common/Config/Setup.php b/system/src/Grav/Common/Config/Setup.php index 27c7c3668..8bc8cc53e 100644 --- a/system/src/Grav/Common/Config/Setup.php +++ b/system/src/Grav/Common/Config/Setup.php @@ -95,6 +95,12 @@ class Setup extends Data '' => ['backup'] ] ], + 'tmp' => [ + 'type' => 'Stream', + 'prefixes' => [ + '' => ['tmp'] + ] + ], 'image' => [ 'type' => 'ReadOnlyStream', 'prefixes' => [ diff --git a/system/src/Grav/Common/Data/Validation.php b/system/src/Grav/Common/Data/Validation.php index 984afb612..22f6d8454 100644 --- a/system/src/Grav/Common/Data/Validation.php +++ b/system/src/Grav/Common/Data/Validation.php @@ -37,12 +37,6 @@ class Validation $field['type'] = 'text'; } - // Special case for files, value is never empty and errors with code 4 instead. - if (empty($validate['required']) && $field['type'] == 'file' && isset($value['error']) - && ($value['error'] == UPLOAD_ERR_NO_FILE || in_array(UPLOAD_ERR_NO_FILE, $value['error']))) { - return $messages; - } - // Get language class. $language = Grav::instance()['language']; @@ -101,12 +95,6 @@ class Validation $field['type'] = 'text'; } - // Special case for files, value is never empty and errors with code 4 instead. - if (empty($validate['required']) && $field['type'] == 'file' && isset($value['error']) - && ($value['error'] == UPLOAD_ERR_NO_FILE || in_array(UPLOAD_ERR_NO_FILE, $value['error']))) { - return null; - } - // If this is a YAML field, simply parse it and return the value. if (isset($field['yaml']) && $field['yaml'] === true) { try { diff --git a/system/src/Grav/Console/Cli/ClearCacheCommand.php b/system/src/Grav/Console/Cli/ClearCacheCommand.php index a5d8f214b..591b0f917 100644 --- a/system/src/Grav/Console/Cli/ClearCacheCommand.php +++ b/system/src/Grav/Console/Cli/ClearCacheCommand.php @@ -27,6 +27,7 @@ class ClearCacheCommand extends ConsoleCommand ->addOption('assets-only', null, InputOption::VALUE_NONE, 'If set will remove only assets/*') ->addOption('images-only', null, InputOption::VALUE_NONE, 'If set will remove only images/*') ->addOption('cache-only', null, InputOption::VALUE_NONE, 'If set will remove only cache/*') + ->addOption('tmp-only', null, InputOption::VALUE_NONE, 'If set will remove only tmp/*') ->setHelp('The clear-cache deletes all cache files'); } @@ -55,6 +56,8 @@ class ClearCacheCommand extends ConsoleCommand $remove = 'images-only'; } elseif ($this->input->getOption('cache-only')) { $remove = 'cache-only'; + } elseif ($this->input->getOption('tmp-only')) { + $remove = 'tmp-only'; } else { $remove = 'standard'; } diff --git a/system/src/Grav/Console/Cli/SandboxCommand.php b/system/src/Grav/Console/Cli/SandboxCommand.php index a593165a7..769bf6a33 100644 --- a/system/src/Grav/Console/Cli/SandboxCommand.php +++ b/system/src/Grav/Console/Cli/SandboxCommand.php @@ -19,15 +19,16 @@ class SandboxCommand extends ConsoleCommand * @var array */ protected $directories = [ + '/assets', '/backup', '/cache', - '/logs', '/images', - '/assets', + '/logs', + '/tmp', '/user/accounts', '/user/config', - '/user/pages', '/user/data', + '/user/pages', '/user/plugins', '/user/themes', ]; diff --git a/tmp/.gitkeep b/tmp/.gitkeep new file mode 100644 index 000000000..e69de29bb