0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-11-09 15:28:40 +00:00

Some maintenance script cleanup

- Create super-script flush.php
- Rename old scripts with old- prefix.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1574 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2008-02-24 05:06:39 +00:00
parent cb793cd9b9
commit e4ce3362a5
9 changed files with 40 additions and 16 deletions

23
maintenance/flush.php Normal file
View File

@ -0,0 +1,23 @@
#!/usr/bin/php
<?php
chdir(dirname(__FILE__));
require_once 'common.php';
assertCli();
/**
* @file
* Runs all generation/flush cache scripts to ensure that somewhat volatile
* generated files are up-to-date.
*/
function e($cmd) {
echo "\$ $cmd\n";
passthru($cmd);
echo "\n";
}
e('php flush-definition-cache.php');
e('php generate-includes.php');
e('php generate-schema-cache.php');
e('php generate-standalone.php');

View File

@ -25,6 +25,7 @@ $exclude_files = array(
);
// Determine what files need to be included:
echo 'Scanning for files... ';
$raw_files = $FS->globr('.', '*.php');
$files = array();
foreach ($raw_files as $file) {
@ -42,6 +43,7 @@ foreach ($raw_files as $file) {
if (in_array($file, $exclude_files)) continue; // rm excluded files
$files[] = $file;
}
echo "done!\n";
// Reorder list so that dependencies are included first:
@ -145,4 +147,6 @@ foreach ($files as $file) {
$php .= "require '$file';" . PHP_EOL;
}
echo "Writing file... ";
file_put_contents('HTMLPurifier.includes.php', $php);
echo "done!\n";

View File

@ -15,11 +15,6 @@ assertCli();
$target = '../library/HTMLPurifier/ConfigSchema/schema.ser';
$FS = new FSTools();
if (file_exists($target)) {
echo "Delete HTMLPurifier/ConfigSchema/schema.ser before running this script.";
exit;
}
$files = $FS->globr('../library/HTMLPurifier/ConfigSchema', '*.txt');
$namespaces = array();
@ -42,4 +37,6 @@ $schema = new HTMLPurifier_ConfigSchema();
foreach ($namespaces as $hash) $adapter->adapt($hash, $schema);
foreach ($directives as $hash) $adapter->adapt($hash, $schema);
echo "Saving schema... ";
file_put_contents($target, serialize($schema));
echo "done!\n";

View File

@ -108,7 +108,10 @@ function replace_includes_callback($matches) {
return replace_includes(remove_php_tags(file_get_contents($file)));
}
echo 'Generating includes file... ';
shell_exec('php generate-includes.php');
echo "done!\n";
chdir(dirname(__FILE__) . '/../library/');
echo 'Creating full file...';

View File

@ -5,6 +5,9 @@ chdir(dirname(__FILE__));
require_once 'common.php';
assertCli();
echo "Please do not run this script. It is here for historical purposes only.";
exit;
/**
* @file
* Extracts all definitions inside a configuration schema

View File

@ -5,8 +5,8 @@ chdir(dirname(__FILE__));
require_once 'common.php';
assertCli();
//echo "Please do not run this script. It is here for historical purposes only.";
//exit;
echo "Please do not run this script. It is here for historical purposes only.";
exit;
/**
* @file

View File

@ -71,9 +71,7 @@ require 'HTMLPurifier/Harness.php';
// Shell-script code is executed
if ($AC['flush']) {
shell_exec($AC['php'] . ' ../maintenance/generate-schema-cache.php');
shell_exec($AC['php'] . ' ../maintenance/flush-definition-cache.php');
shell_exec($AC['php'] . ' ../maintenance/generate-standalone.php');
shell_exec($AC['php'] . ' ../maintenance/flush.php');
}
// Now, userland code begins to be executed

View File

@ -46,12 +46,8 @@ $aliases = array(
);
htmlpurifier_parse_args($AC, $aliases);
// Calls generate-includes.php automatically
shell_exec($AC['php'] . ' ../maintenance/generate-standalone.php');
// Not strictly necessary, but its a good idea
shell_exec($AC['php'] . ' ../maintenance/generate-schema-cache.php');
shell_exec($AC['php'] . ' ../maintenance/flush-definition-cache.php');
// Regenerate any necessary files
shell_exec($AC['php'] . ' ../maintenance/flush.php');
$test = new TestSuite('HTML Purifier Multiple Versions Test');
$file = '';