| Server IP : 138.197.176.125 / Your IP : 216.73.217.54 Web Server : Apache/2.4.41 (Ubuntu) System : Linux SuiteCRM-8 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/vt7multiuserassignment.crmtiger.es/modules/Migration/models/ |
Upload File : |
<?php
/* +***********************************************************************************
* The contents of this file are subject to the vtiger CRM Public License Version 1.0
* ("License"); You may not use this file except in compliance with the License
* The Original Code is: vtiger CRM Open Source
* The Initial Developer of the Original Code is vtiger.
* Portions created by vtiger are Copyright (C) vtiger.
* All Rights Reserved.
* *********************************************************************************** */
class Migration_Module_Model extends Vtiger_Module_Model {
public function getDBVersion(){
$db = PearDatabase::getInstance();
$result = $db->pquery('SELECT current_version FROM vtiger_version', array());
if($db->num_rows($result) > 0){
$currentVersion = $db->query_result($result, 0, 'current_version');
}
return $currentVersion;
}
/**
* Static Function to get the instance of Vtiger Module Model for the given id or name
* @param mixed id or name of the module
*/
public static function getInstance($value=null) {
return new self($value);
}
public function getAllowedMigrationVersions(){
$versions = array(
array('540' => '5.4.0'),
array('600RC' => '6.0.0 RC'),
array('600' => '6.0.0'),
array('610' => '6.1.0'),
array('620' => '6.2.0'),
array('630' => '6.3.0'),
array('640' => '6.4.0'),
array('650' => '6.5.0'),
array('660' => '6.6.0'),
array('700' => '7.0.0'),
array('701' => '7.0.1'),
array('710' => '7.1.0'),
array('711' => '7.1.1'),
array('720' => '7.2.0'),
array('730' => '7.3.0'),
);
return $versions;
}
public function getLatestSourceVersion(){
return vglobal('vtiger_current_version');
}
/**
* Function to update the latest vtiger version in db
* @return type
*/
public function updateVtigerVersion(){
$db = PearDatabase::getInstance();
$db->pquery('UPDATE vtiger_version SET current_version=?,old_version=?', array($this->getLatestSourceVersion(), $this->getDBVersion()));
return true;
}
/**
* Function to rename the migration file and folder
* Writing tab data in flat file
*/
public function postMigrateActivities(){
//Writing tab data in flat file
perform_post_migration_activities();
//rename the migration file and folder
$renamefile = uniqid(rand(), true);
if(!@rename("migrate/", $renamefile."migrate/")) {
if (@copy ("migrate/", $renamefile."migrate/")) {
@unlink("migrate/");
}
}
}
}