PluginProbe ʕ •ᴥ•ʔ
JetBackup – Backup, Restore & Migrate / 2.0.3
JetBackup – Backup, Restore & Migrate v2.0.3
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 / com / lib / BackupGuard / Core / SGBGArchiveHelper.php
backup / com / lib / BackupGuard / Core Last commit date
ISGArchiveDelegate.php 3 years ago SGBGArchive.php 3 years ago SGBGArchiveCdr.php 3 years ago SGBGArchiveHelper.php 3 years ago SGBGCache.php 3 years ago SGBGCacheableFile.php 3 years ago SGBGDirectoryTreeFile.php 3 years ago SGBGFile.php 3 years ago SGBGFileHelper.php 3 years ago SGBGJsonFile.php 3 years ago SGBGLog.php 3 years ago SGBGReloader.php 3 years ago SGBGStateFile.php 3 years ago SGBGTask.php 3 years ago
SGBGArchiveHelper.php
88 lines
1 <?php
2
3 class SGBGArchiveHelper
4 {
5 public static function packToLittleEndian($value, $size = 4)
6 {
7 if (is_int($value)) {
8 $size *= 2; //2 characters for each byte
9 $value = str_pad(dechex($value), $size, '0', STR_PAD_LEFT);
10 return strrev(pack('H'.$size, $value));
11 }
12
13 $hex = str_pad($value->toHex(), 16, '0', STR_PAD_LEFT);
14
15 $high = substr($hex, 0, 8);
16 $low = substr($hex, 8, 8);
17
18 $high = strrev(pack('H8', $high));
19 $low = strrev(pack('H8', $low));
20
21 return $low.$high;
22 }
23
24 public static function unpackLittleEndian($data, $size)
25 {
26 $size *= 2; //2 characters for each byte
27
28 $data = unpack('H'.$size, strrev($data));
29 return $data[1];
30 }
31
32 public static function createPath($path)
33 {
34 if (is_dir($path)) {
35 return true;
36 }
37
38 $prevPath = substr($path, 0, strrpos($path, '/', -2) + 1);
39 $return = self::createPath($prevPath);
40 if ($return && is_writable($prevPath)) {
41 if (!@mkdir($path)) {
42 return false;
43 }
44
45 @chmod($path, 0755);
46 return true;
47 }
48
49 return false;
50 }
51
52 public static function realFilesize($filename)
53 {
54 if (is_dir($filename)) {
55 return 0;
56 }
57
58 $fp = fopen($filename, 'r');
59 $return = false;
60 if (is_resource($fp)) {
61 if (PHP_INT_SIZE < 8) { // 32 bit
62 if (0 === fseek($fp, 0, SEEK_END)) {
63 $return = 0.0;
64 $step = 0x7FFFFFFF;
65 while ($step > 0) {
66 if (0 === fseek($fp, - $step, SEEK_CUR)) {
67 $return += floatval($step);
68 }
69 else {
70 $step >>= 1;
71 }
72 }
73 }
74 }
75 else if (0 === fseek($fp, 0, SEEK_END)) { // 64 bit
76 $return = ftell($fp);
77 }
78 }
79
80 return $return;
81 }
82
83 public static function is_dir_empty($dir) {
84 if (!is_readable($dir)) return null;
85 return (count(scandir($dir)) == 2);
86 }
87 }
88