• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP lstat函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中lstat函数的典型用法代码示例。如果您正苦于以下问题:PHP lstat函数的具体用法?PHP lstat怎么用?PHP lstat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: failureDescription

 /**
  * {@inheritdoc}
  */
 protected function failureDescription($other)
 {
     if (!is_string($other)) {
         if (is_object($other)) {
             $type = sprintf('%s#%s', get_class($other), method_exists($other, '__toString') ? $other->__toString() : '');
         } elseif (null === $other) {
             $type = 'null';
         } else {
             $type = gettype($other) . '#' . $other;
         }
         return $type . ' ' . $this->toString();
     }
     if (!file_exists($other)) {
         return 'not file or directory#' . $other . ' ' . $this->toString();
     }
     if (is_link($other)) {
         $type = 'link';
         $perms = lstat($other);
         $perms = $perms['mode'];
     } else {
         $type = is_file($other) ? 'file' : (is_dir($other) ? 'directory' : 'other');
         $perms = fileperms($other);
     }
     return sprintf('%s#%s %o %s %o', $type, $other, $perms, $this->toString(), $this->mask);
 }
开发者ID:GeckoPackages,项目名称:GeckoPHPUnit,代码行数:28,代码来源:FilePermissionsMaskConstraint.php


示例2: getRuntimeDir

 public function getRuntimeDir($strict = true)
 {
     if ($runtimeDir = getenv('XDG_RUNTIME_DIR')) {
         return $runtimeDir;
     }
     if ($strict) {
         throw new \RuntimeException('XDG_RUNTIME_DIR was not set');
     }
     $fallback = sys_get_temp_dir() . DIRECTORY_SEPARATOR . self::RUNTIME_DIR_FALLBACK . getenv('USER');
     $create = false;
     if (!is_dir($fallback)) {
         mkdir($fallback, 0700, true);
     }
     $st = lstat($fallback);
     # The fallback must be a directory
     if (!$st['mode'] & self::S_IFDIR) {
         rmdir($fallback);
         $create = true;
     } elseif ($st['uid'] != getmyuid() || $st['mode'] & (self::S_IRWXG | self::S_IRWXO)) {
         rmdir($fallback);
         $create = true;
     }
     if ($create) {
         mkdir($fallback, 0700, true);
     }
     return $fallback;
 }
开发者ID:a53ali,项目名称:CakePhP,代码行数:27,代码来源:Xdg.php


示例3: __construct

 public function __construct()
 {
     parent::__construct('filePermissions', function ($string) {
         if (is_string($string)) {
             if (ctype_digit($string)) {
                 $permissions = octdec($string);
             } elseif (is_link($string)) {
                 $permissions = lstat($string)['mode'];
             } elseif (file_exists($string)) {
                 $permissions = fileperms($string);
             } else {
                 throw new \Twig_Error_Runtime(sprintf('Cannot determine permissions for "%s".', $string));
             }
         } else {
             $permissions = octdec($string);
         }
         if (($permissions & 0xc000) === 0xc000) {
             // Socket
             $info = 's';
         } elseif (($permissions & 0xa000) === 0xa000) {
             // Symbolic Link
             $info = 'l';
         } elseif (($permissions & 0x8000) === 0x8000) {
             // Regular
             $info = '-';
         } elseif (($permissions & 0x6000) === 0x6000) {
             // Block special
             $info = 'b';
         } elseif (($permissions & 0x4000) === 0x4000) {
             // Directory
             $info = 'd';
         } elseif (($permissions & 0x2000) === 0x2000) {
             // Character special
             $info = 'c';
         } elseif (($permissions & 0x1000) === 0x1000) {
             // FIFO pipe
             $info = 'p';
         } else {
             // Unknown
             $info = 'u';
         }
         // Owner
         $info .= $permissions & 0x100 ? 'r' : '-';
         $info .= $permissions & 0x80 ? 'w' : '-';
         $info .= $permissions & 0x40 ? $permissions & 0x800 ? 's' : 'x' : ($permissions & 0x800 ? 'S' : '-');
         // Group
         $info .= $permissions & 0x20 ? 'r' : '-';
         $info .= $permissions & 0x10 ? 'w' : '-';
         $info .= $permissions & 0x8 ? $permissions & 0x400 ? 's' : 'x' : ($permissions & 0x400 ? 'S' : '-');
         // World
         $info .= $permissions & 0x4 ? 'r' : '-';
         $info .= $permissions & 0x2 ? 'w' : '-';
         $info .= $permissions & 0x1 ? $permissions & 0x200 ? 't' : 'x' : ($permissions & 0x200 ? 'T' : '-');
         return $info;
     });
 }
