4chdir(dirname(__FILE__));
 
    5require_once 
'common.php';
 
    6require_once 
'../library/HTMLPurifier.auto.php';
 
   18if (count(
$argv) < 3) {
 
   19    echo 
"Usage: {$argv[0]} OldName NewName\n";
 
   23chdir(
'../library/HTMLPurifier/ConfigSchema/schema');
 
   28if (!file_exists(
"$old.txt")) {
 
   29    echo 
"Cannot move undefined configuration directive $old\n";
 
   34    echo 
"Attempting to move to self, aborting\n";
 
   38if (file_exists(
"$new.txt")) {
 
   39    echo 
"Cannot move to already defined directive $new\n";
 
   51} elseif (strpos(
$contents, 
"\r") !== 
false) {
 
   61    $pos_alias = strpos(
$contents, 
'ALIASES:');
 
   62    $pos_ins = strpos(
$contents, $nl, $pos_alias);
 
   63    if ($pos_ins === 
false) $pos_ins = strlen(
$contents);
 
   70    foreach ($lines as 
$n => $line) {
 
   71        if (strncmp($line, 
'--', 2) === 0) {
 
   77        $lines[] = 
"ALIASES: $old";
 
   79        array_splice($lines, 
$insert, 0, 
"ALIASES: $old");
 
   81    file_put_contents(
$file, implode($nl, $lines));
 
   84rename(
"$old.txt", 
"$new.txt") || 
exit(1);
 
An exception for terminatinating execution or to throw for unit testing.
Generic schema interchange format that can be converted to a runtime representation (HTMLPurifier_Con...
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']