[Vtigercrm-developers] vtiger upgrade from 7 to 8

Alan Lord alanslists at gmail.com
Thu Oct 3 11:03:02 GMT 2024


On 03/10/2024 11:27, Rubén A. Estrada Orozco wrote:
> Angelo and Alan,
> 
> Could you please comment on my last email. Please let me insist. I would 
> like to know if you agree with my observations and how you run the db 
> migration from command line.

You are probably right Ruben, but to be honest with you I rarely (if 
ever) use the web-based migration now.

My scripts are now very far from standard (see how many issues from me 
on code.vtiger.com relate to migration scripts) but the basic 
modification is pretty straightforward.

As an example look at the first one:

https://code.vtiger.com/vtiger/vtigercrm/-/blob/master/modules/Migration/schema/540_to_600RC.php

Before the if(!defined('VTIGER_UPGRADE') test I add:

> const VTIGER_UPGRADE = true;
> $Vtiger_Utils_Log = true;
> 
> require_once('include/logging.php');
> require_once('config.php');
> require_once('include/utils/CommonUtils.php');
> 
> require_once('includes/main/WebUI.php');
> 
> ini_set('memory_limit', '-1');
> // Let's see some errors
> ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING); // I can change this going forward :-)
> ini_set('display_startup_errors', 1);
> ini_set('display_errors', 1);

This sets the VTIGER_UPRADE constant to true and includes some files 
(especially the WebUI.PHP) that enable you to use the command line.

I save these files as, for example, 540_to_600RC-cli.php

I also set the pear db to die on error.

You can't really read the output very easily as it contains html markup 
but you get the idea...

I usually run them as the web server user from the vtiger root 
directory, e.g.:

sudo su - www-data -s /bin/bash

(ubuntu server user www-data has no shell by default) You can run them 
as root and then just chown everything back to the web user afterwards 
if its easier.

You can also write a shell script to iterate over each file based on the 
current version.

You can also log the output (2&<1) into files from each version update 
so you can review at your leisure.

You will need to hack a few of them as I recall as some things didn't 
work quite right initially - my commit log for my modified scripts start 
in Sept 2015 ;-)

HTH

Al




More information about the vtigercrm-developers mailing list