I need to create a lot of domains, close to the number of cities on craiglist.com.

Is there a good way of doing this already? If not, do I need to write code for this?

CommentFileSizeAuthor
#2 domain_bulk.zip2.17 KBfizk

Comments

agentrickard’s picture

The changes committed here: #761556: Tiny edits to domain_form/domain_form_submit for re-usability will make that easier. But you still need to queue up an array of domains and pass them to domain_save(). So yes, this needs to be written.

fizk’s picture

Status: Closed (fixed) » Active
StatusFileSize
new2.17 KB

Thanks, I ended up create a module that uses drupal_execute().

For anyone that needs this functionality, I've attached the module.

To create a domain, go to /admin/build/domain/bulk and input your subdomains using the format site name:subdomain

For example, if the root domain is "example.com", then inputting

sweet candy 1:candy1
sweet candy 2:candy2

will create two active and open domains, sweet candy 1 (http://candy1.example.com), and sweet candy 2 (http://candy2.example.com).

If anyone wants to improve the code, I'd suggest making the module add a textbox to the bottom of /admin/build/domain/create, and use most of the settings on the page as the values for creating the domain.

The module will make use of domain_relationships if it's installed.

fizk’s picture

Status: Active » Closed (fixed)
michelle’s picture

Status: Active » Closed (fixed)

Thanks for this. I need to add about 750 domains and I was getting bored doing it one at a time. I need to do a few other things to the domains but this will make a good base to start from rather than trying to do direct imports into the tables like I was going to try and do.

Michelle

michelle’s picture

Status: Closed (fixed) » Active

Just gave this a try and it works well. This is useful and shouldn't just be buried in a zip in the issue queue. Any chance of it becoming a sub module, separate project, or even a handbook page?

Michelle

fizk’s picture

Michelle,

I can create new project for it if you promise to be it's biggest fan :)

fizk’s picture

Status: Active » Closed (fixed)
michelle’s picture

LOL! Well, it's making my life easier importing 734 domains. :) I'm still doing a bit of clean up before doing it on the live site but it worked great on the dev site with my small test.

Michelle