Download & Extend

Do not create default domain on installation

Project:Domain Access
Version:7.x-3.4
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

Hi everybody,

I have the following problem :

When I enable the domain module, its automatically create a new default domain ( sitename / localhost).

I have already a Drupal feature which contains my domains, and i don't want the localhost default domain.

How can I disable this default domain creation during installation ?

PS : It's ok with drush drush en domain --uri="myuri.com" but i have to do this with an installation profile.

Comments

#1

This is considered a "convenience" feature for most users. We need a smart way to shut it off.

In an install profile, can you set a variable before module install? If so, we can read that variable in domain_enable().

If your installer can add data to the {domain} table before enabling domain, then the auto-create should not happen.

#2

Hi,

Thank you for your answer.

Finally, it's ok with this following code in my installation profile :

   module_enable( array(
        'domain',
        'domain_blocks',
        )
     );
  
  $domains['domain_1'] = array(
        'subdomain' => 'd1.mydomain.com',
        'sitename' => 'D1',
        'scheme' => 'http',
        'valid' => '1',
        'weight' => '1',
        'is_default' => '1',
        'machine_name' => 'd1_mydomain_com',
       );    

  $domains['domain_2'] = array(
        'subdomain' => 'd2.mydomain.com',
        'sitename' => 'D2',
        'scheme' => 'http',
        'valid' => '1',
        'weight' => '2',
        'is_default' => '0',
        'machine_name' => 'd2_mydomain_com',
       );
  
  domain_save($domains['domain_1']);
  domain_save($domains['domain_2']);

#3

I just realized how dumb my last statement was. You can't add data to {domain} before it exists.

How are you able to preselect the domains as part of an install profile? Wouldn't those domains vary per install, or are you doing a project-specific profile?

#4

I have the same question about exporting the install profile to a different server which uses a different base domain.

By now I think I will hack it using sed to replace strings in the install profile.