*/
private $checks;
+ /**
+ * @var string The path to the PHP binary
+ */
+ private $phppath = null;
+
/**
* Returns all checks made
*
return $this->checks;
}
+ /**
+ * Returns the PHP path
+ *
+ * @return string the PHP Path
+ */
+ public function getPHPPath()
+ {
+ // if not set, determine the PHP path
+ if (!isset($this->phppath)) {
+ $this->checkPHP();
+ $this->resetChecks();
+ }
+
+ return $this->phppath;
+ }
+
/**
* Resets all checks
*/
*/
public function checkPHP($phppath = null, $required = false)
{
- $passed = $passed2 = $passed3 = false;
- if (isset($phppath)) {
- $passed = file_exists($phppath);
- } else {
- $phppath = trim(shell_exec('which php'));
+ $passed = false;
+ $passed2 = false;
+ $passed3 = false;
+
+ if (!isset($phppath)) {
+ $phppath = 'php';
+ }
+
+ $passed = file_exists($phppath);
+ if (!$passed) {
+ $phppath = trim(shell_exec('which ' . $phppath));
$passed = strlen($phppath);
}
$this->addCheck(L10n::t('PHP cli binary'), $passed2, true, $help);
} else {
// return if it was required
- return $required;
+ return !$required;
}
if ($passed2) {
$str = autoname(8);
- $cmd = "$phppath testargs.php $str";
+ $cmd = "$phppath util/testargs.php $str";
$result = trim(shell_exec($cmd));
$passed3 = $result == $str;
$help = "";
}
if (DBA::connected()) {
- if (DBA::count('user') > 0) {
+ if (DBStructure::existsTable('user')) {
$this->addCheck(L10n::t('Database already in use.'), false, true, '');
return false;