final move of files
[web.mtrack] / MTrack / Interface / CommitHookBridge.php
1 <?php
2
3 abstract class IMTrackCommitHookBridge 
4 {
5   abstract function enumChangedOrModifiedFileNames();
6   abstract function getFileStream($filename);
7   abstract function getCommitMessage();
8   /* returns a tracklink describing the change (eg: [123]) */
9   abstract function getChangesetDescriptor();
10
11  /**
12   * run: call popen, escaping all arguments, merging arguments that are arrays into the array
13   * @args
14   * 
15   */
16     function run()
17     {
18         $args = func_get_args();
19         $all_args = array();
20         foreach ($args as $a) {
21             if (!is_array($a)) {
22                 $all_args[] = escapeshellarg($a);
23                 continue;
24             }
25             foreach ($a as $arg) {
26                 $all_args[] = escapeshellarg($arg);
27             }
28         } 
29          
30         return popen(implode(' ', $all_args), 'r');
31  
32     }
33
34 }