Changeset 12896

Show
Ignore:
Timestamp:
06/29/09 07:31:31 (7 months ago)
Author:
asha
Message:

Migration Changes - Sandeep
============================

1. Fix for the issue where large database selected for migration and selected to create database fails.
2. Fix for issue where entity group relation is not built up properly(optimization - Logic rewrite).
3. Removed performance scripts from Migration folder and code related to that.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • vtigercrm/branches/5.1/install/4setMigrationConfig.php

    r12877 r12896  
    426426                        <!-- Right side tabs --> 
    427427                            <form action="javascript: void(0); " method="post" name="installform" id="form" name="setConfig" id="form"> 
    428                             <input name="action" type="hidden" value='' /> 
    429428                            <table border=0 cellspacing=0 cellpadding=5 width=100%> 
    430429                            <tr><td colspan=2 class=small align=left><img src="include/install/images/confWizSysConfig.gif" alt="System Configuration" title="System Configuration"><br> 
  • vtigercrm/branches/5.1/install/5MigrationProcess.php

    r12877 r12896  
    109109            if(typeof('Event') != 'undefined') { 
    110110                Event.observe(window, 'load', function() { 
    111                         console.log(document.getElementById('triggermigration_iframe')); 
    112111                        document.getElementById('triggermigration_iframe').src = 'install.php?file=5MigrationProcess.php&migration_start=true&auth_key='+auth_key+'&skipcache=<?php echo microtime(true); ?>'; 
    113112                }); 
  • vtigercrm/branches/5.1/install/7createTables.inc.php

    r12877 r12896  
    10351035require_once('include/utils/installVtlibSelectedModules.php'); 
    10361036 
    1037 // Run the performance scripts based on the database type and the vtiger version. 
    1038 require_once('modules/Migration/versions.php'); 
    1039 if($adb->isMySQL()) { 
    1040         @include_once('modules/Migration/Performance/'.$current_version.'_mysql.php'); 
    1041 } elseif($adb->isPostgres()) { 
    1042         @include_once('modules/Migration/Performance/'.$current_version.'_postgres.php');                
    1043 } 
    1044          
    10451037// populate the db with seed data 
    10461038if ($db_populate) { 
  • vtigercrm/branches/5.1/migrate.php

    r12877 r12896  
    197197                                                                        $db_utf8_support = check_db_utf8_support($conn); 
    198198                                                                } 
    199                                                                 $filecontents = file_get_contents($dumpfile);            
    200                                                                 $lines = split("\n", $filecontents); 
    201                                                                 foreach($lines as $line) { 
    202                                                                         $line = trim($line); 
    203                                                                         if(empty($line)) continue; 
    204                                                                         if(stripos($line, '--') === 0) { 
    205                                                                                 // Ignore comments 
    206                                                                         } else { 
     199                                                                $file_size = filesize($dumpfile); 
     200                                                                        //Will take effect only if PHP safe-mode is Off 
     201                                                                if($file_size < 50*1024*1024){ 
     202                                                                        ini_set('memory_limit',2*$file_size); 
     203                                                                } else { 
     204                                                                        ini_set('memory_limit','100M'); 
     205                                                                } 
     206                                                                $fileHandle = fopen($dumpfile,'r'); 
     207                                                                flush(); 
     208                                                                ob_flush(); 
     209                                                                while(!feof($fileHandle )){ 
     210                                                                        $line = fgets($fileHandle); 
     211                                                                        $line = trim($line); 
     212                                                                        flush(); 
     213                                                                        ob_flush(); 
     214                                                                        if(empty($line)) continue; 
     215                                                                        if(stripos($line, '--') === 0) { 
     216                                                                                // Ignore comments 
     217                                                                        } else { 
    207218                                                                                $db_conn->Execute($line); 
    208                                                                      } 
    209                                                              } 
     219                                                                      } 
     220                                                              } 
    210221                                                                $db_conn->Close(); 
     222                                                                fclose($fileHandle ); 
    211223                                                        } 
    212224                                                } else { 
     
    419431                                echo $start_tag.$temp[$patch_count]." ==> ".$temp[$patch_count+1]." Database changes -- Ends.".$end_tag; 
    420432                        } 
    421                         if($dbtype == 'mysql') { 
    422                                 @include_once('modules/Migration/Performance/'.$temp[$patch_count+1].'_mysql.php'); 
    423                         } elseif($dbtype == 'postgres') { 
    424                                 @include_once('modules/Migration/Performance/'.$temp[$patch_count+1].'_postgres.php');           
    425                         } 
    426433                } 
    427434         
  • vtigercrm/branches/5.1/modules/Migration/DBChanges/504_to_510rc.php

    r12877 r12896  
    675675/* Important database schema changes to support database porting */ 
    676676ExecuteQuery("alter table vtiger_attachments drop index attachments_description_type_attachmentsid_idx"); 
    677 ExecuteQuery("alter table vtiger_attachments modify column description LONGTEXT"); 
    678 ExecuteQuery("alter table vtiger_emaildetails modify column idlists LONGTEXT"); 
     677ExecuteQuery("alter table vtiger_attachments modify column description TEXT"); 
     678ExecuteQuery("alter table vtiger_emaildetails modify column idlists TEXT"); 
    679679 
    680680/* Product Bundles Feature */ 
     
    11571157                                                        'Calendar'=>array ('vtiger_activitygrouprelation','activityid') 
    11581158                            ); 
    1159 for($i=0; $i<$num_rows; $i++) { 
    1160         $setype = $adb->query_result($sql_result, $i, 'setype'); 
    1161         $crmid = $adb->query_result($sql_result, $i, 'crmid'); 
    1162          
    1163         if(array_key_exists($setype, $groupTables_array)) { 
    1164                 $groupid_sql = "select groupid from vtiger_groups where groupname in (select groupname from ".$groupTables_array[$setype][0]." where ".$groupTables_array[$setype][1]. " = ".$crmid.")"; 
    1165                 $groupid_res = $adb->query($groupid_sql); 
    1166                 if($adb->num_rows($groupid_res)>0){ 
    1167                         $groupid = $adb->query_result($groupid_res, 0, 'groupid'); 
    1168                 } 
    1169         } 
    1170         else { 
    1171                 $sql1_res = $adb->query("select crmid as entityid from vtiger_seattachmentsrel where attachmentsid = ".$crmid); 
    1172                 if($adb->num_rows($sql1_res)>0){ 
    1173                         $se_recordid = $adb->query_result($sql1_res, 0, 'entityid'); 
    1174                  
    1175                         $groupid_res = $adb->query("select smownerid from vtiger_crmentity where crmid = ".$se_recordid); 
    1176                         if($adb->num_rows($groupid_res)>0){ 
    1177                                 $groupid = $adb->query_result($groupid_res, 0, 'smownerid'); 
    1178                         } 
    1179                 } 
    1180         } 
    1181         // Case when due to some data inconsistency, smownerid is set to 0 but there is not group relation for it stored 
    1182         if(empty($groupid)) { 
    1183                 $groupid = 1; 
    1184         } 
    1185         ExecuteQuery("update vtiger_crmentity set smownerid = $groupid where crmid = $crmid"); 
    1186 
    1187  
     1159                             
     1160foreach($groupTables_array as $module=>$index){ 
     1161        $modulereltable = $index[0]; 
     1162        $modulerelindex = $index[1]; 
     1163        ExecuteQuery("update vtiger_crmentity INNER JOIN {$modulereltable} ON vtiger_crmentity.crmid = {$modulereltable}.{$modulerelindex} INNER JOIN vtiger_groups ON vtiger_groups.groupname = {$modulereltable}.groupname set smownerid = vtiger_groups.groupid"); 
     1164        ExecuteQuery("UPDATE vtiger_crmentity SET smownerid=1 WHERE smownerid=0 AND setype='{$module}'"); 
     1165
    11881166// user-group ends 
    11891167