Commit 7cf0df7d79f0be9e79a216824c0ea010ca577ced

Authored by Megan Watson
2 parents 9e39a956 83f0dcfa

Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge

plugins/thumbnails/thumbnails.php
@@ -147,10 +147,10 @@ class thumbnailGenerator extends BaseProcessor @@ -147,10 +147,10 @@ class thumbnailGenerator extends BaseProcessor
147 $mimeType = KTMime::getMimeTypeName($mimeTypeId); 147 $mimeType = KTMime::getMimeTypeName($mimeTypeId);
148 148
149 // Get the pdf source file - if the document is a pdf then use the document as the source 149 // Get the pdf source file - if the document is a pdf then use the document as the source
150 - if($mimeType == 'application/pdf'){ 150 + if($mimeType == 'application/pdf') {
151 $pdfDir = $default->documentRoot; 151 $pdfDir = $default->documentRoot;
152 $pdfFile = $pdfDir . DIRECTORY_SEPARATOR . $this->document->getStoragePath(); 152 $pdfFile = $pdfDir . DIRECTORY_SEPARATOR . $this->document->getStoragePath();
153 - }else{ 153 + } else {
154 $pdfDir = $default->pdfDirectory; 154 $pdfDir = $default->pdfDirectory;
155 $pdfFile = $pdfDir .DIRECTORY_SEPARATOR. $this->document->iId.'.pdf'; 155 $pdfFile = $pdfDir .DIRECTORY_SEPARATOR. $this->document->iId.'.pdf';
156 } 156 }
@@ -175,28 +175,23 @@ class thumbnailGenerator extends BaseProcessor @@ -175,28 +175,23 @@ class thumbnailGenerator extends BaseProcessor
175 $default->log->debug('Thumbnail Generator Plugin: PDF file does not exist, cannot generate a thumbnail'); 175 $default->log->debug('Thumbnail Generator Plugin: PDF file does not exist, cannot generate a thumbnail');
176 return false; 176 return false;
177 } 177 }
178 - // if a previous version of the thumbnail exists - delete it 178 +
  179 + // if a previous version of the thumbnail exists - delete it
179 if (file_exists($thumbnailfile)) { 180 if (file_exists($thumbnailfile)) {
180 @unlink($thumbnailfile); 181 @unlink($thumbnailfile);
181 } 182 }
182 // do generation 183 // do generation
183 - // if (extension_loaded('imagick')) {  
184 - $pathConvert = (!empty($default->convertPath)) ? $default->convertPath : 'convert';  
185 - // windows path may contain spaces  
186 -  
187 - if (stristr(PHP_OS,'WIN')) {  
188 - $cmd = "\"{$pathConvert}\" -size 200x200 \"{$pdfFile}[0]\" -resize 200x200 \"$thumbnailfile\"";  
189 - }  
190 - else {  
191 - $cmd = "{$pathConvert} -size 200x200 {$pdfFile}[0] -resize 200x200 $thumbnailfile";  
192 - }  
193 - $result = KTUtil::pexec($cmd);  
194 - return true;  
195 - //}else{  
196 - //$default->log->debug('Thumbnail Generator Plugin: Imagemagick not installed, cannot generate a thumbnail');  
197 - // return false;  
198 - //}  
199 - 184 + $pathConvert = (!empty($default->convertPath)) ? $default->convertPath : 'convert';
  185 + // windows path may contain spaces
  186 + if (stristr(PHP_OS,'WIN')) {
  187 + $cmd = "\"{$pathConvert}\" -size 200x200 \"{$pdfFile}[0]\" -resize 200x200 \"$thumbnailfile\"";
  188 + }
  189 + else {
  190 + $cmd = "{$pathConvert} -size 200x200 {$pdfFile}[0] -resize 200x200 $thumbnailfile";
  191 + }
  192 +
  193 + $result = KTUtil::pexec($cmd);
  194 + return true;
