Commit 7cf0df7d79f0be9e79a216824c0ea010ca577ced
Merge branch 'edge' of git@github.com:ktgit/knowledgetree into edge
Showing
13 changed files
with
244 additions
and
66 deletions
plugins/thumbnails/thumbnails.php
| ... | ... | @@ -147,10 +147,10 @@ class thumbnailGenerator extends BaseProcessor |
| 147 | 147 | $mimeType = KTMime::getMimeTypeName($mimeTypeId); |
| 148 | 148 | |
| 149 | 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 | 151 | $pdfDir = $default->documentRoot; |
| 152 | 152 | $pdfFile = $pdfDir . DIRECTORY_SEPARATOR . $this->document->getStoragePath(); |
| 153 | - }else{ | |
| 153 | + } else { | |
| 154 | 154 | $pdfDir = $default->pdfDirectory; |
| 155 | 155 | $pdfFile = $pdfDir .DIRECTORY_SEPARATOR. $this->document->iId.'.pdf'; |
| 156 | 156 | } |
| ... | ... | @@ -175,28 +175,23 @@ class thumbnailGenerator extends BaseProcessor |
| 175 | 175 | $default->log->debug('Thumbnail Generator Plugin: PDF file does not exist, cannot generate a thumbnail'); |
| 176 | 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 | 180 | if (file_exists($thumbnailfile)) { |
| 180 | 181 | @unlink($thumbnailfile); |
| 181 | 182 | } |
| 182 | 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 | 540 | $this->_landing(); |
| 541 | 541 | } elseif ($res == 'landing') { |
| 542 | 542 | $this->_landing(); |
| 543 | + } elseif ($res == 'binstall') { | |
| 544 | + $util = new MigrateUtil(); | |
| 545 | + $util->redirect('../wizard/index.php?step_name=dependencies'); | |
| 543 | 546 | } else { |
| 544 | 547 | } |
| 545 | 548 | break; |
| ... | ... | @@ -550,10 +553,10 @@ class Migrater { |
| 550 | 553 | $util = new MigrateUtil(); |
| 551 | 554 | $util->redirect('../wizard/index.php?step_name=installtype'); |
| 552 | 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 | 560 | default: |
| 558 | 561 | // TODO : handle silent |
| 559 | 562 | $this->_landing(); | ... | ... |
setup/migrate/steps/migrateComplete.php
| ... | ... | @@ -57,6 +57,14 @@ class migrateComplete extends Step { |
| 57 | 57 | */ |
| 58 | 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 | 69 | * Returns step state |
| 62 | 70 | * |
| ... | ... | @@ -67,23 +75,26 @@ class migrateComplete extends Step { |
| 67 | 75 | */ |
| 68 | 76 | function doStep() { |
| 69 | 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 | 81 | function doRun() { |
| 82 | + $this->checkSqlDump(); | |
| 75 | 83 | if(!$this->inStep("complete")) { |
| 76 | - $this->checkSqlDump(); | |
| 84 | + | |
| 77 | 85 | return 'landing'; |
| 78 | 86 | } |
| 79 | 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 | 92 | } else { |
| 83 | 93 | return 'error'; |
| 84 | 94 | } |
| 85 | 95 | } |
| 86 | 96 | $this->removeInstallSessions(); |
| 97 | + return 'landing'; | |
| 87 | 98 | } |
| 88 | 99 | |
| 89 | 100 | private function removeInstallSessions() { |
| ... | ... | @@ -132,17 +143,51 @@ class migrateComplete extends Step { |
| 132 | 143 | $running = true; |
| 133 | 144 | } |
| 134 | 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 | 149 | $this->error[] = "Service : KTMysql running.<br/>"; |
| 139 | 150 | return false; |
| 140 | 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 | 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 | 194 | \ No newline at end of file | ... | ... |
setup/migrate/steps/migrateInstallation.php
| ... | ... | @@ -241,17 +241,17 @@ class migrateInstallation extends step |
| 241 | 241 | if ($froot == 'default') { |
| 242 | 242 | $froot = $this->location; |
| 243 | 243 | } |
| 244 | - $this->ktSettings = array('fileSystemRoot'=> $froot, | |
| 245 | - ); | |
| 244 | + $this->ktSettings = array('fileSystemRoot'=> $froot); | |
| 246 | 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 | 255 | $this->dbSettings['dbPort'] = $this->util->getPort($this->location); // Add Port |
| 256 | 256 | $this->temp_variables['urlPaths'] = $this->urlPaths; |
| 257 | 257 | $this->temp_variables['ktSettings'] = $this->ktSettings; | ... | ... |
setup/migrate/steps/migrateServices.php
| ... | ... | @@ -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 | 277 | private function checkServices() { |
| ... | ... | @@ -285,7 +285,7 @@ class migrateServices extends Step |
| 285 | 285 | $this->error[] = "Service : {$serv->getName()} could not be uninstalled.<br/>"; |
| 286 | 286 | $this->serviceCheck = 'cross'; |
| 287 | 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 | 289 | } else { |
| 290 | 290 | $state = 'tick'; |
| 291 | 291 | $this->temp_variables['services'][$serv->getName()]['msg'] = "Service has been uninstalled"; |
| ... | ... | @@ -341,7 +341,7 @@ class migrateServices extends Step |
| 341 | 341 | } else { |
| 342 | 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 | 345 | return true; |
| 346 | 346 | } |
| 347 | 347 | } | ... | ... |
setup/migrate/templates/complete.tpl
| ... | ... | @@ -12,13 +12,25 @@ |
| 12 | 12 | <div id="step_content_<?php echo $step_name; ?>" class="step"> |
| 13 | 13 | |
| 14 | 14 | <!-- SQL --> |
| 15 | - <h3>KnowledgeTree database successfully exported</h3> | |
| 15 | + <h3>KnowledgeTree database successfully exported to:</h3> | |
| 16 | 16 | <span class='<?php echo $sql['class']; ?>'> </span><?php echo $sql['msg']; ?> |
| 17 | 17 | <br /><br /> |
| 18 | 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']; ?>'> </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']; ?>'> </span> | |
| 28 | + <?php echo $zmysql['name']; ?> | |
| 29 | + <?php echo $zmysql['msg']; ?> | |
| 30 | + <?php //} ?> | |
| 31 | + <?php } ?> | |
| 21 | 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 | 35 | </form> |
| 24 | 36 | <?php if (AJAX) { echo $html->js('form.js'); } ?> |
| 25 | 37 | \ No newline at end of file | ... | ... |
setup/upgrade/steps/upgradeDatabase.php
| ... | ... | @@ -86,7 +86,8 @@ class upgradeDatabase extends Step |
| 86 | 86 | protected $silent = false; |
| 87 | 87 | protected $temp_variables = array(); |
| 88 | 88 | public $paths = ''; |
| 89 | - | |
| 89 | + public $migrateCheck = false; | |
| 90 | + | |
| 90 | 91 | /** |
| 91 | 92 | * Main control of database setup |
| 92 | 93 | * |
| ... | ... | @@ -99,6 +100,7 @@ class upgradeDatabase extends Step |
| 99 | 100 | $this->temp_variables = array("step_name"=>"database", "silent"=>$this->silent, |
| 100 | 101 | "loadingText"=>"The database upgrade is under way. Please wait until it completes"); |
| 101 | 102 | $this->initErrors(); |
| 103 | + $this->checkMigration(); | |
| 102 | 104 | if(!$this->inStep("database")) { |
| 103 | 105 | $this->doRun(); |
| 104 | 106 | return 'landing'; |
| ... | ... | @@ -124,6 +126,12 @@ class upgradeDatabase extends Step |
| 124 | 126 | return 'landing'; |
| 125 | 127 | } |
| 126 | 128 | |
| 129 | + public function checkMigration() { | |
| 130 | + if($this->util->isMigration()) { | |
| 131 | + $this->migrateCheck = true; | |
| 132 | + } | |
| 133 | + } | |
| 134 | + | |
| 127 | 135 | private function confirmUpgrade() { |
| 128 | 136 | return isset($_POST['ConfirmUpgrade']); |
| 129 | 137 | } |
| ... | ... | @@ -219,6 +227,7 @@ class upgradeDatabase extends Step |
| 219 | 227 | $this->temp_variables['sysVersion'] = $this->sysVersion; |
| 220 | 228 | $this->temp_variables['sysVersion'] = $this->sysVersion; |
| 221 | 229 | $this->temp_variables['dbSettings'] = $this->dbSettings; |
| 230 | + $this->temp_variables['migrateCheck'] = $this->migrateCheck; | |
| 222 | 231 | } |
| 223 | 232 | |
| 224 | 233 | private function upgradeConfirm() | ... | ... |
setup/upgrade/templates/complete.tpl
| ... | ... | @@ -23,7 +23,7 @@ |
| 23 | 23 | <?php } ?> |
| 24 | 24 | <p class="disclaimer"> |
| 25 | 25 | <?php if(WINDOWS_OS) { ?> |
| 26 | - cd <?php echo "\"".SYSTEM_ROOT."\""; ?> <br/> | |
| 26 | + cd <?php echo "\"".SYSTEM_ROOT."knowledgetree\""; ?> <br/> | |
| 27 | 27 | dmsctl.bat install<br/> |
| 28 | 28 | dmsctl.bat start |
| 29 | 29 | <?php } else { ?> | ... | ... |
setup/upgrade/templates/database.tpl
| ... | ... | @@ -51,8 +51,12 @@ |
| 51 | 51 | else if ($action == 'runUpgrade') { ?> |
| 52 | 52 | <?php if ($backupSuccessful) { ?> |
| 53 | 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 | 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 | 58 | </script> |
| 59 | + <?php } ?> | |
| 56 | 60 | <input type="submit" name="Next" value="Finish" class="button_next"/> |
| 57 | 61 | <?php } |
| 58 | 62 | else { ?><input type="submit" name="Previous" value="Restore" class="button_previous"/><?php } ?> | ... | ... |
setup/wizard/installUtil.php
| ... | ... | @@ -558,6 +558,16 @@ class InstallUtil { |
| 558 | 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 | 572 | * Check if system needs to be migrated |
| 563 | 573 | * |
| ... | ... | @@ -595,7 +605,6 @@ class InstallUtil { |
| 595 | 605 | } |
| 596 | 606 | |
| 597 | 607 | public function loginSpecified() { |
| 598 | -// return true; | |
| 599 | 608 | if(isset($_GET['Return'])) { |
| 600 | 609 | if($_GET['Return'] == "Return To Installation") { |
| 601 | 610 | return true; |
| ... | ... | @@ -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 | 281 | $this->createInstallFile(); |
| 282 | 282 | } |
| 283 | 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 | 285 | $this->util->redirect('../../control.php'); |
| 286 | 286 | } elseif($this->util->migrationSpecified()) { // Check if the migrator needs to be accessed |
| 287 | 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 | 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 | 295 | $response = $this->systemChecks(); |
| 292 | 296 | if($response === true) { | ... | ... |
setup/wizard/steps/database.php
| ... | ... | @@ -644,6 +644,7 @@ class database extends Step |
| 644 | 644 | $this->writeBinaries(); |
| 645 | 645 | // ensure a guid was generated and is stored |
| 646 | 646 | $this->util->getSystemIdentifier(); |
| 647 | + $this->reBuildPaths(); | |
| 647 | 648 | |
| 648 | 649 | return true; |
| 649 | 650 | } |
| ... | ... | @@ -770,8 +771,8 @@ class database extends Step |
| 770 | 771 | $this->parse_mysql_dump($sqlFile); |
| 771 | 772 | $dropPluginHelper = "TRUNCATE plugin_helper;"; // Remove plugin helper table |
| 772 | 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 | 776 | $updateExternalBinaries = 'UPDATE config_settings c SET c.value = "default" where c.group_name = "externalBinary";'; // Remove references to old paths |
| 776 | 777 | $this->util->dbUtilities->query($updateExternalBinaries); |
| 777 | 778 | $this->writeBinaries(); // Rebuild some of the binaries |
| ... | ... | @@ -780,6 +781,15 @@ class database extends Step |
| 780 | 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 | 793 | private function writeBinaries() { |
| 784 | 794 | // if Windows, attempt to insert full paths to binaries |
| 785 | 795 | if (WINDOWS_OS) { |
| ... | ... | @@ -792,18 +802,18 @@ class database extends Step |
| 792 | 802 | 'unzip' => array(0 => 'import', 1 => SYSTEM_ROOT . 'bin\unzip\unzip.exe')); |
| 793 | 803 | |
| 794 | 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 | 808 | foreach ($winBinaries as $displayName => $bin) |
| 799 | 809 | { |
| 800 | 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 | 813 | // instaView won't exist, must be inserted instead of updated |
| 804 | 814 | if ($displayName == 'pdf2swf') { |
| 805 | 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 | 817 | . '"' . str_replace('\\', '\\\\', $bin[1]) . '", "pdf2swf", "string", NULL, 1);'; |
| 808 | 818 | } |
| 809 | 819 | else { | ... | ... |
setup/wizard/templates/complete.tpl
| ... | ... | @@ -228,9 +228,11 @@ |
| 228 | 228 | $redirect = "http://".$_SERVER['SERVER_NAME'].":$port".$root_url."/admin.php"; |
| 229 | 229 | ?> |
| 230 | 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 | 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 | 236 | <?php } ?> |
| 235 | 237 | </form> |
| 236 | 238 | <?php if (AJAX) { echo $html->js('form.js'); } ?> |
| 237 | 239 | \ No newline at end of file | ... | ... |