當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。