Fresh head install with Migrate and Platform features enabled

Once the 'main' site was imported and verified, went to its Migrate tab and was presented with the first screen. (note typo depdendencies - though I didn't patch it yet because I want to patch the main issue but can't fix :( )

Nonetheless I hit migrate and it enters the task queue (screenshot 2). According to hosting_task_migrate_form_validate(), I should receive a form_set_error of 'You may not select your current platform to migrate your site to.'

So it looks like the conditions in hosting_task_migrate_form_validate() are not catching this. When there is more than one platform, this error also never comes up (even if one doesn't select a platform to migrate to, so it remains the default value of 'Current'). Instead the only error that can occur is the first one: 'You need to select a valid platform to migrate your site to.'

So I think this needs some rework but in trying to fix, I didn't succeed / caused other errors. Sorry I don't have a patch for this one.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

FileSize
81.46 KB
74.65 KB

Sorry about the screenshot names. The first one takes you to the front of drupal.org!

Updated ones attached

Anonymous’s picture

I should point out the site being migrated there was the 'main' or 'special' aegir site. I note that even with another Drupal 6 platform, the same style of form is presented, because the other d6 platform is missing key dependencies (hostmaster, hosting, admin_menu, install_profile api etc).

So once all the dependencies are in place on the other platform, the form looks normal again. So the only issue here is that while there is only one platform, or two platforms but where the second doesn't fulfill the dependencies, the form can still be submitted and it tries to 'migrate to itself' .

Anonymous’s picture

Status: Active » Needs review
FileSize
126.81 KB
1.47 KB

What a bastard..

OK, so function hosting_task_migrate_form_validate() was not getting the result of $site->platform at all

if ($form_state['values']['parameters']['target_platform'] == $site->platform) {
     form_set_error('parameters][target_platform', t('You may not select your current platform to migrate your site to.'));

After much grief, I ended up setting a hidden variable alongside the 'no_targets' form item (that had the 'There are no platforms that can meet the depdendencies for this site'' message and typo which the patch also fixes)

I then modified hosting_task_migrate_form_validate() to simply check if the hidden parameter was set, and if so, display the error.

I also removed the return $form; that occurred after the 'There are no platforms...' message: this is what caused the rather bare table-less form per screenshot1 above. By returning the form, we display the table of packages/versions against the current platform, but of course no column for any other platform against it because there are no valid ones. You could put this back in if you like: to me it looks nicer, and is more consistent with all the other states this form can be in. See screenshot3 attached (i grabbed it on form submit so you can also see the error thrown back)

And of course I tested that a 'regular' site can still migrate to other platforms and back again. In the event a choice is not selected in this scenario and the form is submitted, the other condition in the hook_validate appears 'You need to select a valid platform to migrate your site to.'

Sorry if it's seen as a hack with the hidden value, it was the only way I could get it to work without adding a whole bunch of other stuff to the hook_validate to try and make it return a value for $site->platform :/

adrian’s picture

Status: Needs review » Fixed

committed. thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.