[ Index ] |
|
Code source de vtiger CRM 5.0.2 |
1 <?php 2 /********************************************************************************* 3 ** The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 * 10 ********************************************************************************/ 11 12 global $conn; 13 global $migrationlog; 14 $prefix = "vtiger_"; 15 16 $migrationlog->debug("Inside the file rename_tables.php to rename the table names with prefix vtiger_"); 17 18 //Rename all the tables with prefix vtiger_ 19 $tables_list = $conn->get_tables(); 20 foreach($tables_list as $index => $tablename) 21 { 22 $sql = "rename table $tablename to $prefix$tablename"; 23 Execute($sql); 24 } 25 //Table renaming ends. 26 27 28 //In these following tablename => field we have to add the prefix vtiger_ as they are the tablenames 29 $change_cols_array = Array( 30 "cvcolumnlist"=>"columnname", 31 "cvstdfilter"=>"columnname", 32 "cvadvfilter"=>"columnname", 33 "selectcolumn"=>"columnname", 34 "relcriteria"=>"columnname", 35 "reportsortcol"=>"columnname", 36 "reportdatefilter"=>"datecolumnname", 37 "reportsummary"=>"columnname", 38 "field"=>"tablename", 39 ); 40 41 foreach($change_cols_array as $tablename => $columnname) 42 { 43 $result = $conn->query("select $columnname from $prefix$tablename"); 44 45 while($row = $conn->fetch_row($result)) 46 { 47 if((!strstr($row[$columnname],$prefix)) && $row[$columnname] !='' && $row[$columnname] != 'none') 48 { 49 //for reportsummary we should add prefix in second value ie., after first :(semicolon) 50 if($tablename == 'reportsummary') 51 { 52 $queries_list .= "update $prefix$tablename set $columnname=\"".str_replace("cb:","cb:$prefix",$row[$columnname])."\" where $columnname=\"$row[$columnname]\"&&##"; 53 } 54 else 55 { 56 $queries_list .= "update $prefix$tablename set $columnname=\"$prefix$row[$columnname]\" where $columnname=\"$row[$columnname]\"&&##"; 57 } 58 } 59 } 60 } 61 62 $queries_array = explode("&&##",trim($queries_list,"&&##")); 63 64 foreach($queries_array as $index => $query) 65 { 66 Execute($query); 67 } 68 69 70 $migrationlog->debug("End of file rename_tables.php. The table names renamed with prefix vtiger_"); 71 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 10:22:19 2007 | par Balluche grâce à PHPXref 0.7 |