200 } 195 }
201 } 196 }
202 197
setup/migrate/migrater.php
@@ -540,6 +540,9 @@ class Migrater { @@ -540,6 +540,9 @@ class Migrater {
540 $this->_landing(); 540 $this->_landing();
541 } elseif ($res == 'landing') { 541 } elseif ($res == 'landing') {
542 $this->_landing(); 542 $this->_landing();
  543 + } elseif ($res == 'binstall') {
  544 + $util = new MigrateUtil();
  545 + $util->redirect('../wizard/index.php?step_name=dependencies');
543 } else { 546 } else {
544 } 547 }
545 break; 548 break;
@@ -550,10 +553,10 @@ class Migrater { @@ -550,10 +553,10 @@ class Migrater {
550 $util = new MigrateUtil(); 553 $util = new MigrateUtil();
551 $util->redirect('../wizard/index.php?step_name=installtype'); 554 $util->redirect('../wizard/index.php?step_name=installtype');
552 break; 555 break;
553 - case 'binstall':  
554 - $util = new MigrateUtil();  
555 - $util->redirect('../wizard/index.php?step_name=dependencies');  
556 - break; 556 +// case 'binstall':
  557 +// $util = new MigrateUtil();
  558 +// $util->redirect('../wizard/index.php?step_name=dependencies');
  559 +// break;
557 default: 560 default:
558 // TODO : handle silent 561 // TODO : handle silent
559 $this->_landing(); 562 $this->_landing();
setup/migrate/steps/migrateComplete.php
@@ -57,6 +57,14 @@ class migrateComplete extends Step { @@ -57,6 +57,14 @@ class migrateComplete extends Step {
57 */ 57 */
58 protected $mysqlServiceName = "KTMysql"; 58 protected $mysqlServiceName = "KTMysql";
59 59
  60 + /**
  61 + * Name of BitRock Stack MySql
  62 + *
  63 + * @access protected
  64 + * @var string
  65 + */
  66 + protected $zendMysql = "MySQL_ZendServer51";
  67 +
60 /** 68 /**
61 * Returns step state 69 * Returns step state
62 * 70 *
@@ -67,23 +75,26 @@ class migrateComplete extends Step { @@ -67,23 +75,26 @@ class migrateComplete extends Step {
67 */ 75 */
68 function doStep() { 76 function doStep() {
69 $this->temp_variables = array("step_name"=>"complete", "silent"=>$this->silent); 77 $this->temp_variables = array("step_name"=>"complete", "silent"=>$this->silent);
70 - $this->doRun();  
71 - return 'landing'; 78 + return $this->doRun();
72 } 79 }
73 80
74 function doRun() { 81 function doRun() {
  82 + $this->checkSqlDump();
75 if(!$this->inStep("complete")) { 83 if(!$this->inStep("complete")) {
76 - $this->checkSqlDump(); 84 +
77 return 'landing'; 85 return 'landing';
78 } 86 }
79 if($this->next()) { 87 if($this->next()) {
80 - if($this->checkMysql()) {  
81 - return 'next'; 88 + $this->checkZendMysql();
  89 + //if($this->checkMysql()) {
  90 + if($this->checkZendMysql()) {
  91 + return 'binstall';
82 } else { 92 } else {
83 return 'error'; 93 return 'error';
84 } 94 }
85 } 95 }
86 $this->removeInstallSessions(); 96 $this->removeInstallSessions();
  97 + return 'landing';
87 } 98 }
88 99
89 private function removeInstallSessions() { 100 private function removeInstallSessions() {
@@ -132,17 +143,51 @@ class migrateComplete extends Step { @@ -132,17 +143,51 @@ class migrateComplete extends Step {
132 $running = true; 143 $running = true;
133 } 144 }
134 if($running) { 145 if($running) {
135 - $this->temp_variables['services']['KTMysql']['class'] = "cross";  
136 - $this->temp_variables['services']['KTMysql']['name'] = "KTMysql";  
137 - $this->temp_variables['services']['KTMysql']['msg'] = "Service Running"; 146 + $this->temp_variables['ktmysql']['class'] = "cross";
  147 + $this->temp_variables['ktmysql']['name'] = "KTMysql";
  148 + $this->temp_variables['ktmysql']['msg'] = "Service Running";
138 $this->error[] = "Service : KTMysql running.<br/>"; 149 $this->error[] = "Service : KTMysql running.<br/>";
139 return false; 150 return false;
140 } else { 151 } else {
141 - $this->temp_variables['services']['KTMysql']['class'] = "tick";  
142 - $this->temp_variables['services']['KTMysql']['name'] = "KTMysql";  
143 - $this->temp_variables['services']['KTMysql']['msg'] = "Service has been uninstalled"; 152 + $this->temp_variables['ktmysql']['class'] = "tick";
  153 + $this->temp_variables['ktmysql']['name'] = "KTMysql";
  154 + $this->temp_variables['ktmysql']['msg'] = "Service has been uninstalled";
144 return true; 155 return true;
145 } 156 }
146 } 157 }
  158 +
  159 + private function checkZendMysql() {
  160 + $running = false;
  161 + if(WINDOWS_OS) {
  162 + $cmd = "sc query {$this->zendMysql}";
  163 + $response = $this->util->pexec($cmd);
  164 + if($response['out']) {
  165 + $state = preg_replace('/^STATE *\: *\d */', '', trim($response['out'][3])); // Status store in third key
  166 + }
  167 + if($state == "STARTED")
  168 + $running = true;
  169 + } else {
  170 + //TODO : Read fomr my.cnf file
  171 + $mysqlPid = "/var/run/mysqld/mysqld.sock";
  172 + if(file_exists($mysqlPid))
  173 + $running = true;
  174 + }
  175 + if($running) {
  176 + $this->temp_variables['zmysql']['class'] = "tick";
  177 + $this->temp_variables['zmysql']['name'] = "KTMysql";
  178 + $this->temp_variables['zmysql']['msg'] = "Service Running";
  179 + return true;
  180 + } else {
  181 + $this->temp_variables['zmysql']['class'] = "cross";
  182 + $this->temp_variables['zmysql']['name'] = "Mysql";
  183 + $this->temp_variables['zmysql']['msg'] = "Service not running";
  184 + $this->error[] = "Service : KTMysql running.<br/>";
  185 + return false;
  186 + }
  187 + }
  188 +
  189 + public function getErrors() {
  190 + return $this->error;
  191 + }
147 } 192 }
148 ?> 193 ?>
149 \ No newline at end of file 194 \ No newline at end of file
setup/migrate/steps/migrateInstallation.php
@@ -241,17 +241,17 @@ class migrateInstallation extends step @@ -241,17 +241,17 @@ class migrateInstallation extends step
241 if ($froot == 'default') { 241 if ($froot == 'default') {
242 $froot = $this->location; 242 $froot = $this->location;
243 } 243 }
244 - $this->ktSettings = array('fileSystemRoot'=> $froot,  
245 - ); 244 + $this->ktSettings = array('fileSystemRoot'=> $froot);
246 $varDir = $froot.DS.'var'; 245 $varDir = $froot.DS.'var';
247 - $this->urlPaths = array(array('name'=> 'Var Directory', 'path'=> $varDir),  
248 - array('name'=> 'Log Directory', 'path'=> $varDir.DS.'log'),  
249 - array('name'=> 'Document Root', 'path'=> $varDir.DS.'Documents'),  
250 - array('name'=> 'UI Directory', 'path'=> $froot.DS.'presentation'.DS.'lookAndFeel'.DS.'knowledgeTree'),  
251 - array('name'=> 'Temporary Directory', 'path'=> $varDir.DS.'tmp'),  
252 - array('name'=> 'Cache Directory', 'path'=> $varDir.DS.'cache'),  
253 - array('name'=> 'Upload Directory', 'path'=> $varDir.DS.'uploads'), 246 + $this->urlPaths = array(
  247 +// array('name'=> 'Var Directory', 'path'=> $varDir),
  248 +// array('name'=> 'Log Directory', 'path'=> $varDir.DS.'log'),
  249 + array('name'=> 'Document Root', 'path'=> $froot.DS.'Documents'),
  250 +// array('name'=> 'Temporary Directory', 'path'=> $varDir.DS.'tmp'),
  251 +// array('name'=> 'Cache Directory', 'path'=> $varDir.DS.'cache'),
  252 +// array('name'=> 'Upload Directory', 'path'=> $varDir.DS.'uploads'),
254 ); 253 );
  254 +// $this->urlPaths = array();
255 $this->dbSettings['dbPort'] = $this->util->getPort($this->location); // Add Port 255 $this->dbSettings['dbPort'] = $this->util->getPort($this->location); // Add Port
256 $this->temp_variables['urlPaths'] = $this->urlPaths; 256 $this->temp_variables['urlPaths'] = $this->urlPaths;
257 $this->temp_variables['ktSettings'] = $this->ktSettings; 257 $this->temp_variables['ktSettings'] = $this->ktSettings;
setup/migrate/steps/migrateServices.php
@@ -271,7 +271,7 @@ class migrateServices extends Step @@ -271,7 +271,7 @@ class migrateServices extends Step
271 } 271 }
272 272
273 /** 273 /**
274 - * Check if services are uninstall 274 + * Check if services are uninstall
275 * 275 *
276 */ 276 */
277 private function checkServices() { 277 private function checkServices() {
@@ -285,7 +285,7 @@ class migrateServices extends Step @@ -285,7 +285,7 @@ class migrateServices extends Step
285 $this->error[] = "Service : {$serv->getName()} could not be uninstalled.<br/>"; 285 $this->error[] = "Service : {$serv->getName()} could not be uninstalled.<br/>";
286 $this->serviceCheck = 'cross'; 286 $this->serviceCheck = 'cross';
287 //$stopmsg = OS.'GetStopMsg'; 287 //$stopmsg = OS.'GetStopMsg';
288 - $this->temp_variables['services'][$serv->getName()]['msg'] = "Service Running"; //$serv->getStopMsg($this->conf['location']); 288 + $this->temp_variables['services'][$serv->getName()]['msg'] = "Service Running";
289 } else { 289 } else {
290 $state = 'tick'; 290 $state = 'tick';
291 $this->temp_variables['services'][$serv->getName()]['msg'] = "Service has been uninstalled"; 291 $this->temp_variables['services'][$serv->getName()]['msg'] = "Service has been uninstalled";
@@ -341,7 +341,7 @@ class migrateServices extends Step @@ -341,7 +341,7 @@ class migrateServices extends Step
341 } else { 341 } else {
342 $this->temp_variables['services']['KTMysql']['name'] = "KnowledgeTree Mysql Service."; 342 $this->temp_variables['services']['KTMysql']['name'] = "KnowledgeTree Mysql Service.";
343 } 343 }
344 - $this->temp_variables['services']['KTMysql']['msg'] = "Service has been uninstalled"; 344 + $this->temp_variables['services']['KTMysql']['msg'] = "Service has been stopped";
345 return true; 345 return true;
346 } 346 }
347 } 347 }
setup/migrate/templates/complete.tpl
@@ -12,13 +12,25 @@ @@ -12,13 +12,25 @@
12 <div id="step_content_<?php echo $step_name; ?>" class="step"> 12 <div id="step_content_<?php echo $step_name; ?>" class="step">
13 13
14 <!-- SQL --> 14 <!-- SQL -->
15 - <h3>KnowledgeTree database successfully exported</h3> 15 + <h3>KnowledgeTree database successfully exported to:</h3>
16 <span class='<?php echo $sql['class']; ?>'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><?php echo $sql['msg']; ?> 16 <span class='<?php echo $sql['class']; ?>'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><?php echo $sql['msg']; ?>
17 <br /><br /> 17 <br /><br />
18 <h3>Start new MySQL service</h3> 18 <h3>Start new MySQL service</h3>
19 - In order to complete the upgrade process please start the Zend Server MySQL process (<a href="http://wiki.knowledgetree.com/Web_Based_Migrater#Post_Migrate" target="_blank">Click here for help</a>).  
20 - 19 + In order to complete the upgrade process please start the Zend Server MySQL service and then click <b>Next</b> to continue (<a href="http://wiki.knowledgetree.com/Web_Based_Migrater#Deactivate_Services" target="_blank">Click here for help</a>).
  20 + <br /><br />
  21 + <?php if(!empty($errors)) { ?>
  22 +<!-- <span class='<?php //echo $ktmysql['class']; ?>'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>-->
  23 + <?php //echo $ktmysql['name']; ?>
  24 + <?php //echo $ktmysql['msg']; ?>
  25 +<!-- <br /><br />-->
  26 + <?php //if (WINDOWS_OS) { ?>
  27 + <span class='<?php echo $zmysql['class']; ?>'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
  28 + <?php echo $zmysql['name']; ?>
  29 + <?php echo $zmysql['msg']; ?>
  30 + <?php //} ?>
  31 + <?php } ?>
