当前位置: 首页>>代码示例>>PHP>>正文


PHP PEAR_PackageFile_v2::getFilelist方法代码示例

本文整理汇总了PHP中PEAR_PackageFile_v2::getFilelist方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_PackageFile_v2::getFilelist方法的具体用法?PHP PEAR_PackageFile_v2::getFilelist怎么用?PHP PEAR_PackageFile_v2::getFilelist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PEAR_PackageFile_v2的用法示例。


在下文中一共展示了PEAR_PackageFile_v2::getFilelist方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

 function _validateFilelist($list = false, $allowignore = false, $dirs = '')
 {
     $iscontents = false;
     if (!$list) {
         $iscontents = true;
         $list = $this->_packageInfo['contents'];
         if (isset($this->_packageInfo['bundle'])) {
             return $this->_validateBundle($list);
         }
     }
     if ($allowignore) {
         $struc = array('*install->name->as', '*ignore->name');
     } else {
         $struc = array('*dir->name->?baseinstalldir', '*file->name->role->?baseinstalldir->?md5sum');
         // do a quick test for better error message
         if (isset($list['dir']) && isset($list['file'])) {
             $first = false;
             foreach ($list as $key => $tag) {
                 if ($key == 'attribs') {
                     continue;
                 }
                 $first = $key;
                 break;
             }
             if ($first == 'file') {
                 $this->_dirMustBeFirst($dirs);
             }
         }
     }
     if (!isset($list['attribs']) || !isset($list['attribs']['name'])) {
         $unknown = $allowignore ? '<filelist>' : '<dir name="*unknown*">';
         $dirname = $iscontents ? '<contents>' : $unknown;
     } else {
         $dirname = '<dir name="' . $list['attribs']['name'] . '">';
     }
     $res = $this->_stupidSchemaValidate($struc, $list, $dirname);
     if ($allowignore && $res) {
         $this->_pf->getFilelist();
         $fcontents = $this->_pf->getContents();
         $filelist = array();
         if (!isset($fcontents['dir']['file'][0])) {
             $fcontents['dir']['file'] = array($fcontents['dir']['file']);
         }
         foreach ($fcontents['dir']['file'] as $file) {
             $filelist[$file['attribs']['name']] = true;
         }
         if (isset($list['install'])) {
             if (!isset($list['install'][0])) {
                 $list['install'] = array($list['install']);
             }
             foreach ($list['install'] as $file) {
                 if (!isset($filelist[$file['attribs']['name']])) {
                     $this->_notInContents($file['attribs']['name'], 'install');
                 }
             }
         }
         if (isset($list['ignore'])) {
             if (!isset($list['ignore'][0])) {
                 $list['ignore'] = array($list['ignore']);
             }
             foreach ($list['ignore'] as $file) {
                 if (!isset($filelist[$file['attribs']['name']])) {
                     $this->_notInContents($file['attribs']['name'], 'ignore');
                 }
             }
         }
     }
     if (!$allowignore && isset($list['file'])) {
         if (!isset($list['file'][0])) {
             // single file
             $list['file'] = array($list['file']);
         }
         foreach ($list['file'] as $i => $file) {
             if (isset($file['attribs']) && isset($file['attribs']['role'])) {
                 if (!$this->_validateRole($file['attribs']['role'])) {
                     if (isset($this->_packageInfo['usesrole'])) {
                         $roles = $this->_packageInfo['usesrole'];
                         if (!isset($roles[0])) {
                             $roles = array($roles);
                         }
                         foreach ($roles as $role) {
                             if ($role['role'] = $file['attribs']['role']) {
                                 $msg = 'This package contains role "%role%" and requires ' . 'package "%package%" to be used';
                                 if (isset($role['uri'])) {
                                     $params = array('role' => $role['role'], 'package' => $role['uri']);
                                 } else {
                                     $params = array('role' => $role['role'], 'package' => $this->_pf->_registry->parsedPackageNameToString(array('package' => $role['package'], 'channel' => $role['channel']), true));
                                 }
                                 $this->_stack->push('_mustInstallRole', 'error', $params, $msg);
                             }
                         }
                     }
                     $this->_invalidFileRole($file['attribs']['name'], $dirname, $file['attribs']['role']);
                 }
             }
             if (!isset($file['attribs'])) {
                 continue;
             }
             $save = $file['attribs'];
             if ($dirs) {
//.........这里部分代码省略.........
开发者ID:vojtajina,项目名称:sitellite,代码行数:101,代码来源:Validator.php

示例2: array

 function _validateFilelist($list = false, $allowignore = false, $dirs = '')
 {
     $iscontents = false;
     if (!$list) {
         $iscontents = true;
         $list = $this->_packageInfo['contents'];
         if (isset($this->_packageInfo['bundle'])) {
             return $this->_validateBundle($list);
         }
     }
     if ($allowignore) {
         $struc = array('*install->name->as', '*ignore->name');
     } else {
         $struc = array('*dir->name->?baseinstalldir', '*file->name->role->?baseinstalldir->?md5sum');
         if (isset($list['dir']) && isset($list['file'])) {
             // stave off validation errors without requiring a set order.
             $_old = $list;
             if (isset($list['attribs'])) {
                 $list = array('attribs' => $_old['attribs']);
             }
             $list['dir'] = $_old['dir'];
             $list['file'] = $_old['file'];
         }
     }
     if (!isset($list['attribs']) || !isset($list['attribs']['name'])) {
         $unknown = $allowignore ? '<filelist>' : '<dir name="*unknown*">';
         $dirname = $iscontents ? '<contents>' : $unknown;
     } else {
         $dirname = '<dir name="' . $list['attribs']['name'] . '">';
         if (preg_match('~/\\.\\.?(/|\\z)|^\\.\\.?/~', str_replace('\\', '/', $list['attribs']['name']))) {
             // file contains .. parent directory or . cur directory
             $this->_invalidDirName($list['attribs']['name']);
         }
     }
     $res = $this->_stupidSchemaValidate($struc, $list, $dirname);
     if ($allowignore && $res) {
         $ignored_or_installed = array();
         $this->_pf->getFilelist();
         $fcontents = $this->_pf->getContents();
         $filelist = array();
         if (!isset($fcontents['dir']['file'][0])) {
             $fcontents['dir']['file'] = array($fcontents['dir']['file']);
         }
         foreach ($fcontents['dir']['file'] as $file) {
             $filelist[$file['attribs']['name']] = true;
         }
         if (isset($list['install'])) {
             if (!isset($list['install'][0])) {
                 $list['install'] = array($list['install']);
             }
             foreach ($list['install'] as $file) {
                 if (!isset($filelist[$file['attribs']['name']])) {
                     $this->_notInContents($file['attribs']['name'], 'install');
                     continue;
                 }
                 if (array_key_exists($file['attribs']['name'], $ignored_or_installed)) {
                     $this->_multipleInstallAs($file['attribs']['name']);
                 }
                 if (!isset($ignored_or_installed[$file['attribs']['name']])) {
                     $ignored_or_installed[$file['attribs']['name']] = array();
                 }
                 $ignored_or_installed[$file['attribs']['name']][] = 1;
                 if (preg_match('~/\\.\\.?(/|\\z)|^\\.\\.?/~', str_replace('\\', '/', $file['attribs']['as']))) {
                     // file contains .. parent directory or . cur directory references
                     $this->_invalidFileInstallAs($file['attribs']['name'], $file['attribs']['as']);
                 }
             }
         }
         if (isset($list['ignore'])) {
             if (!isset($list['ignore'][0])) {
                 $list['ignore'] = array($list['ignore']);
             }
             foreach ($list['ignore'] as $file) {
                 if (!isset($filelist[$file['attribs']['name']])) {
                     $this->_notInContents($file['attribs']['name'], 'ignore');
                     continue;
                 }
                 if (array_key_exists($file['attribs']['name'], $ignored_or_installed)) {
                     $this->_ignoreAndInstallAs($file['attribs']['name']);
                 }
             }
         }
     }
     if (!$allowignore && isset($list['file'])) {
         if (is_string($list['file'])) {
             $this->_oldStyleFileNotAllowed();
             return false;
         }
         if (!isset($list['file'][0])) {
             // single file
             $list['file'] = array($list['file']);
         }
         foreach ($list['file'] as $i => $file) {
             if (isset($file['attribs']) && isset($file['attribs']['name'])) {
                 if ($file['attribs']['name'][0] == '.' && $file['attribs']['name'][1] == '/') {
                     // name is something like "./doc/whatever.txt"
                     $this->_invalidFileName($file['attribs']['name'], $dirname);
                 }
                 if (preg_match('~/\\.\\.?(/|\\z)|^\\.\\.?/~', str_replace('\\', '/', $file['attribs']['name']))) {
                     // file contains .. parent directory or . cur directory
//.........这里部分代码省略.........
开发者ID:racontemoi,项目名称:mamp,代码行数:101,代码来源:Validator.php

示例3: array

 function _validateFilelist($list = false, $allowignore = false, $dirs = '')
 {
     $iscontents = false;
     if (!$list) {
         $iscontents = true;
         $list = $this->_packageInfo['contents'];
         if (isset($this->_packageInfo['bundle'])) {
             return $this->_validateBundle($list);
         }
     }
     if ($allowignore) {
         $struc = array('*install->name->as', '*ignore->name');
     } else {
         $struc = array('*dir->name->?baseinstalldir', '*file->name->role->?baseinstalldir->?md5sum');
     }
     if (!isset($list['attribs']) || !isset($list['attribs']['name'])) {
         $unknown = $allowignore ? '<filelist>' : '<dir name="*unknown*">';
         $dirname = $iscontents ? '<contents>' : $unknown;
     } else {
         $dirname = '<dir name="' . $list['attribs']['name'] . '">';
     }
     $res = $this->_stupidSchemaValidate($struc, $list, $dirname);
     if ($allowignore && $res) {
         $this->_pf->getFilelist();
         $fcontents = $this->_pf->getContents();
         $filelist = array();
         if (!isset($fcontents['dir']['file'][0])) {
             $fcontents['dir']['file'] = array($fcontents['dir']['file']);
         }
         foreach ($fcontents['dir']['file'] as $file) {
             $filelist[$file['attribs']['name']] = true;
         }
         if (isset($list['install'])) {
             if (!isset($list['install'][0])) {
                 $list['install'] = array($list['install']);
             }
             foreach ($list['install'] as $file) {
                 if (!isset($filelist[$file['attribs']['name']])) {
                     $this->_notInContents($file['attribs']['name'], 'install');
                 }
             }
         }
         if (isset($list['ignore'])) {
             if (!isset($list['ignore'][0])) {
                 $list['ignore'] = array($list['ignore']);
             }
             foreach ($list['ignore'] as $file) {
                 if (!isset($filelist[$file['attribs']['name']])) {
                     $this->_notInContents($file['attribs']['name'], 'ignore');
                 }
             }
         }
     }
     if (!$allowignore && isset($list['file'])) {
         if (!isset($list['file'][0])) {
             // single file
             $list['file'] = array($list['file']);
         }
         foreach ($list['file'] as $i => $file) {
             if (isset($file['attribs']) && isset($file['attribs']['role'])) {
                 if (!$this->_validateRole($file['attribs']['role'])) {
                     $this->_invalidFileRole($file['attribs']['name'], $dirname, $file['attribs']['role']);
                 }
             }
             if (!isset($file['attribs'])) {
                 continue;
             }
             $save = $file['attribs'];
             if ($dirs) {
                 $save['name'] = $dirs . '/' . $save['name'];
             }
             unset($file['attribs']);
             if (count($file) && $this->_curState != PEAR_VALIDATE_DOWNLOADING) {
                 // has tasks
                 foreach ($file as $task => $value) {
                     if ($tagClass = $this->_pf->getTask($task)) {
                         if (!is_array($value) || !isset($value[0])) {
                             $value = array($value);
                         }
                         foreach ($value as $v) {
                             $ret = call_user_func(array($tagClass, 'validateXml'), $this->_pf, $v, $this->_pf->_config, $save);
                             if (is_array($ret)) {
                                 $this->_invalidTask($task, $ret, @$save['name']);
                             }
                         }
                     } else {
                         $this->_unknownTask($task, $save['name']);
                     }
                 }
             }
         }
     }
     if (isset($list['ignore'])) {
         if (!$allowignore) {
             $this->_ignoreNotAllowed('ignore');
         }
     }
     if (isset($list['install'])) {
         if (!$allowignore) {
             $this->_ignoreNotAllowed('install');
//.........这里部分代码省略.........
开发者ID:alex-k,项目名称:velotur,代码行数:101,代码来源:Validator.php


注:本文中的PEAR_PackageFile_v2::getFilelist方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。