⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 package.php

📁 FP2 CRM code+Mysql DB
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?php//// +----------------------------------------------------------------------+// | PHP Version 5                                                        |// +----------------------------------------------------------------------+// | Copyright (c) 1997-2004 The PHP Group                                |// +----------------------------------------------------------------------+// | This source file is subject to version 3.0 of the PHP license,       |// | that is bundled with this package in the file LICENSE, and is        |// | available through the world-wide-web at the following url:           |// | http://www.php.net/license/3_0.txt.                                  |// | If you did not receive a copy of the PHP license and are unable to   |// | obtain it through the world-wide-web, please send a note to          |// | license@php.net so we can mail you a copy immediately.               |// +----------------------------------------------------------------------+// | Authors: Stig Bakken <ssb@php.net>                                   |// |          Martin Jansen <mj@php.net>                                  |// +----------------------------------------------------------------------+//// $Id: Package.php,v 1.60 2004/01/31 22:39:25 cellog Exp $require_once 'PEAR/Common.php';require_once 'PEAR/Command/Common.php';class PEAR_Command_Package extends PEAR_Command_Common{    // {{{ properties    var $commands = array(        'package' => array(            'summary' => 'Build Package',            'function' => 'doPackage',            'shortcut' => 'p',            'options' => array(                'nocompress' => array(                    'shortopt' => 'Z',                    'doc' => 'Do not gzip the package file'                    ),                'showname' => array(                    'shortopt' => 'n',                    'doc' => 'Print the name of the packaged file.',                    ),                ),            'doc' => '[descfile]Creates a PEAR package from its description file (usually calledpackage.xml).'            ),        'package-validate' => array(            'summary' => 'Validate Package Consistency',            'function' => 'doPackageValidate',            'shortcut' => 'pv',            'options' => array(),            'doc' => '',            ),        'cvsdiff' => array(            'summary' => 'Run a "cvs diff" for all files in a package',            'function' => 'doCvsDiff',            'shortcut' => 'cd',            'options' => array(                'quiet' => array(                    'shortopt' => 'q',                    'doc' => 'Be quiet',                    ),                'reallyquiet' => array(                    'shortopt' => 'Q',                    'doc' => 'Be really quiet',                    ),                'date' => array(                    'shortopt' => 'D',                    'doc' => 'Diff against revision of DATE',                    'arg' => 'DATE',                    ),                'release' => array(                    'shortopt' => 'R',                    'doc' => 'Diff against tag for package release REL',                    'arg' => 'REL',                    ),                'revision' => array(                    'shortopt' => 'r',                    'doc' => 'Diff against revision REV',                    'arg' => 'REV',                    ),                'context' => array(                    'shortopt' => 'c',                    'doc' => 'Generate context diff',                    ),                'unified' => array(                    'shortopt' => 'u',                    'doc' => 'Generate unified diff',                    ),                'ignore-case' => array(                    'shortopt' => 'i',                    'doc' => 'Ignore case, consider upper- and lower-case letters equivalent',                    ),                'ignore-whitespace' => array(                    'shortopt' => 'b',                    'doc' => 'Ignore changes in amount of white space',                    ),                'ignore-blank-lines' => array(                    'shortopt' => 'B',                    'doc' => 'Ignore changes that insert or delete blank lines',                    ),                'brief' => array(                    'doc' => 'Report only whether the files differ, no details',                    ),                'dry-run' => array(                    'shortopt' => 'n',                    'doc' => 'Don\'t do anything, just pretend',                    ),                ),            'doc' => '<package.xml>Compares all the files in a package.  Without any options, thiscommand will compare the current code with the last checked-in code.Using the -r or -R option you may compare the current code with thatof a specific release.',            ),        'cvstag' => array(            'summary' => 'Set CVS Release Tag',            'function' => 'doCvsTag',            'shortcut' => 'ct',            'options' => array(                'quiet' => array(                    'shortopt' => 'q',                    'doc' => 'Be quiet',                    ),                'reallyquiet' => array(                    'shortopt' => 'Q',                    'doc' => 'Be really quiet',                    ),                'slide' => array(                    'shortopt' => 'F',                    'doc' => 'Move (slide) tag if it exists',                    ),                'delete' => array(                    'shortopt' => 'd',                    'doc' => 'Remove tag',                    ),                'dry-run' => array(                    'shortopt' => 'n',                    'doc' => 'Don\'t do anything, just pretend',                    ),                ),            'doc' => '<package.xml>Sets a CVS tag on all files in a package.  Use this command after you havepackaged a distribution tarball with the "package" command to tag whatrevisions of what files were in that release.  If need to fix somethingafter running cvstag once, but before the tarball is released to the public,use the "slide" option to move the release tag.',            ),        'run-tests' => array(            'summary' => 'Run Regression Tests',            'function' => 'doRunTests',            'shortcut' => 'rt',            'options' => array(),            'doc' => '[testfile|dir ...]Run regression tests with PHP\'s regression testing script (run-tests.php).',            ),        'package-dependencies' => array(            'summary' => 'Show package dependencies',            'function' => 'doPackageDependencies',            'shortcut' => 'pd',            'options' => array(),            'doc' => 'List all depencies the package has.'            ),        'sign' => array(            'summary' => 'Sign a package distribution file',            'function' => 'doSign',            'shortcut' => 'si',            'options' => array(),            'doc' => '<package-file>Signs a package distribution (.tar or .tgz) file with GnuPG.',            ),        'makerpm' => array(            'summary' => 'Builds an RPM spec file from a PEAR package',            'function' => 'doMakeRPM',            'shortcut' => 'rpm',            'options' => array(                'spec-template' => array(                    'shortopt' => 't',                    'arg' => 'FILE',                    'doc' => 'Use FILE as RPM spec file template'                    ),                'rpm-pkgname' => array(                    'shortopt' => 'p',                    'arg' => 'FORMAT',                    'doc' => 'Use FORMAT as format string for RPM package name, %s is replacedby the PEAR package name, defaults to "PEAR::%s".',                    ),                ),            'doc' => '<package-file>Creates an RPM .spec file for wrapping a PEAR package inside an RPMpackage.  Intended to be used from the SPECS directory, with the PEARpackage tarball in the SOURCES directory:$ pear makerpm ../SOURCES/Net_Socket-1.0.tgzWrote RPM spec file PEAR::Net_Geo-1.0.spec$ rpm -bb PEAR::Net_Socket-1.0.spec...Wrote: /usr/src/redhat/RPMS/i386/PEAR::Net_Socket-1.0-1.i386.rpm',            ),        );    var $output;    // }}}    // {{{ constructor    /**     * PEAR_Command_Package constructor.     *     * @access public     */    function PEAR_Command_Package(&$ui, &$config)    {        parent::PEAR_Command_Common($ui, $config);    }    // }}}    // {{{ _displayValidationResults()    function _displayValidationResults($err, $warn, $strict = false)    {        foreach ($err as $e) {            $this->output .= "Error: $e\n";        }        foreach ($warn as $w) {            $this->output .= "Warning: $w\n";        }        $this->output .= sprintf('Validation: %d error(s), %d warning(s)'."\n",                                       sizeof($err), sizeof($warn));        if ($strict && sizeof($err) > 0) {            $this->output .= "Fix these errors and try again.";            return false;        }        return true;    }    // }}}    // {{{ doPackage()    function doPackage($command, $options, $params)    {        $this->output = '';        include_once 'PEAR/Packager.php';        $pkginfofile = isset($params[0]) ? $params[0] : 'package.xml';        $packager =& new PEAR_Packager();        $err = $warn = array();        $dir = dirname($pkginfofile);        $compress = empty($options['nocompress']) ? true : false;        $result = $packager->package($pkginfofile, $compress);        if (PEAR::isError($result)) {            $this->ui->outputData($this->output, $command);            return $this->raiseError($result);        }        // Don't want output, only the package file name just created        if (isset($options['showname'])) {            $this->output = $result;        }        /* (cox) What is supposed to do that code?        $lines = explode("\n", $this->output);        foreach ($lines as $line) {            $this->output .= $line."n";        }        */        if (PEAR::isError($result)) {            $this->output .= "Package failed: ".$result->getMessage();        }        $this->ui->outputData($this->output, $command);        return true;    }    // }}}    // {{{ doPackageValidate()    function doPackageValidate($command, $options, $params)    {        $this->output = '';        if (sizeof($params) < 1) {            $params[0] = "package.xml";        }        $obj = new PEAR_Common;        $info = null;        if ($fp = @fopen($params[0], "r")) {            $test = fread($fp, 5);            fclose($fp);            if ($test == "<?xml") {                $info = $obj->infoFromDescriptionFile($params[0]);            }        }        if (empty($info)) {            $info = $obj->infoFromTgzFile($params[0]);        }        if (PEAR::isError($info)) {            return $this->raiseError($info);        }        $obj->validatePackageInfo($info, $err, $warn);        $this->_displayValidationResults($err, $warn);        $this->ui->outputData($this->output, $command);        return true;    }    // }}}    // {{{ doCvsTag()    function doCvsTag($command, $options, $params)    {        $this->output = '';        $_cmd = $command;        if (sizeof($params) < 1) {            $help = $this->getHelp($command);            return $this->raiseError("$command: missing parameter: $help[0]");        }        $obj = new PEAR_Common;        $info = $obj->infoFromDescriptionFile($params[0]);        if (PEAR::isError($info)) {            return $this->raiseError($info);        }        $err = $warn = array();        $obj->validatePackageInfo($info, $err, $warn);        if (!$this->_displayValidationResults($err, $warn, true)) {            $this->ui->outputData($this->output, $command);            break;        }        $version = $info['version'];        $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $version);        $cvstag = "RELEASE_$cvsversion";        $files = array_keys($info['filelist']);        $command = "cvs";        if (isset($options['quiet'])) {            $command .= ' -q';        }        if (isset($options['reallyquiet'])) {            $command .= ' -Q';        }        $command .= ' tag';        if (isset($options['slide'])) {            $command .= ' -F';        }        if (isset($options['delete'])) {            $command .= ' -d';        }        $command .= ' ' . $cvstag . ' ' . escapeshellarg($params[0]);        foreach ($files as $file) {            $command .= ' ' . escapeshellarg($file);        }        if ($this->config->get('verbose') > 1) {            $this->output .= "+ $command\n";        }        $this->output .= "+ $command\n";        if (empty($options['dry-run'])) {            $fp = popen($command, "r");            while ($line = fgets($fp, 1024)) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -