@@ -3,31 +3,31 @@ discard block |
||
3 | 3 | class XCloner_Requirements |
4 | 4 | { |
5 | 5 | |
6 | - var $min_php_version = "5.4.0"; |
|
7 | - var $safe_mode = "Off"; |
|
6 | + var $min_php_version = "5.4.0"; |
|
7 | + var $safe_mode = "Off"; |
|
8 | 8 | |
9 | 9 | private $xcloner_settings; |
10 | 10 | |
11 | 11 | public function __construct() |
12 | 12 | { |
13 | - $this->xcloner_settings = new Xcloner_Settings(); |
|
13 | + $this->xcloner_settings = new Xcloner_Settings(); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | public function check_backup_ready_status() |
17 | 17 | { |
18 | - if(!$this->check_min_php_version(1)) |
|
18 | + if (!$this->check_min_php_version(1)) |
|
19 | 19 | return false; |
20 | 20 | |
21 | - if(!$this->check_safe_mode(1)) |
|
21 | + if (!$this->check_safe_mode(1)) |
|
22 | 22 | return false; |
23 | 23 | |
24 | - if(!$this->check_xcloner_start_path(1)) |
|
24 | + if (!$this->check_xcloner_start_path(1)) |
|
25 | 25 | return false; |
26 | 26 | |
27 | - if(!$this->check_xcloner_store_path(1)) |
|
27 | + if (!$this->check_xcloner_store_path(1)) |
|
28 | 28 | return false; |
29 | 29 | |
30 | - if(!$this->check_xcloner_tmp_path(1)) |
|
30 | + if (!$this->check_xcloner_tmp_path(1)) |
|
31 | 31 | return false; |
32 | 32 | |
33 | 33 | return true; |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | public function check_min_php_version($return_bool = 0) |
42 | 42 | { |
43 | 43 | |
44 | - if($return_bool == 1) |
|
44 | + if ($return_bool == 1) |
|
45 | 45 | { |
46 | - if(version_compare(phpversion(), $this->min_php_version, '<')) |
|
46 | + if (version_compare(phpversion(), $this->min_php_version, '<')) |
|
47 | 47 | return false; |
48 | 48 | else |
49 | 49 | return true; |
@@ -52,31 +52,31 @@ discard block |
||
52 | 52 | return phpversion(); |
53 | 53 | } |
54 | 54 | |
55 | - public function check_safe_mode($return_bool=0) |
|
55 | + public function check_safe_mode($return_bool = 0) |
|
56 | 56 | { |
57 | 57 | $safe_mode = "Off"; |
58 | 58 | |
59 | - if($return_bool) |
|
59 | + if ($return_bool) |
|
60 | 60 | { |
61 | - if( ini_get('safe_mode') ) |
|
61 | + if (ini_get('safe_mode')) |
|
62 | 62 | return false; |
63 | 63 | else |
64 | 64 | return true; |
65 | 65 | } |
66 | 66 | |
67 | - if( ini_get('safe_mode') ) |
|
67 | + if (ini_get('safe_mode')) |
|
68 | 68 | $safe_mode = "On"; |
69 | 69 | |
70 | 70 | return $safe_mode; |
71 | 71 | } |
72 | 72 | |
73 | - public function check_xcloner_start_path($return_bool=0) |
|
73 | + public function check_xcloner_start_path($return_bool = 0) |
|
74 | 74 | { |
75 | 75 | $path = $this->xcloner_settings->get_xcloner_start_path(); |
76 | 76 | |
77 | - if($return_bool) |
|
77 | + if ($return_bool) |
|
78 | 78 | { |
79 | - if(!file_exists($path)) |
|
79 | + if (!file_exists($path)) |
|
80 | 80 | return false; |
81 | 81 | |
82 | 82 | return is_readable($path); |
@@ -85,16 +85,16 @@ discard block |
||
85 | 85 | return $path; |
86 | 86 | } |
87 | 87 | |
88 | - public function check_xcloner_tmp_path($return_bool=0) |
|
88 | + public function check_xcloner_tmp_path($return_bool = 0) |
|
89 | 89 | { |
90 | 90 | $path = $this->xcloner_settings->get_xcloner_tmp_path(); |
91 | 91 | |
92 | - if($return_bool) |
|
92 | + if ($return_bool) |
|
93 | 93 | { |
94 | - if(!file_exists($path)) |
|
94 | + if (!file_exists($path)) |
|
95 | 95 | return false; |
96 | 96 | |
97 | - if(!is_writeable($path)) |
|
97 | + if (!is_writeable($path)) |
|
98 | 98 | @chmod($path, 0777); |
99 | 99 | |
100 | 100 | return is_writeable($path); |
@@ -103,16 +103,16 @@ discard block |
||
103 | 103 | return $path; |
104 | 104 | } |
105 | 105 | |
106 | - public function check_xcloner_store_path($return_bool=0) |
|
106 | + public function check_xcloner_store_path($return_bool = 0) |
|
107 | 107 | { |
108 | 108 | $path = $this->xcloner_settings->get_xcloner_store_path(); |
109 | 109 | |
110 | - if($return_bool) |
|
110 | + if ($return_bool) |
|
111 | 111 | { |
112 | - if(!file_exists($path)) |
|
112 | + if (!file_exists($path)) |
|
113 | 113 | return false; |
114 | 114 | |
115 | - if(!is_writeable($path)) |
|
115 | + if (!is_writeable($path)) |
|
116 | 116 | @chmod($path, 0777); |
117 | 117 | |
118 | 118 | return is_writeable($path); |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | |
134 | 134 | public function get_open_basedir() |
135 | 135 | { |
136 | - $open_basedir = ini_get('open_basedir'); |
|
136 | + $open_basedir = ini_get('open_basedir'); |
|
137 | 137 | |
138 | - if(!$open_basedir) |
|
138 | + if (!$open_basedir) |
|
139 | 139 | $open_basedir = "none"; |
140 | 140 | return $open_basedir; |
141 | 141 | } |
@@ -149,14 +149,14 @@ discard block |
||
149 | 149 | $unit_list = array('B', 'KB', 'MB', 'GB', 'PB'); |
150 | 150 | |
151 | 151 | if ($bytes == 0) { |
152 | - return $bytes . ' ' . $unit_list[0]; |
|
152 | + return $bytes.' '.$unit_list[0]; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | $unit_count = count($unit_list); |
156 | 156 | for ($i = $unit_count - 1; $i >= 0; $i--) { |
157 | 157 | $power = $i * 10; |
158 | 158 | if (($bytes >> $power) >= 1) |
159 | - return round($bytes / (1 << $power), $decimals) . ' ' . $unit_list[$i]; |
|
159 | + return round($bytes / (1 << $power), $decimals).' '.$unit_list[$i]; |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | } |