Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Commit

Permalink
FIX: Move add-on downloads out of temp
Browse files Browse the repository at this point in the history
Temp may is space-restricted on SSP and so a hidden folder in there
runs out of disk. This sets up a new folder on the mounted EBS. Making
it a hidden pathname prevents web access.
  • Loading branch information
Sam Minnee committed Nov 17, 2017
1 parent 4b57b0c commit 1920752
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 8 additions & 4 deletions mysite/code/services/AddonBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class AddonBuilder
{

const ADDONS_DIR = 'add-ons';
const ADDONS_DIR = 'addon-downloads';

const SCREENSHOTS_DIR = 'screenshots';

Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 1920752

Please sign in to comment.