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


PHP DirectoryIterator::getPerms方法代码示例

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


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

示例1: buildTableRow

 public function buildTableRow(DirectoryIterator $file, $includeParentDirectoryDots = true)
 {
     if (!$file->isDot() && substr($file->getFilename(), 0, 1) == '.' && Administration::instance()->Configuration->get('show-hidden', 'filemanager') != 'yes') {
         return;
     } elseif ($file->isDot() && !$includeParentDirectoryDots && $file->getFilename() == '..') {
         return;
     } elseif ($file->getFilename() == '.') {
         return;
     }
     $relpath = str_replace($this->getStartLocation() == '' ? DOCROOT : DOCROOT . $this->getStartLocation(), NULL, $file->getPathname());
     if (!$file->isDir()) {
         //if(File::fileType($file->getFilename()) == self::CODE)
         //	$download_uri = self::baseURL() . 'edit/?file=' . urlencode($relpath);
         //else
         $download_uri = self::baseURL() . 'download/?file=' . urlencode($relpath);
     } else {
         $download_uri = self::baseURL() . 'properties/?file=' . urlencode($relpath) . '/';
     }
     if (!$file->isDot()) {
         $td1 = Widget::TableData(Widget::Anchor($file->getFilename(), self::baseURL() . ($file->isDir() ? 'browse' . $relpath . '/' : 'properties/?file=' . urlencode($relpath)), NULL, 'file-type ' . ($file->isDir() ? 'folder' : File::fileType($file->getFilename()))));
         //$group = (function_exists('posix_getgrgid') ? posix_getgrgid($file->getGroup()) : $file->getGroup());
         //$owner = (function_exists('posix_getpwuid') ? posix_getpwuid($file->getOwner()) : $file->getOwner());
         $group = $file->getGroup();
         $owner = $file->getOwner();
         $td3 = Widget::TableData(File::getOctalPermission($file->getPerms()) . ' <span class="inactive">' . File::getReadablePerm($file->getPerms()), NULL, NULL, NULL, array('title' => (isset($owner['name']) ? $owner['name'] : $owner) . ', ' . (isset($group['name']) ? $group['name'] : $group)) . '</span>');
         $td4 = Widget::TableData(DateTimeObj::get(__SYM_DATETIME_FORMAT__, $file->getMTime()));
         if ($file->isWritable()) {
             if ($file->isDir()) {
                 $td5 = Widget::TableData(Widget::Anchor('Edit', $download_uri));
             } else {
                 $td5 = Widget::TableData(Widget::Anchor('Download', $download_uri));
             }
         } else {
             $td5 = Widget::TableData('-', 'inactive');
         }
     } else {
         $td1 = Widget::TableData(Widget::Anchor('&crarr;', self::baseURL() . 'browse' . $relpath . '/'));
         $td3 = Widget::TableData('-', 'inactive');
         $td4 = Widget::TableData('-', 'inactive');
         $td5 = Widget::TableData('-', 'inactive');
     }
     $td2 = Widget::TableData($file->isDir() ? '-' : General::formatFilesize($file->getSize()), $file->isDir() ? 'inactive' : NULL);
     $startlocation = DOCROOT . $this->getStartLocation();
     if (!$file->isDot()) {
         $td5->appendChild(Widget::Input('items[' . str_replace($startlocation, '', $file->getPathname()) . ($file->isDir() ? '/' : NULL) . ']', NULL, 'checkbox'));
     }
     return Widget::TableRow(array($td1, $td2, $td3, $td4, $td5));
 }
开发者ID:bauhouse,项目名称:sym-extensions,代码行数:48,代码来源:extension.driver.php

示例2: _getItemStats

 /**
  * Determine file/directory statistics for input item.
  *
  * @param DirectoryIterator $item Item passed from a DirectoryIterator
  * @return array Listing with stats
  */
 private static function _getItemStats(DirectoryIterator $item)
 {
     $list = array();
     // add filename
     $list['name'] = (string) $item;
     // add directory/file type
     $list['type'] = $item->getType();
     // add modification time
     $list['modified'] = date('Y-m-d H:i:s', $item->getMTime());
     // get permissions
     $list['permissions'] = $item->getPerms();
     // is writable?
     $list['writable'] = $item->isWritable() ? 1 : 0;
     // add path
     $list['path'] = $item->getPathName();
     $list['real_path'] = $item->getRealPath();
     // add size
     $list['size'] = Fari_Format::bytes($item->getSize());
     return $list;
 }
开发者ID:radekstepan,项目名称:PumpedBlog,代码行数:26,代码来源:File.php

示例3: _processFile

 /**
  * Process file
  *
  * @param int $directoryID
  * @param DirectoryIterator $entries
  */
 protected final function _processFile($directoryID, DirectoryIterator $entries)
 {
     $scanID = $this->_scanRow->scanID;
     // Load row when exists
     $fileRow = $this->_fileTable->fetchRow(array('directoryID' => $directoryID, 'name' => $entries->getFilename()));
     // Already scanned
     if ($fileRow && $fileRow->lastScanID == $scanID) {
         return;
     }
     $pathname = $entries->getPathname();
     // Data
     $data = array('modifyDate' => $this->_normalizeDate($entries->getMTime()), 'owner' => $this->_normalizeUser($entries->getOwner()), 'group' => $this->_normalizeGroup($entries->getGroup()), 'permissions' => $entries->getPerms(), 'size' => $entries->getSize(), 'linkTarget' => $entries->isLink() ? $entries->getLinkTarget() : null);
     // Content
     $contentHash = null;
     if (!$entries->isLink() && ($this->_alwaysCheckContent || !$fileRow || $fileRow->modifyDate != $data['modifyDate'] || $fileRow->size != $data['size'])) {
         // Non-accessible file
         if (!is_readable($pathname)) {
             $this->_log(self::LOG_ERROR, "\t{$pathname} cannot be read.");
             if ($fileRow) {
                 $contentHash = $fileRow->contentHash;
             }
         } else {
             $contentHash = md5_file($pathname);
         }
     }
     // Transaction
     $this->_db->beginTransaction();
     // New row
     if ($newRow = !$fileRow) {
         fwrite(STDOUT, "\t{$pathname} is new.\n");
         $fileRow = $this->_createFileRow(array('directoryID' => $directoryID, 'name' => $entries->getFilename()) + $data);
     }
     // Store values
     $oldValues = $fileRow->toArray();
     // Content
     if ($fileRow->contentHash != $contentHash) {
         $data['contentHash'] = $contentHash;
         if ($this->_storagePath) {
             $data['storedAs'] = $this->_copyFile($fileRow->fileID, $entries);
         }
     }
     // Update row
     $this->_updateFileRow($pathname, $fileRow, $data);
     $fileRow->lastScanID = $scanID;
     $fileRow->save();
     // Scan row update
     $this->_scanRow->lastOperationDate = new SeekR_Expression('NOW()');
     $this->_scanRow->save();
     // Transaction
     $this->_db->commit();
 }
开发者ID:AttilaJenei,项目名称:Seek-R,代码行数:57,代码来源:SeekR.php

示例4: folderNeedsToBeUpdated

 private function folderNeedsToBeUpdated(DirectoryIterator $frs_project_dir)
 {
     $comparable_folder_rights = $this->getComprarableFolderRights($frs_project_dir->getPerms());
     return !$frs_project_dir->isDot() && $frs_project_dir->isDir() && $comparable_folder_rights != $this->needed_access_right && $frs_project_dir->getGroup() != $this->codendi_ugroup_id;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:5,代码来源:201504171343_restore_FRS_owner_group.php


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