21 </div> 32 </div>
22 - <input class="button_next" type="submit" value="Continue Installation" name="BInstall"/> 33 +<!-- <input class="button_next" type="submit" value="Continue Installation" name="BInstall"/>-->
  34 + <input class="button_next" type="submit" value="Next" name="Next"/>
23 </form> 35 </form>
24 <?php if (AJAX) { echo $html->js('form.js'); } ?> 36 <?php if (AJAX) { echo $html->js('form.js'); } ?>
25 \ No newline at end of file 37 \ No newline at end of file
setup/upgrade/steps/upgradeDatabase.php
@@ -86,7 +86,8 @@ class upgradeDatabase extends Step @@ -86,7 +86,8 @@ class upgradeDatabase extends Step
86 protected $silent = false; 86 protected $silent = false;
87 protected $temp_variables = array(); 87 protected $temp_variables = array();
88 public $paths = ''; 88 public $paths = '';
89 - 89 + public $migrateCheck = false;
  90 +
90 /** 91 /**
91 * Main control of database setup 92 * Main control of database setup
92 * 93 *
@@ -99,6 +100,7 @@ class upgradeDatabase extends Step @@ -99,6 +100,7 @@ class upgradeDatabase extends Step
99 $this->temp_variables = array("step_name"=>"database", "silent"=>$this->silent, 100 $this->temp_variables = array("step_name"=>"database", "silent"=>$this->silent,
100 "loadingText"=>"The database upgrade is under way. Please wait until it completes"); 101 "loadingText"=>"The database upgrade is under way. Please wait until it completes");
101 $this->initErrors(); 102 $this->initErrors();
  103 + $this->checkMigration();
102 if(!$this->inStep("database")) { 104 if(!$this->inStep("database")) {
103 $this->doRun(); 105 $this->doRun();
104 return 'landing'; 106 return 'landing';
@@ -124,6 +126,12 @@ class upgradeDatabase extends Step @@ -124,6 +126,12 @@ class upgradeDatabase extends Step
124 return 'landing'; 126 return 'landing';
125 } 127 }
126 128
  129 + public function checkMigration() {
  130 + if($this->util->isMigration()) {
  131 + $this->migrateCheck = true;
  132 + }
  133 + }
  134 +
127 private function confirmUpgrade() { 135 private function confirmUpgrade() {
128 return isset($_POST['ConfirmUpgrade']); 136 return isset($_POST['ConfirmUpgrade']);
129 } 137 }
@@ -219,6 +227,7 @@ class upgradeDatabase extends Step @@ -219,6 +227,7 @@ class upgradeDatabase extends Step
219 $this->temp_variables['sysVersion'] = $this->sysVersion; 227 $this->temp_variables['sysVersion'] = $this->sysVersion;
220 $this->temp_variables['sysVersion'] = $this->sysVersion; 228 $this->temp_variables['sysVersion'] = $this->sysVersion;
221 $this->temp_variables['dbSettings'] = $this->dbSettings; 229 $this->temp_variables['dbSettings'] = $this->dbSettings;
  230 + $this->temp_variables['migrateCheck'] = $this->migrateCheck;
222 } 231 }
223 232
224 private function upgradeConfirm() 233 private function upgradeConfirm()
setup/upgrade/templates/complete.tpl
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 <?php } ?> 23 <?php } ?>
24 <p class="disclaimer"> 24 <p class="disclaimer">
25 <?php if(WINDOWS_OS) { ?> 25 <?php if(WINDOWS_OS) { ?>
26 - cd <?php echo "\"".SYSTEM_ROOT."\""; ?> <br/> 26 + cd <?php echo "\"".SYSTEM_ROOT."knowledgetree\""; ?> <br/>
27 dmsctl.bat install<br/> 27 dmsctl.bat install<br/>
28 dmsctl.bat start 28 dmsctl.bat start
29 <?php } else { ?> 29 <?php } else { ?>
setup/upgrade/templates/database.tpl
@@ -51,8 +51,12 @@ @@ -51,8 +51,12 @@
51 else if ($action == 'runUpgrade') { ?> 51 else if ($action == 'runUpgrade') { ?>
52 <?php if ($backupSuccessful) { ?> 52 <?php if ($backupSuccessful) { ?>
53 <script type="text/javascript"> 53 <script type="text/javascript">
  54 + <?php if($migrateCheck) { ?>
  55 + alert("To complete the upgrade please do the following before continuing:\n\n1. Hard refresh your bowser (CTRL-F5) on first view of the Dashboard.\n\n\nSelect 'Finish' at the bottom of this page to continue.");
  56 + <?php } else { ?>
54 alert("To complete the upgrade please do the following before continuing:\n\n1. Restart the services as appropriate for your environment.\n\n\nOn first run of your upgraded installaton please do the following:\n\n1. Hard refresh your bowser (CTRL-F5) on first view of the Dashboard.\n2. Enable the new plugins you wish to use.\n\n\nSelect 'Finish' at the bottom of this page to continue.") 57 alert("To complete the upgrade please do the following before continuing:\n\n1. Restart the services as appropriate for your environment.\n\n\nOn first run of your upgraded installaton please do the following:\n\n1. Hard refresh your bowser (CTRL-F5) on first view of the Dashboard.\n2. Enable the new plugins you wish to use.\n\n\nSelect 'Finish' at the bottom of this page to continue.")
55 </script> 58 </script>
  59 + <?php } ?>
56 <input type="submit" name="Next" value="Finish" class="button_next"/> 60 <input type="submit" name="Next" value="Finish" class="button_next"/>
57 <?php } 61 <?php }
58 else { ?><input type="submit" name="Previous" value="Restore" class="button_previous"/><?php } ?> 62 else { ?><input type="submit" name="Previous" value="Restore" class="button_previous"/><?php } ?>
setup/wizard/installUtil.php
@@ -558,6 +558,16 @@ class InstallUtil { @@ -558,6 +558,16 @@ class InstallUtil {
558 return false; 558 return false;
559 } 559 }
560 560
  561 + public function upgradeInstall() {
  562 + if(isset($_POST['Next'])) {
  563 + if($_POST['Next'] == "Upgrade") {
  564 + return true;
  565 + }
  566 + }
  567 +
  568 + return false;
  569 + }
  570 +
561 /** 571 /**
562 * Check if system needs to be migrated 572 * Check if system needs to be migrated
563 * 573 *
@@ -595,7 +605,6 @@ class InstallUtil { @@ -595,7 +605,6 @@ class InstallUtil {
595 } 605 }
596 606
597 public function loginSpecified() { 607 public function loginSpecified() {
598 -// return true;  
599 if(isset($_GET['Return'])) { 608 if(isset($_GET['Return'])) {
600 if($_GET['Return'] == "Return To Installation") { 609 if($_GET['Return'] == "Return To Installation") {
601 return true; 610 return true;
@@ -1046,8 +1055,93 @@ class InstallUtil { @@ -1046,8 +1055,93 @@ class InstallUtil {
1046 } 1055 }
1047 // }}} 1056 // }}}
1048 1057
1049 - /*  
1050 - Just Because.  
1051 - */ 1058 + // {{{ copyDirectory
  1059 + function copyDirectory($sSrc, $sDst, $bMove = false) {
  1060 + if (file_exists($sDst)) {
  1061 + return false; //PEAR::raiseError(_kt("Destination directory already exists."));
  1062 + }
  1063 + if (!WINDOWS_OS) {
  1064 + if ($bMove && file_exists('/bin/mv')) {
  1065 + $this->pexec(array('/bin/mv', $sSrc, $sDst));
  1066 + return;
  1067 + }
  1068 + if (!$bMove && file_exists('/bin/cp')) {
  1069 + $this->pexec(array('/bin/cp', '-R', $sSrc, $sDst));
  1070 + return;
  1071 + }
  1072 + }
  1073 + if (substr($sDst, 0, strlen($sSrc)) === $sSrc) {
  1074 + return false; //PEAR::raiseError(_kt("Destination of move is within source"));
  1075 + }
  1076 + $hSrc = @opendir($sSrc);
  1077 + if ($hSrc === false) {
  1078 + return false; //PEAR::raiseError(sprintf(_kt("Could not open source directory: %s"), $sSrc));
  1079 + }
  1080 + if (@mkdir($sDst, 0777) === false) {
  1081 + return false; //PEAR::raiseError(sprintf(_kt("Could not create destination directory: %s"), $sDst));
  1082 + }
  1083 + while (($sFilename = readdir($hSrc)) !== false) {
  1084 + if (in_array($sFilename, array('.', '..'))) {
  1085 + continue;
  1086 + }
  1087 + $sOldFile = sprintf("%s/%s", $sSrc, $sFilename);
  1088 + $sNewFile = sprintf("%s/%s", $sDst, $sFilename);
  1089 + if (is_dir($sOldFile)) {
  1090 + $this->copyDirectory($sOldFile, $sNewFile, $bMove);
  1091 + continue;
  1092 + }
  1093 + if ($bMove) {
  1094 + $this->moveFile($sOldFile, $sNewFile);
  1095 + } else {
  1096 + copy($sOldFile, $sNewFile);
  1097 + }
  1098 + }
  1099 + if ($bMove) {
  1100 + @rmdir($sSrc);
  1101 + }
  1102 + }
  1103 + // }}}
  1104 +
  1105 + // {{{ moveFile
  1106 + function moveFile ($sSrc, $sDst) {
  1107 + // Only 4.3.3 and above allow us to use rename across partitions
  1108 + // on Unix-like systems.
  1109 + if (!WINDOWS_OS) {
  1110 + // If /bin/mv exists, just use it.
  1111 + if (file_exists('/bin/mv')) {
  1112 + $this->pexec(array('/bin/mv', $sSrc, $sDst));
  1113 + return;
  1114 + }
  1115 + $aSrcStat = stat($sSrc);
  1116 + if ($aSrcStat === false) {
  1117 + return false; //PEAR::raiseError(sprintf(_kt("Couldn't stat source file: %s"), $sSrc));
  1118 + }
  1119 + $aDstStat = stat(dirname($sDst));
  1120 + if ($aDstStat === false) {
  1121 + return false; //PEAR::raiseError(sprintf(_kt("Couldn't stat destination location: %s"), $sDst));
  1122 + }
  1123 + if ($aSrcStat["dev"] === $aDstStat["dev"]) {
  1124 + $res = @rename($sSrc, $sDst);
  1125 + if ($res === false) {
  1126 + return false; //PEAR::raiseError(sprintf(_kt("Couldn't move file to destination: %s"), $sDst));
  1127 + }
  1128 + return;
  1129 + }
  1130 + $res = @copy($sSrc, $sDst);
  1131 + if ($res === false) {
  1132 + return false; //PEAR::raiseError(sprintf(_kt("Could not copy to destination: %s"), $sDst));
  1133 + }
  1134 + $res = @unlink($sSrc);
  1135 + if ($res === false) {
  1136 + return false; //PEAR::raiseError(sprintf(_kt("Could not remove source: %s"), $sSrc));
  1137 + }
  1138 + } else {
  1139 + $res = @rename($sSrc, $sDst);
  1140 + if ($res === false) {
  1141 + return false; //PEAR::raiseError(sprintf(_kt("Could not move to destination: %s"), $sDst));
  1142 + }
  1143 + }
  1144 + }
  1145 + // }}}
