mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-03 05:11:52 +00:00
[3.1.0] Maintenance scripts emit and honor proper exit codes
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1640 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
0e51e42197
commit
1d25be875d
@ -68,7 +68,7 @@ class FSTools
|
|||||||
}
|
}
|
||||||
// Loop through the folder
|
// Loop through the folder
|
||||||
$dir = $this->dir($source);
|
$dir = $this->dir($source);
|
||||||
while (false !== $entry = $dir->read()) {
|
while ( false !== ($entry = $dir->read()) ) {
|
||||||
// Skip pointers
|
// Skip pointers
|
||||||
if ($entry == '.' || $entry == '..') {
|
if ($entry == '.' || $entry == '..') {
|
||||||
continue;
|
continue;
|
||||||
|
@ -38,7 +38,8 @@ class HTMLPurifier_ConfigSchema_Interchange_Directive
|
|||||||
public $allowed;
|
public $allowed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of aliases for the directive, e.g. array('Alt.Directive').
|
* List of aliases for the directive,
|
||||||
|
* e.g. array(new HTMLPurifier_ConfigSchema_Interchange_Id('Ns', 'Dir'))).
|
||||||
*/
|
*/
|
||||||
public $aliases = array();
|
public $aliases = array();
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
function assertCli() {
|
function assertCli() {
|
||||||
if (php_sapi_name() != 'cli' && !getenv('PHP_IS_CLI')) {
|
if (php_sapi_name() != 'cli' && !getenv('PHP_IS_CLI')) {
|
||||||
echo 'Script cannot be called from web-browser (if you are calling via cli,
|
echo 'Script cannot be called from web-browser (if you are indeed calling via cli,
|
||||||
set environment variable PHP_IS_CLI to work around this).';
|
set environment variable PHP_IS_CLI to work around this).';
|
||||||
exit;
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,7 @@ if (isset($argv[1])) {
|
|||||||
if (in_array($argv[1], $names)) {
|
if (in_array($argv[1], $names)) {
|
||||||
$names = array($argv[1]);
|
$names = array($argv[1]);
|
||||||
} else {
|
} else {
|
||||||
echo "Did not recognized cache parameter {$argv[1]} as valid cache, aborting.\n";
|
throw new Exception("Cache parameter {$argv[1]} is not a valid cache");
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,8 +13,9 @@ assertCli();
|
|||||||
|
|
||||||
function e($cmd) {
|
function e($cmd) {
|
||||||
echo "\$ $cmd\n";
|
echo "\$ $cmd\n";
|
||||||
passthru($cmd);
|
passthru($cmd, $status);
|
||||||
echo "\n";
|
echo "\n";
|
||||||
|
if ($status) exit($status);
|
||||||
}
|
}
|
||||||
|
|
||||||
e('php generate-includes.php');
|
e('php generate-includes.php');
|
||||||
|
@ -27,6 +27,7 @@ $exclude_files = array(
|
|||||||
// Determine what files need to be included:
|
// Determine what files need to be included:
|
||||||
echo 'Scanning for files... ';
|
echo 'Scanning for files... ';
|
||||||
$raw_files = $FS->globr('.', '*.php');
|
$raw_files = $FS->globr('.', '*.php');
|
||||||
|
if (!$raw_files) throw new Exception('Did not find any PHP source files');
|
||||||
$files = array();
|
$files = array();
|
||||||
foreach ($raw_files as $file) {
|
foreach ($raw_files as $file) {
|
||||||
$file = substr($file, 2); // rm leading './'
|
$file = substr($file, 2); // rm leading './'
|
||||||
|
@ -16,6 +16,7 @@ $target = '../library/HTMLPurifier/ConfigSchema/schema.ser';
|
|||||||
$FS = new FSTools();
|
$FS = new FSTools();
|
||||||
|
|
||||||
$files = $FS->globr('../library/HTMLPurifier/ConfigSchema/schema', '*.txt');
|
$files = $FS->globr('../library/HTMLPurifier/ConfigSchema/schema', '*.txt');
|
||||||
|
if (!$files) throw new Exception('Did not find any schema files');
|
||||||
|
|
||||||
$parser = new HTMLPurifier_StringHashParser();
|
$parser = new HTMLPurifier_StringHashParser();
|
||||||
$builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
|
$builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
|
||||||
|
Loading…
Reference in New Issue
Block a user