rw.php

来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PHP 代码 · 共 1,603 行 · 第 1/5 页

PHP
1,603
字号
                return $this->_packageInfo[$p];            }        } else {            $a = null;            return $a;        }    }    /**     * Add a file to the current release that should be installed under a different name     * @param string <contents> path to file     * @param string name the file should be installed as     */    function addInstallAs($path, $as)    {        $r = &$this->_getCurrentRelease();        if ($r === null) {            return false;        }        $this->_isValid = 0;        $r = $this->_mergeTag($r, array('attribs' => array('name' => $path, 'as' => $as)),            array(                'filelist' => array(),                'install' => array('ignore')            ));    }    /**     * Add a file to the current release that should be ignored     * @param string <contents> path to file     * @return bool success of operation     */    function addIgnore($path)    {        $r = &$this->_getCurrentRelease();        if ($r === null) {            return false;        }        $this->_isValid = 0;        $r = $this->_mergeTag($r, array('attribs' => array('name' => $path)),            array(                'filelist' => array(),                'ignore' => array()            ));    }    /**     * Add an extension binary package for this extension source code release     *     * Note that the package must be from the same channel as the extension source package     * @param string     */    function addBinarypackage($package)    {        if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') {            return false;        }        $r = &$this->_getCurrentRelease(false);        if ($r === null) {            return false;        }        $this->_isValid = 0;        $r = $this->_mergeTag($r, $package,            array(                'binarypackage' => array('filelist'),            ));    }    /**     * Add a configureoption to an extension source package     * @param string     * @param string     * @param string     */    function addConfigureOption($name, $prompt, $default = null)    {        if ($this->getPackageType() != 'extsrc' && $this->getPackageType() != 'zendextsrc') {            return false;        }        $r = &$this->_getCurrentRelease(false);        if ($r === null) {            return false;        }        $opt = array('attribs' => array('name' => $name, 'prompt' => $prompt));        if ($default !== null) {            $opt['default'] = $default;        }        $this->_isValid = 0;        $r = $this->_mergeTag($r, $opt,            array(                'configureoption' => array('binarypackage', 'filelist'),            ));    }    /**     * Set an installation condition based on php version for the current release set     * @param string minimum version     * @param string maximum version     * @param false|array incompatible versions of PHP     */    function setPhpInstallCondition($min, $max, $exclude = false)    {        $r = &$this->_getCurrentRelease();        if ($r === null) {            return false;        }        $this->_isValid = 0;        if (isset($r['installconditions']['php'])) {            unset($r['installconditions']['php']);        }        $dep = array('min' => $min, 'max' => $max);        if ($exclude) {            if (is_array($exclude) && count($exclude) == 1) {                $exclude = $exclude[0];            }            $dep['exclude'] = $exclude;        }        if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {            $r = $this->_mergeTag($r, $dep,                array(                    'installconditions' => array('configureoption', 'binarypackage',                        'filelist'),                    'php' => array('extension', 'os', 'arch')                ));        } else {            $r = $this->_mergeTag($r, $dep,                array(                    'installconditions' => array('filelist'),                    'php' => array('extension', 'os', 'arch')                ));        }    }    /**     * @param optional|required optional, required     * @param string extension name     * @param string minimum version     * @param string maximum version     * @param string recommended version     * @param array incompatible versions     */    function addExtensionInstallCondition($name, $min = false, $max = false, $recommended = false,                                          $exclude = false)    {        $r = &$this->_getCurrentRelease();        if ($r === null) {            return false;        }        $this->_isValid = 0;        $dep = $this->_constructDep($name, false, false, $min, $max, $recommended, $exclude);        if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {            $r = $this->_mergeTag($r, $dep,                array(                    'installconditions' => array('configureoption', 'binarypackage',                        'filelist'),                    'extension' => array('os', 'arch')                ));        } else {            $r = $this->_mergeTag($r, $dep,                array(                    'installconditions' => array('filelist'),                    'extension' => array('os', 'arch')                ));        }    }    /**     * Set an installation condition based on operating system for the current release set     * @param string OS name     * @param bool whether this OS is incompatible with the current release     */    function setOsInstallCondition($name, $conflicts = false)    {        $r = &$this->_getCurrentRelease();        if ($r === null) {            return false;        }        $this->_isValid = 0;        if (isset($r['installconditions']['os'])) {            unset($r['installconditions']['os']);        }        $dep = array('name' => $name);        if ($conflicts) {            $dep['conflicts'] = '';        }        if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {            $r = $this->_mergeTag($r, $dep,                array(                    'installconditions' => array('configureoption', 'binarypackage',                        'filelist'),                    'os' => array('arch')                ));        } else {            $r = $this->_mergeTag($r, $dep,                array(                    'installconditions' => array('filelist'),                    'os' => array('arch')                ));        }    }    /**     * Set an installation condition based on architecture for the current release set     * @param string architecture pattern     * @param bool whether this arch is incompatible with the current release     */    function setArchInstallCondition($pattern, $conflicts = false)    {        $r = &$this->_getCurrentRelease();        if ($r === null) {            return false;        }        $this->_isValid = 0;        if (isset($r['installconditions']['arch'])) {            unset($r['installconditions']['arch']);        }        $dep = array('pattern' => $pattern);        if ($conflicts) {            $dep['conflicts'] = '';        }        if ($this->getPackageType() == 'extsrc' || $this->getPackageType() == 'zendextsrc') {            $r = $this->_mergeTag($r, $dep,                array(                    'installconditions' => array('configureoption', 'binarypackage',                        'filelist'),                    'arch' => array()                ));        } else {            $r = $this->_mergeTag($r, $dep,                array(                    'installconditions' => array('filelist'),                    'arch' => array()                ));        }    }    /**     * For extension binary releases, this is used to specify either the     * static URI to a source package, or the package name and channel of the extsrc/zendextsrc     * package it is based on.     * @param string Package name, or full URI to source package (extsrc/zendextsrc type)     */    function setSourcePackage($packageOrUri)    {        $this->_isValid = 0;        if (isset($this->_packageInfo['channel'])) {            $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('phprelease',                'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',                'bundle', 'changelog'),                $packageOrUri, 'srcpackage');        } else {            $this->_packageInfo = $this->_insertBefore($this->_packageInfo, array('phprelease',                'extsrcrelease', 'extbinrelease', 'zendextsrcrelease', 'zendextbinrelease',                'bundle', 'changelog'), $packageOrUri, 'srcuri');        }    }    /**     * Generate a valid change log entry from the current package.xml     * @param string|false     */    function generateChangeLogEntry($notes = false)    {        return array(            'version' =>                 array(                    'release' => $this->getVersion('release'),                    'api' => $this->getVersion('api'),                    ),            'stability' =>                $this->getStability(),            'date' => $this->getDate(),            'license' => $this->getLicense(true),            'notes' => $notes ? $notes : $this->getNotes()            );    }    /**     * @param string release version to set change log notes for     * @param array output of {@link generateChangeLogEntry()}     */    function setChangelogEntry($releaseversion, $contents)    {        if (!isset($this->_packageInfo['changelog'])) {            $this->_packageInfo['changelog']['release'] = $contents;            return;        }        if (!isset($this->_packageInfo['changelog']['release'][0])) {            if ($this->_packageInfo['changelog']['release']['version']['release'] == $releaseversion) {                $this->_packageInfo['changelog']['release'] = array(                    $this->_packageInfo['changelog']['release']);            } else {                $this->_packageInfo['changelog']['release'] = array(                    $this->_packageInfo['changelog']['release']);                return $this->_packageInfo['changelog']['release'][] = $contents;            }        }        foreach($this->_packageInfo['changelog']['release'] as $index => $changelog) {            if (isset($changelog['version']) &&                  strnatcasecmp($changelog['version']['release'], $releaseversion) == 0) {                $curlog = $index;            }        }        if (isset($curlog)) {            $this->_packageInfo['changelog']['release'][$curlog] = $contents;        } else {            $this->_packageInfo['changelog']['release'][] = $contents;        }    }    /**     * Remove the changelog entirely     */    function clearChangeLog()    {        unset($this->_packageInfo['changelog']);    }}?>

⌨️ 快捷键说明

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