From 2529723cc31a1f3f4bc69e4b38a29fb66b8f794e Mon Sep 17 00:00:00 2001 From: Paul Barrett Date: Fri, 27 Nov 2009 14:41:04 +0200 Subject: [PATCH] Added code for copying existing lucene indexing information when doing a migration from 3.6.1 --- setup/wizard/installUtil.php | 11 +++-------- setup/wizard/steps/install.php | 8 ++++++++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/setup/wizard/installUtil.php b/setup/wizard/installUtil.php index 400bd7f..d127fdc 100644 --- a/setup/wizard/installUtil.php +++ b/setup/wizard/installUtil.php @@ -1061,9 +1061,6 @@ class InstallUtil { // {{{ 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)); @@ -1081,15 +1078,13 @@ class InstallUtil { 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)); - } + @mkdir($sDst, 0777); while (($sFilename = readdir($hSrc)) !== false) { if (in_array($sFilename, array('.', '..'))) { continue; } - $sOldFile = sprintf("%s/%s", $sSrc, $sFilename); - $sNewFile = sprintf("%s/%s", $sDst, $sFilename); + $sOldFile = sprintf("%s" . DS . "%s", $sSrc, $sFilename); + $sNewFile = sprintf("%s" . DS . "%s", $sDst, $sFilename); if (is_dir($sOldFile)) { $this->copyDirectory($sOldFile, $sNewFile, $bMove); continue; diff --git a/setup/wizard/steps/install.php b/setup/wizard/steps/install.php index 0e4b78b..6659137 100644 --- a/setup/wizard/steps/install.php +++ b/setup/wizard/steps/install.php @@ -104,6 +104,14 @@ class install extends step public function installStep() { $this->callHome(); + // copy indexing directory if this is a migration + $this->setDataFromSession(); + if ($this->util->isMigration()) { + $migrateSessionData = $this->getDataFromPackage('migrate', 'installation'); + $src = $migrateSessionData['location'] . DS . 'var' . DS . 'indexes'; + $dst = SYSTEM_DIR . 'var' . DS . 'indexes'; + $this->util->copyDirectory($src, $dst); + } } /** -- libgit2 0.21.4