-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathupdatePear.php
executable file
·55 lines (46 loc) · 1.31 KB
/
updatePear.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
* updatePear.php
*
* PHP Versions 4 and 5
*
* @category Date
* @package Date_Holidays
* @author Carsten Lucke <[email protected]>
* @license http://www.php.net/license/3_01.txt PHP License 3.0.1
* @version CVS: $Id$
* @link http://pear.php.net/package/Date_Holidays
*/
if ($_SERVER['argc'] != 4) {
echo 'Wrong execution of file. ';
echo 'Call like that: FILENAME <project-name> <php-interpreter path> <pear-executable path>';
echo '<pear executable path>';
exit;
}
$PACKAGENAME = $_SERVER['argv'][1];
$PHPCMD = $_SERVER['argv'][2];
$PEARCMD = $_SERVER['argv'][3];
$ret = null;
$output = array();
echo 'Removing old pear-package-version ';
exec($PEARCMD . ' uninstall ' . $PACKAGENAME, $output, $ret);
echo printStatus($ret) . "\n";
echo 'Packaging new pear-package-version ';
$lastLine = exec($PEARCMD . ' package -n package.xml', $output, $ret);
echo printStatus($ret) . "\n";
echo 'Installing new pear-package-version ';
exec($PEARCMD . ' install -o ' . $lastLine, $output, $ret);
echo printStatus($ret) . "\n";
/**
* given a numeric value, return '[OK]' (if zero) or '[FAILED]'.
*
* @param mixed $returnCode numeric value
*
* @access public
* @return string
*/
function printStatus($returnCode)
{
return 0 == $returnCode ? '[OK]' : '[FAILED]';
}
?>