1052 } 1146 }
1053 ?> 1147 ?>
setup/wizard/installWizard.php
@@ -281,12 +281,16 @@ class InstallWizard { @@ -281,12 +281,16 @@ class InstallWizard {
281 $this->createInstallFile(); 281 $this->createInstallFile();
282 } 282 }
283 if(!$this->isSystemInstalled()) { // Check if the systems not installed 283 if(!$this->isSystemInstalled()) { // Check if the systems not installed
284 - if($this->util->loginSpecified()) { 284 + if($this->util->loginSpecified()) { // Back to wizard from upgrader
285 $this->util->redirect('../../control.php'); 285 $this->util->redirect('../../control.php');
286 } elseif($this->util->migrationSpecified()) { // Check if the migrator needs to be accessed 286 } elseif($this->util->migrationSpecified()) { // Check if the migrator needs to be accessed
287 $this->util->redirect('../migrate/index.php?'); 287 $this->util->redirect('../migrate/index.php?');
288 - } elseif ($this->util->upgradeSpecified()) { 288 + } elseif ($this->util->upgradeSpecified()) { // Check if the upgrader needs to be accessed
289 $this->util->redirect('../upgrade/index.php?action=installer'); 289 $this->util->redirect('../upgrade/index.php?action=installer');
  290 + } elseif ($this->util->finishSpecified()) { // Check if the installer has completed
  291 + $this->util->redirect('../../login.php');
  292 + } elseif ($this->util->upgradeInstall()) { // Check if the upgrader needs to be accessed
  293 + $this->util->redirect('../upgrade/index.php');
290 } 294 }
291 $response = $this->systemChecks(); 295 $response = $this->systemChecks();
292 if($response === true) { 296 if($response === true) {
setup/wizard/steps/database.php
@@ -644,6 +644,7 @@ class database extends Step @@ -644,6 +644,7 @@ class database extends Step
644 $this->writeBinaries(); 644 $this->writeBinaries();
645 // ensure a guid was generated and is stored 645 // ensure a guid was generated and is stored
646 $this->util->getSystemIdentifier(); 646 $this->util->getSystemIdentifier();
  647 + $this->reBuildPaths();
647 648
648 return true; 649 return true;
649 } 650 }
@@ -770,8 +771,8 @@ class database extends Step @@ -770,8 +771,8 @@ class database extends Step
770 $this->parse_mysql_dump($sqlFile); 771 $this->parse_mysql_dump($sqlFile);
771 $dropPluginHelper = "TRUNCATE plugin_helper;"; // Remove plugin helper table 772 $dropPluginHelper = "TRUNCATE plugin_helper;"; // Remove plugin helper table
772 $this->util->dbUtilities->query($dropPluginHelper); 773 $this->util->dbUtilities->query($dropPluginHelper);
773 - $updateUrls = 'UPDATE config_settings c SET c.value = "default" where c.group_name = "urls";'; // Remove references to old paths  
774 - $this->util->dbUtilities->query($updateUrls); 774 + $this->reBuildPaths();
  775 +
775 $updateExternalBinaries = 'UPDATE config_settings c SET c.value = "default" where c.group_name = "externalBinary";'; // Remove references to old paths 776 $updateExternalBinaries = 'UPDATE config_settings c SET c.value = "default" where c.group_name = "externalBinary";'; // Remove references to old paths
776 $this->util->dbUtilities->query($updateExternalBinaries); 777 $this->util->dbUtilities->query($updateExternalBinaries);
777 $this->writeBinaries(); // Rebuild some of the binaries 778 $this->writeBinaries(); // Rebuild some of the binaries
@@ -780,6 +781,15 @@ class database extends Step @@ -780,6 +781,15 @@ class database extends Step
780 return true; 781 return true;
781 } 782 }
782 783
  784 + private function reBuildPaths() {
  785 + $conf = $this->util->getDataFromSession('configuration');
  786 + $paths = $conf['paths'];
  787 + foreach ($paths as $k=>$path) {
  788 + $sql = 'UPDATE config_settings SET value = "'.$path['path'].'" where item = "'.$k.'";';
  789 + $this->util->dbUtilities->query($sql);
  790 + }
  791 + }
  792 +
