1

I have a Drupal 7 site with a half-dozen multisites/subsites and I am trying to setup Drush so that I can run my modules updates from the command line for the subsites. Running Drush for the main site works fine. Running Drush for ONE of the sub sites works fine. However for about 5 of the subsites I can run commands like

drush @subsite status

or

drush @subsite updb

but if I try to run

drush @subsite update

or

drush @subsite ups

I get an error:

Command pm-updatestatus needs a higher bootstrap level to run - you will need to invoke drush from a more functional Drupal environment to run this command.

So I don't understand what makes all the other sites different from the one, or why some commands would work and others not. I am running these commands from my main Drupal install path:

/var/www/html

What am I doing wrong, and how can I get update to work for my subsites?

It's worth noting that the majority of these subsites were setup at a time when I didn't necessarily know what I was doing, so I can only describe their configuration as "wacky". One of the affected sites is setup in a fairly standard way and the working subsite is of the "wacky" variety, however, so I don't expect that's the problem.

EDIT: Because it is working for one site and not others, I'm wondering if it's a file permission issue. What user does Drush run as, and what level of access does it needs to which files? In my case, I am working on Ubuntu.

0

As a test, change your working directory to the directory that contains the settings.php file for the site you want to operate on, and then run drush pm-updatestatus. See if that bootstraps correctly. If so, the issue is with your alias files. These should work, so long as 'root' and 'uri' are set.

Note, however, that if all of your contrib modules are in sites/all, then one run of pm-updatecode will update the code for all sites. You will need to run drush updatedb for every site that shares any code updated by the last run of pm-updatecode. Drush does not manage this for you, even with pm-update (which runs updatedb on just one site).

This is the added cost of multisite configurations -- you have to be a lot more careful with your update processes, and must update all of the sites at the same time.

  • Thanks for the reply. I tried running the pm-updatestatus command from the subsite folders, but with no success. Actually it wouldn't even run for the one subsite which was working, I still had to go to the Drupal root for it to work. – user470714 Jun 16 '16 at 18:58
0

Okay, after digging further I figured out what the issue was. It was indeed having to do with my so-called "wacky" Drupal subsite config. Basically, the problem was with the database configuration. For my sites, I want each subsite to have its own database EXCEPT FOR all the tables related to the user accounts, such that a user can create/login to their account from any of the sites. Previous to this, I had things configured oddly in the sense that my database configuration in the settings.php file set the MAIN site's database as the database, but then set the default prefix to the subsite's database, and specified exceptions for the user account tables. The reason SOME of the sites were working okay, is because before I knew what I was doing, I would just give the subsites' tables a prefix, but they would still live in the main site's database. Complicated, I know. Anyways, the solution was to reverse the settings.php config so that the subsite's database is specified as it's own and I use the table prefixes to specify the user account tables, which are the exception. I.E., my config now looks like this:

mnpn = subsite database
drupal = main site database
$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'driver' => 'mysql',
      'database' => 'mnpn',
      'username' => 'drupaluser',
      'password' => 'XXXXX',
      'host' => 'localhost',
      'port' => '',
      'prefix' =>
      array (
        'default' => '',
        'users' => 'drupal.',
        'users_roles' => '',
        'users_uid_seq' => 'drupal.',
        'sessions' => 'drupal.',
        'authmap' => 'drupal.',
        'role' => '',
        'sequences' => 'drupal.',
        'profile_fields' => 'drupal.',
        'profile_values' => 'drupal.',
        'variable' => '',
        'actions' => ''
      ),
    ),
  )
  );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.