Back to index

php5  5.3.10
package.php
Go to the documentation of this file.
00001 <?php
00002 
00003 $notes = '
00004 BC BREAKING RELEASE
00005  BC breaks:
00006  * Phar object Compression API is rewritten.  Use Phar::compress() and decompress(),
00007    Phar::compressFiles()/decompressFiles() and PharFileInfo->compress()/decompress().
00008  * phar.extract_list and Phar::getExtractList() are removed
00009 
00010 Major feature functionality release
00011  * phar.cache_list allows web-based phar applications to run at equal or faster than
00012    their on-disk equivalent [Greg]
00013  * new default stub allows running of phar-based phars without phar extension [Greg/Steph]
00014  * add support for tar-based and zip-based phar archives [Greg]
00015  * add support for OpenSSL-based true signatures [Greg]
00016  * add support for signatures to tar-based phar archives [Greg]
00017  * add Phar::isFileFormat() [Greg]
00018  * add Phar::convertToExecutable(), Phar::convertToData() [Greg]
00019  * add Phar::compress() [Greg]
00020  * rename Phar::compressAllFiles() to compressFiles(), uncompressAllFiles() to
00021    decompressFiles() [Greg]
00022  * conversion to compressed or to other file formats automatically copies the archive
00023    to a new extension (i.e. ".phar" to ".phar.tar" or ".tar" to ".tar.gz") [Steph]
00024  * add Phar::webPhar() for running a web-based application unmodified
00025    directly from a phar archive [Greg]
00026  * file functions (fopen-based and stat-based) can be instructed to only look for
00027    relative paths within a phar via Phar::interceptFileFuncs()
00028  * add PharData class to allow manipulation/creation of non-executable tar and zip archives. [Steph]
00029    non-executable tar/zip manipulation is allowed even when phar.readonly=1 [Greg]
00030  * paths with . and .. work (phar://blah.phar/a/../b.php => phar://blah.phar/b.php) [Greg]
00031  * add support for mkdir()/rmdir() and support for empty directories to phar file format [Greg]
00032  * add option to compress the entire phar file for phar/tar file format [Greg]
00033  * implement Phar::isCompressed() returning 0, Phar::GZ or Phar::BZ2 [Greg]
00034  * implement Phar::copy(string $from, string $to) [Greg]
00035  * implement Phar::running(), returns path or URL to currently executed phar
00036  * implement Phar::buildFromIterator(Iterator $it[, string $base_directory]) [Greg]
00037  * implement Phar::buildFromDirectory(string $base_directory[, string $regex]) [Steph]
00038  * implement Phar::mount() for mounting external paths or files to locations inside a phar [Greg]
00039  * add Phar::delete() [Greg]
00040  * implement Phar::unlinkArchive() [Greg]
00041 
00042 Security addition
00043  * aliases are validated so that they contain no directory separators as intended
00044  * on conversion to other formats, user-supplied aliases are validated
00045 
00046 Changes since 2.0.0RC2:
00047  fixed PHP Bug #49021: phar tar signature algorithm reports as Unknown (0) in
00048  getSignature() call
00049  fixed PHP Bug #49020: phar misinterprets ustar long filename standard
00050  fixed PHP Bug #49018: phar tar stores long filenames with prefix/name reversed
00051  fixed PHP Bug #48791: open office files always reported as corrupted
00052  fixed PHP Bug #48783: make install will fail saying phar file exists
00053  fixed PHP Bug #48740: PHAR install fails when INSTALL_ROOT is not the final install location
00054  fixed PHP Bug #48681: openssl signature verification for tar archives broken
00055  fixed PHP Bug #48377: error message unclear on converting phar with existing file
00056  fixed isset() on sub-directories (isset("blah") if file "blah/foo.php" exists)
00057 
00058  make phar work in PHP 6
00059 Changes since 2.0.0RC1:
00060  security vulnerability in handling of long tar filenames fixed
00061  fixed PECL Bug #14646: phar error message unclear with php stream wrappers
00062  fixed PECL Bug #16338: php_stream_copy_to_stream{,_ex}()
00063  fixed PHP Bug #48257: PharData throws an exception with non-phar tar
00064  fixed PHP Bug #47085: rename() returns true even if the file in PHAR does not exist
00065  fixed PHP Bug #46032: PharData::__construct() - wrong memory read
00066  fixed PHP Bug #46060: Phar::addEmptyDir() breaks
00067  fixed PHP Bug #45907: undefined reference to \'PHP_SHA512Init\'
00068  fixed PHP Bug #45726: PHP_Archive / Archive.php missing
00069 Changes since 2.0.0a2: many bugfixes, removal of phar.extract_list, compression API refactored,
00070  conversion API refactored
00071 Changes since 2.0.0b1: addition of phar.cache_list, many performance improvements and bugfixes
00072  implement OpenSSL asynchronous true package signing
00073  add support for package signing to tar-based archives
00074  require PHP 5.2.1+
00075 ';
00076 
00077 if (!class_exists("Phar") && !extension_loaded("Phar")) {
00078        die("Extension phar not present");
00079 }
00080 error_reporting(E_ALL & ~E_DEPRECATED);
00081 
00082 require_once 'PEAR/PackageFileManager2.php';
00083 
00084 PEAR::setErrorHandling(PEAR_ERROR_DIE);
00085 
00086 $options = array(
00087        'filelistgenerator' => 'svn',
00088        'changelogoldtonew' => false,
00089        'simpleoutput'      => true,
00090        'baseinstalldir'    => '/',
00091        'packagedirectory'  => dirname(__FILE__),
00092        'packagefile'       => 'package.xml',
00093        'clearcontents'     => true,
00094        'ignore'            => array('package*.php', 'package*.xml'),
00095        'dir_roles'         => array(
00096                'docs'         => 'doc',
00097                'examples'     => 'doc',
00098                'tests'        => 'test',
00099                'phar'         => 'src',
00100        ),
00101        'exceptions'        => array(
00102                'CREDITS'            => 'doc',
00103                'EXPERIMENTAL'       => 'doc',
00104                'LICENSE'            => 'doc',
00105                'Makefile.frag'      => 'src',
00106                'phar_path_check.re' => 'src',
00107                'TODO'               => 'doc',
00108                'phar.phar'          => 'script',
00109        ),
00110 );
00111 
00112 $package = PEAR_PackageFileManager2::importOptions(dirname(__FILE__) . '/package.xml', $options);
00113 
00114 $package->clearDeps();
00115 $package->setPhpDep('5.2.1');
00116 $package->setPearInstallerDep('1.4.3');
00117 $package->addPackageDepWithChannel('optional', 'bz2', 'pecl.php.net', false, false, false, false, 'bz2');
00118 // all this false business sets the <providesextension> tag that allows us to have hash built
00119 // in statically
00120 $package->addPackageDepWithChannel('optional', 'hash', 'pecl.php.net', false, false, false, false, 'hash');
00121 $package->addExtensionDep('optional', 'spl');
00122 $package->addExtensionDep('optional', 'zlib');
00123 $package->setPackageType('extsrc');
00124 $package->addRelease();
00125 $package->setReleaseVersion(phpversion('phar'));
00126 $package->setAPIVersion(Phar::apiVersion());
00127 $package->setReleaseStability('stable');
00128 $package->setAPIStability('stable');
00129 $package->setNotes("\n$notes\n");
00130 //$package->addGlobalReplacement('package-info', '@package_version@', 'version');
00131 $package->generateContents();
00132 
00133 if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) {
00134        $package->writePackageFile();
00135 } else {
00136        $package->debugPackageFile();
00137 }
00138 
00139 ?>