4 require_once dirname(__FILE__
) . '/common.php';
5 require_once dirname(__FILE__
) . '/../library/HTMLPurifier.auto.php';
10 * Generates a schema cache file, saving it to
11 * library/HTMLPurifier/ConfigSchema/schema.ser.
13 * This should be run when new configuration options are added to
14 * HTML Purifier. A cached version is available via the repository
15 * so this does not normally have to be regenerated.
17 * If you have a directory containing custom configuration schema files,
18 * you can simple add a path to that directory as a parameter to
19 * this, and they will get included.
22 $target = dirname(__FILE__
) . '/../library/HTMLPurifier/ConfigSchema/schema.ser';
24 $builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
25 $interchange = new HTMLPurifier_ConfigSchema_Interchange();
27 $builder->buildDir($interchange);
29 $loader = dirname(__FILE__
) . '/../config-schema.php';
30 if (file_exists($loader)) include $loader;
31 foreach ($_SERVER['argv'] as $i => $dir) {
32 if ($i === 0) continue;
33 $builder->buildDir($interchange, realpath($dir));
36 $interchange->validate();
38 $schema_builder = new HTMLPurifier_ConfigSchema_Builder_ConfigSchema();
39 $schema = $schema_builder->build($interchange);
41 echo "Saving schema... ";
42 file_put_contents($target, serialize($schema));