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


PHP vfsStream::umask方法代码示例

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


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

示例1: __construct

 /**
  * constructor
  *
  * @param  string  $name
  * @param  int     $permissions  optional
  */
 public function __construct($name, $permissions = null)
 {
     $this->name = $name;
     $time = time();
     if (null === $permissions) {
         $permissions = $this->getDefaultPermissions() & ~vfsStream::umask();
     }
     $this->lastAccessed = $time;
     $this->lastAttributeModified = $time;
     $this->lastModified = $time;
     $this->permissions = $permissions;
     $this->user = vfsStream::getCurrentUser();
     $this->group = vfsStream::getCurrentGroup();
 }
开发者ID:alexschwarz89,项目名称:Barzahlen-OXID-4.7,代码行数:20,代码来源:vfsStreamAbstractContent.php

示例2: mkdir

 /**
  * creates a new directory
  *
  * @param   string  $path
  * @param   int     $mode
  * @param   int     $options
  * @return  bool
  */
 public function mkdir($path, $mode, $options)
 {
     $umask = vfsStream::umask();
     if (0 < $umask) {
         $permissions = $mode & ~$umask;
     } else {
         $permissions = $mode;
     }
     $path = $this->resolvePath(vfsStream::path($path));
     if (null !== $this->getContent($path)) {
         trigger_error('mkdir(): Path vfs://' . $path . ' exists', E_USER_WARNING);
         return false;
     }
     if (null === self::$root) {
         self::$root = vfsStream::newDirectory($path, $permissions);
         return true;
     }
     $maxDepth = count(explode('/', $path));
     $names = $this->splitPath($path);
     $newDirs = $names['basename'];
     $dir = null;
     $i = 0;
     while ($dir === null && $i < $maxDepth) {
         $dir = $this->getContent($names['dirname']);
         $names = $this->splitPath($names['dirname']);
         if (null == $dir) {
             $newDirs = $names['basename'] . '/' . $newDirs;
         }
         $i++;
     }
     if (null === $dir || $dir->getType() !== vfsStreamContent::TYPE_DIR || $dir->isWritable(vfsStream::getCurrentUser(), vfsStream::getCurrentGroup()) === false) {
         return false;
     }
     $recursive = (STREAM_MKDIR_RECURSIVE & $options) !== 0 ? true : false;
     if (strpos($newDirs, '/') !== false && false === $recursive) {
         return false;
     }
     vfsStream::newDirectory($newDirs, $permissions)->at($dir);
     return true;
 }
开发者ID:oalkhanishvili,项目名称:track2,代码行数:48,代码来源:vfsStreamWrapper.php

示例3: umaskSettingShouldBeRespectedBySetup

 /**
  * @test
  */
 public function umaskSettingShouldBeRespectedBySetup()
 {
     vfsStream::umask(022);
     $root = vfsStream::setup();
     $this->assertEquals(0755, $root->getPermissions());
 }
开发者ID:oalkhanishvili,项目名称:track2,代码行数:9,代码来源:vfsStreamUmaskTestCase.php

示例4: umask

 /**
  * sets new umask setting and returns previous umask setting
  *
  * If no value is given only the current umask setting is returned.
  *
  * @param   int  $umask  optional
  * @return  int
  * @since   0.8.0
  */
 public static function umask($umask = null)
 {
     $oldUmask = self::$umask;
     if (null !== $umask) {
         self::$umask = $umask;
     }
     return $oldUmask;
 }
开发者ID:clickalicious,项目名称:doozr,代码行数:17,代码来源:vfsStream.php


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