1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace HM\BackUpWordPress; |
4
|
|
|
|
5
|
|
|
/** |
6
|
|
|
* An abstract requirement class, individual requirements should |
7
|
|
|
* extend this class |
8
|
|
|
*/ |
9
|
|
|
abstract class Requirement { |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* @var string |
13
|
|
|
*/ |
14
|
|
|
protected $name = ''; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @return mixed |
18
|
|
|
*/ |
19
|
|
|
protected static function test() {} |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @return mixed |
|
|
|
|
23
|
|
|
*/ |
24
|
|
|
public function name() { |
25
|
|
|
return $this->name; |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @return mixed|string |
|
|
|
|
30
|
|
|
*/ |
31
|
|
|
public function result() { |
32
|
|
|
|
33
|
|
|
$test = $this->test(); |
34
|
|
|
|
35
|
|
|
if ( is_string( $test ) && $test ) |
36
|
|
|
return $test; |
37
|
|
|
|
38
|
|
|
if ( is_bool( $test ) || empty( $test ) ) { |
39
|
|
|
|
40
|
|
|
if ( $test ) { |
41
|
|
|
return 'Yes'; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
return 'No'; |
45
|
|
|
|
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
return var_export( $test, true ); |
49
|
|
|
|
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
public function raw_result() { |
53
|
|
|
return $this->test(); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Class Requirement_Zip_Archive |
60
|
|
|
*/ |
61
|
|
|
class Requirement_Zip_Archive extends Requirement { |
|
|
|
|
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @var string |
65
|
|
|
*/ |
66
|
|
|
var $name = 'ZipArchive'; |
|
|
|
|
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @return bool |
70
|
|
|
*/ |
71
|
|
|
public static function test() { |
72
|
|
|
|
73
|
|
|
if ( class_exists( 'ZipArchive' ) ) { |
|
|
|
|
74
|
|
|
return true; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
return false; |
78
|
|
|
|
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
} |
82
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Zip_Archive', 'PHP' ); |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* Class Requirement_Directory_Iterator_Follow_Symlinks |
86
|
|
|
* |
87
|
|
|
* Tests whether the FOLLOW_SYMLINKS class constant is available on Directory Iterator |
88
|
|
|
*/ |
89
|
|
|
class Requirement_Directory_Iterator_Follow_Symlinks extends Requirement { |
|
|
|
|
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @var string |
93
|
|
|
*/ |
94
|
|
|
var $name = 'DirectoryIterator FOLLOW_SYMLINKS'; |
|
|
|
|
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return bool |
98
|
|
|
*/ |
99
|
|
|
public static function test() { |
100
|
|
|
|
101
|
|
|
if ( defined( 'RecursiveDirectoryIterator::FOLLOW_SYMLINKS' ) ) { |
|
|
|
|
102
|
|
|
return true; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
return false; |
106
|
|
|
|
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
} |
110
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Directory_Iterator_Follow_Symlinks', 'PHP' ); |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Class Requirement_Zip_Command |
114
|
|
|
* |
115
|
|
|
* Tests whether the zip command is available and if it is what path it's available at |
116
|
|
|
*/ |
117
|
|
|
class Requirement_Zip_Command_Path extends Requirement { |
|
|
|
|
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @var string |
121
|
|
|
*/ |
122
|
|
|
var $name = 'zip command'; |
|
|
|
|
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @return string |
|
|
|
|
126
|
|
|
*/ |
127
|
|
|
public static function test() { |
128
|
|
|
|
129
|
|
|
$backup = new Zip_File_Backup_Engine; |
130
|
|
|
|
131
|
|
|
return $backup->get_zip_executable_path(); |
132
|
|
|
|
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
} |
136
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Zip_Command_Path', 'Server' ); |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* Class Requirement_Mysqldump_Command |
140
|
|
|
* |
141
|
|
|
* Tests whether the zip command is available and if it is what path it's available at |
142
|
|
|
*/ |
143
|
|
|
class Requirement_Mysqldump_Command_Path extends Requirement { |
|
|
|
|
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @var string |
147
|
|
|
*/ |
148
|
|
|
var $name = 'mysqldump command'; |
|
|
|
|
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @return string |
|
|
|
|
152
|
|
|
*/ |
153
|
|
|
public static function test() { |
154
|
|
|
|
155
|
|
|
$backup = new Mysqldump_Database_Backup_Engine; |
156
|
|
|
|
157
|
|
|
return $backup->get_mysqldump_executable_path(); |
158
|
|
|
|
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
} |
162
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Mysqldump_Command_Path', 'Server' ); |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* Class Requirement_PHP_Version |
166
|
|
|
*/ |
167
|
|
|
class Requirement_PHP_Version extends Requirement { |
|
|
|
|
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* @var string |
171
|
|
|
*/ |
172
|
|
|
var $name = 'Version'; |
|
|
|
|
173
|
|
|
|
174
|
|
|
/** |
175
|
|
|
* @return string |
176
|
|
|
*/ |
177
|
|
|
public static function test() { |
178
|
|
|
return PHP_VERSION; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
} |
182
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Version', 'PHP' ); |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Class Requirement_Cron_Array |
186
|
|
|
*/ |
187
|
|
|
class Requirement_Cron_Array extends Requirement { |
|
|
|
|
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @var string |
191
|
|
|
*/ |
192
|
|
|
var $name = 'Cron Array'; |
|
|
|
|
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* @return bool|mixed |
196
|
|
|
*/ |
197
|
|
|
public static function test() { |
198
|
|
|
|
199
|
|
|
$cron = get_option( 'cron' ); |
200
|
|
|
|
201
|
|
|
if ( ! $cron ) { |
202
|
|
|
return false; |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
return $cron; |
206
|
|
|
|
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
} |
210
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Cron_Array', 'Site' ); |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* Class Requirement_Cron_Array |
214
|
|
|
*/ |
215
|
|
|
class Requirement_Language extends Requirement { |
|
|
|
|
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* @var string |
219
|
|
|
*/ |
220
|
|
|
var $name = 'Language'; |
|
|
|
|
221
|
|
|
|
222
|
|
|
/** |
223
|
|
|
* @return bool|mixed |
224
|
|
|
*/ |
225
|
|
|
public static function test() { |
226
|
|
|
|
227
|
|
|
// Since 4.0 |
228
|
|
|
$language = get_option( 'WPLANG' ); |
229
|
|
|
|
230
|
|
|
if ( $language ) { |
231
|
|
|
return $language; |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
if ( defined( 'WPLANG' ) && WPLANG ) { |
235
|
|
|
return WPLANG; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
return 'en_US'; |
239
|
|
|
|
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
} |
243
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Language', 'Site' ); |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* Class Requirement_Safe_Mode |
247
|
|
|
*/ |
248
|
|
|
class Requirement_Safe_Mode extends Requirement { |
|
|
|
|
249
|
|
|
|
250
|
|
|
/** |
251
|
|
|
* @var string |
252
|
|
|
*/ |
253
|
|
|
var $name = 'Safe Mode'; |
|
|
|
|
254
|
|
|
|
255
|
|
|
/** |
256
|
|
|
* @return bool |
257
|
|
|
*/ |
258
|
|
|
public static function test() { |
259
|
|
|
return Backup_Utilities::is_safe_mode_on(); |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
} |
263
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Safe_Mode', 'PHP' ); |
264
|
|
|
|
265
|
|
|
/** |
266
|
|
|
* Class Requirement_Shell_Exec |
267
|
|
|
*/ |
268
|
|
|
class Requirement_Proc_Open extends Requirement { |
|
|
|
|
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* @var string |
272
|
|
|
*/ |
273
|
|
|
var $name = 'proc_open'; |
|
|
|
|
274
|
|
|
|
275
|
|
|
/** |
276
|
|
|
* @return bool |
277
|
|
|
*/ |
278
|
|
|
public static function test() { |
279
|
|
|
return function_exists( 'proc_open' ); |
280
|
|
|
} |
281
|
|
|
|
282
|
|
|
} |
283
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Proc_Open', 'PHP' ); |
284
|
|
|
|
285
|
|
|
/** |
286
|
|
|
* Class Requirement_Memory_Limit |
287
|
|
|
*/ |
288
|
|
|
class Requirement_PHP_Memory_Limit extends Requirement { |
|
|
|
|
289
|
|
|
|
290
|
|
|
/** |
291
|
|
|
* @var string |
292
|
|
|
*/ |
293
|
|
|
var $name = 'Memory Limit'; |
|
|
|
|
294
|
|
|
|
295
|
|
|
/** |
296
|
|
|
* @return string |
297
|
|
|
*/ |
298
|
|
|
public static function test() { |
299
|
|
|
return @ini_get( 'memory_limit' ); |
300
|
|
|
} |
301
|
|
|
|
302
|
|
|
} |
303
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Memory_Limit', 'PHP' ); |
304
|
|
|
|
305
|
|
|
/** |
306
|
|
|
* Class Requirement_Backup_Path |
307
|
|
|
*/ |
308
|
|
|
class Requirement_Backup_Path extends Requirement { |
|
|
|
|
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* @var string |
312
|
|
|
*/ |
313
|
|
|
var $name = 'Backup Path'; |
|
|
|
|
314
|
|
|
|
315
|
|
|
/** |
316
|
|
|
* @return string |
317
|
|
|
*/ |
318
|
|
|
public static function test() { |
319
|
|
|
return Path::get_path(); |
320
|
|
|
} |
321
|
|
|
|
322
|
|
|
} |
323
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Backup_Path', 'Site' ); |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* Class Requirement_Backup_Path_Permissions |
327
|
|
|
*/ |
328
|
|
|
class Requirement_Backup_Path_Permissions extends Requirement { |
|
|
|
|
329
|
|
|
|
330
|
|
|
/** |
331
|
|
|
* @var string |
332
|
|
|
*/ |
333
|
|
|
var $name = 'Backup Path Permissions'; |
|
|
|
|
334
|
|
|
|
335
|
|
|
/** |
336
|
|
|
* @return string |
337
|
|
|
*/ |
338
|
|
|
public static function test() { |
339
|
|
|
return substr( sprintf( '%o', fileperms( Path::get_path() ) ), - 4 ); |
340
|
|
|
} |
341
|
|
|
|
342
|
|
|
} |
343
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Backup_Path_Permissions', 'Site' ); |
344
|
|
|
|
345
|
|
|
/** |
346
|
|
|
* Class Requirement_WP_CONTENT_DIR |
347
|
|
|
*/ |
348
|
|
|
class Requirement_WP_CONTENT_DIR extends Requirement { |
|
|
|
|
349
|
|
|
|
350
|
|
|
/** |
351
|
|
|
* @var string |
352
|
|
|
*/ |
353
|
|
|
var $name = 'WP_CONTENT_DIR'; |
|
|
|
|
354
|
|
|
|
355
|
|
|
/** |
356
|
|
|
* @return string |
357
|
|
|
*/ |
358
|
|
|
public static function test() { |
359
|
|
|
return WP_CONTENT_DIR; |
360
|
|
|
} |
361
|
|
|
|
362
|
|
|
} |
363
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_WP_CONTENT_DIR', 'Site' ); |
364
|
|
|
|
365
|
|
|
/** |
366
|
|
|
* Class Requirement_WP_CONTENT_DIR_Permissions |
367
|
|
|
*/ |
368
|
|
|
class Requirement_WP_CONTENT_DIR_Permissions extends Requirement { |
|
|
|
|
369
|
|
|
|
370
|
|
|
/** |
371
|
|
|
* @var string |
372
|
|
|
*/ |
373
|
|
|
var $name = 'WP_CONTENT_DIR Permissions'; |
|
|
|
|
374
|
|
|
|
375
|
|
|
/** |
376
|
|
|
* @return string |
377
|
|
|
*/ |
378
|
|
|
public static function test() { |
379
|
|
|
return substr( sprintf( '%o', fileperms( WP_CONTENT_DIR ) ), - 4 ); |
380
|
|
|
} |
381
|
|
|
|
382
|
|
|
} |
383
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_WP_CONTENT_DIR_Permissions', 'Site' ); |
384
|
|
|
|
385
|
|
|
/** |
386
|
|
|
* Class Requirement_ABSPATH |
387
|
|
|
*/ |
388
|
|
|
class Requirement_ABSPATH extends Requirement { |
|
|
|
|
389
|
|
|
|
390
|
|
|
/** |
391
|
|
|
* @var string |
392
|
|
|
*/ |
393
|
|
|
var $name = 'ABSPATH'; |
|
|
|
|
394
|
|
|
|
395
|
|
|
/** |
396
|
|
|
* @return string |
397
|
|
|
*/ |
398
|
|
|
public static function test() { |
399
|
|
|
return ABSPATH; |
400
|
|
|
} |
401
|
|
|
|
402
|
|
|
} |
403
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_ABSPATH', 'Site' ); |
404
|
|
|
|
405
|
|
|
/** |
406
|
|
|
* Class Requirement_Backup_Root_Path |
407
|
|
|
*/ |
408
|
|
|
class Requirement_Backup_Root_Path extends Requirement { |
|
|
|
|
409
|
|
|
|
410
|
|
|
/** |
411
|
|
|
* @var string |
412
|
|
|
*/ |
413
|
|
|
var $name = 'Site Root Path'; |
|
|
|
|
414
|
|
|
|
415
|
|
|
/** |
416
|
|
|
* @return string |
417
|
|
|
*/ |
418
|
|
|
public static function test() { |
419
|
|
|
return Path::get_root(); |
420
|
|
|
} |
421
|
|
|
|
422
|
|
|
} |
423
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Backup_Root_Path', 'Site' ); |
424
|
|
|
|
425
|
|
|
/** |
426
|
|
|
* Class Requirement_Calculated_Size |
427
|
|
|
*/ |
428
|
|
|
class Requirement_Calculated_Size extends Requirement { |
|
|
|
|
429
|
|
|
|
430
|
|
|
/** |
431
|
|
|
* @var string |
432
|
|
|
*/ |
433
|
|
|
var $name = 'Calculated size of site'; |
|
|
|
|
434
|
|
|
|
435
|
|
|
/** |
436
|
|
|
* @return array |
437
|
|
|
*/ |
438
|
|
|
public static function test() { |
439
|
|
|
|
440
|
|
|
$backup_sizes = array(); |
441
|
|
|
|
442
|
|
|
$schedules = Schedules::get_instance(); |
443
|
|
|
|
444
|
|
|
foreach ( $schedules->get_schedules() as $schedule ) { |
445
|
|
|
|
446
|
|
|
$site_size = new Site_Size( $schedule->get_type(), $schedule->get_excludes() ); |
447
|
|
|
|
448
|
|
|
if ( $site_size->is_site_size_cached() ) { |
449
|
|
|
$backup_sizes[ $schedule->get_type() ] = $site_size->get_formatted_site_size(); |
450
|
|
|
} |
451
|
|
|
|
452
|
|
|
} |
453
|
|
|
|
454
|
|
|
return $backup_sizes; |
455
|
|
|
|
456
|
|
|
} |
457
|
|
|
|
458
|
|
|
} |
459
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Calculated_Size', 'Site' ); |
460
|
|
|
|
461
|
|
|
/** |
462
|
|
|
* Class Requirement_WP_Cron_Test_Response |
463
|
|
|
*/ |
464
|
|
|
class Requirement_WP_Cron_Test extends Requirement { |
|
|
|
|
465
|
|
|
|
466
|
|
|
/** |
467
|
|
|
* @var string |
468
|
|
|
*/ |
469
|
|
|
var $name = 'WP Cron Test Failed'; |
|
|
|
|
470
|
|
|
|
471
|
|
|
/** |
472
|
|
|
* @return mixed |
|
|
|
|
473
|
|
|
*/ |
474
|
|
|
public static function test() { |
475
|
|
|
return (bool) get_option( 'hmbkp_wp_cron_test_failed' ); |
476
|
|
|
} |
477
|
|
|
|
478
|
|
|
} |
479
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_WP_Cron_Test', 'Site' ); |
480
|
|
|
|
481
|
|
|
/** |
482
|
|
|
* Class Requirement_PHP_API |
483
|
|
|
*/ |
484
|
|
|
class Requirement_PHP_API extends Requirement { |
|
|
|
|
485
|
|
|
|
486
|
|
|
/** |
487
|
|
|
* @var string |
488
|
|
|
*/ |
489
|
|
|
var $name = 'Interface'; |
|
|
|
|
490
|
|
|
|
491
|
|
|
/** |
492
|
|
|
* @return string |
493
|
|
|
*/ |
494
|
|
|
public static function test() { |
495
|
|
|
return php_sapi_name(); |
496
|
|
|
} |
497
|
|
|
|
498
|
|
|
} |
499
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_API', 'PHP' ); |
500
|
|
|
|
501
|
|
|
/** |
502
|
|
|
* Class Requirement_Server_Software |
503
|
|
|
*/ |
504
|
|
|
class Requirement_Server_Software extends Requirement { |
|
|
|
|
505
|
|
|
|
506
|
|
|
/** |
507
|
|
|
* @var string |
508
|
|
|
*/ |
509
|
|
|
var $name = 'Server'; |
|
|
|
|
510
|
|
|
|
511
|
|
|
/** |
512
|
|
|
* @return bool |
513
|
|
|
*/ |
514
|
|
|
public static function test() { |
|
|
|
|
515
|
|
|
|
516
|
|
|
if ( ! empty( $_SERVER['SERVER_SOFTWARE'] ) ) |
517
|
|
|
return $_SERVER['SERVER_SOFTWARE']; |
518
|
|
|
|
519
|
|
|
return false; |
520
|
|
|
|
521
|
|
|
} |
522
|
|
|
|
523
|
|
|
} |
524
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Server_Software', 'Server' ); |
525
|
|
|
|
526
|
|
|
/** |
527
|
|
|
* Class Requirement_Server_OS |
528
|
|
|
*/ |
529
|
|
|
class Requirement_Server_OS extends Requirement { |
|
|
|
|
530
|
|
|
|
531
|
|
|
/** |
532
|
|
|
* @var string |
533
|
|
|
*/ |
534
|
|
|
var $name = 'OS'; |
|
|
|
|
535
|
|
|
|
536
|
|
|
/** |
537
|
|
|
* @return string |
538
|
|
|
*/ |
539
|
|
|
public static function test() { |
540
|
|
|
return PHP_OS; |
541
|
|
|
} |
542
|
|
|
|
543
|
|
|
} |
544
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Server_OS', 'Server' ); |
545
|
|
|
|
546
|
|
|
/** |
547
|
|
|
* Class Requirement_PHP_Disable_Functions |
548
|
|
|
*/ |
549
|
|
|
class Requirement_PHP_Disable_Functions extends Requirement { |
|
|
|
|
550
|
|
|
|
551
|
|
|
/** |
552
|
|
|
* @var string |
553
|
|
|
*/ |
554
|
|
|
var $name = 'Disabled Functions'; |
|
|
|
|
555
|
|
|
|
556
|
|
|
/** |
557
|
|
|
* @return string |
558
|
|
|
*/ |
559
|
|
|
public static function test() { |
560
|
|
|
return @ini_get( 'disable_functions' ); |
561
|
|
|
} |
562
|
|
|
|
563
|
|
|
} |
564
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Disable_Functions', 'PHP' ); |
565
|
|
|
|
566
|
|
|
/** |
567
|
|
|
* Class Requirement_PHP_Open_Basedir |
568
|
|
|
*/ |
569
|
|
|
class Requirement_PHP_Open_Basedir extends Requirement { |
|
|
|
|
570
|
|
|
|
571
|
|
|
/** |
572
|
|
|
* @var string |
573
|
|
|
*/ |
574
|
|
|
var $name = 'open_basedir'; |
|
|
|
|
575
|
|
|
|
576
|
|
|
/** |
577
|
|
|
* @return string |
578
|
|
|
*/ |
579
|
|
|
public static function test() { |
580
|
|
|
return @ini_get( 'open_basedir' ); |
581
|
|
|
} |
582
|
|
|
|
583
|
|
|
} |
584
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_PHP_Open_Basedir', 'PHP' ); |
585
|
|
|
|
586
|
|
|
/* CONSTANTS */ |
587
|
|
|
|
588
|
|
|
/** |
589
|
|
|
* Class Requirement_Define_HMBKP_PATH |
590
|
|
|
*/ |
591
|
|
|
class Requirement_Define_HMBKP_PATH extends Requirement { |
|
|
|
|
592
|
|
|
|
593
|
|
|
/** |
594
|
|
|
* @var string |
595
|
|
|
*/ |
596
|
|
|
var $name = 'HMBKP_PATH'; |
|
|
|
|
597
|
|
|
|
598
|
|
|
/** |
599
|
|
|
* @return string |
600
|
|
|
*/ |
601
|
|
|
public static function test() { |
602
|
|
|
return defined( 'HMBKP_PATH' ) ? HMBKP_PATH : ''; |
603
|
|
|
} |
604
|
|
|
|
605
|
|
|
} |
606
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_PATH', 'constants' ); |
607
|
|
|
|
608
|
|
|
/** |
609
|
|
|
* Class Requirement_Define_HMBKP_ROOT |
610
|
|
|
*/ |
611
|
|
|
class Requirement_Define_HMBKP_ROOT extends Requirement { |
|
|
|
|
612
|
|
|
|
613
|
|
|
/** |
614
|
|
|
* @var string |
615
|
|
|
*/ |
616
|
|
|
var $name = 'HMBKP_ROOT'; |
|
|
|
|
617
|
|
|
|
618
|
|
|
/** |
619
|
|
|
* @return string |
620
|
|
|
*/ |
621
|
|
|
public static function test() { |
622
|
|
|
return defined( 'HMBKP_ROOT' ) ? HMBKP_ROOT : ''; |
623
|
|
|
} |
624
|
|
|
|
625
|
|
|
} |
626
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_ROOT', 'constants' ); |
627
|
|
|
|
628
|
|
|
/** |
629
|
|
|
* Class Requirement_Define_HMBKP_MYSQLDUMP_PATH |
630
|
|
|
*/ |
631
|
|
|
class Requirement_Define_HMBKP_MYSQLDUMP_PATH extends Requirement { |
|
|
|
|
632
|
|
|
|
633
|
|
|
/** |
634
|
|
|
* @var string |
635
|
|
|
*/ |
636
|
|
|
var $name = 'HMBKP_MYSQLDUMP_PATH'; |
|
|
|
|
637
|
|
|
|
638
|
|
|
/** |
639
|
|
|
* @return string |
640
|
|
|
*/ |
641
|
|
|
public static function test() { |
642
|
|
|
return defined( 'HMBKP_MYSQLDUMP_PATH' ) ? HMBKP_MYSQLDUMP_PATH : ''; |
643
|
|
|
} |
644
|
|
|
|
645
|
|
|
} |
646
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_MYSQLDUMP_PATH', 'constants' ); |
647
|
|
|
|
648
|
|
|
/** |
649
|
|
|
* Class Requirement_Define_HMBKP_ZIP_PATH |
650
|
|
|
*/ |
651
|
|
|
class Requirement_Define_HMBKP_ZIP_PATH extends Requirement { |
|
|
|
|
652
|
|
|
|
653
|
|
|
/** |
654
|
|
|
* @var string |
655
|
|
|
*/ |
656
|
|
|
var $name = 'HMBKP_ZIP_PATH'; |
|
|
|
|
657
|
|
|
|
658
|
|
|
/** |
659
|
|
|
* @return string |
660
|
|
|
*/ |
661
|
|
|
public static function test() { |
662
|
|
|
return defined( 'HMBKP_ZIP_PATH' ) ? HMBKP_ZIP_PATH : ''; |
663
|
|
|
} |
664
|
|
|
|
665
|
|
|
} |
666
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_ZIP_PATH', 'constants' ); |
667
|
|
|
|
668
|
|
|
/** |
669
|
|
|
* Class Requirement_Define_HMBKP_CAPABILITY |
670
|
|
|
*/ |
671
|
|
|
class Requirement_Define_HMBKP_CAPABILITY extends Requirement { |
|
|
|
|
672
|
|
|
|
673
|
|
|
/** |
674
|
|
|
* @var string |
675
|
|
|
*/ |
676
|
|
|
var $name = 'HMBKP_CAPABILITY'; |
|
|
|
|
677
|
|
|
|
678
|
|
|
/** |
679
|
|
|
* @return string |
680
|
|
|
*/ |
681
|
|
|
public static function test() { |
682
|
|
|
return defined( 'HMBKP_CAPABILITY' ) ? HMBKP_CAPABILITY : ''; |
683
|
|
|
} |
684
|
|
|
|
685
|
|
|
} |
686
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_CAPABILITY', 'constants' ); |
687
|
|
|
|
688
|
|
|
/** |
689
|
|
|
* Class Requirement_Define_HMBKP_EMAIL |
690
|
|
|
*/ |
691
|
|
|
class Requirement_Define_HMBKP_EMAIL extends Requirement { |
|
|
|
|
692
|
|
|
|
693
|
|
|
/** |
694
|
|
|
* @var string |
695
|
|
|
*/ |
696
|
|
|
var $name = 'HMBKP_EMAIL'; |
|
|
|
|
697
|
|
|
|
698
|
|
|
/** |
699
|
|
|
* @return string |
700
|
|
|
*/ |
701
|
|
|
public static function test() { |
702
|
|
|
return defined( 'HMBKP_EMAIL' ) ? HMBKP_EMAIL : ''; |
703
|
|
|
} |
704
|
|
|
|
705
|
|
|
} |
706
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_EMAIL', 'constants' ); |
707
|
|
|
|
708
|
|
|
/** |
709
|
|
|
* Class Requirement_Define_HMBKP_ATTACHMENT_MAX_FILESIZE |
710
|
|
|
*/ |
711
|
|
|
class Requirement_Define_HMBKP_ATTACHMENT_MAX_FILESIZE extends Requirement { |
|
|
|
|
712
|
|
|
|
713
|
|
|
/** |
714
|
|
|
* @var string |
715
|
|
|
*/ |
716
|
|
|
var $name = 'HMBKP_ATTACHMENT_MAX_FILESIZE'; |
|
|
|
|
717
|
|
|
|
718
|
|
|
/** |
719
|
|
|
* @return string |
720
|
|
|
*/ |
721
|
|
|
public static function test() { |
722
|
|
|
return defined( 'HMBKP_ATTACHMENT_MAX_FILESIZE' ) ? HMBKP_ATTACHMENT_MAX_FILESIZE : ''; |
723
|
|
|
} |
724
|
|
|
|
725
|
|
|
} |
726
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_ATTACHMENT_MAX_FILESIZE', 'constants' ); |
727
|
|
|
|
728
|
|
|
/** |
729
|
|
|
* Class Requirement_Define_HMBKP_EXCLUDE |
730
|
|
|
*/ |
731
|
|
|
class Requirement_Define_HMBKP_EXCLUDE extends Requirement { |
|
|
|
|
732
|
|
|
|
733
|
|
|
/** |
734
|
|
|
* @var string |
735
|
|
|
*/ |
736
|
|
|
var $name = 'HMBKP_EXCLUDE'; |
|
|
|
|
737
|
|
|
|
738
|
|
|
/** |
739
|
|
|
* @return string |
740
|
|
|
*/ |
741
|
|
|
public static function test() { |
742
|
|
|
return defined( 'HMBKP_EXCLUDE' ) ? HMBKP_EXCLUDE : ''; |
743
|
|
|
} |
744
|
|
|
|
745
|
|
|
} |
746
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Define_HMBKP_EXCLUDE', 'constants' ); |
747
|
|
|
|
748
|
|
|
class Requirement_Active_Plugins extends Requirement { |
|
|
|
|
749
|
|
|
|
750
|
|
|
var $name = 'Active Plugins'; |
|
|
|
|
751
|
|
|
|
752
|
|
|
public static function test(){ |
|
|
|
|
753
|
|
|
return get_option( 'active_plugins' ); |
754
|
|
|
} |
755
|
|
|
|
756
|
|
|
} |
757
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Active_Plugins', 'Site' ); |
758
|
|
|
|
759
|
|
|
class Requirement_Home_Url extends Requirement { |
|
|
|
|
760
|
|
|
|
761
|
|
|
var $name = 'Home URL'; |
|
|
|
|
762
|
|
|
|
763
|
|
|
public static function test(){ |
|
|
|
|
764
|
|
|
return home_url(); |
765
|
|
|
} |
766
|
|
|
|
767
|
|
|
} |
768
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Home_Url', 'Site' ); |
769
|
|
|
|
770
|
|
|
class Requirement_Site_Url extends Requirement { |
|
|
|
|
771
|
|
|
|
772
|
|
|
var $name = 'Site URL'; |
|
|
|
|
773
|
|
|
|
774
|
|
|
public static function test() { |
|
|
|
|
775
|
|
|
return site_url(); |
776
|
|
|
} |
777
|
|
|
|
778
|
|
|
} |
779
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Site_Url', 'Site' ); |
780
|
|
|
|
781
|
|
|
class Requirement_Plugin_Version extends Requirement { |
|
|
|
|
782
|
|
|
var $name = 'Plugin Version'; |
|
|
|
|
783
|
|
|
|
784
|
|
|
public static function test() { |
|
|
|
|
785
|
|
|
return Plugin::PLUGIN_VERSION; |
786
|
|
|
} |
787
|
|
|
} |
788
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Plugin_Version', 'constants' ); |
789
|
|
|
|
790
|
|
|
class Requirement_Max_Exec extends Requirement { |
|
|
|
|
791
|
|
|
|
792
|
|
|
var $name = 'Max execution time'; |
|
|
|
|
793
|
|
|
|
794
|
|
|
public static function test(){ |
|
|
|
|
795
|
|
|
return @ini_get( 'max_execution_time' ); |
796
|
|
|
} |
797
|
|
|
} |
798
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_Max_Exec', 'PHP' ); |
799
|
|
|
|
800
|
|
|
class Requirement_PDO extends Requirement { |
|
|
|
|
801
|
|
|
|
802
|
|
|
var $name = 'PDO'; |
|
|
|
|
803
|
|
|
|
804
|
|
|
public static function test() { |
805
|
|
|
|
806
|
|
|
if ( class_exists( 'PDO' ) && \PDO::getAvailableDrivers() ) { |
807
|
|
|
return implode( ', ', \PDO::getAvailableDrivers() ); |
808
|
|
|
} |
809
|
|
|
|
810
|
|
|
return false; |
811
|
|
|
|
812
|
|
|
} |
813
|
|
|
} |
814
|
|
|
Requirements::register( 'HM\BackUpWordPress\Requirement_PDO', 'PHP' ); |
815
|
|
|
|
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.