Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add --exclude <directory> option

  • Loading branch information...
commit 9909065d1b910cd3ed60b27b80d684999eb70dc8 1 parent 5d4a935
@chehodgins chehodgins authored
Showing with 24 additions and 3 deletions.
  1. +24 −3 migrate.php
View
27 migrate.php
@@ -5,8 +5,9 @@ function usage($argv) {
$help = <<<ENDH
Usage: $argv[0] [options] {file(s) to check}
options:
- -h|--help This help
- -d L|--debug L Set debug level L
+ -h|--help This help
+ -d L|--debug L Set debug level L
+ -e <dir>|--exclude <dir> Exclude <dir> from migration
File(s) can be either filenames or directories.
ENDH;
@@ -31,6 +32,17 @@ function usage($argv) {
}
continue;
}
+
+ if($option == "-e" || $option == "--exclude") {
+ $i++;
+ if($i<$_SERVER['argc']) {
+ $chk->exclude = $_SERVER['argv'][$i];
+ } else {
+ usage($_SERVER['argv']);
+ }
+ continue;
+ }
+
$needhelp = false;
$chk->check($option);
}
@@ -42,7 +54,8 @@ function usage($argv) {
class Checker
{
public $debug = 0;
-
+ public $exclude = '';
+
protected $_filename;
const DEPRECATED = 'deprecated-func';
@@ -266,6 +279,14 @@ protected function recursiveCheck($filename)
{
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($filename));
foreach($files as $object) {
+ if($this->exclude != '' && strpos($object->getPathname(), DIRECTORY_SEPARATOR . $this->exclude . DIRECTORY_SEPARATOR) !== false) {
+ if($this->debug >= 1) {
+ echo "SKIPPING: $object\n";
+ flush();
+ }
+ continue;
+ }
+
if($object->isFile() && preg_match('/\.php$/', $object->getFilename())) {
$this->check($object->getPathName());
}
Please sign in to comment.
Something went wrong with that request. Please try again.