开发者ID:GeckoPackages,项目名称:GeckoTwig,代码行数:56,代码来源:FilePermissionsFilter.php


示例4: buildDirModel

function buildDirModel($dir, $model, $rootname, $user_id, $db)
{
    ##Remove from $dir to output the part until s3db root;
    $dirFiles = scandir($dir);
    #echo '<pre>';print_r($dirFiles);exit;
    #foreach ($dirFiles as $ind)
    for ($i = 0; $i < count($dirFiles); $i++) {
        $ind = $dirFiles[$i];
        if (is_file($dir . '/' . $ind) && !ereg('^(s3id|config.inc.php|treeitem.*.js|.*.tmp|.*[0-9]{8}$)', $ind)) {
            $fstat = lstat($dir . '/' . $ind);
            $lastModified = date('Y-m-d H:i:s', $fstat['mtime']);
            $path = str_replace($rootname, '', $dir);
            $path = $path == '' ? $ind : substr($path, 1, strlen($path)) . '/' . $ind;
            $path = addslashes($path);
            ###
            #Is there an item with this path value on path rule?
            #$item_id = findFileItemId($path,$user_id,$db);
            ###
            #Find the statement_id of this file on the local s3db
            $allFileIds = @file_get_contents('fileIds.tmp');
            $allFileIds = @unserialize($allFileIds);
            $file_id = @array_search($path, $allFileIds);
            if ($file_id == '') {
                echo "Finding ID of file " . $path . chr(10);
                $sql = "select statement_id from s3db_statement where rule_id = '" . $GLOBALS['update_project']['file']['rule_id'] . "' and file_name = '" . $path . "' order by created_on desc limit 1";
                $db->query($sql, __LINE__, __FILE__);
                if ($db->next_record()) {
                    $file_id = $db->f('statement_id');
                    $allFileIds[$file_id] = $path;
                }
            }
            if ($file_id == '') {
                $updated = fileUpdate($path, $user_id, $db);
                $file_id = $updated;
            }
            if ($file_id != '') {
                file_put_contents('fileIds.tmp', serialize($allFileIds));
                echo "writting item " . $path . " " . $file_id . chr(10);
                $subjResources = new Resource($GLOBALS['s3db_info']['deployment']['URI'] . 's3dbfiles.php?file_id=' . $file_id);
                $statement = new Statement($subjResources, new Resource('http://purl.org/dc/elements/1.1/date'), new Literal($lastModified));
                $path = new Statement($subjResources, new Resource('http://s3db.org/scripts'), new Literal($path));
                $model->add($statement);
                $model->add($path);
            } else {
                @file_put_contents('update_error_log.txt', "Could not find a file_id for " . $path . chr(10));
            }
        } elseif (is_dir($dir . '/' . $ind) && !ereg('^(.|..|extras)$', $ind)) {
            $newDir = $dir . '/' . $ind;
            $submodel = ModelFactory::getDefaultModel();
            $submodel = buildDirModel($newDir, $submodel, $rootname, $user_id, $db);
            $model->addModel($submodel);
        }
    }
    return $model;
}
开发者ID:helenadeus,项目名称:s3db.map,代码行数:55,代码来源:updates.php


