You are here

function _coder_review_drush_is_patch_arg in Coder 7

Same name and namespace in other branches
  1. 7.2 coder_review/coder_review.drush.inc \_coder_review_drush_is_patch_arg()

Handle patch reviews.

1 call to _coder_review_drush_is_patch_arg()
coder_review_drush_review in coder_review/coder_review.drush.inc
Do the actual review.

File

coder_review/coder_review.drush.inc, line 223
Command line utility for coder_review.

Code

function _coder_review_drush_is_patch_arg(&$arg, $root) {
  if (drupal_substr($arg, 0, 7) == 'http://') {
    return TRUE;
  }
  if (preg_match('/\\.(patch|diff|tmp)$/', $arg)) {
    if (isset($_SERVER['OLDPWD'])) {
      $path = preg_replace(",^{$root}/,", '', $_SERVER['OLDPWD'] . '/' . $arg);
      if (is_file($path)) {
        $arg = $path;
        return TRUE;
      }
    }
  }
}