It's impossible to use aegir to upgrade a CiviCRM install from 3x to 4x.
The reason is because the following must be set before _civicrm_init() is called:
if ( !defined('CIVICRM_UPGRADE_ACTIVE') ) {
define('CIVICRM_UPGRADE_ACTIVE', 1);
}
$_POST['upgrade'] = 1;
$_GET['q'] = 'civicrm/upgrade';
If not, then _civicrm_init() will fail because it will be looking for the civicrm_setting table which doesn't exist until after the upgrade.
This seems impossible to fix, because verify.provision.inc has to call _civicrm_init() before it knows whether or not to try the upgrade. We can't very well define a constant, check to see if we are upgrading and if we are not upgrading, undefine a constant.
Thanks to bgm's suggestion, I was able to complete the upgrade by creating a new site in the new platform, copy the database from the existing site to the new site (drush sql-sync @site1 @site2), and then run:
drush @site2 updatedb
drush @site2 civicrm-upgrade-db
For the civicrm upgrade command to work, I applied the attached patch (which incorporates changes made to civicrm's upstream civicrm.drush.inc script).
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 1461610_8.patch | 20.38 KB | samuelsov |
| #5 | civicrm-drupal6-support.patch | 884 bytes | bgm |
| #3 | 1461610_3.patch | 13.16 KB | samuelsov |
| civicrm.upgrade.patch | 1020 bytes | jmcclelland |
Comments
Comment #1
jmcclelland commentedComment #2
samuelsov commentedBased on your patch, I am currently working on a version that separate the verify and the deploy task.
It's working but it need more work to find the good version of Drupal to put in the civicrm.settings.php (ie. Drupal6 only if Drupal6 and Civi >= 4.1)
I should have beta code to propose soon.
Comment #3
samuelsov commentedSorry it took me so long. I'm new to provision.
I have tested the patch on some empty civicrm site and it's working well. I will now test it on production web site.
The separation of deploy and verify is far from perfect and the code is duplicated and things like civicrm file settings creation is done several times as we can see in this log :
Comment #4
bgm commentedThanks for the patch!
Questions:
* in _provision_civicrm_get_cms(), why not use drush_drupal_major_version() ?
* as far as I understand, you are proposing to remove the upgrade code from 'verify' in order to have it in 'deploy', which is run on import/migrate? Just to be sure, is this also how drupal does?
* did you test in a non-CiviCRM platform?
I started integrating some patches, so the upgrade path is working, but will release a beta first, and then apply the patch, so that we can get a stable release out before pushing a bit change.
Comment #5
bgm commentedFor the $cms, I applied the following patch upstream.
Comment #6
bgm commentedIn fact, for the Drupal6 'cms' issue, see: #1549850: civicrm.settings.tpl should generate "Drupal6" not "Drupal" for CIVICRM_UF in D6 environment.
Comment #7
samuelsov commentedJust inexperience :) the solution you propose is clearly better.
Yes i think so, but as you can see, i'm not really an expert on drush / provision
Not yet but i will do some more test today... on real site and as you propose on some non-CiviCRM sites.
Comment #8
samuelsov commentedNew patch that includes the changes of bgm.
There is still one big bug that i need to resolve - we should remove drush_bootstrap in deploy and find another way to find out if civicrm module is enabled.
Otherwise, it's working fine and i'm going to do some more test (non civicrm site for example).
Comment #9
bgm commentedTo summarise offline discussions with samuelsov and anarcat:
* the civicrm DB upgrade should be done in deploy only
* when doing a Migrate task: aegir runs deploy, then verify, so careful to redundant operations, but some tasks such as regenerating civicrm.settings.php or checking permissions need to be done in verify (and some of those must be done before calling the DB upgrade)
* is OK to bootstrap Drupal, not many alternatives.
Comment #10
bgm commentedPatch committed (with a bit of refactoring). Please do more tests!
Comment #11
jmcclelland commentedJust tested using multiple servers and was able to successfully upgrade from 4.1.3 to 4.1.5. Nice work!
Comment #12
bgm commented