示例5: writeHeader

 /**
  * @param $real_path
  * @param $new_path
  * @return bool
  */
 protected function writeHeader($real_path, $new_path)
 {
     if (strlen($new_path) > 99) {
         $this->writeLongHeader($new_path);
     }
     $v_info = lstat($real_path);
     $v_uid = sprintf("%6s ", DecOct($v_info[4]));
     $v_gid = sprintf("%6s ", DecOct($v_info[5]));
     $v_perms = sprintf("%6s ", DecOct($v_info['mode']));
     $v_mtime = sprintf("%11s", DecOct($v_info['mtime']));
     $v_linkname = '';
     if (@is_link($real_path)) {
         $v_typeflag = '2';
         $v_linkname = readlink($real_path);
         $v_size = sprintf("%11s ", DecOct(0));
     } elseif (@is_dir($real_path)) {
         $v_typeflag = "5";
         $v_size = sprintf("%11s ", DecOct(0));
     } else {
         $v_typeflag = '';
         clearstatcache(TRUE, $real_path);
         $v_size = sprintf("%11s ", DecOct($v_info['size']));
     }
     $v_magic = '';
     $v_version = '';
     $v_uname = '';
     $v_gname = '';
     $v_devmajor = '';
     $v_devminor = '';
     $v_prefix = '';
     $v_binary_data_first = pack("a100a8a8a8a12A12", $new_path, $v_perms, $v_uid, $v_gid, $v_size, $v_mtime);
     $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12", $v_typeflag, $v_linkname, $v_magic, $v_version, $v_uname, $v_gname, $v_devmajor, $v_devminor, $v_prefix, '');
     // ----- Calculate the checksum
     $v_checksum = 0;
     // ..... First part of the header
     for ($i = 0; $i < 148; $i++) {
         $v_checksum += ord(substr($v_binary_data_first, $i, 1));
     }
     // ..... Ignore the checksum value and replace it by ' ' (space)
     for ($i = 148; $i < 156; $i++) {
         $v_checksum += ord(' ');
     }
     // ..... Last part of the header
     for ($i = 156, $j = 0; $i < 512; $i++, $j++) {
         $v_checksum += ord(substr($v_binary_data_last, $j, 1));
     }
     // ----- Write the first 148 bytes of the header in the archive
     $this->archive->write($v_binary_data_first, 148);
     // ----- Write the calculated checksum
     $v_checksum = sprintf("%6s ", DecOct($v_checksum));
     $v_binary_data = pack("a8", $v_checksum);
     $this->archive->write($v_binary_data, 8);
     // ----- Write the last 356 bytes of the header in the archive
     $this->archive->write($v_binary_data_last, 356);
 }
开发者ID:Wylbur,项目名称:gj,代码行数:60,代码来源:TarArchiveWriter.php


示例6: lstat

 /**
  * {@inheritdoc}
  */
 public function lstat($path)
 {
     if ($stat = @\lstat($path)) {
         $stat["isfile"] = (bool) \is_file($path);
         $stat["isdir"] = empty($stat["isfile"]);
         \clearstatcache(true, $path);
     } else {
         $stat = null;
     }
     return new Success($stat);
 }
开发者ID:staabm,项目名称:file,代码行数:14,代码来源:BlockingDriver.php


示例7: writeLog

 /**
  * Manage log file.
  *
  * @param string $filePath
  * @param string $callStart
  * @param string $resource
  * @param string $duration
  */
 protected function writeLog($filePath, $callStart, $resource, $duration)
 {
     $log = fopen($filePath, "a+");
     clearstatcache();
     $fileStats = lstat($filePath);
     if ($fileStats && 0 === $fileStats['size']) {
         fwrite($log, "datetime;soap_call_resource;duration (s)\n");
     }
     fwrite($log, sprintf("%s;%s;%s\n", $callStart, $resource, $duration));
     fclose($log);
 }
开发者ID:mejdoubimeriem,项目名称:prestashopconnector,代码行数:19,代码来源:PrestashopSoapClientProfiler.php


示例8: httpfs_getattr

function httpfs_getattr($data)
{
    $path = explode("", $data, 2)[0];
    $s = lstat($path);
    if ($s) {
        dump_ok();
        echo pack('NNNNNNNNNNNNN', $s['dev'], $s['ino'], $s['mode'], $s['nlink'], $s['uid'], $s['gid'], $s['rdev'], $s['size'], $s['atime'], $s['mtime'], $s['ctime'], $s['blksize'], $s['blocks']);
    } else {
        dump_error(ENTRY_NOT_FOUND);
    }
}
开发者ID:ksmaheshkumar,项目名称:httpfs,代码行数:11,代码来源:template.php


