Skip to content

Commit 95a83cd

Browse files
committed
use realpath to figure out program name
1 parent ae1aaa0 commit 95a83cd

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

eventum-cvs-hook.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@
5757
//
5858

5959
// save name of this script
60-
$PROGRAM = basename(array_shift($argv));
60+
$PROGRAM = basename(realpath(array_shift($argv)), '.php');
6161

6262
$dir = dirname(__FILE__);
6363
require_once "$dir/helpers.php";
6464

6565
// load eventum-cvs-hook.conf.php from dir of this script if it exists
66-
$configfile = $dir . DIRECTORY_SEPARATOR . basename(__FILE__, '.php') . '.conf.php';
66+
$configfile = "$dir/$PROGRAM.conf.php";
6767
if (file_exists($configfile)) {
6868
require_once $configfile;
6969
}

eventum-git-hook.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,14 @@
3838
// DO NOT CHANGE ANYTHING AFTER THIS LINE
3939
//
4040

41+
// save name of this script
42+
$PROGRAM = basename(realpath(array_shift($argv)), '.php');
43+
4144
$dir = dirname(__FILE__);
4245
require_once "$dir/helpers.php";
4346

44-
// load eventum-svn-hook.conf.php from dir of this script if it exists
45-
$configfile = dirname(__FILE__) . DIRECTORY_SEPARATOR . basename(__FILE__, '.php') . '.conf.php';
47+
// load eventum-git-hook.conf.php from dir of this script if it exists
48+
$configfile = "$dir/$PROGRAM.conf.php";
4649
if (file_exists($configfile)) {
4750
require_once $configfile;
4851
}

eventum-svn-hook.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,19 @@
5151
//
5252
// DO NOT CHANGE ANYTHING AFTER THIS LINE
5353
//
54+
55+
// save name of this script
56+
$PROGRAM = basename(realpath(array_shift($argv)), '.php');
57+
5458
$dir = dirname(__FILE__);
5559
require_once "$dir/helpers.php";
5660

5761
// load eventum-svn-hook.conf.php from dir of this script if it exists
58-
$configfile = $dir . DIRECTORY_SEPARATOR . basename(__FILE__, '.php') . '.conf.php';
62+
$configfile = "$dir/$PROGRAM.conf.php";
5963
if (file_exists($configfile)) {
6064
require_once $configfile;
6165
}
6266

63-
// save name of this script
64-
$PROGRAM = basename(array_shift($argv));
65-
6667
if ($argc < 3) {
6768
error_log("$PROGRAM: Missing arguments, got " . ($argc - 1) . ", expected 2");
6869
exit(1);

0 commit comments

Comments
 (0)