Fix inability to totally override content model.
[htmlpurifier.git] / maintenance / old-remove-schema-def.php
blob5ae0319736286b7d3e478a654d21254203a15686
1 #!/usr/bin/php
2 <?php
4 chdir(dirname(__FILE__));
5 require_once 'common.php';
6 assertCli();
8 echo "Please do not run this script. It is here for historical purposes only.";
9 exit;
11 /**
12 * @file
13 * Removes ConfigSchema function calls from source files.
16 chdir(dirname(__FILE__) . '/../library/');
17 $FS = new FSTools();
19 $files = $FS->globr('.', '*.php');
20 foreach ($files as $file) {
21 if (substr_count(basename($file), '.') > 1) continue;
22 $old_code = file_get_contents($file);
23 $new_code = preg_replace("#^HTMLPurifier_ConfigSchema::.+?\);[\n\r]*#ms", '', $old_code);
24 if ($old_code !== $new_code) {
25 file_put_contents($file, $new_code);
27 if (preg_match('#^\s+HTMLPurifier_ConfigSchema::#m', $new_code)) {
28 echo "Indented ConfigSchema call in $file\n";
32 // vim: et sw=4 sts=4