mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-01-03 05:11:52 +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:
parent
cb793cd9b9
commit
e4ce3362a5
23
maintenance/flush.php
Normal file
23
maintenance/flush.php
Normal 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');
|
@ -25,6 +25,7 @@ $exclude_files = array(
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Determine what files need to be included:
|
// Determine what files need to be included:
|
||||||
|
echo 'Scanning for files... ';
|
||||||
$raw_files = $FS->globr('.', '*.php');
|
$raw_files = $FS->globr('.', '*.php');
|
||||||
$files = array();
|
$files = array();
|
||||||
foreach ($raw_files as $file) {
|
foreach ($raw_files as $file) {
|
||||||
@ -42,6 +43,7 @@ foreach ($raw_files as $file) {
|
|||||||
if (in_array($file, $exclude_files)) continue; // rm excluded files
|
if (in_array($file, $exclude_files)) continue; // rm excluded files
|
||||||
$files[] = $file;
|
$files[] = $file;
|
||||||
}
|
}
|
||||||
|
echo "done!\n";
|
||||||
|
|
||||||
// Reorder list so that dependencies are included first:
|
// Reorder list so that dependencies are included first:
|
||||||
|
|
||||||
@ -145,4 +147,6 @@ foreach ($files as $file) {
|
|||||||
$php .= "require '$file';" . PHP_EOL;
|
$php .= "require '$file';" . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "Writing file... ";
|
||||||
file_put_contents('HTMLPurifier.includes.php', $php);
|
file_put_contents('HTMLPurifier.includes.php', $php);
|
||||||
|
echo "done!\n";
|
||||||
|
@ -15,11 +15,6 @@ assertCli();
|
|||||||
$target = '../library/HTMLPurifier/ConfigSchema/schema.ser';
|
$target = '../library/HTMLPurifier/ConfigSchema/schema.ser';
|
||||||
$FS = new FSTools();
|
$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');
|
$files = $FS->globr('../library/HTMLPurifier/ConfigSchema', '*.txt');
|
||||||
|
|
||||||
$namespaces = array();
|
$namespaces = array();
|
||||||
@ -42,4 +37,6 @@ $schema = new HTMLPurifier_ConfigSchema();
|
|||||||
foreach ($namespaces as $hash) $adapter->adapt($hash, $schema);
|
foreach ($namespaces as $hash) $adapter->adapt($hash, $schema);
|
||||||
foreach ($directives as $hash) $adapter->adapt($hash, $schema);
|
foreach ($directives as $hash) $adapter->adapt($hash, $schema);
|
||||||
|
|
||||||
|
echo "Saving schema... ";
|
||||||
file_put_contents($target, serialize($schema));
|
file_put_contents($target, serialize($schema));
|
||||||
|
echo "done!\n";
|
||||||
|
@ -108,7 +108,10 @@ function replace_includes_callback($matches) {
|
|||||||
return replace_includes(remove_php_tags(file_get_contents($file)));
|
return replace_includes(remove_php_tags(file_get_contents($file)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo 'Generating includes file... ';
|
||||||
shell_exec('php generate-includes.php');
|
shell_exec('php generate-includes.php');
|
||||||
|
echo "done!\n";
|
||||||
|
|
||||||
chdir(dirname(__FILE__) . '/../library/');
|
chdir(dirname(__FILE__) . '/../library/');
|
||||||
|
|
||||||
echo 'Creating full file...';
|
echo 'Creating full file...';
|
||||||
|
@ -5,6 +5,9 @@ chdir(dirname(__FILE__));
|
|||||||
require_once 'common.php';
|
require_once 'common.php';
|
||||||
assertCli();
|
assertCli();
|
||||||
|
|
||||||
|
echo "Please do not run this script. It is here for historical purposes only.";
|
||||||
|
exit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Extracts all definitions inside a configuration schema
|
* Extracts all definitions inside a configuration schema
|
@ -5,8 +5,8 @@ chdir(dirname(__FILE__));
|
|||||||
require_once 'common.php';
|
require_once 'common.php';
|
||||||
assertCli();
|
assertCli();
|
||||||
|
|
||||||
//echo "Please do not run this script. It is here for historical purposes only.";
|
echo "Please do not run this script. It is here for historical purposes only.";
|
||||||
//exit;
|
exit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
@ -71,9 +71,7 @@ require 'HTMLPurifier/Harness.php';
|
|||||||
// Shell-script code is executed
|
// Shell-script code is executed
|
||||||
|
|
||||||
if ($AC['flush']) {
|
if ($AC['flush']) {
|
||||||
shell_exec($AC['php'] . ' ../maintenance/generate-schema-cache.php');
|
shell_exec($AC['php'] . ' ../maintenance/flush.php');
|
||||||
shell_exec($AC['php'] . ' ../maintenance/flush-definition-cache.php');
|
|
||||||
shell_exec($AC['php'] . ' ../maintenance/generate-standalone.php');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now, userland code begins to be executed
|
// Now, userland code begins to be executed
|
||||||
|
@ -46,12 +46,8 @@ $aliases = array(
|
|||||||
);
|
);
|
||||||
htmlpurifier_parse_args($AC, $aliases);
|
htmlpurifier_parse_args($AC, $aliases);
|
||||||
|
|
||||||
// Calls generate-includes.php automatically
|
// Regenerate any necessary files
|
||||||
shell_exec($AC['php'] . ' ../maintenance/generate-standalone.php');
|
shell_exec($AC['php'] . ' ../maintenance/flush.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');
|
|
||||||
|
|
||||||
$test = new TestSuite('HTML Purifier Multiple Versions Test');
|
$test = new TestSuite('HTML Purifier Multiple Versions Test');
|
||||||
$file = '';
|
$file = '';
|
||||||
|
Loading…
Reference in New Issue
Block a user