function sweaver_drush_verify_edit in Sweaver 7
Same name and namespace in other branches
- 6 drush/sweaver.drush.inc \sweaver_drush_verify_edit()
Verify if drush can write into the sweaver files directory.
1 call to sweaver_drush_verify_edit()
- sweaver_drush_style in drush/
sweaver.drush.inc - Edit a style via drush.
File
- drush/
sweaver.drush.inc, line 352 - Sweaver Drush functions.
Code
function sweaver_drush_verify_edit($style) {
$write = TRUE;
$public_path = variable_get('file_public_path', conf_path() . '/files');
$draft_file = $public_path . '/sweaver/sweaver_' . $style->theme . '_' . $style->style_id . '_draft.css';
$live_file = $public_path . '/sweaver/sweaver_' . $style->theme . '_' . $style->style_id . '_live.css';
$touch_file = isset($style->active) ? $live_file : $draft_file;
$write = @touch($touch_file);
if (!$write) {
drush_set_context("DRUSH_EXECUTION_COMPLETED", TRUE);
drush_print(dt('The drush user is not able to overwrite the files in the sweaver directory. Either change the permissions (best option) of those files or run Drush with sudo permissions (might conflict later on when editing the style again from the interface.)'));
exit;
}
}