Skip to content

Instantly share code, notes, and snippets.

@dsueiro
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save dsueiro/8bb2922f6ec30277e791 to your computer and use it in GitHub Desktop.

Select an option

Save dsueiro/8bb2922f6ec30277e791 to your computer and use it in GitHub Desktop.
Looking for a certain module on a folder containing bare repositories with Magentos
<?php
if (count($argv) != 2) {
die("Usage:\n\tphp {$argv[0]} scope/module/folder\nExample:\tphp {$argv[0]} local/SemExpert/Oca # no bar at the end");
}
foreach(glob('*.git') as $dir) {
if (!chdir($dir)) {
continue;
}
$cmd = "git ls-tree -r master app/code/{$argv[1]}/etc/config.xml";
#echo "$cmd\n";
$result = exec($cmd);
if (!empty($result)) {
echo "$dir\n";
$parts = preg_split("/\s+/ ", $result);
$cmd2 = "git cat-file blob {$parts[2]} | grep \<version\>";
#echo "$cmd2\n";
echo exec($cmd2) . "\n";
}
chdir('..');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment