[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Migration/ -> MigrationStep1.php (source)

   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  //To get the Current installed MySQL path
  13  include ("connection.php");
  14  $vtiger_home = $_ENV["VTIGER_HOME"];
  15  $mysqldir = $mysql_dir;
  16  
  17  if(is_file($mysqldir."/bin/mysqldump"))
  18  {
  19      $installed_mysql_path = $mysqldir."/bin/mysqldump";
  20      $getmysqlpath = 0;
  21  }
  22  elseif(is_file($vtiger_home."/mysql/bin/mysqldump"))
  23  {
  24      $installed_mysql_path = $vtiger_home."/mysql/bin/mysqldump";
  25      $getmysqlpath = 0;
  26  }
  27  elseif(substr($_ENV["OS"],0,3) == "Win")
  28  {
  29      if(is_file($vtiger_home.'\mysql\bin\mysql.exe'))
  30      {
  31          $installed_mysql_path = $vtiger_home.'\mysql\bin\mysqldump.exe';
  32          @session_unregister('set_server_mysql_path');
  33          $_SESSION['set_server_mysql_path'] = $vtiger_home.'\mysql\bin';
  34          $getmysqlpath = 0;
  35      }
  36      else
  37      {
  38          $getmysqlpath = 1;
  39      }
  40  }
  41  else
  42  {
  43      $getmysqlpath = 1;
  44  
  45      if($_REQUEST['migration_option'] == 'alter_db_details')
  46          $showmysqlpath = 'none';
  47      else
  48          $showmysqlpath = 'block';
  49  }
  50  
  51  
  52  
  53  require_once ('Smarty_setup.php');
  54  
  55  global $app_strings,$app_list_strings,$mod_strings,$theme,$currentModule;
  56  
  57  $smarty = new vtigerCRM_Smarty();
  58  
  59  
  60  $theme_path="themes/".$theme."/";
  61  $image_path=$theme_path."images/";
  62  require_once ($theme_path.'layout_utils.php');
  63  
  64  
  65  $smarty->assign("MOD", $mod_strings);
  66  $smarty->assign("APP", $app_strings);
  67  $smarty->assign("MODULE","Migration");
  68  
  69  $smarty->assign("THEME", $theme);
  70  $smarty->assign("IMAGE_PATH", $image_path);
  71  
  72  $smarty->assign("DB_DETAILS_CHECKED", 'checked');
  73  $smarty->assign("SHOW_DB_DETAILS", 'block');
  74  
  75  //Based on this $getmysqlpath variable we should get the mysql path from the user
  76  $smarty->assign("GET_MYSQL_PATH",$getmysqlpath);
  77  $smarty->assign("SHOW_MYSQL_PATH",$showmysqlpath);
  78  
  79  //this is to set the entered values when we could not proceed the migration and return to step1
  80  if($_REQUEST['migration_option'] != '')
  81  {
  82      if($_REQUEST['migration_option'] == 'db_details')
  83      {
  84          if($_REQUEST['old_host_name'] != '')
  85              $smarty->assign("OLD_HOST_NAME", $_REQUEST['old_host_name']);
  86          if($_REQUEST['old_port_no'] != '')
  87              $smarty->assign("OLD_PORT_NO", $_REQUEST['old_port_no']);
  88          if($_REQUEST['old_mysql_username'] != '')
  89              $smarty->assign("OLD_MYSQL_USERNAME", $_REQUEST['old_mysql_username']);
  90          if($_REQUEST['old_mysql_password'] != '')
  91              $smarty->assign("OLD_MYSQL_PASSWORD", $_REQUEST['old_mysql_password']);
  92          if($_REQUEST['old_dbname'] != '')
  93              $smarty->assign("OLD_DBNAME", $_REQUEST['old_dbname']);
  94  
  95          if($_REQUEST['server_mysql_path'] != '')
  96              $smarty->assign("SERVER_MYSQL_PATH", $_REQUEST['server_mysql_path']);
  97      }
  98      elseif($_REQUEST['migration_option'] == 'dump_details')
  99      {
 100          $smarty->assign("DUMP_DETAILS_CHECKED", 'checked');
 101          $smarty->assign("DB_DETAILS_CHECKED", '');
 102  
 103          $smarty->assign("SHOW_DUMP_DETAILS", 'block');
 104          $smarty->assign("SHOW_DB_DETAILS", 'none');
 105      }
 106      else
 107      {
 108          if($_REQUEST['alter_old_host_name'] != '')
 109              $smarty->assign("ALTER_OLD_HOST_NAME", $_REQUEST['alter_old_host_name']);
 110          if($_REQUEST['alter_old_port_no'] != '')
 111              $smarty->assign("ALTER_OLD_PORT_NO", $_REQUEST['alter_old_port_no']);
 112          if($_REQUEST['alter_old_mysql_username'] != '')
 113              $smarty->assign("ALTER_OLD_MYSQL_USERNAME", $_REQUEST['alter_old_mysql_username']);
 114          if($_REQUEST['alter_old_mysql_password'] != '')
 115              $smarty->assign("ALTER_OLD_MYSQL_PASSWORD", $_REQUEST['alter_old_mysql_password']);
 116          if($_REQUEST['alter_old_dbname'] != '')
 117              $smarty->assign("ALTER_OLD_DBNAME", $_REQUEST['alter_old_dbname']);
 118  
 119          if($_REQUEST['server_mysql_path'] != '')
 120              $smarty->assign("SERVER_MYSQL_PATH", $_REQUEST['server_mysql_path']);
 121  
 122          $smarty->assign("DB_DETAILS_CHECKED", '');
 123          $smarty->assign("DUMP_DETAILS_CHECKED", '');
 124          $smarty->assign("ALTER_DB_DETAILS_CHECKED", 'checked');
 125  
 126          $smarty->assign("SHOW_DB_DETAILS", 'none');
 127          $smarty->assign("SHOW_DUMP_DETAILS", 'none');
 128          $smarty->assign("SHOW_ALTER_DB_DETAILS", 'block');
 129      }
 130  }
 131  
 132  //For 5.0.2 we have added this table. After 5.0.2 we have to remove this and provide the migration in some other way
 133  $res = $adb->query("show create table vtiger_entityname");
 134  if(!$res)
 135      $smarty->assign("502_PATCH","apply");
 136  
 137  $smarty->display("MigrationStep1.tpl");
 138  
 139  
 140  ?>


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7