In certain circumstances I am not quite clear about, it is impossible to delete a platform:

Existing sites were found on this platform. These sites will need to be deleted before this platform can be deleted.

That, even if the site listing says:

No sites available.

This is a minor issue, because if we just run verify before, it works.

Comments

j0nathan’s picture

Subscribing.

Anonymous’s picture

So this is odd, because that error is provided by a FALSE result of provision_drupal_find_sites(), which literally looks for a 'settings.php' in any subdir of the platform.


function provision_drupal_find_sites() {
  if ($dir = opendir("./sites")) {
    while (FALSE !== ($subdir = readdir($dir))) {
      // skip internal directory pointers
      if ($subdir != '.' && $subdir != '..') {
        $file = "./sites/$subdir/settings.php";
        if (file_exists("$file") && ($subdir != 'default') && !is_link("./sites/$subdir")) {
          $sites[$subdir] = $file;
        }
      }
    }
    closedir($dir);
  } else {
    drush_log(dt("Cannot find sites directory"), 'error');
    $sites = FALSE;
  }
  return $sites;
}

evaluated in provision_drupal_provision_delete():

elseif (d()->type === 'platform') {
    if (provision_drupal_find_sites()) {
      drush_set_error(dt('Existing sites were found on this platform. These sites will need to be deleted before this platform can be deleted.'));
    }
    else {
      _provision_recursive_delete(d()->root);
      d()->service('http')->sync(d()->root);
    }
  }

So, were there any other factors at play here, i.e:

1) There was no settings.php in the 'all' or 'default' dir in that platform's 'sites' dir by any chance?
2) Anything else 'different' from usual, such as the platform being a remote server or something? Wondering if it's related to all the syncing stuff that goes on with multiserver, since the 'Delete' task on platforms predates that.

And I'm guessing it's a lovely random thing that sometimes works?

eugenmayer’s picture

Would get solved by http://drupal.org/node/1074932 .. mark as dupe and just hint how to use it here?

anarcat’s picture

I think the issue here is that the platform caches a copy of the site list in the drushrc - verifying it fixes that. Not sure it's a big priority...

steven jones’s picture

Version: » 6.x-2.x-dev

Let's just run a verify on a platform as part of the delete process?

helmo’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

The 6.x-2.x branch will go EOL along with Drupal this week. So I'm closing
this issue. If it remains a confirmed issue in 7.x-3.x, feel free to re-open,
or better yet, create a new issue referencing this one.