PluginProbe ʕ •ᴥ•ʔ
JetBackup – Backup, Restore & Migrate / trunk
JetBackup – Backup, Restore & Migrate vtrunk
3.1.22.3 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.8.1 1.4.9 1.5.0 1.5.1 1.5.1.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.6.0 1.6.10 1.6.11 1.6.12 1.6.13 1.6.15 1.6.5.1 1.6.8.8 1.6.9 1.6.9.1 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7.5 2.0.8.7 2.0.9.11 2.0.9.14 2.0.9.15 2.0.9.6 2.0.9.7 2.0.9.9 3.1.10.7 3.1.11.1 3.1.12.3 3.1.13.4 3.1.14.17 3.1.15.4 3.1.16.1 3.1.17.5 3.1.18.10 3.1.18.8 3.1.18.9 3.1.19.8 3.1.20.3 3.1.21.3 3.1.7.9 3.1.9.2 trunk 1.1.90 1.1.91 1.2.0 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2
backup / src / JetBackup / Archive / Scan / ScanFile.php
backup / src / JetBackup / Archive / Scan Last commit date
.htaccess 1 year ago Scan.php 1 year ago ScanFile.php 9 months ago index.html 1 year ago web.config 1 year ago
ScanFile.php
79 lines
1 <?php
2 /*
3 *
4 * JetBackup @ package
5 * Created By Idan Ben-Ezra
6 *
7 * Copyrights @ JetApps
8 * https://www.jetapps.com
9 *
10 **/
11 namespace JetBackup\Archive\Scan;
12
13 use JetBackup\Entities\Util;
14 use JetBackup\Exception\ArchiveException;
15 use JetBackup\JetBackup;
16
17 class ScanFile {
18
19 const IFMT = 0170000;
20 const IFDIR = 0040000;
21 const IFCHR = 0020000;
22 const IFBLK = 0060000;
23 const IFREG = 0100000;
24 const IFIFO = 0010000;
25 const IFLNK = 0120000;
26 const IFSOCK = 0140000;
27
28 private $_filename;
29 private $_path;
30 private $_clean_path;
31 private $_source;
32 private $_stat;
33
34 public function __construct($directory, $filename, $source) {
35 $this->_path = $directory;
36 $this->_filename = $filename;
37 $this->_source = $source;
38 clearstatcache(true, $directory . JetBackup::SEP . $filename);
39 $this->_stat = @lstat($directory . JetBackup::SEP . $filename);
40 if($this->_stat === false) throw new ArchiveException("Failed fetching information for file '$directory/$filename'");
41 }
42
43 public function getFilename() { return $this->_filename; }
44 public function getPath() { return $this->_path; }
45 public function getFullPath() {
46
47 if (!isset($this->_clean_path)) {
48 $dirSeparator = preg_quote(JetBackup::SEP, '#');
49 $this->_clean_path = preg_replace("#" . $dirSeparator . "+#", JetBackup::SEP, $this->getPath() . JetBackup::SEP . $this->getFilename());
50 }
51
52 return $this->_clean_path;
53 }
54 public function getCleanPath() { return substr($this->getFullPath(), strlen($this->_source)); }
55 public function getStat() { return $this->_stat; }
56 public function getMode() { return $this->_stat['mode']; }
57 public function getSize() { return $this->_stat['size']; }
58 public function getModifyTime() { return $this->_stat['mtime']; }
59 public function getGroupId() { return $this->_stat['gid']; }
60 public function getOwnerId() { return $this->_stat['uid']; }
61 public function getGroup() {
62 $group = Util::getgrgid($this->getGroupId());
63 return $group ? $group['name'] : '';
64 }
65 public function getOwner() {
66 $user = Util::getpwuid($this->getOwnerId());
67 return $user ? $user['name'] : '';
68 }
69
70 public function isDir() { return ($this->getMode() & self::IFMT) == self::IFDIR; }
71 public function isFile() { return ($this->getMode() & self::IFMT) == self::IFREG; }
72 public function isLink() { return ($this->getMode() & self::IFMT) == self::IFLNK; }
73 public function isBlockDevice() { return ($this->getMode() & self::IFMT) == self::IFBLK; }
74 public function isCharacterDevice() { return ($this->getMode() & self::IFMT) == self::IFCHR; }
75 public function isFifo() { return ($this->getMode() & self::IFMT) == self::IFIFO; }
76 public function isSocket() { return ($this->getMode() & self::IFMT) == self::IFSOCK; }
77
78 }
79