示例9: getTempDir

 /**
  * This function retrieves the path to a directory where temporary files can be saved.
  *
  * @return string Path to a temporary directory, without a trailing directory separator.
  * @throws \SimpleSAML_Error_Exception If the temporary directory cannot be created or it exists and does not belong
  * to the current user.
  *
  * @author Andreas Solberg, UNINETT AS <[email protected]>
  * @author Olav Morken, UNINETT AS <[email protected]>
  * @author Jaime Perez, UNINETT AS <[email protected]>
  */
 public static function getTempDir()
 {
     $globalConfig = \SimpleSAML_Configuration::getInstance();
     $tempDir = rtrim($globalConfig->getString('tempdir', sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'simplesaml'), DIRECTORY_SEPARATOR);
     if (!is_dir($tempDir)) {
         if (!mkdir($tempDir, 0700, true)) {
             $error = error_get_last();
             throw new \SimpleSAML_Error_Exception('Error creating temporary directory "' . $tempDir . '": ' . $error['message']);
         }
     } elseif (function_exists('posix_getuid')) {
         // check that the owner of the temp directory is the current user
         $stat = lstat($tempDir);
         if ($stat['uid'] !== posix_getuid()) {
             throw new \SimpleSAML_Error_Exception('Temporary directory "' . $tempDir . '" does not belong to the current user.');
         }
     }
     return $tempDir;
 }
开发者ID:SysBind,项目名称:simplesamlphp,代码行数:29,代码来源:System.php


示例10: getStatRaw

 /**
  * Gives information about a file
  * 
  * Stat from regular file (stat()) and symbolic link (lstat())
  * 
  * @param string $findkey Find a key from stat value as 'dev'
  * @return array|string
  */
 public function getStatRaw($findkey = '')
 {
     if (is_link($this->source)) {
         if ($findkey !== '') {
             $stat = lstat($this->source);
             return $stat[$findkey];
         }
         if ($findkey === '') {
             return lstat($this->source);
         } else {
             $stat = lstat($this->source);
             if ($stat) {
                 foreach (array_keys($stat) as $key) {
                     if (is_string($key)) {
                         $statResponse[$key] = $stat[$key];
                     }
                 }
                 return $statResponse;
             }
             return $stat;
         }
     }
     if (file_exists($this->source) || is_dir($this->source)) {
         if ($findkey !== '') {
             $stat = stat($this->source);
             return $stat[$findkey];
         }
         if ($findkey === '') {
             return stat($this->source);
         } else {
             $stat = stat($this->source);
             if ($stat) {
                 foreach (array_keys($stat) as $key) {
                     if (is_string($key)) {
                         $statResponse[$key] = $stat[$key];
                     }
                 }
                 return $statResponse;
             }
             return $stat;
         }
     }
     return false;
 }
开发者ID:ionitium,项目名称:filesystem,代码行数:52,代码来源:Filesysteminfo.php


示例11: header

 /**
  * Print report header
  *
  * @param array $targets List of target directories
  * @param array $argv Command line arguments
  */
 public function header($targets, $argv)
 {
     $header = !empty($this->format) ? $this->getRowFormatHeader($this->format) : $this->getRowHeader();
     echo "date: " . date('r (U)') . "\n";
     echo "getenv(TZ): " . getenv('TZ') . "\n";
     echo "date_default_timezone_get: " . date_default_timezone_get() . "\n";
     if (defined('DIRSCAN_VERSION')) {
         echo "dirscan version: " . DIRSCAN_VERSION . "\n";
     }
     echo "php version: " . phpversion() . "\n";
     echo "uname: " . php_uname() . "\n";
     echo "cwd: " . getcwd() . "\n";
     echo "settings: " . json_encode($this->settings) . "\n";
     echo "argv: " . json_encode($argv) . "\n";
     echo "target" . (count($targets) > 1 ? "s" : "") . ": " . "\n";
     foreach ($targets as $key => $target) {
         $targetStat = lstat($target);
         $targetStat['realpath'] = realpath($target);
         echo sprintf(" - %s (realpath: %s, device: %s)\n", $target, $targetStat['realpath'], $targetStat['dev']);
     }
     echo "=====================================\n";
     echo implode("\t", $header) . "\n";
 }
开发者ID:vincepare,项目名称:dirscan,代码行数:29,代码来源:CliReporter.php


示例12: cached

 public function cached()
 {
     // Check for non-existant cache file
     if (!file_exists('data/cache/language_registry')) {
         return false;
     }
     // Get directory modification date
     clearstatcache();
     $dir_modified = array_element(lstat('./locale/'), 9);
     // Get cache modification date
     clearstatcache();
     $cache_modified = array_element(lstat('data/cache/language_registry'), 9);
     // If the cache is older than the directory
     if ($cache_modified < $dir_modified) {
         //print "rebuild<br/>\n";
         // Rebuild cache
         return false;
     } else {
         // Otherwise cache is up to date
         //print "fine<br/>\n";
         return true;
     }
 }
