public function step1Action() { $this->view->headTitle('Step 1'); $this->view->headLink()->appendStylesheet("/css/template/table.css"); $sh = new MAL_Util_Shell(); $requirements = array(); $requirements[_r("PHP version greater than 5.3.2")] = array("ACTUAL" => PHP_VERSION, "RESULT" => PHP_VERSION_ID >= 50302); $requirements[_r("PHP mcrypt module installed")] = array("ACTUAL" => extension_loaded("mcrypt") ? _r("OK") : _r("Not installed"), "RESULT" => extension_loaded("mcrypt")); $requirements[_r("PHP ftp module installed")] = array("ACTUAL" => extension_loaded("ftp") ? _r("OK") : _r("Not installed"), "RESULT" => extension_loaded("ftp")); $requirements[_r("PHP Safe mode is disabled")] = array("ACTUAL" => ini_get('safe_mode') ? "safe_mode = " . ini_get('safe_mode') : _r("Not set"), "RESULT" => ini_get('safe_mode') != '1'); $requirements[_r("MySQL installed")] = array("ACTUAL" => extension_loaded("pdo_mysql") ? _r("OK") : _r("Not installed"), "RESULT" => extension_loaded("pdo_mysql")); $sh->Exec("echo test"); $requirements[_r("Permission to run 'exec' function")] = array("ACTUAL" => $sh->getLastOutput() == array("test") ? _r("OK") : _r("Could not run"), "RESULT" => $sh->getLastOutput() == array("test")); $sh->Exec("ssh -v"); $r = $sh->getLastOutput(); $requirements[_r("OpenSSH installed")] = array("ACTUAL" => $r[0], "RESULT" => strpos($r[0], "OpenSSH") !== false); $sh->Exec("git --version"); $r = $sh->getLastOutput(); $requirements[_r("Git installed")] = array("ACTUAL" => $r[0], "RESULT" => strpos($r[0], "git version ") !== false); $requirements[_r("May not work with Suhosin")] = array("ACTUAL" => $this->hasSuhosin() ? _r("Suhosin is enabled") . " - <strong>" . _r("GoDeploy may not function correctly") . "</strong>" : _r("Suhosin not enabled"), "RESULT" => !$this->hasSuhosin(), "NOT_CRITICAL" => true); $cfg_test = APPLICATION_PATH . "/configs/config.ini"; $fh = @fopen($cfg_test, "a+"); $requirements[_r("Config file writable")] = array("ACTUAL" => $cfg_test . " " . _r("is") . " " . ($fh === false ? "<strong>" . _r("not writable") . "</strong>" : _r("writable")), "RESULT" => $fh !== false, "NOT_CRITICAL" => true); if ($fh !== false) { fclose($fh); @unlink($cfg_test); } $cache_test = str_replace("/application", "/gitcache/.test", APPLICATION_PATH); $fh = @fopen($cache_test, "a+"); $requirements[_r("gitcache directory writable")] = array("ACTUAL" => $cache_test . " " . _r("is") . " " . ($fh === false ? "<strong>" . _r("not writable") . "</strong>" : _r("writable")), "RESULT" => $fh !== false); if ($fh !== false) { fclose($fh); @unlink($cache_test); } // Check we've passed everything $passed = true; foreach ($requirements as $rq) { if ($rq["RESULT"] === false && !isset($rq["NOT_CRITICAL"])) { $passed = false; } } $this->view->passed = $passed; $this->view->requirements = $requirements; }
public function Exec($cmd, $noisy = false) { parent::Exec($cmd, $noisy); GD_Debug::Log("GD_Shell cmd: {$cmd}", GD_Debug::DEBUG_FULL); }