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

📄 rw.php

📁 php-4.4.7学习linux时下载的源代码
💻 PHP
📖 第 1 页 / 共 4 页
字号:
    /**     * This is only used at install-time, after all serialization     * is over.     * @param string file name     * @param string installed path     */    function setInstalledAs($file, $path)    {        if ($path) {            return $this->_packageInfo['filelist'][$file]['installed_as'] = $path;        }        unset($this->_packageInfo['filelist'][$file]['installed_as']);    }    /**     * This is only used at install-time, after all serialization     * is over.     */    function installedFile($file, $atts)    {        if (isset($this->_packageInfo['filelist'][$file])) {            $this->_packageInfo['filelist'][$file] =                array_merge($this->_packageInfo['filelist'][$file], $atts['attribs']);        } else {            $this->_packageInfo['filelist'][$file] = $atts['attribs'];        }    }    /**     * Reset the listing of package contents     * @param string base installation dir for the whole package, if any     */    function clearContents($baseinstall = false)    {        $this->_filesValid = false;        $this->_isValid = 0;        if (!isset($this->_packageInfo['contents'])) {            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,                array('compatible',                    'dependencies', 'providesextension', 'usesrole', 'usestask',                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease',                    'extbinrelease', 'bundle', 'changelog'), array(), 'contents');        }        if ($this->getPackageType() != 'bundle') {            $this->_packageInfo['contents'] =                 array('dir' => array('attribs' => array('name' => '/')));            if ($baseinstall) {                $this->_packageInfo['contents']['dir']['attribs']['baseinstalldir'] = $baseinstall;            }        }    }    /**     * @param string relative path of the bundled package.     */    function addBundledPackage($path)    {        if ($this->getPackageType() != 'bundle') {            return false;        }        $this->_filesValid = false;        $this->_isValid = 0;        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $path, array(                'contents' => array('compatible', 'dependencies', 'providesextension',                'usesrole', 'usestask', 'srcpackage', 'srcuri', 'phprelease',                'extsrcrelease', 'extbinrelease', 'bundle', 'changelog'),                'bundledpackage' => array()));    }    /**     * @param string file name     * @param PEAR_Task_Common a read/write task     */    function addTaskToFile($filename, $task)    {        if (!method_exists($task, 'getXml')) {            return false;        }        if (!method_exists($task, 'getName')) {            return false;        }        if (!method_exists($task, 'validate')) {            return false;        }        if (!$task->validate()) {            return false;        }        if (!isset($this->_packageInfo['contents']['dir']['file'])) {            return false;        }        $this->getTasksNs(); // discover the tasks namespace if not done already        $files = $this->_packageInfo['contents']['dir']['file'];        if (!isset($files[0])) {            $files = array($files);            $ind = false;        } else {            $ind = true;        }        foreach ($files as $i => $file) {            if (isset($file['attribs'])) {                if ($file['attribs']['name'] == $filename) {                    if ($ind) {                        $t = isset($this->_packageInfo['contents']['dir']['file'][$i]                              ['attribs'][$this->_tasksNs .                              ':' . $task->getName()]) ?                              $this->_packageInfo['contents']['dir']['file'][$i]                              ['attribs'][$this->_tasksNs .                              ':' . $task->getName()] : false;                        if ($t && !isset($t[0])) {                            $this->_packageInfo['contents']['dir']['file'][$i]                                [$this->_tasksNs . ':' . $task->getName()] = array($t);                        }                        $this->_packageInfo['contents']['dir']['file'][$i][$this->_tasksNs .                            ':' . $task->getName()][] = $task->getXml();                    } else {                        $t = isset($this->_packageInfo['contents']['dir']['file']                              ['attribs'][$this->_tasksNs .                              ':' . $task->getName()]) ? $this->_packageInfo['contents']['dir']['file']                              ['attribs'][$this->_tasksNs .                              ':' . $task->getName()] : false;                        if ($t && !isset($t[0])) {                            $this->_packageInfo['contents']['dir']['file']                                [$this->_tasksNs . ':' . $task->getName()] = array($t);                        }                        $this->_packageInfo['contents']['dir']['file'][$this->_tasksNs .                            ':' . $task->getName()][] = $task->getXml();                    }                    return true;                }            }        }        return false;    }    /**     * @param string path to the file     * @param string filename     * @param array extra attributes     */    function addFile($dir, $file, $attrs)    {        if ($this->getPackageType() == 'bundle') {            return false;        }        $this->_filesValid = false;        $this->_isValid = 0;        $dir = preg_replace(array('!\\\\+!', '!/+!'), array('/', '/'), $dir);        if ($dir == '/' || $dir == '') {            $dir = '';        } else {            $dir .= '/';        }        $attrs['name'] = $dir . $file;        if (!isset($this->_packageInfo['contents'])) {            // ensure that the contents tag is set up            $this->_packageInfo = $this->_insertBefore($this->_packageInfo,                array('compatible', 'dependencies', 'providesextension', 'usesrole', 'usestask',                'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease',                'extbinrelease', 'bundle', 'changelog'), array(), 'contents');        }        if (isset($this->_packageInfo['contents']['dir']['file'])) {            if (!isset($this->_packageInfo['contents']['dir']['file'][0])) {                $this->_packageInfo['contents']['dir']['file'] =                    array($this->_packageInfo['contents']['dir']['file']);            }            $this->_packageInfo['contents']['dir']['file'][]['attribs'] = $attrs;        } else {            $this->_packageInfo['contents']['dir']['file']['attribs'] = $attrs;        }    }    /**     * @param string Dependent package name     * @param string Dependent package's channel name     * @param string minimum version of specified package that this release is guaranteed to be     *               compatible with     * @param string maximum version of specified package that this release is guaranteed to be     *               compatible with     * @param string versions of specified package that this release is not compatible with     */    function addCompatiblePackage($name, $channel, $min, $max, $exclude = false)    {        $this->_isValid = 0;        $set = array(            'name' => $name,            'channel' => $channel,            'min' => $min,            'max' => $max,        );        if ($exclude) {            $set['exclude'] = $exclude;        }        $this->_isValid = 0;        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array(                'compatible' => array('dependencies', 'providesextension', 'usesrole', 'usestask',                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',                    'bundle', 'changelog')            ));    }    /**     * Removes the <usesrole> tag entirely     */    function resetUsesrole()    {        if (isset($this->_packageInfo['usesrole'])) {            unset($this->_packageInfo['usesrole']);        }    }    /**     * @param string     * @param string package name or uri     * @param string channel name if non-uri     */    function addUsesrole($role, $packageOrUri, $channel = false) {        $set = array('role' => $role);        if ($channel) {            $set['package'] = $packageOrUri;            $set['channel'] = $channel;        } else {            $set['uri'] = $packageOrUri;        }        $this->_isValid = 0;        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array(                'usesrole' => array('usestask', 'srcpackage', 'srcuri',                    'phprelease', 'extsrcrelease', 'extbinrelease', 'bundle', 'changelog')            ));    }    /**     * Removes the <usestask> tag entirely     */    function resetUsestask()    {        if (isset($this->_packageInfo['usestask'])) {            unset($this->_packageInfo['usestask']);        }    }    /**     * @param string     * @param string package name or uri     * @param string channel name if non-uri     */    function addUsestask($task, $packageOrUri, $channel = false) {        $set = array('task' => $task);        if ($channel) {            $set['package'] = $packageOrUri;            $set['channel'] = $channel;        } else {            $set['uri'] = $packageOrUri;        }        $this->_isValid = 0;        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $set, array(                'usestask' => array('srcpackage', 'srcuri',                    'phprelease', 'extsrcrelease', 'extbinrelease', 'bundle', 'changelog')            ));    }    /**     * Remove all compatible tags     */    function clearCompatible()    {        unset($this->_packageInfo['compatible']);    }    /**     * Reset dependencies prior to adding new ones     */    function clearDeps()    {        if (!isset($this->_packageInfo['dependencies'])) {            $this->_packageInfo = $this->_mergeTag($this->_packageInfo, array(),                array(                    'dependencies' => array('providesextension', 'usesrole', 'usestask',                        'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',                        'bundle', 'changelog')));        }        $this->_packageInfo['dependencies'] = array();    }    /**     * @param string minimum PHP version allowed     * @param string maximum PHP version allowed     * @param array $exclude incompatible PHP versions     */    function setPhpDep($min, $max = false, $exclude = false)    {        $this->_isValid = 0;        $dep =            array(                'min' => $min,            );        if ($max) {            $dep['max'] = $max;        }        if ($exclude) {            if (count($exclude) == 1) {                $exclude = $exclude[0];            }            $dep['exclude'] = $exclude;        }        if (isset($this->_packageInfo['dependencies']['required']['php'])) {            $this->_stack->push(__FUNCTION__, 'warning', array('dep' =>            $this->_packageInfo['dependencies']['required']['php']),                'warning: PHP dependency already exists, overwriting');            unset($this->_packageInfo['dependencies']['required']['php']);        }        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,            array(                'dependencies' => array('providesextension', 'usesrole', 'usestask',                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',                    'bundle', 'changelog'),                'required' => array('optional', 'group'),                'php' => array('pearinstaller', 'package', 'subpackage', 'extension', 'os', 'arch')            ));        return true;    }    /**     * @param string minimum allowed PEAR installer version     * @param string maximum allowed PEAR installer version     * @param string recommended PEAR installer version     * @param array incompatible version of the PEAR installer     */    function setPearinstallerDep($min, $max = false, $recommended = false, $exclude = false)    {        $this->_isValid = 0;        $dep =            array(                'min' => $min,            );        if ($max) {            $dep['max'] = $max;        }        if ($recommended) {            $dep['recommended'] = $recommended;        }        if ($exclude) {            if (count($exclude) == 1) {                $exclude = $exclude[0];            }            $dep['exclude'] = $exclude;        }        if (isset($this->_packageInfo['dependencies']['required']['pearinstaller'])) {            $this->_stack->push(__FUNCTION__, 'warning', array('dep' =>            $this->_packageInfo['dependencies']['required']['pearinstaller']),                'warning: PEAR Installer dependency already exists, overwriting');            unset($this->_packageInfo['dependencies']['required']['pearinstaller']);        }        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,            array(                'dependencies' => array('providesextension', 'usesrole', 'usestask',                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',                    'bundle', 'changelog'),                'required' => array('optional', 'group'),                'pearinstaller' => array('package', 'subpackage', 'extension', 'os', 'arch')            ));    }    /**     * Mark a package as conflicting with this package     * @param string package name     * @param string package channel     * @param string extension this package provides, if any     */    function addConflictingPackageDepWithChannel($name, $channel, $providesextension = false)    {        $this->_isValid = 0;        $dep =            array(                'name' => $name,                'channel' => $channel,                'conflicts' => '',            );        if ($providesextension) {            $dep['providesextension'] = $providesextension;        }        $this->_packageInfo = $this->_mergeTag($this->_packageInfo, $dep,            array(                'dependencies' => array('providesextension', 'usesrole', 'usestask',                    'srcpackage', 'srcuri', 'phprelease', 'extsrcrelease', 'extbinrelease',                    'bundle', 'changelog'),                'required' => array('optional', 'group'),                'package' => array('subpackage', 'extension', 'os', 'arch')            ));    }

⌨️ 快捷键说明

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