开发者ID:rrsc,项目名称:freemed,代码行数:23,代码来源:LanguageRegistry.class.php


示例13: getdirfiles

function getdirfiles($dir, $exts)
{
    $path = $_SERVER['DOCUMENT_ROOT'];
    $path = PathBckSlash($path);
    $result = array();
    if (is_dir($path . $dir)) {
        $dp = dir($path . $dir);
        while (($file = $dp->read()) !== false) {
            if ($file != '.' && $file != '..') {
                if (!is_dir($path . $dir . "/" . $file)) {
                    if (in_array(strtolower(pathinfo($file, PATHINFO_EXTENSION)), $exts)) {
                        $fpropert = lstat($path . $dir . "/" . $file);
                        if ($fpropert) {
                            $result[] = array("fname" => $file, "url" => $dir . "/" . $file, "ctime" => date("Y-m-d H:i:s", $fpropert[10]), "size" => round($fpropert[7] / 1024) . "k");
                        }
                    }
                }
            }
        }
        $dp->close();
    }
    return $result;
}
开发者ID:TheProjecter,项目名称:webfmt,代码行数:23,代码来源:core.php


示例14: buildDirModel

function buildDirModel($dir, $model, $rootname)
{
    ##Remove from $dir to output the part until s3db root;
    $dirFiles = scandir($dir);
    foreach ($dirFiles as $ind) {
        if (is_file($dir . '/' . $ind) && !ereg('^(s3id|config.inc.php|treeitem.*.js)', $ind)) {
            $fstat = lstat($dir . '/' . $ind);
            $lastModified = date('Y-m-d H:i:s', $fstat['mtime']);
            $path = str_replace($rootname, '', $dir);
            $path = $path == '' ? $ind : substr($path, 1, strlen($path)) . '/' . $ind;
            $subjResources = new Resource('http://www.s3db.org/central/s3dbfiles.php?file=' . $path);
            $statement = new Statement($subjResources, new Resource('http://purl.org/dc/elements/1.1/date'), new Literal($lastModified));
            $path = new Statement($subjResources, new Resource('http://s3db.org/scripts'), new Literal($path));
            $model->add($statement);
            $model->add($path);
        } elseif (is_dir($dir . '/' . $ind) && !ereg('^(.|..|extras)$', $ind)) {
            $newDir = $dir . '/' . $ind;
            $submodel = ModelFactory::getDefaultModel();
            $submodel = buildDirModel($newDir, $submodel, $rootname);
            $model->addModel($submodel);
        }
    }
    return $model;
}
开发者ID:helenadeus,项目名称:s3db.map,代码行数:24,代码来源:RSS.php


示例15: _stat

 /**
  * Return stat for given path.
  * Stat contains following fields:
  * - (int)    size    file size in b. required
  * - (int)    ts      file modification time in unix time. required
  * - (string) mime    mimetype. required for folders, others - optionally
  * - (bool)   read    read permissions. required
  * - (bool)   write   write permissions. required
  * - (bool)   locked  is object locked. optionally
  * - (bool)   hidden  is object hidden. optionally
  * - (string) alias   for symlinks - link target path relative to root path. optionally
  * - (string) target  for symlinks - link target path. optionally
  *
  * If file does not exists - returns empty array or false.
  *
  * @param  string  $path    file path 
  * @return array|false
  * @author Dmitry (dio) Levashov
  **/
 protected function _stat($path)
 {
     $stat = array();
     if (!file_exists($path)) {
         return $stat;
     }
     //Verifies the given path is the root or is inside the root. Prevents directory traveral.
     if (!$this->aroot) {
         // for Inheritance class ( not calling parent::configure() )
         $this->aroot = realpath($this->root);
     }
     if (!$this->_inpath($path, $this->aroot)) {
         return $stat;
     }
     if ($path != $this->root && is_link($path)) {
         if (($target = $this->readlink($path)) == false || $target == $path) {
             $stat['mime'] = 'symlink-broken';
             $stat['read'] = false;
             $stat['write'] = false;
             $stat['size'] = 0;
             return $stat;
         }
         $stat['alias'] = $this->_path($target);
         $stat['target'] = $target;
         $path = $target;
         $lstat = lstat($path);
         $size = $lstat['size'];
     } else {
         $size = @filesize($path);
     }
     $dir = is_dir($path);
     $stat['mime'] = $dir ? 'directory' : $this->mimetype($path);
     $stat['ts'] = filemtime($path);
     $stat['read'] = is_readable($path);
     $stat['write'] = is_writable($path);
     if ($stat['read']) {
         $stat['size'] = $dir ? 0 : $size;
     }
     return $stat;
 }
