aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/ezyang/htmlpurifier/update-for-release
diff options
context:
space:
mode:
authorMario Vavti <mario@mariovavti.com>2019-09-23 09:12:05 +0000
committerMario <mario@mariovavti.com>2019-09-23 12:21:04 +0200
commitaafecd9d1e2b5ff442f0a34eecf074db902086ae (patch)
treed531b9fe1d1f636d9a661704d61b396beecd5324 /vendor/ezyang/htmlpurifier/update-for-release
parent9b90114d035ce4c10ee11cd2fbffe1f5ab95af17 (diff)
downloadvolse-hubzilla-aafecd9d1e2b5ff442f0a34eecf074db902086ae.tar.gz
volse-hubzilla-aafecd9d1e2b5ff442f0a34eecf074db902086ae.tar.bz2
volse-hubzilla-aafecd9d1e2b5ff442f0a34eecf074db902086ae.zip
composer update ezyang/htmlpurifier
(cherry picked from commit 38cb094ede8a389ef0b8bb331c1e6a3befd666a8)
Diffstat (limited to 'vendor/ezyang/htmlpurifier/update-for-release')
-rw-r--r--vendor/ezyang/htmlpurifier/update-for-release110
1 files changed, 110 insertions, 0 deletions
diff --git a/vendor/ezyang/htmlpurifier/update-for-release b/vendor/ezyang/htmlpurifier/update-for-release
new file mode 100644
index 000000000..32709d25e
--- /dev/null
+++ b/vendor/ezyang/htmlpurifier/update-for-release
@@ -0,0 +1,110 @@
+<?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])) {
+ echo
+'php release.php [version]
+ HTML Purifier release script
+';
+ exit;
+}
+
+$version = trim($argv[1]);
+
+// Bump version numbers:
+
+// ...in VERSION
+file_put_contents('VERSION', $version);
+
+// ...in NEWS
+if ($is_dev = (strpos($version, 'dev') === false)) {
+ $date = date('Y-m-d');
+ $news_c = str_replace(
+ $l = "$version, unknown release date",
+ "$version, released $date",
+ file_get_contents('NEWS'),
+ $c
+ );
+ if (!$c) {
+ echo 'Could not update NEWS, missing ' . $l . PHP_EOL;
+ exit;
+ } elseif ($c > 1) {
+ echo 'More than one release declaration in NEWS replaced' . PHP_EOL;
+ exit;
+ }
+ file_put_contents('NEWS', $news_c);
+}
+
+// ...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(
+ '/public \$version = \'.+?\';/',
+ "public \$version = '$version';",
+ $htmlpurifier_c,
+ 1, $c
+);
+if (!$c) {
+ echo 'Could not update HTMLPurifier.php, missing public $version.' . PHP_EOL;
+ exit;
+}
+$htmlpurifier_c = preg_replace(
+ '/const VERSION = \'.+?\';/',
+ "const VERSION = '$version';",
+ $htmlpurifier_c,
+ 1, $c
+);
+if (!$c) {
+ echo 'Could not update HTMLPurifier.php, missing const $version.' . PHP_EOL;
+ exit;
+}
+file_put_contents('library/HTMLPurifier.php', $htmlpurifier_c);
+
+$config_c = file_get_contents('library/HTMLPurifier/Config.php');
+$config_c = preg_replace(
+ '/public \$version = \'.+?\';/',
+ "public \$version = '$version';",
+ $config_c,
+ 1, $c
+);
+if (!$c) {
+ echo 'Could not update Config.php, missing public $version.' . PHP_EOL;
+ exit;
+}
+file_put_contents('library/HTMLPurifier/Config.php', $config_c);
+
+passthru('maintenance/flush.sh');
+
+if ($is_dev) echo "Review changes, write something in WHATSNEW and FOCUS, and then commit with log 'Release $version.'" . PHP_EOL;
+else echo "Numbers updated to dev, no other modifications necessary!";
+
+// vim: et sw=4 sts=4