changed git call from https to git readonly
[atutor.git] / mods / wiki / tools / mergeplugins
1 #!/usr/local/bin/php -qC
2 <?php
3
4 if (count($_SERVER["argv"]) < 3) {
5    die("syntax: mergeplugins  config.php mergedplugins.php\n");
6 }
7
8 #-- read in config.php
9 $cnf = implode("", file($_SERVER["argv"][1]));
10 $outfn = $_SERVER["argv"][2];
11
12 #-- merge plugins
13 $out = "";
14 $cnf = preg_replace('/^\s*#.+$/m', "", $cnf);
15 preg_match_all('/(?:include|require)(?:_once)?\(["\'](plugin.+?)["\']\);/m', $cnf, $uu);
16 foreach ($uu[1] as $file) {
17    if (strpos($file, "/db/")) { continue; }
18    echo "+ $file\n";
19    $out .= @implode("", file($file));
20 }
21
22 #-- write output file
23 $f = fopen($outfn, "w");
24 fwrite($f, $out);
25 fclose($f);
26
27 ?>