开发者ID:scorpionx,项目名称:vtt-bundle,代码行数:59,代码来源:elFinderVolumeLocalFileSystem.php


示例16: _stat

 /**
  * Return stat for given path.
  * Stat contains following fields:
  * - (int)    size    file size in b. required
  * - (int)    ts      file modification time in unix time. required
  * - (string) mime    mimetype. required for folders, others - optionally
  * - (bool)   read    read permissions. required
  * - (bool)   write   write permissions. required
  * - (bool)   locked  is object locked. optionally
  * - (bool)   hidden  is object hidden. optionally
  * - (string) alias   for symlinks - link target path relative to root path. optionally
  * - (string) target  for symlinks - link target path. optionally
  *
  * If file does not exists - returns empty array or false.
  *
  * @param  string  $path    file path 
  * @return array|false
  * @author Dmitry (dio) Levashov
  **/
 protected function _stat($path)
 {
     $stat = array();
     if (!file_exists($path)) {
         return $stat;
     }
     if ($path != $this->root && is_link($path)) {
         if (($target = $this->readlink($path)) == false || $target == $path) {
             $stat['mime'] = 'symlink-broken';
             $stat['read'] = false;
             $stat['write'] = false;
             $stat['size'] = 0;
             return $stat;
         }
         $stat['alias'] = $this->_path($target);
         $stat['target'] = $target;
         $path = $target;
         $lstat = lstat($path);
         $size = $lstat['size'];
     } else {
         $size = @filesize($path);
     }
     $dir = is_dir($path);
     $stat['mime'] = $dir ? 'directory' : $this->mimetype($path);
     $stat['ts'] = filemtime($path);
     $stat['read'] = is_readable($path);
     $stat['write'] = is_writable($path);
     if ($stat['read']) {
         $stat['size'] = $dir ? 0 : $size;
     }
     return $stat;
 }
开发者ID:rb26,项目名称:zenphoto,代码行数:51,代码来源:elFinderVolumeLocalFileSystem.class.php


示例17: testGetAttribute_lstat_Posix

 /**
  * Tests Fs_Node->getAttribute() getting posix info
  * this test is not so good because owner of the symlink is the same as the owner of the file
  */
 public function testGetAttribute_lstat_Posix()
 {
     $stat = lstat($this->file);
     $userinfo = extension_loaded('posix') && ($info = posix_getpwuid($stat['uid'])) ? $info['name'] : $stat['uid'];
     $groupinfo = extension_loaded('posix') && ($info = posix_getgrgid($stat['gid'])) ? $info['name'] : $stat['gid'];
     $this->assertEquals($userinfo, $this->Fs_Node->getAttribute('owner', Fs::NO_DEREFERENCE), 'owner');
     $this->assertEquals($groupinfo, $this->Fs_Node->getAttribute('group', Fs::NO_DEREFERENCE), 'group');
 }
开发者ID:jasny,项目名称:Q,代码行数:12,代码来源:BrokenTest.php


示例18: getURLLastModified

 public function getURLLastModified($url, $symlink, $bucket)
 {
     $this->clearstatcache();
     if (!$this->fileExists($symlink)) {
         return array('time' => 0, 'revalidate' => true, 'cache_age' => 0);
     }
     $symlinkAbs = $this->absolutize($symlink);
     $stat = lstat($symlinkAbs);
     $now = time();
     if (readlink($symlinkAbs) == '/dev/null') {
         $failed_time = $now - $stat['mtime'];
         if ($failed_time > binarypool_config::getBadUrlExpiry()) {
             unlink($symlinkAbs);
             return array('time' => 0, 'revalidate' => true, 'cache_age' => $failed_time);
         }
         $failed_nextfetch = $stat['mtime'] + binarypool_config::getBadUrlExpiry() - $now;
         throw new binarypool_exception(122, 400, "File download failed {$failed_time} seconds ago. Re-fetching allowed in next time in {$failed_nextfetch} seconds: {$url}");
     }
     $cache_age = $now - $stat['mtime'];
     $revalidate = false;
     if ($cache_age > binarypool_config::getCacheRevalidate($bucket)) {
         $revalidate = true;
     }
     return array('time' => filemtime($symlinkAbs), 'revalidate' => $revalidate, 'cache_age' => $cache_age);
 }
