Can i suggest the following modification to the function drd_server_server_domains

This essentially just makes an educated guess at all the domains on the server if the sites.php file hasn't been created

function drd_server_server_domains($sid) {
  $user = drd_server_load_user($sid);
  if (is_string($user)) {
    return drd_server_error($user);
  }
  $sites = array();
  if (file_exists(DRUPAL_ROOT . '/sites/sites.php')) {
    include(DRUPAL_ROOT . '/sites/sites.php');
  }
  else {  	
	foreach(scandir(DRUPAL_ROOT.'/sites') as $file)	{
	  if(is_dir(DRUPAL_ROOT.'/sites/'.$file) && !in_array($file, array('.','..','default','all'))) {
		$sites[$file] = $file;
	  }
	}
  }
  
  $output = array();
  foreach ($sites as $url => $id) {
    if (isset($output[$id])) {
      $output[$id]['aliases'][] = $url;
    }
    else {
      if (file_exists(DRUPAL_ROOT . '/sites/'. $id .'/files/.htaccess')) {
        $output[$id] = array(
          'url' => $url,
          'aliases' => array(),
        );
      }
    }
  }
  return drupal_json_encode($output);
}

Maybe there could be some additional logic here.
perhaps even read some info from settings.php in each folder to figure out if there are multiple aliases to the same site.

CommentFileSizeAuthor
#1 drd_server_d6_1059398.patch839 bytesjurgenhaas

Comments

jurgenhaas’s picture

Status: Active » Needs review
StatusFileSize
new839 bytes

This is a great idea, thanks a lot. Please find attached a patch which implements this into the latest dev release and I will submit when succesfully reviewed.

thtas’s picture

Cool!
Additional logic i was thinking of is to translate special drupal naming conventions
i.e. domain.com.folder to domain.com/folder

From bootstrap.inc:

/*
 * Example for a fictitious site installed at
 * -http://www.drupal.org:8080/mysite/test/ the 'settings.php' is searched in
 * the following directories:
 *
 *  1. $confdir/8080.www.drupal.org.mysite.test
 *  2. $confdir/www.drupal.org.mysite.test
 *  3. $confdir/drupal.org.mysite.test
 *  4. $confdir/org.mysite.test
 *
 *  5. $confdir/8080.www.drupal.org.mysite
 *  6. $confdir/www.drupal.org.mysite
 *  7. $confdir/drupal.org.mysite
 *  8. $confdir/org.mysite
 *
 *  9. $confdir/8080.www.drupal.org
 * 10. $confdir/www.drupal.org
 * 11. $confdir/drupal.org
 * 12. $confdir/org
 *
 * 13. $confdir/default
*/

I'm thinking this may not actually possible though... shame.

jurgenhaas’s picture

Status: Needs review » Fixed

The brand new version 2.x should now cover all of this. Pleae open new tickets if anything is still missing. Again, thanks a lot for your input.

Status: Fixed » Closed (fixed)

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