- replace old adodb path by extraPath

This commit is contained in:
steinm 2013-02-04 09:19:50 +00:00
parent 78c1ea37a3
commit c68e0165a5

View File

@ -152,8 +152,8 @@ class Settings { /* {{{ */
var $_adminIP = ""; var $_adminIP = "";
// Max Execution Time // Max Execution Time
var $_maxExecutionTime = null; var $_maxExecutionTime = null;
// Path to adodb // Extra Path to additional software, will be added to include path
var $_ADOdbPath = null; var $_extraPath = null;
// DB-Driver used by adodb (see adodb-readme) // DB-Driver used by adodb (see adodb-readme)
var $_dbDriver = "mysql"; var $_dbDriver = "mysql";
// DB-Server // DB-Server
@ -381,7 +381,6 @@ class Settings { /* {{{ */
// XML Path: /configuration/system/database // XML Path: /configuration/system/database
$node = $xml->xpath('/configuration/system/database'); $node = $xml->xpath('/configuration/system/database');
$tab = $node[0]->attributes(); $tab = $node[0]->attributes();
$this->_ADOdbPath = strval($tab["ADOdbPath"]);
$this->_dbDriver = strval($tab["dbDriver"]); $this->_dbDriver = strval($tab["dbDriver"]);
$this->_dbHostname = strval($tab["dbHostname"]); $this->_dbHostname = strval($tab["dbHostname"]);
$this->_dbDatabase = strval($tab["dbDatabase"]); $this->_dbDatabase = strval($tab["dbDatabase"]);
@ -446,6 +445,7 @@ class Settings { /* {{{ */
$tab = $node[0]->attributes(); $tab = $node[0]->attributes();
$this->_coreDir = strval($tab["coreDir"]); $this->_coreDir = strval($tab["coreDir"]);
$this->_luceneClassDir = strval($tab["luceneClassDir"]); $this->_luceneClassDir = strval($tab["luceneClassDir"]);
$this->_extraPath = strval($tab["extraPath"]);
$this->_contentOffsetDir = strval($tab["contentOffsetDir"]); $this->_contentOffsetDir = strval($tab["contentOffsetDir"]);
$this->_maxDirID = intval($tab["maxDirID"]); $this->_maxDirID = intval($tab["maxDirID"]);
$this->_updateNotifyTime = intval($tab["updateNotifyTime"]); $this->_updateNotifyTime = intval($tab["updateNotifyTime"]);
@ -637,7 +637,6 @@ class Settings { /* {{{ */
// XML Path: /configuration/system/database // XML Path: /configuration/system/database
$node = $this->getXMLNode($xml, '/configuration/system', 'database'); $node = $this->getXMLNode($xml, '/configuration/system', 'database');
$this->setXMLAttributValue($node, "ADOdbPath", $this->_ADOdbPath);
$this->setXMLAttributValue($node, "dbDriver", $this->_dbDriver); $this->setXMLAttributValue($node, "dbDriver", $this->_dbDriver);
$this->setXMLAttributValue($node, "dbHostname", $this->_dbHostname); $this->setXMLAttributValue($node, "dbHostname", $this->_dbHostname);
$this->setXMLAttributValue($node, "dbDatabase", $this->_dbDatabase); $this->setXMLAttributValue($node, "dbDatabase", $this->_dbDatabase);
@ -680,6 +679,7 @@ class Settings { /* {{{ */
$node = $this->getXMLNode($xml, '/configuration/advanced', 'server'); $node = $this->getXMLNode($xml, '/configuration/advanced', 'server');
$this->setXMLAttributValue($node, "coreDir", $this->_coreDir); $this->setXMLAttributValue($node, "coreDir", $this->_coreDir);
$this->setXMLAttributValue($node, "luceneClassDir", $this->_luceneClassDir); $this->setXMLAttributValue($node, "luceneClassDir", $this->_luceneClassDir);
$this->setXMLAttributValue($node, "extraPath", $this->_extraPath);
$this->setXMLAttributValue($node, "contentOffsetDir", $this->_contentOffsetDir); $this->setXMLAttributValue($node, "contentOffsetDir", $this->_contentOffsetDir);
$this->setXMLAttributValue($node, "maxDirID", $this->_maxDirID); $this->setXMLAttributValue($node, "maxDirID", $this->_maxDirID);
$this->setXMLAttributValue($node, "updateNotifyTime", $this->_updateNotifyTime); $this->setXMLAttributValue($node, "updateNotifyTime", $this->_updateNotifyTime);
@ -931,8 +931,9 @@ class Settings { /* {{{ */
); );
} }
// $this->_ADOdbPath
$bCheckDB = true; $bCheckDB = true;
// $this->_ADOdbPath
/* not needed anymore after switch to PDO
if($this->_ADOdbPath) { if($this->_ADOdbPath) {
if (!file_exists($this->_ADOdbPath."/adodb/adodb.inc.php")) { if (!file_exists($this->_ADOdbPath."/adodb/adodb.inc.php")) {
$bCheckDB = false; $bCheckDB = false;
@ -964,72 +965,71 @@ class Settings { /* {{{ */
); );
} }
} }
*/
// database // database
if ($bCheckDB) { if ($bCheckDB) {
try { try {
include $this->_ADOdbPath."adodb/adodb.inc.php"; $dsn = "";
switch($this->_dbDriver) {
$connTmp = ADONewConnection($this->_dbDriver); case 'mysql':
if (!$connTmp) { case 'mysqli':
$result["dbDriver"] = array( case 'mysqlnd':
"status" => "notfound", $dsn = $this->_dbDriver.":dbname=".$this->_dbDatabase.";host=".$this->_dbHostname;
"type" => "error", break;
"currentvalue" => $this->_dbDriver, case 'sqlite':
"suggestionvalue" => "mysql" $dsn = $this->_dbDriver.":".$this->_dbDatabase;
); break;
} else { default:
$connTmp->Connect($this->_dbHostname, $this->_dbUser, $this->_dbPass, $this->_dbDatabase); $result["dbDriver"] = array(
if (!$connTmp->IsConnected()) "status" => "notfound",
{
$result["dbDatabase"] = array(
"status" => "error",
"type" => "error", "type" => "error",
"currentvalue" => '[host, user, database] -> [' . $this->_dbHostname . ',' . $this->_dbUser . ',' . $this->_dbDatabase .']', "currentvalue" => $this->_dbDriver,
"systemerror" => $connTmp->ErrorMsg() "suggestionvalue" => "mysql|sqlite"
); );
} else { }
/* Check if there wasn't a previous error while searching for if($dsn) {
* LetoDMS_Core. $connTmp = new PDO($dsn, $this->_dbUser, $this->_dbPass);
*/ /* Check if there wasn't a previous error while searching for
if(!isset($result["coreDir"])) { * LetoDMS_Core.
/* Instanciate LetoDMS_Core to check version */ */
if(!empty($this->_coreDir)) if(!isset($result["coreDir"])) {
require_once($this->_coreDir.'/Core.php'); /* Instanciate LetoDMS_Core to check version */
else if(!empty($this->_coreDir))
require_once('LetoDMS/Core.php'); require_once($this->_coreDir.'/Core.php');
$tmpcore = new LetoDMS_Core_DMS(null, $this->_contentDir); else
$db = new LetoDMS_Core_DatabaseAccess($this->_dbDriver, $this->_dbHostname, $this->_dbUser, $this->_dbPass, $this->_dbDatabase); require_once('LetoDMS/Core.php');
if(!$db->connect()) { $tmpcore = new LetoDMS_Core_DMS(null, $this->_contentDir);
$result["dbDatabase"] = array( $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", "status" => "error",
"type" => "error", "type" => "error",
"currentvalue" => '[host, user, database] -> [' . $this->_dbHostname . ',' . $this->_dbUser . ',' . $this->_dbDatabase .']', "currentvalue" => $dms->version,
"systemerror" => $connTmp->ErrorMsg() "suggestion" => 'updateDatabase'
); );
} 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(); $connTmp = null;
} }
} }
} catch(Exception $e) { } catch(Exception $e) {
$result["dbDatabase"] = array( $result["dbDatabase"] = array(
"status" => "error", "status" => "error",
"type" => "error", "type" => "error",
"currentvalue" => '[host, user, database] -> [' . $settings->_dbHostname . ',' . $settings->_dbUser . ',' . $settings->_dbDatabase .']', "currentvalue" => '[host, user, database] -> [' . $this->_dbHostname . ',' . $this->_dbUser . ',' . $this->_dbDatabase .']',
"systemerror" => $e->getMessage() "systemerror" => $e->getMessage()
); );
} }
@ -1081,11 +1081,11 @@ class Settings { /* {{{ */
} }
// database // database
if (!in_array($this->_dbDriver, $loaded_extensions)) { if (!in_array('pdo_'.$this->_dbDriver, $loaded_extensions)) {
$result["php_dbDriver"] = array( $result["php_dbDriver"] = array(
"status" => "notfound", "status" => "notfound",
"type" => "error", "type" => "error",
"currentvalue" => $this->_dbDriver, "currentvalue" => 'pdo_'.$this->_dbDriver,
"suggestion" => "activate_php_extension" "suggestion" => "activate_php_extension"
); );
} }