Skip to content

Commit

Permalink
Add horde-run-cmd utility
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Oct 16, 2013
1 parent 96afa82 commit 1fdf2b4
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions framework/bin/horde-run-cmd.php
@@ -0,0 +1,31 @@
<?php
/**
* Runs a shell command (contained in $argv[1]) in the base of every
* application and library contained in the current git checkout.
*/

function horde_get_base_dirs()
{
$basedirs = array(
dirname(__FILE__) . '/../',
dirname(__FILE__) . '/../../'
);

$out = array();

foreach ($basedirs as $base) {
foreach (new DirectoryIterator($base) as $val) {
if ($val->isDir() &&
file_exists($val->getPathname() . '/package.xml')) {
$out[] = realpath($val->getPathname());
}
}
}

return $out;
}

foreach (horde_get_base_dirs() as $val) {
chdir($val);
system($argv[1]);
}

0 comments on commit 1fdf2b4

Please sign in to comment.