diff --git a/.platform.yml b/.platform.yml index 6dd5cb24..f42a1c3a 100644 --- a/.platform.yml +++ b/.platform.yml @@ -8,3 +8,9 @@ crons: queuedjobs_task: time: '* * * * *' command: 'test -f /var/www/mysite/www/host.txt && /usr/local/bin/sera 1 php /var/www/mysite/www/framework/cli-script.php dev/tasks/ProcessJobQueueTask 2>&1 | logger -t SilverStripe_cron' +shared_dirs: + mysite: + "addon-downloads": {} + url_rules: + mysite: + '^/addon-downloads/': 'deny' diff --git a/README.md b/README.md index aa1ec2f3..47707b45 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,11 @@ from [Packagist](http://packagist.org). ## Dependencies +### Environment variables + + * `SS_ADDONS_DOWNLOAD_PATH`: Set this to the full path of the folder to download into. Otherwise, a subfolder of the + SilverStripe temp path will be used. + ### ElasticSearch [ElasticSearch](http://www.elasticsearch.org) is used to provide add-on package indexing and searching. diff --git a/mysite/code/services/AddonBuilder.php b/mysite/code/services/AddonBuilder.php index 7b06bdda..b14b50dd 100755 --- a/mysite/code/services/AddonBuilder.php +++ b/mysite/code/services/AddonBuilder.php @@ -9,7 +9,7 @@ class AddonBuilder { - const ADDONS_DIR = 'add-ons'; + const ADDONS_DIR = 'addon-downloads'; const SCREENSHOTS_DIR = 'screenshots'; @@ -46,9 +46,13 @@ public function build(Addon $addon) continue; } - $path = implode('/', array( - TEMP_FOLDER, self::ADDONS_DIR, $addon->Name - )); + if (defined('SS_ADDONS_DOWNLOAD_PATH')) { + $path = SS_ADDONS_DOWNLOAD_PATH . '/' . $addon->Name; + } else { + $path = implode('/', array( + TEMP_FOLDER, self::ADDONS_DIR, $addon->Name + )); + } // Convert PackagistAPI result into class compatible with Composer logic $package = new Package(