summaryrefslogtreecommitdiff
path: root/ext/phar/build_precommand.php
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-03-14 05:42:27 +0000
committer <>2013-04-03 16:25:08 +0000
commitc4dd7a1a684490673e25aaf4fabec5df138854c4 (patch)
tree4d57c44caae4480efff02b90b9be86f44bf25409 /ext/phar/build_precommand.php
downloadphp2-master.tar.gz
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/phar/build_precommand.php')
-rwxr-xr-xext/phar/build_precommand.php55
1 files changed, 55 insertions, 0 deletions
diff --git a/ext/phar/build_precommand.php b/ext/phar/build_precommand.php
new file mode 100755
index 0000000..c2fe9c8
--- /dev/null
+++ b/ext/phar/build_precommand.php
@@ -0,0 +1,55 @@
+#!/usr/bin/php
+<?php echo '<'.'?php';?>
+
+/** @file phar.php
+ * @ingroup Phar
+ * @brief class Phar Pre Command
+ * @author Marcus Boerger
+ * @date 2007 - 2008
+ *
+ * Phar Command
+ */
+foreach(array("SPL", "Reflection", "Phar") as $ext) {
+ if (!extension_loaded($ext)) {
+ echo "$argv[0] requires PHP extension $ext.\n";
+ exit(1);
+ }
+}
+
+<?php
+
+$classes = array(
+ 'DirectoryTreeIterator',
+ 'DirectoryGraphIterator',
+ 'InvertedRegexIterator',
+ 'CLICommand',
+ 'PharCommand',
+ );
+
+foreach($classes as $name) {
+ echo "if (!class_exists('$name', 0))\n{\n";
+ $f = file(dirname(__FILE__) . '/phar/' . strtolower($name) . '.inc');
+ unset($f[0]);
+ $c = count($f);
+ while ($c && (strlen($f[$c]) == 0 || $f[$c] == "\n" || $f[$c] == "\r\n")) {
+ unset($f[$c--]);
+ }
+ if (substr($f[$c], -2) == "\r\n") {
+ $f[$c] = substr($f[$c], 0, -2);
+ }
+ if (substr($f[$c], -1) == "\n") {
+ $f[$c] = substr($f[$c], 0, -1);
+ }
+ if (substr($f[$c], -2) == '?>') {
+ $f[$c] = substr($f[$c], 0,-2);
+ }
+ while ($c && (strlen($f[$c]) == 0 || $f[$c] == "\n" || $f[$c] == "\r\n")) {
+ unset($f[$c--]);
+ }
+ echo join('', $f);
+ echo "\n}\n\n";
+}
+
+echo 'new PharCommand($argc, $argv);'."\n";
+
+?>