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