| 1 | <?php |
||
| 8 | class Backup_Utilities { |
||
| 9 | |||
| 10 | /** |
||
| 11 | * Checks whether Safe Mode is currently on |
||
| 12 | * |
||
| 13 | * @param string $ini_get_callback By default we use `ini_get` to check for |
||
| 14 | * the Safe Mode setting but this can be |
||
| 15 | * overridden for testing purposes. |
||
| 16 | * |
||
| 17 | * @return boolean Whether Safe Mode is on or off. |
||
| 18 | */ |
||
| 19 | public static function is_safe_mode_on( $ini_get_callback = 'ini_get' ) { |
||
| 20 | |||
| 21 | $safe_mode = @call_user_func( $ini_get_callback, 'safe_mode' ); |
||
| 22 | |||
| 23 | if ( $safe_mode && strtolower( $safe_mode ) !== 'off' ) { |
||
|
1 ignored issue
–
show
|
|||
| 24 | return true; |
||
| 25 | } |
||
| 26 | |||
| 27 | return false; |
||
| 28 | |||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Check whether it's possible to use `exec`. |
||
| 33 | * |
||
| 34 | * @return boolean [description] |
||
| 35 | */ |
||
| 36 | public static function is_exec_available() { |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Check whether a PHP function has been disabled. |
||
| 67 | * |
||
| 68 | * @param string $function The function you want to test for. |
||
| 69 | * @param string $ini_get_callback By default we check with ini_get, but |
||
| 70 | * it's possible to overridde this for |
||
| 71 | * testing purposes. |
||
| 72 | * |
||
| 73 | * @return boolean Whether the function is disabled or not. |
||
| 74 | */ |
||
| 75 | public static function is_function_disabled( $function, $ini_get_callback = 'ini_get' ) { |
||
| 90 | |||
| 91 | /** |
||
| 92 | * Attempt to work out path to a cli executable. |
||
| 93 | * |
||
| 94 | * @param array $paths An array of paths to check against. |
||
| 95 | * |
||
| 96 | * @return string|false The path to the executable. |
||
| 97 | */ |
||
| 98 | public static function get_executable_path( $paths ) { |
||
| 128 | |||
| 129 | } |
||
| 130 |