← All changes
|
includes/helpers/Check_Requirements/Check_Requirements.php
+31
-0
51.1.2
→
51.1.86
View file →
| @@ -1,0 +1,31 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace King_Addons; | |
| 4 | + | |
| 5 | +if (!defined('ABSPATH')) { | |
| 6 | + exit; // Exit if accessed directly. | |
| 7 | +} | |
| 8 | + | |
| 9 | +final class Check_Requirements | |
| 10 | +{ | |
| 11 | + public static function check_import_requirements(): array | |
| 12 | + { | |
| 13 | + $requirements = [ | |
| 14 | + 'memory' => (int)ini_get('memory_limit') >= 128, // Check if memory is at least 128MB | |
| 15 | +// 'zip' => class_exists('ZipArchive'), | |
| 16 | + // Add more checks if necessary | |
| 17 | + ]; | |
| 18 | + | |
| 19 | + $errors = []; | |
| 20 | + | |
| 21 | + if (!$requirements['zip']) { | |
| 22 | + $errors[] = 'ZIP module is not enabled on this server.'; | |
| 23 | + } | |
| 24 | + | |
| 25 | + if (!$requirements['memory']) { | |
| 26 | + $errors[] = 'Memory limit is less than 128MB.'; | |
| 27 | + } | |
| 28 | + | |
| 29 | + return $errors; | |
| 30 | + } | |
| 31 | +} | |