mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-22 08:21: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
|
||||
$dir = $this->dir($source);
|
||||
while (false !== $entry = $dir->read()) {
|
||||
while ( false !== ($entry = $dir->read()) ) {
|
||||
// Skip pointers
|
||||
if ($entry == '.' || $entry == '..') {
|
||||
continue;
|
||||
|
@ -38,7 +38,8 @@ class HTMLPurifier_ConfigSchema_Interchange_Directive
|
||||
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();
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
function assertCli() {
|
||||
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).';
|
||||
exit;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,7 @@ if (isset($argv[1])) {
|
||||
if (in_array($argv[1], $names)) {
|
||||
$names = array($argv[1]);
|
||||
} else {
|
||||
echo "Did not recognized cache parameter {$argv[1]} as valid cache, aborting.\n";
|
||||
exit;
|
||||
throw new Exception("Cache parameter {$argv[1]} is not a valid cache");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,8 +13,9 @@ assertCli();
|
||||
|
||||
function e($cmd) {
|
||||
echo "\$ $cmd\n";
|
||||
passthru($cmd);
|
||||
passthru($cmd, $status);
|
||||
echo "\n";
|
||||
if ($status) exit($status);
|
||||
}
|
||||
|
||||
e('php generate-includes.php');
|
||||
|
@ -27,6 +27,7 @@ $exclude_files = array(
|
||||
// Determine what files need to be included:
|
||||
echo 'Scanning for files... ';
|
||||
$raw_files = $FS->globr('.', '*.php');
|
||||
if (!$raw_files) throw new Exception('Did not find any PHP source files');
|
||||
$files = array();
|
||||
foreach ($raw_files as $file) {
|
||||
$file = substr($file, 2); // rm leading './'
|
||||
|
@ -16,6 +16,7 @@ $target = '../library/HTMLPurifier/ConfigSchema/schema.ser';
|
||||
$FS = new FSTools();
|
||||
|
||||
$files = $FS->globr('../library/HTMLPurifier/ConfigSchema/schema', '*.txt');
|
||||
if (!$files) throw new Exception('Did not find any schema files');
|
||||
|
||||
$parser = new HTMLPurifier_StringHashParser();
|
||||
$builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
|
||||
|
Loading…
Reference in New Issue
Block a user