"scripts": {
"post-install-cmd": [
"bash tools/scripts/composer/dompdf-cleanup.sh",
- "bash tools/scripts/composer/tcpdf-cleanup.sh"
+ "bash tools/scripts/composer/tcpdf-cleanup.sh",
+ "bash tools/scripts/composer/pear-execption-fix.sh"
],
"post-update-cmd": [
"bash tools/scripts/composer/dompdf-cleanup.sh",
- "bash tools/scripts/composer/tcpdf-cleanup.sh"
+ "bash tools/scripts/composer/tcpdf-cleanup.sh",
+ "bash tools/scripts/composer/pear-execption-fix.sh"
]
}
}
--- /dev/null
+#!/bin/bash
+
+## Cleanup the vendor tree. The main issue here is that civi Civi is
+## deployed as a module inside a CMS, so all its source-code gets published.
+## Some libraries distribute admin tools and sample files which should not
+## be published.
+##
+## This script should be idempotent -- if you rerun it several times, it
+## should always produce the same post-condition.
+
+## Replace a line in a file
+## This is a bit like 'sed -i', but dumber and more cross-platform.
+function simple_replace() {
+ php -r 'file_put_contents($argv[1], preg_replace($argv[2], $argv[3], file_get_contents($argv[1])));' "$@"
+}
+
+
+# add in class_exists test as per CRM-8921.
+simple_replace vendor/pear/pear_exception/PEAR/Exception.php '^\<\?php^' '<?php
+ // CRM-8921
+ if ( class_exists( "'"PEAR_Exception"'" ) ) {
+ return;
+ }' /home/seamus/test.php