- many more checks during installation process

This commit is contained in:
steinm 2011-10-26 07:30:51 +00:00
parent cb9710c08f
commit 16eeb9bde8

View File

@ -680,7 +680,7 @@ class Settings { /* {{{ */
*
* @return array
*/
function check() { /* {{{ */
function check($minversion) { /* {{{ */
// suggestion rootdir
if (file_exists("../inc/inc.Settings.php"))
$rootDir = realpath ("../inc/inc.Settings.php");
@ -700,6 +700,7 @@ class Settings { /* {{{ */
if (!file_exists($this->_rootDir ."inc/inc.Settings.php")) {
$result["rootDir"] = array(
"status" => "notfound",
"type" => "error",
"currentvalue" => $this->_rootDir,
"suggestionvalue" => $rootDir
);
@ -711,6 +712,7 @@ class Settings { /* {{{ */
if (!file_exists($this->_coreDir ."Core.php")) {
$result["coreDir"] = array(
"status" => "notfound",
"type" => "error",
"currentvalue" => $this->_coreDir,
"suggestionvalue" => $rootDir
);
@ -720,6 +722,7 @@ class Settings { /* {{{ */
if(!$found) {
$result["coreDir"] = array(
"status" => "notfound",
"type" => "error",
"currentvalue" => $this->_coreDir,
"suggestionvalue" => $rootDir
);
@ -732,6 +735,7 @@ class Settings { /* {{{ */
if (strpos($tmp, $this->_httpRoot) === false) {
$result["httpRoot"] = array(
"status" => "notfound",
"type" => "error",
"currentvalue" => $this->_httpRoot,
"suggestionvalue" => $tmp
);
@ -742,12 +746,14 @@ class Settings { /* {{{ */
if (file_exists($rootDir.'data/')) {
$result["contentDir"] = array(
"status" => "notfound",
"type" => "error",
"currentvalue" => $this->_contentDir,
"suggestionvalue" => $rootDir . 'data/'
);
} else {
$result["contentDir"] = array(
"status" => "notfound",
"type" => "error",
"currentvalue" => $this->_contentDir,
"suggestion" => "createdirectory"
);
@ -775,6 +781,7 @@ class Settings { /* {{{ */
if (!is_null($errorMsgPerms)) {
$result["contentDir"] = array(
"status" => "perms",
"type" => "error",
"currentvalue" => $this->_contentDir,
"systemerror" => $errorMsgPerms
);
@ -785,6 +792,7 @@ class Settings { /* {{{ */
if (!file_exists($this->_stagingDir)) {
$result["stagingDir"] = array(
"status" => "notfound",
"type" => "error",
"currentvalue" => $this->_stagingDir,
"suggestionvalue" => $this->_contentDir . 'staging/'
);
@ -794,6 +802,7 @@ class Settings { /* {{{ */
if (!file_exists($this->_luceneDir)) {
$result["luceneDir"] = array(
"status" => "notfound",
"type" => "error",
"currentvalue" => $this->_luceneDir,
"suggestionvalue" => $this->_contentDir . 'lucene/'
);
@ -807,12 +816,14 @@ class Settings { /* {{{ */
if (file_exists($rootDir."adodb/adodb.inc.php")) {
$result["ADOdbPath"] = array(
"status" => "notfound",
"type" => "error",
"currentvalue" => $this->_ADOdbPath,
"suggestionvalue" => $rootDir
);
} else {
$result["ADOdbPath"] = array(
"status" => "notfound",
"type" => "error",
"currentvalue" => $this->_ADOdbPath,
"suggestion" => "installADOdb"
);
@ -824,6 +835,7 @@ class Settings { /* {{{ */
$bCheckDB = false;
$result["ADOdbPath"] = array(
"status" => "notfound",
"type" => "error",
"currentvalue" => $this->_ADOdbPath,
"suggestion" => "installADOdb"
);
@ -839,6 +851,7 @@ class Settings { /* {{{ */
if (!$connTmp) {
$result["dbDriver"] = array(
"status" => "notfound",
"type" => "error",
"currentvalue" => $this->_dbDriver,
"suggestionvalue" => "mysql"
);
@ -848,9 +861,42 @@ class Settings { /* {{{ */
{
$result["dbDatabase"] = array(
"status" => "error",
"type" => "error",
"currentvalue" => '[host, user, database] -> [' . $this->_dbHostname . ',' . $this->_dbUser . ',' . $this->_dbDatabase .']',
"systemerror" => $connTmp->ErrorMsg()
);
} else {
/* Check if there wasn't a previous error while searching for
* LetoDMS_Core.
*/
if(!isset($result["coreDir"])) {
/* Instanciate LetoDMS_Core to check version */
if(!empty($this->_coreDir))
require_once($this->_coreDir.'/Core.php');
else
require_once('LetoDMS/Core.php');
$tmpcore = new LetoDMS_Core_DMS(null, $this->_contentDir);
$db = new LetoDMS_Core_DatabaseAccess($this->_dbDriver, $this->_dbHostname, $this->_dbUser, $this->_dbPass, $this->_dbDatabase);
if(!$db->connect()) {
$result["dbDatabase"] = array(
"status" => "error",
"type" => "error",
"currentvalue" => '[host, user, database] -> [' . $this->_dbHostname . ',' . $this->_dbUser . ',' . $this->_dbDatabase .']',
"systemerror" => $connTmp->ErrorMsg()
);
} else {
$dms = new LetoDMS_Core_DMS($db, $this->_contentDir.$this->_contentOffsetDir);
if(!$dms->checkVersion()) {
$result["dbVersion"] = array(
"status" => "error",
"type" => "error",
"currentvalue" => $dms->version,
"suggestion" => 'updateDatabase'
);
}
}
}
}
$connTmp->Disconnect();
@ -858,6 +904,7 @@ class Settings { /* {{{ */
} catch(Exception $e) {
$result["dbDatabase"] = array(
"status" => "error",
"type" => "error",
"currentvalue" => '[host, user, database] -> [' . $settings->_dbHostname . ',' . $settings->_dbUser . ',' . $settings->_dbDatabase .']',
"systemerror" => $e->getMessage()
);
@ -883,6 +930,7 @@ class Settings { /* {{{ */
if (!in_array("mod_rewrite", $loaded_extensions)) {
$result["apache_mod_rewrite"] = array(
"status" => "notfound",
"type" => "error",
"suggestion" => "activate_module"
);
}
@ -894,6 +942,7 @@ class Settings { /* {{{ */
if (!in_array("gd", $loaded_extensions)) {
$result["php_gd2"] = array(
"status" => "notfound",
"type" => "error",
"suggestion" => "activate_php_extension"
);
}
@ -902,6 +951,7 @@ class Settings { /* {{{ */
if (!in_array("mbstring", $loaded_extensions)) {
$result["php_mbstring"] = array(
"status" => "notfound",
"type" => "error",
"suggestion" => "activate_php_extension"
);
}
@ -910,12 +960,38 @@ class Settings { /* {{{ */
if (!in_array($this->_dbDriver, $loaded_extensions)) {
$result["php_dbDriver"] = array(
"status" => "notfound",
"type" => "error",
"currentvalue" => $this->_dbDriver,
"suggestion" => "activate_php_extension"
);
}
// Check for Log.php
if (!Settings::findInIncPath('Log.php')) {
$result["pear_log"] = array(
"status" => "notfound",
"type" => "error",
"suggestion" => "install_pear_package_log"
);
}
// Check for HTTP/WebDAV/Server.php
if (!Settings::findInIncPath('HTTP/WebDAV/Server.php')) {
$result["pear_webdav"] = array(
"status" => "notfound",
"type" => "warning",
"suggestion" => "install_pear_package_webdav"
);
}
// Check for Zend/Search/Lucene.php
if (!Settings::findInIncPath('Zend/Search/Lucene.php')) {
$result["zendframework"] = array(
"status" => "notfound",
"type" => "warning",
"suggestion" => "install_zendframework"
);
}
return $result;
} /* }}} */