diff --git a/plugins/thumbnails/thumbnails.php b/plugins/thumbnails/thumbnails.php
index a2fe432..5556454 100755
--- a/plugins/thumbnails/thumbnails.php
+++ b/plugins/thumbnails/thumbnails.php
@@ -147,10 +147,10 @@ class thumbnailGenerator extends BaseProcessor
$mimeType = KTMime::getMimeTypeName($mimeTypeId);
// Get the pdf source file - if the document is a pdf then use the document as the source
- if($mimeType == 'application/pdf'){
+ if($mimeType == 'application/pdf') {
$pdfDir = $default->documentRoot;
$pdfFile = $pdfDir . DIRECTORY_SEPARATOR . $this->document->getStoragePath();
- }else{
+ } else {
$pdfDir = $default->pdfDirectory;
$pdfFile = $pdfDir .DIRECTORY_SEPARATOR. $this->document->iId.'.pdf';
}
@@ -175,28 +175,23 @@ class thumbnailGenerator extends BaseProcessor
$default->log->debug('Thumbnail Generator Plugin: PDF file does not exist, cannot generate a thumbnail');
return false;
}
- // if a previous version of the thumbnail exists - delete it
+
+ // if a previous version of the thumbnail exists - delete it
if (file_exists($thumbnailfile)) {
@unlink($thumbnailfile);
}
// do generation
- // if (extension_loaded('imagick')) {
- $pathConvert = (!empty($default->convertPath)) ? $default->convertPath : 'convert';
- // windows path may contain spaces
-
- if (stristr(PHP_OS,'WIN')) {
- $cmd = "\"{$pathConvert}\" -size 200x200 \"{$pdfFile}[0]\" -resize 200x200 \"$thumbnailfile\"";
- }
- else {
- $cmd = "{$pathConvert} -size 200x200 {$pdfFile}[0] -resize 200x200 $thumbnailfile";
- }
- $result = KTUtil::pexec($cmd);
- return true;
- //}else{
- //$default->log->debug('Thumbnail Generator Plugin: Imagemagick not installed, cannot generate a thumbnail');
- // return false;
- //}
-
+ $pathConvert = (!empty($default->convertPath)) ? $default->convertPath : 'convert';
+ // windows path may contain spaces
+ if (stristr(PHP_OS,'WIN')) {
+ $cmd = "\"{$pathConvert}\" -size 200x200 \"{$pdfFile}[0]\" -resize 200x200 \"$thumbnailfile\"";
+ }
+ else {
+ $cmd = "{$pathConvert} -size 200x200 {$pdfFile}[0] -resize 200x200 $thumbnailfile";
+ }
+
+ $result = KTUtil::pexec($cmd);
+ return true;
}
}
diff --git a/setup/migrate/migrater.php b/setup/migrate/migrater.php
index dff40d1..d7b6907 100644
--- a/setup/migrate/migrater.php
+++ b/setup/migrate/migrater.php
@@ -540,6 +540,9 @@ class Migrater {
$this->_landing();
} elseif ($res == 'landing') {
$this->_landing();
+ } elseif ($res == 'binstall') {
+ $util = new MigrateUtil();
+ $util->redirect('../wizard/index.php?step_name=dependencies');
} else {
}
break;
@@ -550,10 +553,10 @@ class Migrater {
$util = new MigrateUtil();
$util->redirect('../wizard/index.php?step_name=installtype');
break;
- case 'binstall':
- $util = new MigrateUtil();
- $util->redirect('../wizard/index.php?step_name=dependencies');
- break;
+// case 'binstall':
+// $util = new MigrateUtil();
+// $util->redirect('../wizard/index.php?step_name=dependencies');
+// break;
default:
// TODO : handle silent
$this->_landing();
diff --git a/setup/migrate/steps/migrateComplete.php b/setup/migrate/steps/migrateComplete.php
index e3dda6f..c70a228 100644
--- a/setup/migrate/steps/migrateComplete.php
+++ b/setup/migrate/steps/migrateComplete.php
@@ -57,6 +57,14 @@ class migrateComplete extends Step {
*/
protected $mysqlServiceName = "KTMysql";
+ /**
+ * Name of BitRock Stack MySql
+ *
+ * @access protected
+ * @var string
+ */
+ protected $zendMysql = "MySQL_ZendServer51";
+
/**
* Returns step state
*
@@ -67,23 +75,26 @@ class migrateComplete extends Step {
*/
function doStep() {
$this->temp_variables = array("step_name"=>"complete", "silent"=>$this->silent);
- $this->doRun();
- return 'landing';
+ return $this->doRun();
}
function doRun() {
+ $this->checkSqlDump();
if(!$this->inStep("complete")) {
- $this->checkSqlDump();
+
return 'landing';
}
if($this->next()) {
- if($this->checkMysql()) {
- return 'next';
+ $this->checkZendMysql();
+ //if($this->checkMysql()) {
+ if($this->checkZendMysql()) {
+ return 'binstall';
} else {
return 'error';
}
}
$this->removeInstallSessions();
+ return 'landing';
}
private function removeInstallSessions() {
@@ -132,17 +143,51 @@ class migrateComplete extends Step {
$running = true;
}
if($running) {
- $this->temp_variables['services']['KTMysql']['class'] = "cross";
- $this->temp_variables['services']['KTMysql']['name'] = "KTMysql";
- $this->temp_variables['services']['KTMysql']['msg'] = "Service Running";
+ $this->temp_variables['ktmysql']['class'] = "cross";
+ $this->temp_variables['ktmysql']['name'] = "KTMysql";
+ $this->temp_variables['ktmysql']['msg'] = "Service Running";
$this->error[] = "Service : KTMysql running.
";
return false;
} else {
- $this->temp_variables['services']['KTMysql']['class'] = "tick";
- $this->temp_variables['services']['KTMysql']['name'] = "KTMysql";
- $this->temp_variables['services']['KTMysql']['msg'] = "Service has been uninstalled";
+ $this->temp_variables['ktmysql']['class'] = "tick";
+ $this->temp_variables['ktmysql']['name'] = "KTMysql";
+ $this->temp_variables['ktmysql']['msg'] = "Service has been uninstalled";
return true;
}
}
+
+ private function checkZendMysql() {
+ $running = false;
+ if(WINDOWS_OS) {
+ $cmd = "sc query {$this->zendMysql}";
+ $response = $this->util->pexec($cmd);
+ if($response['out']) {
+ $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key
+ }
+ if($state == "STARTED")
+ $running = true;
+ } else {
+ //TODO : Read fomr my.cnf file
+ $mysqlPid = "/var/run/mysqld/mysqld.sock";
+ if(file_exists($mysqlPid))
+ $running = true;
+ }
+ if($running) {
+ $this->temp_variables['zmysql']['class'] = "tick";
+ $this->temp_variables['zmysql']['name'] = "KTMysql";
+ $this->temp_variables['zmysql']['msg'] = "Service Running";
+ return true;
+ } else {
+ $this->temp_variables['zmysql']['class'] = "cross";
+ $this->temp_variables['zmysql']['name'] = "Mysql";
+ $this->temp_variables['zmysql']['msg'] = "Service not running";
+ $this->error[] = "Service : KTMysql running.
";
+ return false;
+ }
+ }
+
+ public function getErrors() {
+ return $this->error;
+ }
}
?>
\ No newline at end of file
diff --git a/setup/migrate/steps/migrateInstallation.php b/setup/migrate/steps/migrateInstallation.php
index 0718624..16634a3 100644
--- a/setup/migrate/steps/migrateInstallation.php
+++ b/setup/migrate/steps/migrateInstallation.php
@@ -241,17 +241,17 @@ class migrateInstallation extends step
if ($froot == 'default') {
$froot = $this->location;
}
- $this->ktSettings = array('fileSystemRoot'=> $froot,
- );
+ $this->ktSettings = array('fileSystemRoot'=> $froot);
$varDir = $froot.DS.'var';
- $this->urlPaths = array(array('name'=> 'Var Directory', 'path'=> $varDir),
- array('name'=> 'Log Directory', 'path'=> $varDir.DS.'log'),
- array('name'=> 'Document Root', 'path'=> $varDir.DS.'Documents'),
- array('name'=> 'UI Directory', 'path'=> $froot.DS.'presentation'.DS.'lookAndFeel'.DS.'knowledgeTree'),
- array('name'=> 'Temporary Directory', 'path'=> $varDir.DS.'tmp'),
- array('name'=> 'Cache Directory', 'path'=> $varDir.DS.'cache'),
- array('name'=> 'Upload Directory', 'path'=> $varDir.DS.'uploads'),
+ $this->urlPaths = array(
+// array('name'=> 'Var Directory', 'path'=> $varDir),
+// array('name'=> 'Log Directory', 'path'=> $varDir.DS.'log'),
+ array('name'=> 'Document Root', 'path'=> $froot.DS.'Documents'),
+// array('name'=> 'Temporary Directory', 'path'=> $varDir.DS.'tmp'),
+// array('name'=> 'Cache Directory', 'path'=> $varDir.DS.'cache'),
+// array('name'=> 'Upload Directory', 'path'=> $varDir.DS.'uploads'),
);
+// $this->urlPaths = array();
$this->dbSettings['dbPort'] = $this->util->getPort($this->location); // Add Port
$this->temp_variables['urlPaths'] = $this->urlPaths;
$this->temp_variables['ktSettings'] = $this->ktSettings;
diff --git a/setup/migrate/steps/migrateServices.php b/setup/migrate/steps/migrateServices.php
index f30dc1a..a6d9fb0 100644
--- a/setup/migrate/steps/migrateServices.php
+++ b/setup/migrate/steps/migrateServices.php
@@ -271,7 +271,7 @@ class migrateServices extends Step
}
/**
- * Check if services are uninstall
+ * Check if services are uninstall
*
*/
private function checkServices() {
@@ -285,7 +285,7 @@ class migrateServices extends Step
$this->error[] = "Service : {$serv->getName()} could not be uninstalled.
";
$this->serviceCheck = 'cross';
//$stopmsg = OS.'GetStopMsg';
- $this->temp_variables['services'][$serv->getName()]['msg'] = "Service Running"; //$serv->getStopMsg($this->conf['location']);
+ $this->temp_variables['services'][$serv->getName()]['msg'] = "Service Running";
} else {
$state = 'tick';
$this->temp_variables['services'][$serv->getName()]['msg'] = "Service has been uninstalled";
@@ -341,7 +341,7 @@ class migrateServices extends Step
} else {
$this->temp_variables['services']['KTMysql']['name'] = "KnowledgeTree Mysql Service.";
}
- $this->temp_variables['services']['KTMysql']['msg'] = "Service has been uninstalled";
+ $this->temp_variables['services']['KTMysql']['msg'] = "Service has been stopped";
return true;
}
}
diff --git a/setup/migrate/templates/complete.tpl b/setup/migrate/templates/complete.tpl
index de9745d..fd1bbe0 100644
--- a/setup/migrate/templates/complete.tpl
+++ b/setup/migrate/templates/complete.tpl
@@ -12,13 +12,25 @@
- cd
+ cd
dmsctl.bat install
dmsctl.bat start
diff --git a/setup/upgrade/templates/database.tpl b/setup/upgrade/templates/database.tpl
index 64c38cc..a9716ef 100644
--- a/setup/upgrade/templates/database.tpl
+++ b/setup/upgrade/templates/database.tpl
@@ -51,8 +51,12 @@
else if ($action == 'runUpgrade') { ?>
+
diff --git a/setup/wizard/installUtil.php b/setup/wizard/installUtil.php
index c684624..38cbe9d 100644
--- a/setup/wizard/installUtil.php
+++ b/setup/wizard/installUtil.php
@@ -558,6 +558,16 @@ class InstallUtil {
return false;
}
+ public function upgradeInstall() {
+ if(isset($_POST['Next'])) {
+ if($_POST['Next'] == "Upgrade") {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
/**
* Check if system needs to be migrated
*
@@ -595,7 +605,6 @@ class InstallUtil {
}
public function loginSpecified() {
-// return true;
if(isset($_GET['Return'])) {
if($_GET['Return'] == "Return To Installation") {
return true;
@@ -1046,8 +1055,93 @@ class InstallUtil {
}
// }}}
- /*
- Just Because.
- */
+ // {{{ copyDirectory
+ function copyDirectory($sSrc, $sDst, $bMove = false) {
+ if (file_exists($sDst)) {
+ return false; //PEAR::raiseError(_kt("Destination directory already exists."));
+ }
+ if (!WINDOWS_OS) {
+ if ($bMove && file_exists('/bin/mv')) {
+ $this->pexec(array('/bin/mv', $sSrc, $sDst));
+ return;
+ }
+ if (!$bMove && file_exists('/bin/cp')) {
+ $this->pexec(array('/bin/cp', '-R', $sSrc, $sDst));
+ return;
+ }
+ }
+ if (substr($sDst, 0, strlen($sSrc)) === $sSrc) {
+ return false; //PEAR::raiseError(_kt("Destination of move is within source"));
+ }
+ $hSrc = @opendir($sSrc);
+ if ($hSrc === false) {
+ return false; //PEAR::raiseError(sprintf(_kt("Could not open source directory: %s"), $sSrc));
+ }
+ if (@mkdir($sDst, 0777) === false) {
+ return false; //PEAR::raiseError(sprintf(_kt("Could not create destination directory: %s"), $sDst));
+ }
+ while (($sFilename = readdir($hSrc)) !== false) {
+ if (in_array($sFilename, array('.', '..'))) {
+ continue;
+ }
+ $sOldFile = sprintf("%s/%s", $sSrc, $sFilename);
+ $sNewFile = sprintf("%s/%s", $sDst, $sFilename);
+ if (is_dir($sOldFile)) {
+ $this->copyDirectory($sOldFile, $sNewFile, $bMove);
+ continue;
+ }
+ if ($bMove) {
+ $this->moveFile($sOldFile, $sNewFile);
+ } else {
+ copy($sOldFile, $sNewFile);
+ }
+ }
+ if ($bMove) {
+ @rmdir($sSrc);
+ }
+ }
+ // }}}
+
+ // {{{ moveFile
+ function moveFile ($sSrc, $sDst) {
+ // Only 4.3.3 and above allow us to use rename across partitions
+ // on Unix-like systems.
+ if (!WINDOWS_OS) {
+ // If /bin/mv exists, just use it.
+ if (file_exists('/bin/mv')) {
+ $this->pexec(array('/bin/mv', $sSrc, $sDst));
+ return;
+ }
+ $aSrcStat = stat($sSrc);
+ if ($aSrcStat === false) {
+ return false; //PEAR::raiseError(sprintf(_kt("Couldn't stat source file: %s"), $sSrc));
+ }
+ $aDstStat = stat(dirname($sDst));
+ if ($aDstStat === false) {
+ return false; //PEAR::raiseError(sprintf(_kt("Couldn't stat destination location: %s"), $sDst));
+ }
+ if ($aSrcStat["dev"] === $aDstStat["dev"]) {
+ $res = @rename($sSrc, $sDst);
+ if ($res === false) {
+ return false; //PEAR::raiseError(sprintf(_kt("Couldn't move file to destination: %s"), $sDst));
+ }
+ return;
+ }
+ $res = @copy($sSrc, $sDst);
+ if ($res === false) {
+ return false; //PEAR::raiseError(sprintf(_kt("Could not copy to destination: %s"), $sDst));
+ }
+ $res = @unlink($sSrc);
+ if ($res === false) {
+ return false; //PEAR::raiseError(sprintf(_kt("Could not remove source: %s"), $sSrc));
+ }
+ } else {
+ $res = @rename($sSrc, $sDst);
+ if ($res === false) {
+ return false; //PEAR::raiseError(sprintf(_kt("Could not move to destination: %s"), $sDst));
+ }
+ }
+ }
+ // }}}
}
?>
diff --git a/setup/wizard/installWizard.php b/setup/wizard/installWizard.php
index bed117e..4e56516 100644
--- a/setup/wizard/installWizard.php
+++ b/setup/wizard/installWizard.php
@@ -281,12 +281,16 @@ class InstallWizard {
$this->createInstallFile();
}
if(!$this->isSystemInstalled()) { // Check if the systems not installed
- if($this->util->loginSpecified()) {
+ if($this->util->loginSpecified()) { // Back to wizard from upgrader
$this->util->redirect('../../control.php');
} elseif($this->util->migrationSpecified()) { // Check if the migrator needs to be accessed
$this->util->redirect('../migrate/index.php?');
- } elseif ($this->util->upgradeSpecified()) {
+ } elseif ($this->util->upgradeSpecified()) { // Check if the upgrader needs to be accessed
$this->util->redirect('../upgrade/index.php?action=installer');
+ } elseif ($this->util->finishSpecified()) { // Check if the installer has completed
+ $this->util->redirect('../../login.php');
+ } elseif ($this->util->upgradeInstall()) { // Check if the upgrader needs to be accessed
+ $this->util->redirect('../upgrade/index.php');
}
$response = $this->systemChecks();
if($response === true) {
diff --git a/setup/wizard/steps/database.php b/setup/wizard/steps/database.php
index 8c41c3f..56134eb 100644
--- a/setup/wizard/steps/database.php
+++ b/setup/wizard/steps/database.php
@@ -644,6 +644,7 @@ class database extends Step
$this->writeBinaries();
// ensure a guid was generated and is stored
$this->util->getSystemIdentifier();
+ $this->reBuildPaths();
return true;
}
@@ -770,8 +771,8 @@ class database extends Step
$this->parse_mysql_dump($sqlFile);
$dropPluginHelper = "TRUNCATE plugin_helper;"; // Remove plugin helper table
$this->util->dbUtilities->query($dropPluginHelper);
- $updateUrls = 'UPDATE config_settings c SET c.value = "default" where c.group_name = "urls";'; // Remove references to old paths
- $this->util->dbUtilities->query($updateUrls);
+ $this->reBuildPaths();
+
$updateExternalBinaries = 'UPDATE config_settings c SET c.value = "default" where c.group_name = "externalBinary";'; // Remove references to old paths
$this->util->dbUtilities->query($updateExternalBinaries);
$this->writeBinaries(); // Rebuild some of the binaries
@@ -780,6 +781,15 @@ class database extends Step
return true;
}
+ private function reBuildPaths() {
+ $conf = $this->util->getDataFromSession('configuration');
+ $paths = $conf['paths'];
+ foreach ($paths as $k=>$path) {
+ $sql = 'UPDATE config_settings SET value = "'.$path['path'].'" where item = "'.$k.'";';
+ $this->util->dbUtilities->query($sql);
+ }
+ }
+
private function writeBinaries() {
// if Windows, attempt to insert full paths to binaries
if (WINDOWS_OS) {
@@ -792,18 +802,18 @@ class database extends Step
'unzip' => array(0 => 'import', 1 => SYSTEM_ROOT . 'bin\unzip\unzip.exe'));
if (INSTALL_TYPE == 'commercial' || true) {
- $winBinaries['pdf2swf'] = array(0 => 'externalBinary', 1 => SYSTEM_ROOT . 'bin\pdf2swf.exe');
+ $winBinaries['pdf2swf'] = array(0 => 'externalBinary', 1 => SYSTEM_ROOT . 'bin\swftools\pdf2swf.exe');
}
foreach ($winBinaries as $displayName => $bin)
{
// continue without attempting to set the path if we can't find the file in the specified location
- if (!file_exists($bin[1])) continue;
+// if (!file_exists($bin[1])) continue;
// instaView won't exist, must be inserted instead of updated
if ($displayName == 'pdf2swf') {
$updateBin = 'INSERT INTO `config_settings` (group_name, display_name, description, item, value, default_value, type, options, can_edit) '
- . 'VALUES ("' . $bin[0] . '", "pdf2swf", "The path to the SWFTools \"pdf2swf\" binary", "pdf2swfPath", '
+ . 'VALUES ("' . $bin[0] . '", "' . $displayName . '", "The path to the SWFTools \"pdf2swf\" binary", "pdf2swfPath", '
. '"' . str_replace('\\', '\\\\', $bin[1]) . '", "pdf2swf", "string", NULL, 1);';
}
else {
diff --git a/setup/wizard/templates/complete.tpl b/setup/wizard/templates/complete.tpl
index 8d27b8f..c40949b 100644
--- a/setup/wizard/templates/complete.tpl
+++ b/setup/wizard/templates/complete.tpl
@@ -228,9 +228,11 @@
$redirect = "http://".$_SERVER['SERVER_NAME'].":$port".$root_url."/admin.php";
?>
- Next
+
+
- Finish
+
+
js('form.js'); } ?>
\ No newline at end of file