[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/modules/Migration/models/ -> Module.php (source)

   1  <?php
   2  
   3  /* +***********************************************************************************

   4   * The contents of this file are subject to the vtiger CRM Public License Version 1.0

   5   * ("License"); You may not use this file except in compliance with the License

   6   * The Original Code is:  vtiger CRM Open Source

   7   * The Initial Developer of the Original Code is vtiger.

   8   * Portions created by vtiger are Copyright (C) vtiger.

   9   * All Rights Reserved.

  10   * *********************************************************************************** */
  11  
  12  class Migration_Module_Model extends Vtiger_Module_Model {
  13      
  14  	public function getDBVersion(){
  15          $db = PearDatabase::getInstance();
  16          
  17          $result = $db->pquery('SELECT current_version FROM vtiger_version', array());
  18          if($db->num_rows($result) > 0){
  19              $currentVersion = $db->query_result($result, 0, 'current_version');
  20          }
  21          return $currentVersion;
  22      }
  23      
  24  	public static function getInstance() {
  25          return new self();
  26      }
  27      
  28  	public function getAllowedMigrationVersions(){
  29          $versions = array(
  30              array('540'   => '5.4.0'),
  31              array('600RC' => '6.0.0 RC'),
  32                          array('600' => '6.0.0'),
  33                          array('610' => '6.1.0')
  34          );
  35          return $versions;
  36      }
  37      
  38  	public function getLatestSourceVersion(){
  39          return vglobal('vtiger_current_version');
  40      }
  41      
  42      /**

  43       * Function to update the latest vtiger version in db

  44       * @return type

  45       */
  46  	public function updateVtigerVersion(){
  47          $db = PearDatabase::getInstance();
  48          $db->pquery('UPDATE vtiger_version SET current_version=?,old_version=?', array($this->getLatestSourceVersion(), $this->getDBVersion()));
  49          return true;
  50      }
  51      
  52      /**

  53       * Function to rename the migration file and folder

  54       * Writing tab data in flat file

  55       */
  56  	public function postMigrateActivities(){
  57          //Writing tab data in flat file

  58          perform_post_migration_activities();
  59          
  60          //rename the migration file and folder

  61          $renamefile = uniqid(rand(), true);
  62                  
  63          if(!@rename("migrate/", $renamefile."migrate/")) {
  64              if (@copy ("migrate/", $renamefile."migrate/")) {
  65                  @unlink("migrate/");
  66              } 
  67          }
  68      }
  69  }


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1