Commit 0c0833f3a9c98897c9c01756afb00e94b13761a1

Authored by Jarrett Jordaan
1 parent e91370eb

Story Id:1166880 VM Merge

Committed by: Jarrett Jordaan

Reviewed by: Prince Mbekwa
setup/migrate/steps/migrateDatabase.php
@@ -153,18 +153,21 @@ class migrateDatabase extends Step @@ -153,18 +153,21 @@ class migrateDatabase extends Step
153 $location = $installation['location']; 153 $location = $installation['location'];
154 $uname = $this->temp_variables['duname']; 154 $uname = $this->temp_variables['duname'];
155 $pwrd = $this->temp_variables['dpassword']; 155 $pwrd = $this->temp_variables['dpassword'];
  156 + $tmpFolder = $this->resolveTempDir();
156 if(WINDOWS_OS) { 157 if(WINDOWS_OS) {
157 - $tmpFolder = "tmp/"; 158 +// $tmpFolder = "tmp/";
158 $exe = "\"$location\mysql\bin\mysqldump.exe\""; // Location of dump 159 $exe = "\"$location\mysql\bin\mysqldump.exe\""; // Location of dump
159 } else { 160 } else {
160 - $tmpFolder = "/tmp/"; 161 +// $tmpFolder = "/tmp/";
161 $exe = "'$location/mysql/bin/mysqldump'"; // Location of dump 162 $exe = "'$location/mysql/bin/mysqldump'"; // Location of dump
162 } 163 }
163 - $sqlFile = $tmpFolder."dms.sql"; 164 + $sqlFile = $tmpFolder."/dms_migrate.sql";
164 $dbAdminUser = $dbSettings['dbAdminUser']; 165 $dbAdminUser = $dbSettings['dbAdminUser'];
165 $dbAdminPass = $dbSettings['dbAdminPass']; 166 $dbAdminPass = $dbSettings['dbAdminPass'];
166 $dbName = $dbSettings['dbName']; 167 $dbName = $dbSettings['dbName'];
167 $cmd = "$exe -u{$dbAdminUser} -p{$dbAdminPass} $dbName > ".$sqlFile; 168 $cmd = "$exe -u{$dbAdminUser} -p{$dbAdminPass} $dbName > ".$sqlFile;
  169 +// echo $cmd;
  170 +// die;
168 $response = $this->util->pexec($cmd); 171 $response = $this->util->pexec($cmd);
169 if(file_exists($sqlFile)) { 172 if(file_exists($sqlFile)) {
170 $fileContents = file_get_contents($sqlFile); 173 $fileContents = file_get_contents($sqlFile);
@@ -178,6 +181,28 @@ class migrateDatabase extends Step @@ -178,6 +181,28 @@ class migrateDatabase extends Step
178 return false; 181 return false;
179 } 182 }
180 183
  184 + // TODO
  185 +function resolveTempDir()
  186 +{
  187 +
  188 + if (!WINDOWS_OS)
  189 + {
  190 + $dir='/tmp/kt-db-backup';
  191 + }
  192 + else
  193 + {
  194 + $dir='c:/kt-db-backup';
  195 + }
  196 +// $oKTConfig =& KTConfig::getSingleton();
  197 +// $dir = $oKTConfig->get('backup/backupDirectory',$dir);
  198 +
  199 + if (!is_dir($dir))
  200 + {
  201 + mkdir($dir);
  202 + }
  203 + return $dir;
  204 +}
  205 +
181 public function doTest() { 206 public function doTest() {
182 return true; 207 return true;
183 $installation = $this->getDataFromSession("installation"); // Get installation directory 208 $installation = $this->getDataFromSession("installation"); // Get installation directory
setup/migrate/templates/database.tpl
@@ -2,34 +2,36 @@ @@ -2,34 +2,36 @@
2 <p class="title">Migrate Database</p> 2 <p class="title">Migrate Database</p>
3 <div id="database" class="step1" style="display:block;"> 3 <div id="database" class="step1" style="display:block;">
4 <div class="description"> 4 <div class="description">
5 - This step configures the connection to the database server and migrates the database. The details for an administrative <br/>  
6 - user on the database server are required in order to be able to configure and migrate the database. 5 + This step configures the connection to the database server and migrates the database.
  6 +<!-- The details for an administrative <br/>-->
  7 +<!-- user on the database server are required in order to be able to configure and migrate the database.-->
7 </div> 8 </div>
8 <div id="step_content_database" class="step"> 9 <div id="step_content_database" class="step">
9 - <span class="error"> <?php if($errors['con']) { echo $errors['con']."<br/><br/>"; } ?> </span>  
10 - <span class="error">!!NB!! You are advised to backup your database before proceeding. !!NB!!</span>  
11 <br/><br/> 10 <br/><br/>
  11 + <span class="error">!!NB!! You are advised to backup your database before proceeding. !!NB!!</span>
  12 +<!-- <span class="error"> <?php if($errors['con']) { echo $errors['con']."<br/><br/>"; } ?> </span>
  13 +
  14 +
12 <p class="empty_space"> 15 <p class="empty_space">
13 Database Details 16 Database Details
14 </p> 17 </p>
15 <table class="dbconf"> 18 <table class="dbconf">
16 <?php 19 <?php
17 - $input_size = '35';  
18 - $align = 'left'; 20 +// $input_size = '35';
  21 +// $align = 'left';
19 ?> 22 ?>
20 - <!-- TODO: Different Databases-->  
21 <tr> 23 <tr>
22 <td><label for='duname'>Enter Database Administrative username: </label></td> 24 <td><label for='duname'>Enter Database Administrative username: </label></td>
23 - <td><input type='text' value="<?php echo $duname?>" id='duname' name='duname' size='<?php echo $input_size; ?>' style="float:left"/></td>  
24 - <td id="error" class="error"><?php if($errors['duname']) echo $errors['duname']; ?></td> 25 + <td><input type='text' value="<?php //echo $duname?>" id='duname' name='duname' size='<?php //echo $input_size; ?>' style="float:left"/></td>
  26 + <td id="error" class="error"><?php //if($errors['duname']) echo $errors['duname']; ?></td>
25 </tr> 27 </tr>
26 <tr> 28 <tr>
27 <td><label for='dpassword'>Enter the password for the Administrator: </label></td> 29 <td><label for='dpassword'>Enter the password for the Administrator: </label></td>
28 - <td><input type='password' value="<?php echo $dpassword?>" id='dpassword' name='dpassword' size='<?php echo $input_size; ?>' style="float:left"/></td>  
29 - <td id="error" class="error"><?php if($errors['dpassword']) echo $errors['dpassword']; ?></td> 30 + <td><input type='password' value="<?php //echo $dpassword?>" id='dpassword' name='dpassword' size='<?php //echo $input_size; ?>' style="float:left"/></td>
  31 + <td id="error" class="error"><?php //if($errors['dpassword']) echo $errors['dpassword']; ?></td>
30 </tr> 32 </tr>
31 </table> 33 </table>
32 - </div> 34 + </div>-->
33 </div> 35 </div>
34 <input type="submit" name="Previous" value="Previous" class="button_previous"/> 36 <input type="submit" name="Previous" value="Previous" class="button_previous"/>
35 <input type="submit" name="Next" value="Next" class="button_next"/> 37 <input type="submit" name="Next" value="Next" class="button_next"/>