| 1487 | | ?> |
| 1488 | | No newline at end of file |
| | 1487 | function wp_checkmem() { |
| | 1488 | $memory_limit = ini_get("memory_limit"); |
| | 1489 | $memory_limit_bytes = trim($memory_limit); |
| | 1490 | $last = strtolower($memory_limit_bytes{strlen($memory_limit_bytes)-1}); |
| | 1491 | switch($last) { |
| | 1492 | // The 'G' modifier is available since PHP 5.1.0 |
| | 1493 | case 'g': |
| | 1494 | $memory_limit_bytes *= 1024; |
| | 1495 | case 'm': |
| | 1496 | $memory_limit_bytes *= 1024; |
| | 1497 | case 'k': |
| | 1498 | $memory_limit_bytes *= 1024; |
| | 1499 | } |
| | 1500 | if($memory_limit_bytes < 8388608) { |
| | 1501 | return ("Warning: Memory limit is $memory_limit. The minimum recommended is 8M.<br/>"); |
| | 1502 | } |
| | 1503 | } |
| | 1504 | |
| | 1505 | function wp_checkfunctions () { |
| | 1506 | $functions = array( |
| | 1507 | "dir" => __("WordPress will not be able to list the contents of directories."), |
| | 1508 | "fopen" => __("We may have to use CURL instead of fopen when checking remote resources."), |
| | 1509 | "curl_init" => __("We may have to use fopen instead of CURL when checking remote resources.") |
| | 1510 | ); |
| | 1511 | foreach($functions as $f=>$r) { |
| | 1512 | if(!function_exists($f)){ |
| | 1513 | $t .= __("Warning: $f() has been disabled. $r<br/>"); |
| | 1514 | } |
| | 1515 | } |
| | 1516 | return $t; |
| | 1517 | } |
| | 1518 | |
| | 1519 | function wp_preflightchecks() { |
| | 1520 | $t = wp_checkmem(); |
| | 1521 | $t .= wp_checkfunctions(); |
| | 1522 | if ($t <> "") { |
| | 1523 | echo "<h1>". __('Pre-flight checks') ."</h1>"; |
| | 1524 | _e('To resolve these issues you may need to adjust your PHP environment. Please contact your system administrator if necessary.'); |
| | 1525 | echo "<div class='preflightchecks'>$t</div>"; |
| | 1526 | } |
| | 1527 | } |
| | 1528 | ?> |