2008-02-10 20:34:39 +00:00
|
|
|
#!/usr/bin/php
|
|
|
|
<?php
|
|
|
|
|
|
|
|
chdir(dirname(__FILE__));
|
|
|
|
require_once 'common.php';
|
|
|
|
require_once '../library/HTMLPurifier.auto.php';
|
|
|
|
assertCli();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
* Generates a schema cache file from the contents of
|
|
|
|
* library/HTMLPurifier/ConfigSchema/schema.ser
|
|
|
|
*/
|
|
|
|
|
|
|
|
$target = '../library/HTMLPurifier/ConfigSchema/schema.ser';
|
|
|
|
$FS = new FSTools();
|
|
|
|
|
2008-02-24 05:59:57 +00:00
|
|
|
$files = $FS->globr('../library/HTMLPurifier/ConfigSchema/schema', '*.txt');
|
2008-02-10 20:34:39 +00:00
|
|
|
|
2008-03-22 19:30:37 +00:00
|
|
|
$parser = new HTMLPurifier_StringHashParser();
|
2008-03-22 03:55:59 +00:00
|
|
|
$builder = new HTMLPurifier_ConfigSchema_InterchangeBuilder();
|
|
|
|
$interchange = new HTMLPurifier_ConfigSchema_Interchange();
|
2008-02-10 20:34:39 +00:00
|
|
|
foreach ($files as $file) {
|
2008-03-22 19:30:37 +00:00
|
|
|
$builder->build($interchange, new HTMLPurifier_StringHash($parser->parseFile($file)));
|
2008-02-10 20:34:39 +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";
|