2007-04-02 03:58:59 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
// release script
|
|
|
|
// PHP 5.0 only
|
|
|
|
|
|
|
|
if (php_sapi_name() != 'cli') {
|
|
|
|
echo 'Release script cannot be called from web-browser.';
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!isset($argv[1])) {
|
2008-12-06 07:28:20 +00:00
|
|
|
echo
|
2007-04-02 03:58:59 +00:00
|
|
|
'php release.php [version]
|
|
|
|
HTML Purifier release script
|
|
|
|
';
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$version = trim($argv[1]);
|
|
|
|
|
|
|
|
// Bump version numbers:
|
|
|
|
|
|
|
|
// ...in VERSION
|
|
|
|
file_put_contents('VERSION', $version);
|
|
|
|
|
2022-09-18 06:44:00 +00:00
|
|
|
$is_dev = strpos($version, 'dev') === false;
|
2007-04-02 03:58:59 +00:00
|
|
|
|
|
|
|
// ...in Doxyfile
|
|
|
|
$doxyfile_c = preg_replace(
|
|
|
|
'/(?<=PROJECT_NUMBER {9}= )[^\s]+/m', // brittle
|
|
|
|
$version,
|
|
|
|
file_get_contents('Doxyfile'),
|
|
|
|
1, $c
|
|
|
|
);
|
|
|
|
if (!$c) {
|
|
|
|
echo 'Could not update Doxyfile, missing PROJECT_NUMBER.' . PHP_EOL;
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
file_put_contents('Doxyfile', $doxyfile_c);
|
|
|
|
|
|
|
|
// ...in HTMLPurifier.php
|
|
|
|
$htmlpurifier_c = file_get_contents('library/HTMLPurifier.php');
|
|
|
|
$htmlpurifier_c = preg_replace(
|
|
|
|
'/HTML Purifier .+? - /',
|
|
|
|
"HTML Purifier $version - ",
|
|
|
|
$htmlpurifier_c,
|
|
|
|
1, $c
|
|
|
|
);
|
|
|
|
if (!$c) {
|
|
|
|
echo 'Could not update HTMLPurifier.php, missing HTML Purifier [version] header.' . PHP_EOL;
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
$htmlpurifier_c = preg_replace(
|
2008-01-04 23:54:12 +00:00
|
|
|
'/public \$version = \'.+?\';/',
|
|
|
|
"public \$version = '$version';",
|
2007-04-02 03:58:59 +00:00
|
|
|
$htmlpurifier_c,
|
|
|
|
1, $c
|
|
|
|
);
|
|
|
|
if (!$c) {
|
2008-04-25 05:26:10 +00:00
|
|
|
echo 'Could not update HTMLPurifier.php, missing public $version.' . PHP_EOL;
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
$htmlpurifier_c = preg_replace(
|
2008-04-25 05:47:36 +00:00
|
|
|
'/const VERSION = \'.+?\';/',
|
|
|
|
"const VERSION = '$version';",
|
2008-04-25 05:26:10 +00:00
|
|
|
$htmlpurifier_c,
|
|
|
|
1, $c
|
|
|
|
);
|
|
|
|
if (!$c) {
|
|
|
|
echo 'Could not update HTMLPurifier.php, missing const $version.' . PHP_EOL;
|
2007-04-02 03:58:59 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
file_put_contents('library/HTMLPurifier.php', $htmlpurifier_c);
|
|
|
|
|
2007-05-27 13:25:54 +00:00
|
|
|
$config_c = file_get_contents('library/HTMLPurifier/Config.php');
|
|
|
|
$config_c = preg_replace(
|
2008-01-04 23:54:12 +00:00
|
|
|
'/public \$version = \'.+?\';/',
|
|
|
|
"public \$version = '$version';",
|
2007-05-27 13:25:54 +00:00
|
|
|
$config_c,
|
|
|
|
1, $c
|
|
|
|
);
|
|
|
|
if (!$c) {
|
2008-04-25 05:26:10 +00:00
|
|
|
echo 'Could not update Config.php, missing public $version.' . PHP_EOL;
|
2007-05-27 13:25:54 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
file_put_contents('library/HTMLPurifier/Config.php', $config_c);
|
|
|
|
|
2022-09-18 06:44:00 +00:00
|
|
|
$includes = file_get_contents('library/HTMLPurifier.includes.php');
|
|
|
|
$includes = preg_replace(
|
|
|
|
'/@version .+?/',
|
|
|
|
"@version $version",
|
|
|
|
$includes,
|
|
|
|
1, $c
|
|
|
|
);
|
|
|
|
if (!$c) {
|
|
|
|
echo 'Could not update HTMLPurifier.includes.php, missing @version docblock.' . PHP_EOL;
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
file_put_contents('HTMLPurifier.includes.php', $includes);
|
|
|
|
|
2019-07-14 18:58:38 +00:00
|
|
|
passthru('maintenance/flush.sh');
|
2008-04-22 16:20:45 +00:00
|
|
|
|
2022-09-18 06:44:00 +00:00
|
|
|
if ($is_dev) echo "Review changes, and then commit with log 'Release $version.'" . PHP_EOL;
|
2008-04-25 05:26:10 +00:00
|
|
|
else echo "Numbers updated to dev, no other modifications necessary!";
|
2008-12-06 09:24:59 +00:00
|
|
|
|
|
|
|
// vim: et sw=4 sts=4
|