uploadsPath -> cms.storage.uploads.path

This commit is contained in:
Samuel Georges 2015-02-23 19:55:41 +11:00
parent f7ba386156
commit 54fe8452e5
5 changed files with 112 additions and 68 deletions

View File

@ -3,7 +3,7 @@
- Added the ability to prune Event and Request log records. - Added the ability to prune Event and Request log records.
* **Build 199** (2015-02-19) * **Build 199** (2015-02-19)
- The **/uploads** directory has been moved to **/storage/app/uploads** to make way for CDN support. This directory should be moved on the file system and the config (`cms.uploadsPath`) updated. - The **/uploads** directory has been moved to **/storage/app/uploads** to make way for CDN support. This directory should be moved on the file system and the config (`cms.storage.uploads.path`) updated.
* **Build 192** (2015-02-14) * **Build 192** (2015-02-14)
- For security reasons a vague error message is shown when a user tries to sign in unsuccessfully and the setting `app.debug` is disabled. - For security reasons a vague error message is shown when a user tries to sign in unsuccessfully and the setting `app.debug` is disabled.

View File

@ -97,6 +97,7 @@ return array(
| Available Settings: "single", "daily", "syslog" | Available Settings: "single", "daily", "syslog"
| |
*/ */
'log' => 'single', 'log' => 'single',
/* /*

View File

@ -2,53 +2,6 @@
return array( return array(
/*
|--------------------------------------------------------------------------
| Specifies the default CMS theme.
|--------------------------------------------------------------------------
|
| This parameter value can be overridden by the CMS back-end settings.
|
*/
'activeTheme' => 'demo',
/*
|--------------------------------------------------------------------------
| Determines which modules to load
|--------------------------------------------------------------------------
|
| Specify which modules should be registered when using the application.
|
*/
'loadModules' => ['System', 'Backend', 'Cms'],
/*
|--------------------------------------------------------------------------
| Specific plugins to disable
|--------------------------------------------------------------------------
|
| Specify plugin codes which will always be disabled in the application.
|
*/
'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,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Bleeding edge updates | Bleeding edge updates
@ -62,6 +15,17 @@ return array(
'edgeUpdates' => false, 'edgeUpdates' => false,
/*
|--------------------------------------------------------------------------
| Specifies the default CMS theme.
|--------------------------------------------------------------------------
|
| This parameter value can be overridden by the CMS back-end settings.
|
*/
'activeTheme' => 'demo',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Back-end URI prefix | Back-end URI prefix
@ -86,16 +50,39 @@ return array(
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Time to live for parsed CMS objects. | Determines which modules to load
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Specifies the number of minutes the CMS object cache lives. After the interval | Specify which modules should be registered when using the application.
| is expired item are re-cached. Note that items are re-cached automatically when
| the corresponding template file is modified.
| |
*/ */
'parsedPageCacheTTL' => 10, 'loadModules' => ['System', 'Backend', 'Cms'],
/*
|--------------------------------------------------------------------------
| 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,
/*
|--------------------------------------------------------------------------
| Specific plugins to disable
|--------------------------------------------------------------------------
|
| Specify plugin codes which will always be disabled in the application.
|
*/
'disablePlugins' => [],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -124,6 +111,19 @@ return array(
'urlCacheTtl' => 10, 'urlCacheTtl' => 10,
/*
|--------------------------------------------------------------------------
| Time to live for parsed CMS objects.
|--------------------------------------------------------------------------
|
| Specifies the number of minutes the CMS object cache lives. After the interval
| is expired item are re-cached. Note that items are re-cached automatically when
| the corresponding template file is modified.
|
*/
'parsedPageCacheTTL' => 10,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Determines if the asset caching is enabled. | Determines if the asset caching is enabled.
@ -178,26 +178,38 @@ return array(
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Public uploads path | Resource storage
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Specifies the public uploads path relative to the application base URL, | Specifies the configuration for resource storage, such as media and
| or you can specify a full URL path. | upload files. These resources are used:
| |
| media - generated by the media manager.
| uploads - generated by attachment model relationships.
|
| For each resource you can specify:
|
| disk - filesystem disk, as specified in filesystems.php config.
| folder - a folder prefix for storing all generated files inside.
| path - the public path relative to the application base URL,
| or you can specify a full URL path.
*/ */
'uploadsPath' => '/storage/app/uploads', 'storage' => [
/* 'uploads' => [
|-------------------------------------------------------------------------- 'disk' => 'local',
| Default permission mask 'folder' => 'uploads',
|-------------------------------------------------------------------------- 'path' => '/storage/app/uploads',
| ],
| Specifies a default file and folder permission for newly created objects.
|
*/
'defaultMask' => ['file' => null, 'folder' => null], 'media' => [
'disk' => 'local',
'folder' => 'media',
'path' => '/storage/app/media',
],
],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -227,4 +239,15 @@ return array(
'linkPolicy' => 'detect', 'linkPolicy' => 'detect',
/*
|--------------------------------------------------------------------------
| Default permission mask
|--------------------------------------------------------------------------
|
| Specifies a default file and folder permission for newly created objects.
|
*/
'defaultMask' => ['file' => null, 'folder' => null],
); );

View File

@ -125,6 +125,8 @@ class OctoberUtil extends Command
} }
$totalCount = 0; $totalCount = 0;
$uploadsPath = Config::get('filesystems.disks.local.root', storage_path().'/app');
$uploadsPath .= '/uploads';
/* /*
* Recursive function to scan the directory for files beginning * Recursive function to scan the directory for files beginning
@ -146,7 +148,7 @@ class OctoberUtil extends Command
} }
}; };
$purgeFunc(uploads_path()); $purgeFunc($uploadsPath);
if ($totalCount > 0) { if ($totalCount > 0) {
$this->comment(sprintf('Successfully deleted %s thumbs', $totalCount)); $this->comment(sprintf('Successfully deleted %s thumbs', $totalCount));
@ -155,4 +157,22 @@ class OctoberUtil extends Command
$this->comment('No thumbs found to delete'); $this->comment('No thumbs found to delete');
} }
} }
protected function utilPurgeUploads()
{
if (!$this->confirmToProceed('This will PERMANENTLY DELETE files in the uploads directory that do not exist in the "system_files" table.')) {
return;
}
// @todo
}
protected function utilPurgeOrphans()
{
if (!$this->confirmToProceed('This will PERMANENTLY DELETE files in "system_files" that do not belong to any other model.')) {
return;
}
// @todo
}
} }

View File

@ -30,7 +30,7 @@ class File extends FileBase
*/ */
public function getPublicPath() public function getPublicPath()
{ {
$uploadsPath = Config::get('cms.uploadsPath', '/storage/app/uploads'); $uploadsPath = Config::get('cms.storage.uploads.path', '/storage/app/uploads');
if (!preg_match("/(\/\/|http|https)/", $uploadsPath)) { if (!preg_match("/(\/\/|http|https)/", $uploadsPath)) {
$uploadsPath = Request::getBasePath() . $uploadsPath; $uploadsPath = Request::getBasePath() . $uploadsPath;