From 027af0dd9f3b3ebd798ba2611a5cc9809dbe6a23 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Sun, 22 Feb 2015 14:04:07 +1100 Subject: [PATCH] Switch to our own internals for local storage The local storage driver is not suitable because it does not apply the appropriate permissions to local files. This is a big issue especially for shared hosting where the webserver will create a file and the owner is locked from touching it. We detect the local driver and use the FileHelper class whenever a file or directory is created. Eg: if configured to apply chmod 777 then it will be fulfilled as expected. --- modules/system/models/File.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/system/models/File.php b/modules/system/models/File.php index 7fe8f0d34..fb501bba1 100644 --- a/modules/system/models/File.php +++ b/modules/system/models/File.php @@ -17,14 +17,18 @@ class File extends FileBase */ protected $table = 'system_files'; - // - // Configuration - // + /** + * If working with local storage, determine the absolute local path. + */ + protected function getLocalRootPath() + { + return Config::get('filesystems.disks.local.root', storage_path().'/app'); + } /** * Define the public address for the storage path. */ - public function getPublicDirectory() + public function getPublicPath() { $uploadsPath = Config::get('cms.uploadsPath', '/storage/app/uploads');