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

📄 package.php

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 PHP
📖 第 1 页 / 共 3 页
字号:
            $this->output .= "Fix these errors and try again.";            return false;        }        return true;    }    // }}}    function &getPackager()    {        if (!class_exists('PEAR_Packager')) {            require_once 'PEAR/Packager.php';        }        $a = &new PEAR_Packager;        return $a;    }    function &getPackageFile($config, $debug = false, $tmpdir = null)    {        if (!class_exists('PEAR_Common')) {            require_once 'PEAR/Common.php';        }        if (!class_exists('PEAR/PackageFile.php')) {            require_once 'PEAR/PackageFile.php';        }        $a = &new PEAR_PackageFile($config, $debug, $tmpdir);        $common = new PEAR_Common;        $common->ui = $this->ui;        $a->setLogger($common);        return $a;    }    // {{{ doPackage()    function doPackage($command, $options, $params)    {        $this->output = '';        $pkginfofile = isset($params[0]) ? $params[0] : 'package.xml';        $pkg2 = isset($params[1]) ? $params[1] : null;        if (!$pkg2 && !isset($params[0])) {            if (file_exists('package2.xml')) {                $pkg2 = 'package2.xml';            }        }        $packager = &$this->getPackager();        $compress = empty($options['nocompress']) ? true : false;        $result = $packager->package($pkginfofile, $compress, $pkg2);        if (PEAR::isError($result)) {            return $this->raiseError($result);        }        // Don't want output, only the package file name just created        if (isset($options['showname'])) {            $this->output = $result;        }        if ($this->output) {            $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 = &$this->getPackageFile($this->config, $this->_debug);        $obj->rawReturn();        PEAR::staticPushErrorHandling(PEAR_ERROR_RETURN);        $info = $obj->fromTgzFile($params[0], PEAR_VALIDATE_NORMAL);        if (PEAR::isError($info)) {            $info = $obj->fromPackageFile($params[0], PEAR_VALIDATE_NORMAL);        } else {            $archive = $info->getArchiveFile();            $tar = &new Archive_Tar($archive);            $tar->extract(dirname($info->getPackageFile()));            $info->setPackageFile(dirname($info->getPackageFile()) . DIRECTORY_SEPARATOR .                $info->getPackage() . '-' . $info->getVersion() . DIRECTORY_SEPARATOR .                basename($info->getPackageFile()));        }        PEAR::staticPopErrorHandling();        if (PEAR::isError($info)) {            return $this->raiseError($info);        }        $valid = false;        if ($info->getPackagexmlVersion() == '2.0') {            if ($valid = $info->validate(PEAR_VALIDATE_NORMAL)) {                $info->flattenFileList();                $valid = $info->validate(PEAR_VALIDATE_PACKAGING);            }        } else {            $valid = $info->validate(PEAR_VALIDATE_PACKAGING);        }        $err = array();        $warn = array();        if (!$valid) {            foreach ($info->getValidationWarnings() as $error) {                if ($error['level'] == 'warning') {                    $warn[] = $error['message'];                } else {                    $err[] = $error['message'];                }            }        }        $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 = &$this->getPackageFile($this->config, $this->_debug);        $info = $obj->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL);        if (PEAR::isError($info)) {            return $this->raiseError($info);        }        $err = $warn = array();        if (!$info->validate()) {            foreach ($info->getValidationWarnings() as $error) {                if ($error['level'] == 'warning') {                    $warn[] = $error['message'];                } else {                    $err[] = $error['message'];                }            }        }        if (!$this->_displayValidationResults($err, $warn, true)) {            $this->ui->outputData($this->output, $command);            return $this->raiseError('CVS tag failed');        }        $version = $info->getVersion();        $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $version);        $cvstag = "RELEASE_$cvsversion";        $files = array_keys($info->getFilelist());        $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]);        array_shift($params);        if (count($params)) {            // add in additional files to be tagged            $files = array_merge($files, $params);        }        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)) {                $this->output .= rtrim($line)."\n";            }            pclose($fp);        }        $this->ui->outputData($this->output, $_cmd);        return true;    }    // }}}    // {{{ doCvsDiff()    function doCvsDiff($command, $options, $params)    {        $this->output = '';        if (sizeof($params) < 1) {            $help = $this->getHelp($command);            return $this->raiseError("$command: missing parameter: $help[0]");        }        $obj = &$this->getPackageFile($this->config, $this->_debug);        $info = $obj->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL);        if (PEAR::isError($info)) {            return $this->raiseError($info);        }        $err = $warn = array();        if (!$info->validate()) {            foreach ($info->getValidationWarnings() as $error) {                if ($error['level'] == 'warning') {                    $warn[] = $error['message'];                } else {                    $err[] = $error['message'];                }            }        }        if (!$this->_displayValidationResults($err, $warn, true)) {            $this->ui->outputData($this->output, $command);            return $this->raiseError('CVS diff failed');        }        $info1 = $info->getFilelist();        $files = $info1;        $cmd = "cvs";        if (isset($options['quiet'])) {            $cmd .= ' -q';            unset($options['quiet']);        }        if (isset($options['reallyquiet'])) {            $cmd .= ' -Q';            unset($options['reallyquiet']);        }        if (isset($options['release'])) {            $cvsversion = preg_replace('/[^a-z0-9]/i', '_', $options['release']);            $cvstag = "RELEASE_$cvsversion";            $options['revision'] = $cvstag;            unset($options['release']);        }        $execute = true;        if (isset($options['dry-run'])) {            $execute = false;            unset($options['dry-run']);        }        $cmd .= ' diff';        // the rest of the options are passed right on to "cvs diff"        foreach ($options as $option => $optarg) {            $arg = $short = false;            if (isset($this->commands[$command]['options'][$option])) {                $arg = $this->commands[$command]['options'][$option]['arg'];                $short = $this->commands[$command]['options'][$option]['shortopt'];            }            $cmd .= $short ? " -$short" : " --$option";            if ($arg && $optarg) {                $cmd .= ($short ? '' : '=') . escapeshellarg($optarg);            }        }        foreach ($files as $file) {            $cmd .= ' ' . escapeshellarg($file['name']);        }        if ($this->config->get('verbose') > 1) {            $this->output .= "+ $cmd\n";        }        if ($execute) {            $fp = popen($cmd, "r");            while ($line = fgets($fp, 1024)) {                $this->output .= rtrim($line)."\n";            }            pclose($fp);        }        $this->ui->outputData($this->output, $command);        return true;    }    // }}}    // {{{ doPackageDependencies()    function doPackageDependencies($command, $options, $params)    {        // $params[0] -> the PEAR package to list its information        if (sizeof($params) != 1) {            return $this->raiseError("bad parameter(s), try \"help $command\"");        }        $obj = &$this->getPackageFile($this->config, $this->_debug);        $info = $obj->fromAnyFile($params[0], PEAR_VALIDATE_NORMAL);        if (PEAR::isError($info)) {            return $this->raiseError($info);        }        $deps = $info->getDeps();        if (is_array($deps)) {            if ($info->getPackagexmlVersion() == '1.0') {                $data = array(                    'caption' => 'Dependencies for pear/' . $info->getPackage(),

⌨️ 快捷键说明

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