2008-02-10 20:34:39 +00:00
|
|
|
#!/usr/bin/php
|
|
|
|
<?php
|
|
|
|
|
2009-05-30 02:10:47 +00:00
|
|
|
require_once dirname(__FILE__) . '/common.php';
|
|
|
|
require_once dirname(__FILE__) . '/../library/HTMLPurifier.auto.php';
|
2008-02-10 20:34:39 +00:00
|
|
|
assertCli();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
2008-04-22 01:58:06 +00:00
|
|
|
* Generates a schema cache file, saving it to
|
2008-04-03 22:39:50 +00:00
|
|
|
* library/HTMLPurifier/ConfigSchema/schema.ser.
|
2008-12-06 07:28:20 +00:00
|
|
|
*
|
2008-04-03 22:39:50 +00:00
|
|
|
* This should be run when new configuration options are added to
|
2009-05-30 02:10:47 +00:00
|
|
|
* HTML Purifier. A cached version is available via the repository
|
|
|
|
* so this does not normally have to be regenerated.
|
|
|
|
*
|
|
|
|
* If you have a directory containing custom configuration schema files,
|
|
|
|
* you can simple add a path to that directory as a parameter to
|
|
|
|
* this, and they will get included.
|
2008-02-10 20:34:39 +00:00
|
|
|
*/
|
|
|
|
|
2009-05-30 02:10:47 +00:00
|
|
|
$target = dirname(__FILE__) . '/../library/HTMLPurifier/ConfigSchema/schema.ser';
|
|
|
|
|
|
|
|
$builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
|
|
|
|
$interchange = new HTMLPurifier_ConfigSchema_Interchange();
|
|
|
|
|
|
|
|
$builder->buildDir($interchange);
|
|
|
|
|
|
|
|
$loader = dirname(__FILE__) . '/../config-schema.php';
|
|
|
|
if (file_exists($loader)) include $loader;
|
|
|
|
foreach ($_SERVER['argv'] as $i => $dir) {
|
|
|
|
if ($i === 0) continue;
|
|
|
|
$builder->buildDir($interchange, realpath($dir));
|
|
|
|
}
|
2008-02-10 20:34:39 +00:00
|
|
|
|
2008-04-22 01:58:06 +00:00
|
|
|
$interchange->validate();
|
2008-03-22 20:26:04 +00:00
|
|
|
|
2008-03-22 03:55:59 +00:00
|
|
|
$schema_builder = new HTMLPurifier_ConfigSchema_Builder_ConfigSchema();
|
|
|
|
$schema = $schema_builder->build($interchange);
|
2008-02-10 20:34:39 +00:00
|
|
|
|
2008-02-24 05:06:39 +00:00
|
|
|
echo "Saving schema... ";
|
2008-02-10 20:34:39 +00:00
|
|
|
file_put_contents($target, serialize($schema));
|
2008-02-24 05:06:39 +00:00
|
|
|
echo "done!\n";
|
2008-12-06 09:24:59 +00:00
|
|
|
|
|
|
|
// vim: et sw=4 sts=4
|