Skip to content
Commits on Source (3)
......@@ -137,8 +137,8 @@ if (isset($_SERVER['db_name'])) {
global $conf;
$conf['install_profile'] = '<?php print $this->profile ?>';
$conf['file_directory_path'] = 'sites/<?php print $this->uri ?>/files';
$conf['file_directory_temp'] = 'sites/<?php print $this->uri ?>/private/temp';
$conf['file_directory_path'] = '<?php print $this->file_public_path ?>';
$conf['file_directory_temp'] = '<?php print $this->file_temporary_path ?>;
$conf['clean_url'] = 1;
$conf['aegir_api'] = <?php print $this->api_version ? $this->api_version : 0 ?>;
$conf['allow_authorize_operations'] = FALSE;
......
......@@ -138,9 +138,9 @@ if (isset($_SERVER['db_name'])) {
global $conf;
$conf['install_profile'] = '<?php print $this->profile ?>';
$conf['file_public_path'] = 'sites/<?php print $this->uri ?>/files';
$conf['file_private_path'] = 'sites/<?php print $this->uri ?>/private/files';
$conf['file_temporary_path'] = 'sites/<?php print $this->uri ?>/private/temp';
$conf['file_public_path'] = '<?php print $this->file_public_path ?>';
$conf['file_private_path'] = '<?php print $this->file_private_path ?>';
$conf['file_temporary_path'] = '<?php print $this->file_temporary_path ?>';
$drupal_hash_salt = '';
$conf['clean_url'] = 1;
$conf['aegir_api'] = <?php print $this->api_version ? $this->api_version : 0 ?>;
......
......@@ -131,9 +131,9 @@ if (isset($_SERVER['db_name'])) {
*/
umask(0002);
$settings['file_public_path'] = 'sites/<?php print $this->uri ?>/files';
$settings['file_private_path'] = 'sites/<?php print $this->uri ?>/private/files';
$config['system.file']['path']['temporary'] = 'sites/<?php print $this->uri ?>/private/temp';
$settings['file_public_path'] = '<?php print $this->file_public_path ?>';
$settings['file_private_path'] = '<?php print $this->file_private_path ?>';
$config['system.file']['path']['temporary'] = '<?php print $this->file_temporary_path ?>';
$config_directories[CONFIG_SYNC_DIRECTORY] = 'sites/<?php print $this->uri ?>/private/config/sync';
$settings['hash_salt'] = '<?php print $drupal_hash_salt_var ?>';
$settings['aegir_api'] = <?php print $this->api_version ? $this->api_version : 0 ?>;
......
......@@ -12,6 +12,9 @@ class Provision_Context_site extends Provision_Context {
'platform' => 'site: the platform the site is run on',
'db_server' => 'site: the db server the site is run on',
'uri' => 'site: example.com URI, no http:// or trailing /',
'file_public_path' => 'site: path to public files folder. Defaults to sites/example.com/files',
'file_private_path' => 'site: path to private files folder. Defaults to sites/example.com/private/files',
'file_temporary_path' => 'site: path to temporary files folder. Defaults to sites/example.com/private/temp',
'language' => 'site: site language; default en',
'aliases' => 'site: comma-separated URIs',
'redirection' => 'site: boolean for whether --aliases should redirect; default false',
......@@ -42,6 +45,9 @@ class Provision_Context_site extends Provision_Context {
// this can potentially be handled by a Drupal sub class
$this->setProperty('profile', 'standard');
$this->setProperty('install_method', 'profile');
$this->setProperty('file_public_path', 'sites/' . $this->uri . '/files');
$this->setProperty('file_private_path', 'sites/' . $this->uri . '/private/files');
$this->setProperty('file_temporary_path', 'sites/' . $this->uri . '/private/temp');
}
/**
......
......@@ -34,6 +34,27 @@ function drush_provision_drupal_provision_delete() {
drush_set_option('provision_save_config', false);
_provision_recursive_delete(d()->site_path);
// If files paths are not in the default location, throw a warning saying
// they will not be deleted automatically.
foreach (array('file_public_path', 'file_private_path', 'file_temporary_path') as $property_name) {
$path = d()->{$property_name};
if (!drush_is_absolute_path($path)) {
$path = d()->root . DIRECTORY_SEPARATOR . '';
}
// If files path is not inside site path, don't delete it because there
// may be files from other sites.
// @TODO: Create a site property like 'file_directory_force_delete' to force
// deletion of files dirs that are outside of the site root.
if (strpos($path, d()->site_path) !== 0) {
drush_log(dt('Warning: File path "!name" was not deleted, because it may contain files from other sites. You must manually delete the folder.', array(
'!name' => $path,
)), 'warning');
}
}
// we remove the aliases even if redirection is enabled as a precaution
// if redirection is enabled, keep silent about errors
_provision_drupal_delete_aliases();
......
......@@ -134,6 +134,14 @@ function provision_drupal_push_site($override_slave_authority = FALSE) {
// Sync all filesystem changes to the remote server.
d()->service('http')->sync(d()->site_path, $options);
// If this site's "file_public_path" is not the default site_path/files, sync it.
if (d()->site_path . '/files' != d()->file_public_path) {
d()->service('http')->sync(d()->file_public_path, $options);
}
if (d()->site_path . '/files/private' != d()->file_private_path) {
d()->service('http')->sync(d()->file_private_path, $options);
}
// Reset the exclude-path option
if(!is_null($exclude)) {
if(empty($old_exclude)) {
......@@ -157,8 +165,8 @@ function provision_drupal_fetch_site($alias = NULL) {
$site = d($alias);
// synch filesystem changes back from the remote server.
$site->service('http')->fetch($site->site_path . '/files/');
$site->service('http')->fetch($site->site_path . '/private/');
$site->service('http')->fetch($site->file_public_path);
$site->service('http')->fetch($site->file_private_path);
$site->service('http')->fetch($site->site_path . '/modules/');
$site->service('http')->fetch($site->site_path . '/themes/');
$site->service('http')->fetch($site->site_path . '/libraries/');
......@@ -200,76 +208,80 @@ function _provision_drupal_create_directories($url = NULL) {
"sites/$url/libraries" => 02775, # http://drupal.org/node/496240
);
$file_public_path = d()->file_public_path;
$file_private_path = d()->file_private_path;
$file_temporary_path = d()->file_temporary_path;
$chgrp = array();
// special case: platform. do not handle files dir
if ($url != 'all') {
$mkdir["sites/$url/files"] = 02770;
$chgrp["sites/$url/files"] = d('@server_master')->web_group;
$mkdir[$file_public_path] = 02770;
$chgrp[$file_public_path] = d('@server_master')->web_group;
$mkdir["sites/$url/files/tmp"] = 02770;
$chgrp["sites/$url/files/tmp"] = d('@server_master')->web_group;
$mkdir["$file_public_path/tmp"] = 02770;
$chgrp["$file_public_path/tmp"] = d('@server_master')->web_group;
$mkdir["sites/$url/files/images"] = 02770;
$chgrp["sites/$url/files/images"] = d('@server_master')->web_group;
$mkdir["$file_public_path/images"] = 02770;
$chgrp["$file_public_path/images"] = d('@server_master')->web_group;
$mkdir["sites/$url/files/pictures"] = 02770;
$chgrp["sites/$url/files/pictures"] = d('@server_master')->web_group;
$mkdir["$file_public_path/pictures"] = 02770;
$chgrp["$file_public_path/pictures"] = d('@server_master')->web_group;
$mkdir["sites/$url/files/css"] = 02770;
$chgrp["sites/$url/files/css"] = d('@server_master')->web_group;
$mkdir["$file_public_path/css"] = 02770;
$chgrp["$file_public_path/css"] = d('@server_master')->web_group;
$mkdir["sites/$url/files/js"] = 02770;
$chgrp["sites/$url/files/js"] = d('@server_master')->web_group;
$mkdir["$file_public_path/js"] = 02770;
$chgrp["$file_public_path/js"] = d('@server_master')->web_group;
$mkdir["sites/$url/files/ctools"] = 02770;
$chgrp["sites/$url/files/ctools"] = d('@server_master')->web_group;
$mkdir["$file_public_path/ctools"] = 02770;
$chgrp["$file_public_path/ctools"] = d('@server_master')->web_group;
$mkdir["sites/$url/files/imagecache"] = 02770;
$chgrp["sites/$url/files/imagecache"] = d('@server_master')->web_group;
$mkdir["$file_public_path/imagecache"] = 02770;
$chgrp["$file_public_path/imagecache"] = d('@server_master')->web_group;
$mkdir["sites/$url/files/locations"] = 02770;
$chgrp["sites/$url/files/locations"] = d('@server_master')->web_group;
$mkdir["$file_public_path/locations"] = 02770;
$chgrp["$file_public_path/locations"] = d('@server_master')->web_group;
// d7 support
$mkdir["sites/$url/private"] = 02770;
$chgrp["sites/$url/private"] = d('@server_master')->web_group;
$mkdir["$file_private_path"] = 02770;
$chgrp["$file_private_path"] = d('@server_master')->web_group;
$mkdir["sites/$url/private/files"] = 02770;
$chgrp["sites/$url/private/files"] = d('@server_master')->web_group;
$mkdir["$file_private_path/files"] = 02770;
$chgrp["$file_private_path/files"] = d('@server_master')->web_group;
$mkdir["sites/$url/private/temp"] = 02770;
$chgrp["sites/$url/private/temp"] = d('@server_master')->web_group;
$mkdir["$file_temporary_path"] = 02770;
$chgrp["$file_temporary_path"] = d('@server_master')->web_group;
$mkdir["sites/$url/files/styles"] = 02770;
$chgrp["sites/$url/files/styles"] = d('@server_master')->web_group;
$mkdir["$file_public_path/styles"] = 02770;
$chgrp["$file_public_path/styles"] = d('@server_master')->web_group;
// d8 support
$mkdir["sites/$url/private/config"] = 02770;
$chgrp["sites/$url/private/config"] = d('@server_master')->web_group;
$mkdir["$file_private_path/config"] = 02770;
$chgrp["$file_private_path/config"] = d('@server_master')->web_group;
$mkdir["sites/$url/private/config/sync"] = 02770;
$chgrp["sites/$url/private/config/sync"] = d('@server_master')->web_group;
$mkdir["$file_private_path/config/sync"] = 02770;
$chgrp["$file_private_path/config/sync"] = d('@server_master')->web_group;
}
// These paths should not have recursive operations performed on them.
$chmod_not_recursive = $chgrp_not_recursive = array(
"sites/$url",
"sites/$url/files",
"sites/$url/files/tmp",
"sites/$url/files/images",
"sites/$url/files/pictures",
"sites/$url/files/css",
"sites/$url/files/js",
"sites/$url/files/ctools",
"sites/$url/files/imagecache",
"sites/$url/files/locations",
"sites/$url/private",
"sites/$url/private/files",
"sites/$url/private/temp",
"sites/$url/files/styles",
"sites/$url/files/private",
"sites/$url/private/config",
"sites/$url/private/config/sync"
"$file_public_path",
"$file_public_path/tmp",
"$file_public_path/images",
"$file_public_path/pictures",
"$file_public_path/css",
"$file_public_path/js",
"$file_public_path/ctools",
"$file_public_path/imagecache",
"$file_public_path/locations",
"$file_public_path/styles",
"$file_public_path/private",
"$file_private_path",
"$file_private_path/files",
"$file_private_path/temp",
"$file_private_path/config",
"$file_private_path/config/sync"
);
// Allow other commands to add or alter the directories to be created,
......