function demo_get_fileconfig in Demonstration site (Sandbox / Snapshot) 7
Same name and namespace in other branches
- 8 demo.module \demo_get_fileconfig()
- 5 demo.admin.inc \demo_get_fileconfig()
- 6 demo.admin.inc \demo_get_fileconfig()
8 calls to demo_get_fileconfig()
- demo_delete_confirm in ./
demo.admin.inc - Form builder to confirm deletion of a snapshot.
- demo_delete_confirm_submit in ./
demo.admin.inc - Form submit handler for demo_delete_confirm().
- demo_download in ./
demo.admin.inc - Transfer (download) a snapshot file.
- demo_dump_form_validate in ./
demo.admin.inc - Form validation handler for demo_dump_form().
- demo_get_dumps in ./
demo.admin.inc
File
- ./
demo.admin.inc, line 397 - Demonstration Site administrative pages.
Code
function demo_get_fileconfig($filename = 'demo_site') {
$fileconfig = array();
// Build dump path.
if (!file_stream_wrapper_valid_scheme('private')) {
// @todo Temporarily throwing a form error here.
// Don't break demo_profile.
if (!defined('MAINTENANCE_MODE')) {
form_set_error('', t('The <a href="@file-settings-url">private filesystem</a> must be configured in order to create or load snapshots.', array(
'@file-settings-url' => url('admin/config/media/file-system', array(
'query' => drupal_get_destination(),
)),
)));
}
return FALSE;
}
$fileconfig['path'] = 'private://' . variable_get('demo_dump_path', 'demo');
$fileconfig['dumppath'] = $fileconfig['path'];
// @todo Update to D7?
// Append site name if it is not included in file_directory_path() and if not
// storing files in sites/all/files.
$fileconfig['site'] = str_replace('sites', '', conf_path());
/*
if (strpos($fileconfig['path'], conf_path()) === FALSE && strpos($fileconfig['path'], '/all/') === FALSE) {
$fileconfig['dumppath'] .= $fileconfig['site'];
}
*/
// Check if directory exists.
if (!file_prepare_directory($fileconfig['dumppath'], FILE_CREATE_DIRECTORY)) {
return FALSE;
}
// Protect dump files.
file_create_htaccess($fileconfig['path'], TRUE);
// Build SQL filename.
$fileconfig['sql'] = $filename . '.sql';
$fileconfig['sqlfile'] = $fileconfig['dumppath'] . '/' . $fileconfig['sql'];
// Build info filename.
$fileconfig['info'] = $filename . '.info';
$fileconfig['infofile'] = $fileconfig['dumppath'] . '/' . $fileconfig['info'];
return $fileconfig;
}