开发者ID:pneff,项目名称:binarypool,代码行数:25,代码来源:storage_driver_file.php


示例19: _lstat

 protected function _lstat($vd6fe1d0be6347b8ef2427fa629c04485)
 {
     return lstat($vd6fe1d0be6347b8ef2427fa629c04485);
 }
开发者ID:BGCX261,项目名称:zimmerli-svn-to-git,代码行数:4,代码来源:elFinderVolumeLocalFileSystem.class.php


示例20: _writeHeader

 function _writeHeader($p_filename, $p_stored_filename)
 {
     if ($p_stored_filename == '') {
         $p_stored_filename = $p_filename;
     }
     $v_reduce_filename = $this->_pathReduction($p_stored_filename);
     if (strlen($v_reduce_filename) > 99) {
         if (!$this->_writeLongHeader($v_reduce_filename)) {
             return false;
         }
     }
     $v_info = lstat($p_filename);
     $v_uid = sprintf("%07s", DecOct($v_info[4]));
     $v_gid = sprintf("%07s", DecOct($v_info[5]));
     $v_perms = sprintf("%07s", DecOct($v_info['mode'] & 0777));
     $v_mtime = sprintf("%011s", DecOct($v_info['mtime']));
     $v_linkname = '';
     if (@is_link($p_filename)) {
         $v_typeflag = '2';
         $v_linkname = readlink($p_filename);
         $v_size = sprintf("%011s", DecOct(0));
     } elseif (@is_dir($p_filename)) {
         $v_typeflag = "5";
         $v_size = sprintf("%011s", DecOct(0));
     } else {
         $v_typeflag = '0';
         clearstatcache();
         $v_size = sprintf("%011s", DecOct($v_info['size']));
     }
     $v_magic = 'ustar ';
     $v_version = ' ';
     if (function_exists('posix_getpwuid')) {
         $userinfo = posix_getpwuid($v_info[4]);
         $groupinfo = posix_getgrgid($v_info[5]);
         $v_uname = $userinfo['name'];
         $v_gname = $groupinfo['name'];
     } else {
         $v_uname = '';
         $v_gname = '';
     }
     $v_devmajor = '';
     $v_devminor = '';
     $v_prefix = '';
     $v_binary_data_first = pack("a100a8a8a8a12a12", $v_reduce_filename, $v_perms, $v_uid, $v_gid, $v_size, $v_mtime);
     $v_binary_data_last = pack("a1a100a6a2a32a32a8a8a155a12", $v_typeflag, $v_linkname, $v_magic, $v_version, $v_uname, $v_gname, $v_devmajor, $v_devminor, $v_prefix, '');
     // ----- Calculate the checksum
     $v_checksum = 0;
     // ..... First part of the header
     for ($i = 0; $i < 148; $i++) {
         $v_checksum += ord(substr($v_binary_data_first, $i, 1));
     }
     // ..... Ignore the checksum value and replace it by ' ' (space)
     for ($i = 148; $i < 156; $i++) {
         $v_checksum += ord(' ');
     }
     // ..... Last part of the header
     for ($i = 156, $j = 0; $i < 512; $i++, $j++) {
         $v_checksum += ord(substr($v_binary_data_last, $j, 1));
     }
     // ----- Write the first 148 bytes of the header in the archive
     $this->_writeBlock($v_binary_data_first, 148);
     // ----- Write the calculated checksum
     $v_checksum = sprintf("%06s ", DecOct($v_checksum));
     $v_binary_data = pack("a8", $v_checksum);
     $this->_writeBlock($v_binary_data, 8);
     // ----- Write the last 356 bytes of the header in the archive
     $this->_writeBlock($v_binary_data_last, 356);
     return true;
 }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:69,代码来源:Tar.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP lt函数代码示例发布时间:2022-05-15
下一篇:
PHP lscandir_without_dot函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap