Commit 2529723cc31a1f3f4bc69e4b38a29fb66b8f794e
1 parent
6b7e2ce3
Added code for copying existing lucene indexing information when doing a migration from 3.6.1
KTC-866. Number of indexed documents after upgrade does not correspond to the actual number that it should be Fixed Committed by: Paul Barrett Reviewed by: Jarrett Jordaan
Showing
2 changed files
with
11 additions
and
8 deletions
setup/wizard/installUtil.php
| ... | ... | @@ -1061,9 +1061,6 @@ class InstallUtil { |
| 1061 | 1061 | |
| 1062 | 1062 | // {{{ copyDirectory |
| 1063 | 1063 | function copyDirectory($sSrc, $sDst, $bMove = false) { |
| 1064 | - if (file_exists($sDst)) { | |
| 1065 | - return false; //PEAR::raiseError(_kt("Destination directory already exists.")); | |
| 1066 | - } | |
| 1067 | 1064 | if (!WINDOWS_OS) { |
| 1068 | 1065 | if ($bMove && file_exists('/bin/mv')) { |
| 1069 | 1066 | $this->pexec(array('/bin/mv', $sSrc, $sDst)); |
| ... | ... | @@ -1081,15 +1078,13 @@ class InstallUtil { |
| 1081 | 1078 | if ($hSrc === false) { |
| 1082 | 1079 | return false; //PEAR::raiseError(sprintf(_kt("Could not open source directory: %s"), $sSrc)); |
| 1083 | 1080 | } |
| 1084 | - if (@mkdir($sDst, 0777) === false) { | |
| 1085 | - return false; //PEAR::raiseError(sprintf(_kt("Could not create destination directory: %s"), $sDst)); | |
| 1086 | - } | |
| 1081 | + @mkdir($sDst, 0777); | |
| 1087 | 1082 | while (($sFilename = readdir($hSrc)) !== false) { |
| 1088 | 1083 | if (in_array($sFilename, array('.', '..'))) { |
| 1089 | 1084 | continue; |
| 1090 | 1085 | } |
| 1091 | - $sOldFile = sprintf("%s/%s", $sSrc, $sFilename); | |
| 1092 | - $sNewFile = sprintf("%s/%s", $sDst, $sFilename); | |
| 1086 | + $sOldFile = sprintf("%s" . DS . "%s", $sSrc, $sFilename); | |
| 1087 | + $sNewFile = sprintf("%s" . DS . "%s", $sDst, $sFilename); | |
| 1093 | 1088 | if (is_dir($sOldFile)) { |
| 1094 | 1089 | $this->copyDirectory($sOldFile, $sNewFile, $bMove); |
| 1095 | 1090 | continue; | ... | ... |
setup/wizard/steps/install.php
| ... | ... | @@ -104,6 +104,14 @@ class install extends step |
| 104 | 104 | public function installStep() |
| 105 | 105 | { |
| 106 | 106 | $this->callHome(); |
| 107 | + // copy indexing directory if this is a migration | |
| 108 | + $this->setDataFromSession(); | |
| 109 | + if ($this->util->isMigration()) { | |
| 110 | + $migrateSessionData = $this->getDataFromPackage('migrate', 'installation'); | |
| 111 | + $src = $migrateSessionData['location'] . DS . 'var' . DS . 'indexes'; | |
| 112 | + $dst = SYSTEM_DIR . 'var' . DS . 'indexes'; | |
| 113 | + $this->util->copyDirectory($src, $dst); | |
| 114 | + } | |
| 107 | 115 | } |
| 108 | 116 | |
| 109 | 117 | /** | ... | ... |