public function test_remove_default_command_path() { $paths = $this->paths; $paths[] = $path = trim(shell_exec('which mysql ' . ignore_stderr())); if (!$path) { $this->markTestSkipped('Couldn\'t find mysql'); } unset($paths['mysql']); shuffle($paths); $this->assertEquals($path, Backup_Utilities::get_executable_path($paths)); }
/** * Calculate the path to the zip executable. * * The executable path can be overridden using either the `HMBKP_ZIP_PATH` * Constant or the `hmbkp_zip_executable_path` filter. * * If neither of those are set then we fallback to checking a number of * common locations. * * @return string|false The path to the executable or false. */ public function get_zip_executable_path() { if (defined('HMBKP_ZIP_PATH')) { return HMBKP_ZIP_PATH; } /** * Allow the executable path to be set via a filter * * @param string The path to the zip executable */ $this->zip_executable_path = apply_filters('hmbkp_zip_executable_path', ''); if (!$this->zip_executable_path) { // List of possible zip locations $paths = array('zip', '/usr/bin/zip', '/opt/local/bin/zip'); $this->zip_executable_path = Backup_Utilities::get_executable_path($paths); } return $this->zip_executable_path; }