mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
cb0c51234e
|
@ -41,8 +41,18 @@ The fastes way to get SeedDMS running is by unpacking the archive
|
|||
Let's assume you use seeddms-quickstart-5.1.10.tar.gz.
|
||||
It will create a new directory `seeddms51x` containing everything you
|
||||
need to run SeedDMS with sqlite3.
|
||||
|
||||
Setting up the web server
|
||||
--------------------------
|
||||
|
||||
First you will need to set up your web server. Here, we will only focus
|
||||
on apache.
|
||||
Either let the document root of your web server point to the directory `www`
|
||||
below `seeddms51x` or add an alias. For apache this could be like
|
||||
below `seeddms51x`
|
||||
|
||||
DocumentRoot /var/www/seeddms51x/www
|
||||
|
||||
or add an alias. For apache this could be like
|
||||
|
||||
Alias /seeddms51x /<some directory>/seeddms51x/www
|
||||
|
||||
|
@ -52,11 +62,16 @@ Alias /mydms /<some directory>/seeddms51x/www
|
|||
|
||||
Do not set the DocumentRoot or Alias to
|
||||
the `seeddms51x` directory, because this will allow anybody to access
|
||||
your `data` and `conf` directory. This is a major security risk.
|
||||
your `data` and `conf` directory if it is not secured by a .htaccess file.
|
||||
This is a major security risk.
|
||||
|
||||
Make sure that the subdirectory `seeddms51x/data` and the configuration file
|
||||
`seeddms51/conf/settings.xml` is writeable by your web server. All other
|
||||
directories must just be readable by your web server.
|
||||
directories can be just readable by your web server, though it is advisable
|
||||
to even protect them from writing.
|
||||
|
||||
Adjusting the configuration of SeedDMS
|
||||
---------------------------------------
|
||||
|
||||
In the next step you need to adjust the configuration file in
|
||||
`seeddms51x/conf/settings.xml`. Open the file in your favorite text editor
|
||||
|
@ -71,7 +86,7 @@ It will first ask to unlock the installer by creating a file
|
|||
`ENABLE_INSTALL_TOOL` in the diretory `seeddms51x/conf/`. Change all paths by
|
||||
replacing `/home/www-data` with your base directory where you put seeddms51x.
|
||||
Set httpRoot to '/' (if the document root points to`seeddms51x/www`) or
|
||||
'/seeddms51x' (if you have set an alias like described above).
|
||||
'/seeddms51x' (if you have set an alias `seeddms51x` like described above).
|
||||
|
||||
Once your configuration is done,
|
||||
save it, remove the file `ENABLE_INSTALL_TOOL` and point your browser to
|
||||
|
|
|
@ -1356,6 +1356,7 @@ class Settings { /* {{{ */
|
|||
|
||||
// TODO
|
||||
// $this->_coreDir
|
||||
/*
|
||||
if($this->_coreDir) {
|
||||
if (!file_exists($this->_coreDir ."Core.php")) {
|
||||
$result["coreDir"] = array(
|
||||
|
@ -1376,7 +1377,7 @@ class Settings { /* {{{ */
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
// $this->_httpRoot
|
||||
$tmp = $this->curPageURL();
|
||||
$tmp = str_replace ("install.php", "" , $tmp);
|
||||
|
@ -1527,7 +1528,7 @@ class Settings { /* {{{ */
|
|||
if(!empty($this->_coreDir))
|
||||
require_once($this->_coreDir.'/Core.php');
|
||||
else
|
||||
require_once('SeedDMS/Core.php');
|
||||
require_once($this->_rootDir.'../pear/SeedDMS/Core.php');
|
||||
$tmpcore = new SeedDMS_Core_DMS(null, $this->_contentDir);
|
||||
$db = new SeedDMS_Core_DatabaseAccess($this->_dbDriver, $this->_dbHostname, $this->_dbUser, $this->_dbPass, $this->_dbDatabase);
|
||||
if(!$db->connect()) {
|
||||
|
@ -1590,7 +1591,7 @@ class Settings { /* {{{ */
|
|||
}
|
||||
|
||||
// Check PHP version
|
||||
if (version_compare(PHP_VERSION, '5.6.38') < 0) {
|
||||
if (version_compare(PHP_VERSION, '7.2.5') < 0) {
|
||||
$result["php_version"] = array(
|
||||
"status" => "versiontolow",
|
||||
"type" => "error",
|
||||
|
@ -1600,6 +1601,15 @@ class Settings { /* {{{ */
|
|||
|
||||
// Check PHP configuration
|
||||
$loaded_extensions = get_loaded_extensions();
|
||||
// xml
|
||||
if (!in_array("xml", $loaded_extensions)) {
|
||||
$result["php_xml"] = array(
|
||||
"status" => "notfound",
|
||||
"type" => "error",
|
||||
"suggestion" => "activate_php_extension"
|
||||
);
|
||||
}
|
||||
|
||||
// gd2
|
||||
if (!in_array("gd", $loaded_extensions)) {
|
||||
$result["php_gd2"] = array(
|
||||
|
@ -1618,6 +1628,42 @@ class Settings { /* {{{ */
|
|||
);
|
||||
}
|
||||
|
||||
// json
|
||||
if (!in_array("json", $loaded_extensions)) {
|
||||
$result["php_json"] = array(
|
||||
"status" => "notfound",
|
||||
"type" => "error",
|
||||
"suggestion" => "activate_php_extension"
|
||||
);
|
||||
}
|
||||
|
||||
// zip
|
||||
if (!in_array("zip", $loaded_extensions)) {
|
||||
$result["php_zip"] = array(
|
||||
"status" => "notfound",
|
||||
"type" => "error",
|
||||
"suggestion" => "activate_php_extension"
|
||||
);
|
||||
}
|
||||
|
||||
// fileinfo
|
||||
if (!in_array("fileinfo", $loaded_extensions)) {
|
||||
$result["php_fileinfo"] = array(
|
||||
"status" => "notfound",
|
||||
"type" => "error",
|
||||
"suggestion" => "activate_php_extension"
|
||||
);
|
||||
}
|
||||
|
||||
// sqlite3
|
||||
if (!in_array("sqlite3", $loaded_extensions)) {
|
||||
$result["php_sqlite3"] = array(
|
||||
"status" => "notfound",
|
||||
"type" => "error",
|
||||
"suggestion" => "activate_php_extension"
|
||||
);
|
||||
}
|
||||
|
||||
// database
|
||||
if (!in_array('pdo_'.$this->_dbDriver, $loaded_extensions)) {
|
||||
$result["php_dbDriver"] = array(
|
||||
|
@ -1641,6 +1687,7 @@ class Settings { /* {{{ */
|
|||
*/
|
||||
|
||||
// Check for HTTP/WebDAV/Server.php
|
||||
/*
|
||||
if (!Settings::findInIncPath('HTTP/WebDAV/Server.php')) {
|
||||
$result["pear_webdav"] = array(
|
||||
"status" => "notfound",
|
||||
|
@ -1648,8 +1695,10 @@ class Settings { /* {{{ */
|
|||
"suggestion" => "install_pear_package_webdav"
|
||||
);
|
||||
}
|
||||
*/
|
||||
|
||||
// Check for Zend/Search/Lucene.php
|
||||
/*
|
||||
if (!Settings::findInIncPath('Zend/Search/Lucene.php')) {
|
||||
$result["zendframework"] = array(
|
||||
"status" => "notfound",
|
||||
|
@ -1657,6 +1706,7 @@ class Settings { /* {{{ */
|
|||
"suggestion" => "install_zendframework"
|
||||
);
|
||||
}
|
||||
*/
|
||||
return $result;
|
||||
} /* }}} */
|
||||
|
||||
|
|
|
@ -35,11 +35,13 @@ if(!trim($settings->_encryptionKey)) {
|
|||
$settings->save();
|
||||
}
|
||||
|
||||
if(isset($settings->_extraPath))
|
||||
ini_set('include_path', $settings->_rootDir.'pear'. PATH_SEPARATOR .ini_get('include_path'));
|
||||
if(!empty($settings->_extraPath)) {
|
||||
ini_set('include_path', $settings->_extraPath. PATH_SEPARATOR .ini_get('include_path'));
|
||||
|
||||
/* composer is installed in pear directory */
|
||||
require_once 'vendor/autoload.php';
|
||||
}
|
||||
/* composer is installed in pear directory, but install tool does not need it */
|
||||
if(!defined("SEEDDMS_INSTALL"))
|
||||
require_once $settings->_rootDir.'../pear/vendor/autoload.php';
|
||||
|
||||
if(isset($settings->_maxExecutionTime)) {
|
||||
if (php_sapi_name() !== "cli") {
|
||||
|
@ -67,3 +69,7 @@ if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
|
|||
* relative to it.
|
||||
*/
|
||||
ini_set('include_path', $settings->_rootDir. PATH_SEPARATOR .ini_get('include_path'));
|
||||
/* Add root Dir.'../pear'. Needed because the SeedDMS_Core, etc. are included
|
||||
* relative to it.
|
||||
*/
|
||||
ini_set('include_path', $settings->_rootDir.'../pear'. PATH_SEPARATOR .ini_get('include_path'));
|
||||
|
|
|
@ -2,6 +2,62 @@
|
|||
include("../views/bootstrap/class.Bootstrap.php");
|
||||
|
||||
class SeedDMS_View_Install extends SeedDMS_Theme_Style {
|
||||
protected function printError($error) { /* {{{ */
|
||||
print "<div class=\"alert alert-error\">\n";
|
||||
print $error;
|
||||
print "</div>";
|
||||
} /* }}} */
|
||||
|
||||
protected function printWarning($error) { /* {{{ */
|
||||
print "<div class=\"alert alert-warning\">";
|
||||
print $error;
|
||||
print "</div>";
|
||||
} /* }}} */
|
||||
|
||||
protected function printCheckError($resCheck) { /* {{{ */
|
||||
$hasError = false;
|
||||
foreach($resCheck as $keyRes => $paramRes) {
|
||||
if(isset($paramRes['type']) && $paramRes['type'] == 'error')
|
||||
$hasError = true;
|
||||
$errorMes = getMLText("settings_$keyRes"). " : " . getMLText("settings_".$paramRes["status"]);
|
||||
|
||||
if (isset($paramRes["currentvalue"]))
|
||||
$errorMes .= "<br/> => " . getMLText("settings_currentvalue") . " : " . $paramRes["currentvalue"];
|
||||
if (isset($paramRes["suggestionvalue"]))
|
||||
$errorMes .= "<br/> => " . getMLText("settings_suggestionvalue") . " : " . $paramRes["suggestionvalue"];
|
||||
if (isset($paramRes["suggestion"]))
|
||||
$errorMes .= "<br/> => " . getMLText("settings_".$paramRes["suggestion"]);
|
||||
if (isset($paramRes["systemerror"]))
|
||||
$errorMes .= "<br/> => " . $paramRes["systemerror"];
|
||||
|
||||
if(isset($paramRes['type']) && $paramRes['type'] == 'error')
|
||||
$this->printError($errorMes);
|
||||
else
|
||||
$this->printWarning($errorMes);
|
||||
}
|
||||
|
||||
return $hasError;
|
||||
} /* }}} */
|
||||
|
||||
protected function openDBConnection($settings) { /* {{{ */
|
||||
switch($settings->_dbDriver) {
|
||||
case 'mysql':
|
||||
case 'mysqli':
|
||||
case 'mysqlnd':
|
||||
case 'pgsql':
|
||||
$tmp = explode(":", $settings->_dbHostname);
|
||||
$dsn = $settings->_dbDriver.":dbname=".$settings->_dbDatabase.";host=".$tmp[0];
|
||||
if(isset($tmp[1]))
|
||||
$dsn .= ";port=".$tmp[1];
|
||||
break;
|
||||
case 'sqlite':
|
||||
$dsn = $settings->_dbDriver.":".$settings->_dbDatabase;
|
||||
break;
|
||||
}
|
||||
$connTmp = new PDO($dsn, $settings->_dbUser, $settings->_dbPass);
|
||||
return $connTmp;
|
||||
} /* }}} */
|
||||
|
||||
public function intro() { /* {{{ */
|
||||
$this->htmlStartPage("INSTALL");
|
||||
$this->globalBanner();
|
||||
|
@ -16,7 +72,7 @@ echo '<p><a href="install.php">' . getMLText("settings_start_install") . '</a></
|
|||
$this->htmlEndPage();
|
||||
} /* }}} */
|
||||
|
||||
public function install() { /* {{{ */
|
||||
public function install($msg) { /* {{{ */
|
||||
$settings = $this->params['settings'];
|
||||
$configDir = $this->params['configdir'];
|
||||
|
||||
|
@ -25,7 +81,7 @@ echo '<p><a href="install.php">' . getMLText("settings_start_install") . '</a></
|
|||
$this->contentStart();
|
||||
$this->contentHeading("SeedDMS Installation for version ".SEEDDMS_VERSION);
|
||||
if(isset($msg))
|
||||
echo "<div class=\"alert alert-warning\">".$msg."</div>";
|
||||
$this->warningMsg($msg);
|
||||
$this->contentContainerStart();
|
||||
|
||||
|
||||
|
@ -66,278 +122,276 @@ echo '<p><a href="install.php">' . getMLText("settings_start_install") . '</a></
|
|||
exit();
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Check System
|
||||
*/
|
||||
if (printCheckError( $settings->checkSystem())) { /* {{{ */
|
||||
if (function_exists("apache_get_version")) {
|
||||
echo "<br/>Apache version: " . apache_get_version();
|
||||
}
|
||||
|
||||
echo "<br/>PHP version: " . phpversion();
|
||||
|
||||
echo "<br/>PHP include path: " . ini_get('include_path');
|
||||
|
||||
echo '<br/>';
|
||||
echo '<br/>';
|
||||
echo '<a href="' . $httpRoot . 'install/install.php">' . getMLText("refresh") . '</a>';
|
||||
echo ' - ';
|
||||
echo '<a href="' . $httpRoot . 'install/install.php?phpinfo">' . getMLText("version_info") . '</a>';
|
||||
|
||||
exit;
|
||||
} /* }}} */
|
||||
|
||||
|
||||
if (isset($_POST["action"])) $action=$_POST["action"];
|
||||
else if (isset($_GET["action"])) $action=$_GET["action"];
|
||||
else $action=NULL;
|
||||
|
||||
$showform = true;
|
||||
if ($action=="setSettings") {
|
||||
/**
|
||||
* Get Parameters
|
||||
*/
|
||||
$settings->_rootDir = $_POST["rootDir"];
|
||||
$settings->_httpRoot = $_POST["httpRoot"];
|
||||
$settings->_contentDir = $_POST["contentDir"];
|
||||
$settings->_luceneDir = $_POST["luceneDir"];
|
||||
$settings->_stagingDir = $_POST["stagingDir"];
|
||||
$settings->_cacheDir = $_POST["cacheDir"];
|
||||
$settings->_extraPath = $_POST["extraPath"];
|
||||
$settings->_dbDriver = $_POST["dbDriver"];
|
||||
$settings->_dbHostname = $_POST["dbHostname"];
|
||||
$settings->_dbDatabase = $_POST["dbDatabase"];
|
||||
$settings->_dbUser = $_POST["dbUser"];
|
||||
$settings->_dbPass = $_POST["dbPass"];
|
||||
$settings->_coreDir = $_POST["coreDir"];
|
||||
$settings->_luceneClassDir = $_POST["luceneClassDir"];
|
||||
|
||||
if(isset($settings->_extraPath))
|
||||
ini_set('include_path', $settings->_extraPath. PATH_SEPARATOR .ini_get('include_path'));
|
||||
|
||||
/**
|
||||
* Check Parameters, require version 3.3.x
|
||||
*/
|
||||
$hasError = printCheckError( $settings->check(substr(str_replace('.', '', SEEDDMS_VERSION), 0,2)));
|
||||
|
||||
if (!$hasError) {
|
||||
// Create database
|
||||
if (isset($_POST["createDatabase"])) {
|
||||
$createOK = false;
|
||||
$errorMsg = "";
|
||||
|
||||
$connTmp =openDBConnection($settings);
|
||||
if ($connTmp) {
|
||||
// read SQL file
|
||||
if ($settings->_dbDriver=="mysql")
|
||||
$queries = file_get_contents("create_tables-innodb.sql");
|
||||
elseif($settings->_dbDriver=="sqlite")
|
||||
$queries = file_get_contents("create_tables-sqlite3.sql");
|
||||
elseif($settings->_dbDriver=="pgsql")
|
||||
$queries = file_get_contents("create_tables-postgres.sql");
|
||||
else
|
||||
die();
|
||||
|
||||
// generate SQL query
|
||||
$queries = explode(";", $queries);
|
||||
|
||||
// execute queries
|
||||
foreach($queries as $query) {
|
||||
// var_dump($query);
|
||||
$query = trim($query);
|
||||
if (!empty($query)) {
|
||||
$connTmp->exec($query);
|
||||
|
||||
if ($connTmp->errorCode() != 0) {
|
||||
$errorMsg .= $connTmp->errorInfo()[2] . "<br/>";
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Check System
|
||||
*/
|
||||
if ($this->printCheckError( $settings->checkSystem())) { /* {{{ */
|
||||
if (function_exists("apache_get_version")) {
|
||||
echo "<br/>Apache version: " . apache_get_version();
|
||||
}
|
||||
|
||||
// error ?
|
||||
if (empty($errorMsg))
|
||||
$createOK = true;
|
||||
echo "<br/>PHP version: " . phpversion();
|
||||
|
||||
$connTmp = null;
|
||||
echo "<br/>PHP include path: " . ini_get('include_path');
|
||||
|
||||
// Show error
|
||||
if (!$createOK) {
|
||||
echo $errorMsg;
|
||||
$hasError = true;
|
||||
}
|
||||
} // create database
|
||||
echo '<br/>';
|
||||
echo '<br/>';
|
||||
echo '<a href="' . $httpRoot . 'install/install.php">' . getMLText("refresh") . '</a>';
|
||||
echo ' - ';
|
||||
echo '<a href="' . $httpRoot . 'install/install.php?phpinfo">' . getMLText("version_info") . '</a>';
|
||||
|
||||
if (!$hasError) {
|
||||
exit;
|
||||
} /* }}} */
|
||||
|
||||
// Save settings
|
||||
$settings->save();
|
||||
if (isset($_POST["action"])) $action=$_POST["action"];
|
||||
else if (isset($_GET["action"])) $action=$_GET["action"];
|
||||
else $action=NULL;
|
||||
|
||||
$needsupdate = false;
|
||||
$connTmp =openDBConnection($settings);
|
||||
if ($connTmp) {
|
||||
switch($settings->_dbDriver) {
|
||||
case 'mysql':
|
||||
case 'mysqli':
|
||||
case 'mysqlnd':
|
||||
case 'sqlite':
|
||||
$sql = 'select * from `tblVersion`';
|
||||
break;
|
||||
case 'pgsql':
|
||||
$sql = 'select * from "tblVersion"';
|
||||
break;
|
||||
}
|
||||
$res = $connTmp->query($sql);
|
||||
if($res) {
|
||||
if($rec = $res->fetch(PDO::FETCH_ASSOC)) {
|
||||
$updatedirs = array();
|
||||
$d = dir(".");
|
||||
while (false !== ($entry = $d->read())) {
|
||||
if(preg_match('/update-([0-9.]*)/', $entry, $matches)) {
|
||||
$updatedirs[] = $matches[1];
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
$showform = true;
|
||||
if ($action=="setSettings") { /* {{{ */
|
||||
/**
|
||||
* Get Parameters
|
||||
*/
|
||||
$settings->_rootDir = $_POST["rootDir"];
|
||||
$settings->_httpRoot = $_POST["httpRoot"];
|
||||
$settings->_contentDir = $_POST["contentDir"];
|
||||
$settings->_luceneDir = $_POST["luceneDir"];
|
||||
$settings->_stagingDir = $_POST["stagingDir"];
|
||||
$settings->_cacheDir = $_POST["cacheDir"];
|
||||
$settings->_extraPath = $_POST["extraPath"];
|
||||
$settings->_dbDriver = $_POST["dbDriver"];
|
||||
$settings->_dbHostname = $_POST["dbHostname"];
|
||||
$settings->_dbDatabase = $_POST["dbDatabase"];
|
||||
$settings->_dbUser = $_POST["dbUser"];
|
||||
$settings->_dbPass = $_POST["dbPass"];
|
||||
$settings->_coreDir = ''; //$_POST["coreDir"];
|
||||
$settings->_luceneClassDir = ''; //$_POST["luceneClassDir"];
|
||||
|
||||
echo "Your current database schema has version ".$rec['major'].'.'.$rec['minor'].'.'.$rec['subminor'].". Please run all (if any)<br />of the update scripts below in the listed order.<br /><br />";
|
||||
$connTmp = null;
|
||||
if(isset($settings->_extraPath))
|
||||
ini_set('include_path', $settings->_extraPath. PATH_SEPARATOR .ini_get('include_path'));
|
||||
|
||||
if($updatedirs) {
|
||||
asort($updatedirs);
|
||||
foreach($updatedirs as $updatedir) {
|
||||
if($updatedir > $rec['major'].'.'.$rec['minor'].'.'.$rec['subminor']) {
|
||||
$needsupdate = true;
|
||||
print "<h3>Database update to version ".$updatedir." needed</h3>";
|
||||
if(file_exists('update-'.$updatedir.'/update.txt')) {
|
||||
print "<p>Please read the comments on updating this version. <a href=\"update-".$updatedir."/update.txt\" target=\"_blank\">Read now</a></p>";
|
||||
}
|
||||
print "<p>Run the <a href=\"update.php?version=".$updatedir."\">update script</a>.</p>";
|
||||
/**
|
||||
* Check Parameters, require version 3.3.x
|
||||
*/
|
||||
$hasError = $this->printCheckError( $settings->check(substr(str_replace('.', '', SEEDDMS_VERSION), 0,2)));
|
||||
|
||||
if (!$hasError) {
|
||||
// Create database
|
||||
if (isset($_POST["createDatabase"])) {
|
||||
$createOK = false;
|
||||
$errorMsg = "";
|
||||
|
||||
$connTmp = $this->openDBConnection($settings);
|
||||
if ($connTmp) {
|
||||
// read SQL file
|
||||
if ($settings->_dbDriver=="mysql")
|
||||
$queries = file_get_contents("create_tables-innodb.sql");
|
||||
elseif($settings->_dbDriver=="sqlite")
|
||||
$queries = file_get_contents("create_tables-sqlite3.sql");
|
||||
elseif($settings->_dbDriver=="pgsql")
|
||||
$queries = file_get_contents("create_tables-postgres.sql");
|
||||
else
|
||||
die();
|
||||
|
||||
// generate SQL query
|
||||
$queries = explode(";", $queries);
|
||||
|
||||
// execute queries
|
||||
foreach($queries as $query) {
|
||||
// var_dump($query);
|
||||
$query = trim($query);
|
||||
if (!empty($query)) {
|
||||
$connTmp->exec($query);
|
||||
|
||||
if ($connTmp->errorCode() != 0) {
|
||||
$errorMsg .= $connTmp->errorInfo()[2] . "<br/>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print "<p>Your current database is up to date.</p>";
|
||||
}
|
||||
}
|
||||
if(!$needsupdate) {
|
||||
echo getMLText("settings_install_success");
|
||||
echo "<br/><br/>";
|
||||
echo getMLText("settings_delete_install_folder");
|
||||
echo "<br/><br/>";
|
||||
echo '<a href="install.php?disableinstall=1">' . getMLText("settings_disable_install") . '</a>';
|
||||
echo "<br/><br/>";
|
||||
|
||||
echo '<a href="../out/out.Settings.php">' . getMLText("settings_more_settings") .'</a>';
|
||||
$showform = false;
|
||||
// error ?
|
||||
if (empty($errorMsg))
|
||||
$createOK = true;
|
||||
|
||||
$connTmp = null;
|
||||
|
||||
// Show error
|
||||
if (!$createOK) {
|
||||
echo $errorMsg;
|
||||
$hasError = true;
|
||||
}
|
||||
} // create database
|
||||
|
||||
if (!$hasError) {
|
||||
|
||||
// Save settings
|
||||
$settings->save();
|
||||
|
||||
$needsupdate = false;
|
||||
$connTmp = $this->openDBConnection($settings);
|
||||
if ($connTmp) {
|
||||
switch($settings->_dbDriver) {
|
||||
case 'mysql':
|
||||
case 'mysqli':
|
||||
case 'mysqlnd':
|
||||
case 'sqlite':
|
||||
$sql = 'select * from `tblVersion`';
|
||||
break;
|
||||
case 'pgsql':
|
||||
$sql = 'select * from "tblVersion"';
|
||||
break;
|
||||
}
|
||||
$res = $connTmp->query($sql);
|
||||
if($res) {
|
||||
if($rec = $res->fetch(PDO::FETCH_ASSOC)) {
|
||||
$updatedirs = array();
|
||||
$d = dir(".");
|
||||
while (false !== ($entry = $d->read())) {
|
||||
if(preg_match('/update-([0-9.]*)/', $entry, $matches)) {
|
||||
$updatedirs[] = $matches[1];
|
||||
}
|
||||
}
|
||||
$d->close();
|
||||
|
||||
echo "Your current database schema has version ".$rec['major'].'.'.$rec['minor'].'.'.$rec['subminor'].". Please run all (if any)<br />of the update scripts below in the listed order.<br /><br />";
|
||||
$connTmp = null;
|
||||
|
||||
if($updatedirs) {
|
||||
asort($updatedirs);
|
||||
foreach($updatedirs as $updatedir) {
|
||||
if($updatedir > $rec['major'].'.'.$rec['minor'].'.'.$rec['subminor']) {
|
||||
$needsupdate = true;
|
||||
print "<h3>Database update to version ".$updatedir." needed</h3>";
|
||||
if(file_exists('update-'.$updatedir.'/update.txt')) {
|
||||
print "<p>Please read the comments on updating this version. <a href=\"update-".$updatedir."/update.txt\" target=\"_blank\">Read now</a></p>";
|
||||
}
|
||||
print "<p>Run the <a href=\"update.php?version=".$updatedir."\">update script</a>.</p>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print "<p>Your current database is up to date.</p>";
|
||||
}
|
||||
}
|
||||
if(!$needsupdate) {
|
||||
echo getMLText("settings_install_success");
|
||||
echo "<br/><br/>";
|
||||
echo getMLText("settings_delete_install_folder");
|
||||
echo "<br/><br/>";
|
||||
echo '<a href="install.php?disableinstall=1">' . getMLText("settings_disable_install") . '</a>';
|
||||
echo "<br/><br/>";
|
||||
|
||||
echo '<a href="../out/out.Settings.php">' . getMLText("settings_more_settings") .'</a>';
|
||||
$showform = false;
|
||||
}
|
||||
} else {
|
||||
print "<p>You does not seem to have a valid database. The table tblVersion is missing.</p>";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
print "<p>You does not seem to have a valid database. The table tblVersion is missing.</p>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Back link
|
||||
echo '<br/>';
|
||||
echo '<br/>';
|
||||
// echo '<a href="' . $httpRoot . '/install/install.php">' . getMLText("back") . '</a>';
|
||||
// Back link
|
||||
echo '<br/>';
|
||||
echo '<br/>';
|
||||
// echo '<a href="' . $httpRoot . '/install/install.php">' . getMLText("back") . '</a>';
|
||||
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
if($showform) {
|
||||
if($showform) { /* {{{ */
|
||||
|
||||
/**
|
||||
* Set parameters
|
||||
*/
|
||||
?>
|
||||
/**
|
||||
* Set parameters
|
||||
*/
|
||||
?>
|
||||
<form action="install.php" method="post" enctype="multipart/form-data">
|
||||
<input type="Hidden" name="action" value="setSettings">
|
||||
<table>
|
||||
<!-- SETTINGS - SYSTEM - SERVER -->
|
||||
<tr ><td><b> <?php printMLText("settings_Server");?></b></td> </tr>
|
||||
<tr title="<?php printMLText("settings_rootDir_desc");?>">
|
||||
<td><?php printMLText("settings_rootDir");?>:</td>
|
||||
<td><input type="text" name="rootDir" value="<?php echo $settings->_rootDir ?>" size="100" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_httpRoot_desc");?>">
|
||||
<td><?php printMLText("settings_httpRoot");?>:</td>
|
||||
<td><input type="text" name="httpRoot" value="<?php echo $settings->_httpRoot ?>" size="100" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_contentDir_desc");?>">
|
||||
<td><?php printMLText("settings_contentDir");?>:</td>
|
||||
<td><input type="text" name="contentDir" value="<?php echo $settings->_contentDir ?>" size="100" style="background:yellow" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_luceneDir_desc");?>">
|
||||
<td><?php printMLText("settings_luceneDir");?>:</td>
|
||||
<td><input type="text" name="luceneDir" value="<?php echo $settings->_luceneDir ?>" size="100" style="background:yellow" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_stagingDir_desc");?>">
|
||||
<td><?php printMLText("settings_stagingDir");?>:</td>
|
||||
<td><input type="text" name="stagingDir" value="<?php echo $settings->_stagingDir ?>" size="100" style="background:yellow" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_cacheDir_desc");?>">
|
||||
<td><?php printMLText("settings_cacheDir");?>:</td>
|
||||
<td><input type="text" name="cacheDir" value="<?php echo $settings->_cacheDir ?>" size="100" style="background:yellow" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_coreDir_desc");?>">
|
||||
<td><?php printMLText("settings_coreDir");?>:</td>
|
||||
<td><input type="text" name="coreDir" value="<?php echo $settings->_coreDir ?>" size="100" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_luceneClassDir_desc");?>">
|
||||
<td><?php printMLText("settings_luceneClassDir");?>:</td>
|
||||
<td><input type="text" name="luceneClassDir" value="<?php echo $settings->_luceneClassDir ?>" size="100" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_extraPath_desc");?>">
|
||||
<td><?php printMLText("settings_extraPath");?>:</td>
|
||||
<td><input type="text" name="extraPath" value="<?php echo $settings->_extraPath ?>" size="100" /></td>
|
||||
</tr>
|
||||
<table>
|
||||
<!-- SETTINGS - SYSTEM - SERVER -->
|
||||
<tr ><td><b> <?php printMLText("settings_Server");?></b></td> </tr>
|
||||
<tr title="<?php printMLText("settings_rootDir_desc");?>">
|
||||
<td><?php printMLText("settings_rootDir");?>:</td>
|
||||
<td><input type="text" name="rootDir" value="<?php echo $settings->_rootDir ?>" size="100" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_httpRoot_desc");?>">
|
||||
<td><?php printMLText("settings_httpRoot");?>:</td>
|
||||
<td><input type="text" name="httpRoot" value="<?php echo $settings->_httpRoot ?>" size="100" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_contentDir_desc");?>">
|
||||
<td><?php printMLText("settings_contentDir");?>:</td>
|
||||
<td><input type="text" name="contentDir" value="<?php echo $settings->_contentDir ?>" size="100" style="background:yellow" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_luceneDir_desc");?>">
|
||||
<td><?php printMLText("settings_luceneDir");?>:</td>
|
||||
<td><input type="text" name="luceneDir" value="<?php echo $settings->_luceneDir ?>" size="100" style="background:yellow" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_stagingDir_desc");?>">
|
||||
<td><?php printMLText("settings_stagingDir");?>:</td>
|
||||
<td><input type="text" name="stagingDir" value="<?php echo $settings->_stagingDir ?>" size="100" style="background:yellow" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_cacheDir_desc");?>">
|
||||
<td><?php printMLText("settings_cacheDir");?>:</td>
|
||||
<td><input type="text" name="cacheDir" value="<?php echo $settings->_cacheDir ?>" size="100" style="background:yellow" /></td>
|
||||
</tr>
|
||||
<!--
|
||||
<tr title="<?php printMLText("settings_coreDir_desc");?>">
|
||||
<td><?php printMLText("settings_coreDir");?>:</td>
|
||||
<td><input type="text" name="coreDir" value="<?php echo $settings->_coreDir ?>" size="100" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_luceneClassDir_desc");?>">
|
||||
<td><?php printMLText("settings_luceneClassDir");?>:</td>
|
||||
<td><input type="text" name="luceneClassDir" value="<?php echo $settings->_luceneClassDir ?>" size="100" /></td>
|
||||
</tr>
|
||||
-->
|
||||
<tr title="<?php printMLText("settings_extraPath_desc");?>">
|
||||
<td><?php printMLText("settings_extraPath");?>:</td>
|
||||
<td><input type="text" name="extraPath" value="<?php echo $settings->_extraPath ?>" size="100" /></td>
|
||||
</tr>
|
||||
|
||||
<!-- SETTINGS - SYSTEM - DATABASE -->
|
||||
<tr ><td><b> <?php printMLText("settings_Database");?></b></td> </tr>
|
||||
<tr title="<?php printMLText("settings_dbDriver_desc");?>">
|
||||
<td><?php printMLText("settings_dbDriver");?>:</td>
|
||||
<td><input type="text" name="dbDriver" value="<?php echo $settings->_dbDriver ?>" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_dbHostname_desc");?>">
|
||||
<td><?php printMLText("settings_dbHostname");?>:</td>
|
||||
<td><input type="text" name="dbHostname" value="<?php echo $settings->_dbHostname ?>" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_dbDatabase_desc");?>">
|
||||
<td><?php printMLText("settings_dbDatabase");?>:</td>
|
||||
<td><input type="text" name="dbDatabase" value="<?php echo $settings->_dbDatabase ?>" style="background:yellow" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_dbUser_desc");?>">
|
||||
<td><?php printMLText("settings_dbUser");?>:</td>
|
||||
<td><input type="text" name="dbUser" value="<?php echo $settings->_dbUser ?>" style="background:yellow" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_dbPass_desc");?>">
|
||||
<td><?php printMLText("settings_dbPass");?>:</td>
|
||||
<td><input name="dbPass" value="<?php echo $settings->_dbPass ?>" type="password" style="background:yellow" /></td>
|
||||
</tr>
|
||||
<tr><td></td></tr>
|
||||
<tr><td></td></tr>
|
||||
<tr>
|
||||
<td><?php printMLText("settings_createdatabase");?>:</td>
|
||||
<td><input name="createDatabase" type="checkbox" style="background:yellow"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" class="btn btn-primary" value="<?php printMLText("apply");?>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- SETTINGS - SYSTEM - DATABASE -->
|
||||
<tr ><td><b> <?php printMLText("settings_Database");?></b></td> </tr>
|
||||
<tr title="<?php printMLText("settings_dbDriver_desc");?>">
|
||||
<td><?php printMLText("settings_dbDriver");?>:</td>
|
||||
<td><input type="text" name="dbDriver" value="<?php echo $settings->_dbDriver ?>" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_dbHostname_desc");?>">
|
||||
<td><?php printMLText("settings_dbHostname");?>:</td>
|
||||
<td><input type="text" name="dbHostname" value="<?php echo $settings->_dbHostname ?>" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_dbDatabase_desc");?>">
|
||||
<td><?php printMLText("settings_dbDatabase");?>:</td>
|
||||
<td><input type="text" name="dbDatabase" value="<?php echo $settings->_dbDatabase ?>" style="background:yellow" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_dbUser_desc");?>">
|
||||
<td><?php printMLText("settings_dbUser");?>:</td>
|
||||
<td><input type="text" name="dbUser" value="<?php echo $settings->_dbUser ?>" style="background:yellow" /></td>
|
||||
</tr>
|
||||
<tr title="<?php printMLText("settings_dbPass_desc");?>">
|
||||
<td><?php printMLText("settings_dbPass");?>:</td>
|
||||
<td><input name="dbPass" value="<?php echo $settings->_dbPass ?>" type="password" style="background:yellow" /></td>
|
||||
</tr>
|
||||
<tr><td></td></tr>
|
||||
<tr><td></td></tr>
|
||||
<tr>
|
||||
<td><?php printMLText("settings_createdatabase");?>:</td>
|
||||
<td><input name="createDatabase" type="checkbox" style="background:yellow"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><input type="submit" class="btn btn-primary" value="<?php printMLText("apply");?>" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
<?php
|
||||
<?php
|
||||
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
/*
|
||||
// just remove info for web page installation
|
||||
$settings->_printDisclaimer = false;
|
||||
$settings->_footNote = false;
|
||||
|
||||
*/
|
||||
|
||||
// just remove info for web page installation
|
||||
$settings->_printDisclaimer = false;
|
||||
$settings->_footNote = false;
|
||||
// end of the page
|
||||
// end of the page
|
||||
$this->contentContainerEnd();
|
||||
$this->contentEnd();
|
||||
$this->htmlEndPage();
|
||||
|
|
|
@ -46,66 +46,6 @@ if (!file_exists("settings.xml.template_install")) {
|
|||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Functions
|
||||
*/
|
||||
function openDBConnection($settings) { /* {{{ */
|
||||
switch($settings->_dbDriver) {
|
||||
case 'mysql':
|
||||
case 'mysqli':
|
||||
case 'mysqlnd':
|
||||
case 'pgsql':
|
||||
$tmp = explode(":", $settings->_dbHostname);
|
||||
$dsn = $settings->_dbDriver.":dbname=".$settings->_dbDatabase.";host=".$tmp[0];
|
||||
if(isset($tmp[1]))
|
||||
$dsn .= ";port=".$tmp[1];
|
||||
break;
|
||||
case 'sqlite':
|
||||
$dsn = $settings->_dbDriver.":".$settings->_dbDatabase;
|
||||
break;
|
||||
}
|
||||
$connTmp = new PDO($dsn, $settings->_dbUser, $settings->_dbPass);
|
||||
return $connTmp;
|
||||
} /* }}} */
|
||||
|
||||
function printError($error) { /* {{{ */
|
||||
print "<div class=\"alert alert-error\">\n";
|
||||
print $error;
|
||||
print "</div>";
|
||||
} /* }}} */
|
||||
|
||||
function printWarning($error) { /* {{{ */
|
||||
print "<div class=\"install_warning\">";
|
||||
print "Warning<br />";
|
||||
print $error;
|
||||
print "</div>";
|
||||
} /* }}} */
|
||||
|
||||
function printCheckError($resCheck) { /* {{{ */
|
||||
$hasError = false;
|
||||
foreach($resCheck as $keyRes => $paramRes) {
|
||||
if(isset($paramRes['type']) && $paramRes['type'] == 'error')
|
||||
$hasError = true;
|
||||
$errorMes = getMLText("settings_$keyRes"). " : " . getMLText("settings_".$paramRes["status"]);
|
||||
|
||||
if (isset($paramRes["currentvalue"]))
|
||||
$errorMes .= "<br/> => " . getMLText("settings_currentvalue") . " : " . $paramRes["currentvalue"];
|
||||
if (isset($paramRes["suggestionvalue"]))
|
||||
$errorMes .= "<br/> => " . getMLText("settings_suggestionvalue") . " : " . $paramRes["suggestionvalue"];
|
||||
if (isset($paramRes["suggestion"]))
|
||||
$errorMes .= "<br/> => " . getMLText("settings_".$paramRes["suggestion"]);
|
||||
if (isset($paramRes["systemerror"]))
|
||||
$errorMes .= "<br/> => " . $paramRes["systemerror"];
|
||||
|
||||
if(isset($paramRes['type']) && $paramRes['type'] == 'error')
|
||||
printError($errorMes);
|
||||
else
|
||||
printWarning($errorMes);
|
||||
}
|
||||
|
||||
return $hasError;
|
||||
} /* }}} */
|
||||
|
||||
function fileExistsInIncludePath($file) { /* {{{ */
|
||||
$paths = explode(PATH_SEPARATOR, get_include_path());
|
||||
$found = false;
|
||||
|
@ -170,12 +110,13 @@ do {
|
|||
$httpRoot = str_replace ("//", "/" , $httpRoot, $count);
|
||||
} while ($count<>0);
|
||||
|
||||
$msg = '';
|
||||
if($rootDir != $settings->_rootDir) {
|
||||
$msg = "Your Root directory has been modified to fit your installation path!";
|
||||
}
|
||||
$settings->_rootDir = $rootDir;
|
||||
|
||||
if(!$settings->_contentDir) {
|
||||
if(!$settings->_contentDir || !is_dir($settings->_contentDir)) {
|
||||
$settings->_contentDir = realpath($settings->_rootDir."..") . '/data/';
|
||||
$settings->_luceneDir = $settings->_contentDir . 'lucene/';
|
||||
$settings->_stagingDir = $settings->_contentDir . 'staging/';
|
||||
|
@ -186,6 +127,11 @@ if(!$settings->_contentDir) {
|
|||
$settings->_cacheDir = $settings->_contentDir . 'cache/';
|
||||
}
|
||||
}
|
||||
if($settings->_dbDriver == 'sqlite') {
|
||||
if(!$settings->_dbDatabase || !file_exists($settings->_dbDatabase)) {
|
||||
$settings->_dbDatabase = $settings->_contentDir.'content.db';
|
||||
}
|
||||
}
|
||||
$settings->_httpRoot = $httpRoot;
|
||||
|
||||
if(isset($settings->_extraPath))
|
||||
|
@ -201,5 +147,5 @@ include("../inc/inc.ClassUI.php");
|
|||
include("class.Install.php");
|
||||
|
||||
$view = new SeedDMS_View_Install(array('settings'=>$settings, 'session'=>null, 'sitename'=>'SeedDMS', 'printdisclaimer'=>0, 'showmissingtranslations'=>0, 'absbaseprefix'=>'/', 'enabledropfolderlist'=>0, 'enablemenutasks'=>0, 'configdir'=>$configDir));
|
||||
$view->install();
|
||||
?>
|
||||
$view->install($msg);
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ if(!$controller->run()) {
|
|||
$user = $controller->getUser();
|
||||
|
||||
if (isset($referuri) && strlen($referuri)>0) {
|
||||
header("Location: " . getBaseUrl() . "/" . $referuri);
|
||||
header("Location: " . getBaseUrl() . $referuri);
|
||||
}
|
||||
else {
|
||||
header("Location: ".$settings->_httpRoot.(isset($settings->_siteDefaultPage) && strlen($settings->_siteDefaultPage)>0 ? $settings->_siteDefaultPage : "out/out.ViewFolder.php?folderid=".($user->getHomeFolder() ? $user->getHomeFolder() : $settings->_rootFolderID)));
|
||||
|
|
|
@ -52,8 +52,8 @@ class SeedDMS_View_EditAttributes extends SeedDMS_Theme_Style {
|
|||
<input type="hidden" name="version" value="<?php print $version->getVersion();?>">
|
||||
|
||||
<?php
|
||||
$this->contentContainerStart();
|
||||
if($attrdefs) {
|
||||
$this->contentContainerStart();
|
||||
foreach($attrdefs as $attrdef) {
|
||||
$arr = $this->callHook('editDocumentContentAttribute', $version, $attrdef);
|
||||
if(is_array($arr)) {
|
||||
|
@ -66,17 +66,19 @@ class SeedDMS_View_EditAttributes extends SeedDMS_Theme_Style {
|
|||
$this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, $version->getAttribute($attrdef)));
|
||||
}
|
||||
}
|
||||
}
|
||||
$arrs = $this->callHook('addDocumentContentAttributes', $version);
|
||||
if(is_array($arrs)) {
|
||||
foreach($arrs as $arr) {
|
||||
$this->formField($arr[0], $arr[1], isset($arr[2]) ? $arr[2] : null);
|
||||
$arrs = $this->callHook('addDocumentContentAttributes', $version);
|
||||
if(is_array($arrs)) {
|
||||
foreach($arrs as $arr) {
|
||||
$this->formField($arr[0], $arr[1], isset($arr[2]) ? $arr[2] : null);
|
||||
}
|
||||
} elseif(is_string($arrs)) {
|
||||
echo $arrs;
|
||||
}
|
||||
} elseif(is_string($arrs)) {
|
||||
echo $arrs;
|
||||
$this->contentContainerEnd();
|
||||
$this->formSubmit("<i class=\"fa fa-save\"></i> ".getMLText('save'));
|
||||
} else {
|
||||
$this->warningMsg(getMLText('no_attributes_defined'));
|
||||
}
|
||||
$this->contentContainerEnd();
|
||||
$this->formSubmit("<i class=\"fa fa-save\"></i> ".getMLText('save'));
|
||||
?>
|
||||
</form>
|
||||
<?php
|
||||
|
|
Loading…
Reference in New Issue
Block a user