foreach ($args as $arg) {
if (!is_array($arg)) {
- $cmd .= ' ' . escapeshellarg($arg);
+ $cmd .= ' ' . MTrackSCM::escapeshellarg($arg);
continue;
}
foreach ($arg as $a) {
- $cmd .= ' ' . escapeshellarg($a);
+ $cmd .= ' ' . MTrackSCM::escapeshellarg($a);
}
}
$FORKS[$cmd] = 0;
}
$FORKS[$cmd]++;
- var_dump($cmd);
+ //echo $cmd;
// debugging....
if (false) {
if (php_sapi_name() == 'cli') {
}
}
-
-
+ static function escapeshellarg($a) {
+ if (preg_match('/\-[a-z0-9]+$/i', $a)) {
+ return $a; // raw -a
+ }
+ if (preg_match('/\-\-[a-z0-9]+=/i', $a)) {
+ $lr = explode('=', $a,2);
+ return $lr[0].'=' . escapeshellarg($lr[1]); // raw -a
+ }
+ return escapeshellarg($a);
+
+
+ }
public $repopath = '';
/*
return self::makeDisplayName($this);
}
- public function resolveRevision($rev, $object, $ident) {
- if ($rev !== null) {
- return $rev;
- }
- if ($object === null) {
- return null;
- }
- switch ($object) {
- case 'rev':
- $rev = $ident;
- break;
- case 'branch':
- $branches = $this->getBranches();
- $rev = isset($branches[$ident]) ? $branches[$ident] : null;
- break;
- case 'tag':
- $tags = $this->getTags();
- $rev = isset($tags[$ident]) ? $tags[$ident] : null;
- break;
- }
- if ($rev === null) {
- throw new Exception(
- "don't know which revision to use ($rev,$object,$ident)");
- }
- return $rev;
- }
+ public function resolveRevision($rev, $object, $ident)
+ {
+ if ($rev !== null) {
+ return $rev;
+ }
+
+ if ($object === null) {
+ return null;
+ }
+
+ switch ($object) {
+ case 'rev':
+ $rev = $ident;
+ break;
+
+ case 'branch':
+ $branches = $this->getBranches();
+ $rev = isset($branches[$ident]) ? $branches[$ident] : null;
+ break;
+
+ case 'tag':
+ $tags = $this->getTags();
+ $rev = isset($tags[$ident]) ? $tags[$ident] : null;
+ break;
+ }
+ if ($rev === null) {
+ throw new Exception(
+ "don't know which revision to use ($rev,$object,$ident)");
+ }
+ return $rev;
+ }
}