/usr/share/php/Icewind/SMB/NativeFileInfo.php is in php-smb 1.0.5-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | <?php
/**
* Copyright (c) 2014 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Licensed under the MIT license:
* http://opensource.org/licenses/MIT
*/
namespace Icewind\SMB;
class NativeFileInfo implements IFileInfo {
const MODE_FILE = 0100000;
/**
* @var string
*/
protected $path;
/**
* @var string
*/
protected $name;
/**
* @var \Icewind\SMB\NativeShare
*/
protected $share;
/**
* @var array | null
*/
protected $statCache;
/**
* @var int
*/
protected $modeCache;
/**
* @param \Icewind\SMB\NativeShare $share
* @param string $path
* @param string $name
* @param array $stat
*/
public function __construct($share, $path, $name, $stat = null) {
$this->share = $share;
$this->path = $path;
$this->name = $name;
$this->statCache = $stat;
}
/**
* @return string
*/
public function getPath() {
return $this->path;
}
/**
* @return string
*/
public function getName() {
return $this->name;
}
/**
* @return array
*/
protected function stat() {
if (!$this->statCache) {
$this->statCache = $this->share->getStat($this->getPath());
}
return $this->statCache;
}
/**
* @return int
*/
public function getSize() {
$stat = $this->stat();
return $stat['size'];
}
/**
* @return int
*/
public function getMTime() {
$stat = $this->stat();
return $stat['mtime'];
}
/**
* @return bool
*/
public function isDirectory() {
$stat = $this->stat();
return !($stat['mode'] & self::MODE_FILE);
}
/**
* @return int
*/
protected function getMode() {
if (!$this->modeCache) {
$attribute = $this->share->getAttribute($this->path, 'system.dos_attr.mode');
// parse hex string
$this->modeCache = (int)hexdec(substr($attribute, 2));
}
return $this->modeCache;
}
/**
* @return bool
*/
public function isReadOnly() {
$mode = $this->getMode();
return (bool)($mode & FileInfo::MODE_READONLY);
}
/**
* @return bool
*/
public function isHidden() {
$mode = $this->getMode();
return (bool)($mode & FileInfo::MODE_HIDDEN);
}
/**
* @return bool
*/
public function isSystem() {
$mode = $this->getMode();
return (bool)($mode & FileInfo::MODE_SYSTEM);
}
/**
* @return bool
*/
public function isArchived() {
$mode = $this->getMode();
return (bool)($mode & FileInfo::MODE_ARCHIVE);
}
}
|