783 private function writeBinaries() { 793 private function writeBinaries() {
784 // if Windows, attempt to insert full paths to binaries 794 // if Windows, attempt to insert full paths to binaries
785 if (WINDOWS_OS) { 795 if (WINDOWS_OS) {
@@ -792,18 +802,18 @@ class database extends Step @@ -792,18 +802,18 @@ class database extends Step
792 'unzip' => array(0 => 'import', 1 => SYSTEM_ROOT . 'bin\unzip\unzip.exe')); 802 'unzip' => array(0 => 'import', 1 => SYSTEM_ROOT . 'bin\unzip\unzip.exe'));
793 803
794 if (INSTALL_TYPE == 'commercial' || true) { 804 if (INSTALL_TYPE == 'commercial' || true) {
795 - $winBinaries['pdf2swf'] = array(0 => 'externalBinary', 1 => SYSTEM_ROOT . 'bin\pdf2swf.exe'); 805 + $winBinaries['pdf2swf'] = array(0 => 'externalBinary', 1 => SYSTEM_ROOT . 'bin\swftools\pdf2swf.exe');
796 } 806 }
797 807
798 foreach ($winBinaries as $displayName => $bin) 808 foreach ($winBinaries as $displayName => $bin)
799 { 809 {
800 // continue without attempting to set the path if we can't find the file in the specified location 810 // continue without attempting to set the path if we can't find the file in the specified location
801 - if (!file_exists($bin[1])) continue; 811 +// if (!file_exists($bin[1])) continue;
802 812
803 // instaView won't exist, must be inserted instead of updated 813 // instaView won't exist, must be inserted instead of updated
804 if ($displayName == 'pdf2swf') { 814 if ($displayName == 'pdf2swf') {
805 $updateBin = 'INSERT INTO `config_settings` (group_name, display_name, description, item, value, default_value, type, options, can_edit) ' 815 $updateBin = 'INSERT INTO `config_settings` (group_name, display_name, description, item, value, default_value, type, options, can_edit) '
806 - . 'VALUES ("' . $bin[0] . '", "pdf2swf", "The path to the SWFTools \"pdf2swf\" binary", "pdf2swfPath", ' 816 + . 'VALUES ("' . $bin[0] . '", "' . $displayName . '", "The path to the SWFTools \"pdf2swf\" binary", "pdf2swfPath", '
807 . '"' . str_replace('\\', '\\\\', $bin[1]) . '", "pdf2swf", "string", NULL, 1);'; 817 . '"' . str_replace('\\', '\\\\', $bin[1]) . '", "pdf2swf", "string", NULL, 1);';
808 } 818 }
809 else { 819 else {
setup/wizard/templates/complete.tpl
@@ -228,9 +228,11 @@ @@ -228,9 +228,11 @@
228 $redirect = "http://".$_SERVER['SERVER_NAME'].":$port".$root_url."/admin.php"; 228 $redirect = "http://".$_SERVER['SERVER_NAME'].":$port".$root_url."/admin.php";
229 ?> 229 ?>
230 <?php if($migrate_check) { ?> 230 <?php if($migrate_check) { ?>
231 - <a href="../upgrade/index.php" class="back button_next" style="width:30px;" onclick="javascript:{w.clearSessions();}">Next</a> 231 +<!-- <a href="../upgrade/index.php" class="back button_next" style="width:30px;" onclick="javascript:{w.clearSessions();}">Next</a>-->
  232 + <input type="submit" name="Upgrade" value="Next" class="button_next"/>
232 <?php } else { ?> 233 <?php } else { ?>
233 - <a href="../../login.php" class="back button_next" style="width:50px;" onclick="javascript:{w.clearSessions();}">Finish</a> 234 +<!-- <a href="../../login.php" class="back button_next" style="width:50px;" onclick="javascript:{w.clearSessions();}">Finish</a>-->
  235 + <input type="submit" name="Finish" value="Finish" class="button_next"/>
234 <?php } ?> 236 <?php } ?>
235 </form> 237 </form>
236 <?php if (AJAX) { echo $html->js('form.js'); } ?> 238 <?php if (AJAX) { echo $html->js('form.js'); } ?>
237 \ No newline at end of file 239 \ No newline at end of file