You are here

function sweaver_drush_verify_edit in Sweaver 6

Same name and namespace in other branches
  1. 7 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 350
Sweaver Drush functions.

Code

function sweaver_drush_verify_edit($style) {
  $write = TRUE;
  $draft_file = file_directory_path() . '/sweaver/sweaver_' . $style->theme . '_' . $style->style_id . '_draft.css';
  $live_file = file_directory_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;
  }
}