function demo_get_fileconfig in Demonstration site (Sandbox / Snapshot) 5
Same name and namespace in other branches
- 8 demo.module \demo_get_fileconfig()
- 6 demo.admin.inc \demo_get_fileconfig()
- 7 demo.admin.inc \demo_get_fileconfig()
9 calls to demo_get_fileconfig()
- demo_admin_settings in ./
demo.admin.inc - demo_autocomplete in ./
demo.admin.inc - Retrieve a pipe delimited string of autocomplete suggestions for existing snapshot names.
- demo_delete_confirm in ./
demo.admin.inc - demo_delete_confirm_submit in ./
demo.admin.inc - demo_download in ./
demo.admin.inc - Transfer (download) a snapshot file.
File
- ./
demo.admin.inc, line 301 - Demonstration Site administrative pages
Code
function demo_get_fileconfig($filename = 'demo_site') {
$fileconfig = array();
// Build dump path.
$fileconfig['path'] = variable_get('demo_dump_path', file_directory_path() . '/demo');
$fileconfig['site'] = str_replace('sites', '', conf_path());
$fileconfig['dumppath'] = $fileconfig['path'] . $fileconfig['site'];
// Check if directory exists.
file_check_directory($fileconfig['path'], FILE_CREATE_DIRECTORY, 'path');
if (!file_check_directory($fileconfig['dumppath'], FILE_CREATE_DIRECTORY, 'path')) {
return FALSE;
}
// Protect dump files.
$htaccess = $fileconfig['path'] . "/.htaccess";
if (!is_file($htaccess)) {
$htaccess_lines = "# demo.module snapshots\n# Do not let the webserver serve anything under here!\n#\nDeny from all\n";
if (($fp = fopen($htaccess, 'w')) && fputs($fp, $htaccess_lines)) {
fclose($fp);
chmod($htaccess, 0664);
}
}
// Build SQL filename.
$fileconfig['sql'] = $filename . '.sql';
$fileconfig['sqlfile'] = $fileconfig['path'] . $fileconfig['site'] . '/' . $filename . '.sql';
// Build info filename.
$fileconfig['info'] = $filename . '.info';
$fileconfig['infofile'] = $fileconfig['path'] . $fileconfig['site'] . '/' . $filename . '.info';
return $fileconfig;
}