The Status Report tells me to "run the database update script immediately", but update.php gives me the warning above and then "No pending updates."

Now what?

I would expect Drupal to at least tell me what the offending modules are and the nature of the unmet dependencies.

CommentFileSizeAuthor
#13 schema_versions.patch1.38 KBcatch
#7 last_removed.patch1.07 KBcatch

Comments

marcvangend’s picture

That's strange. Can you reproduce this error? I agree that it would be good for developers to get more information than this. On the other hand, we shouldn't confuse the less technical users (the majority) with too much information. They just want to know what to do.

If this is caused by upgrading between alpha or dev versions, I don't think this is major. After all, updates aren't supported until we reach beta.

salvis’s picture

This is my development installation and the condition is still present. I don't know how I got into it, nor how to get out of it.

I agree about not confusing non-technical users, but we should give technical users a chance to get to the bottom of the problem. Maybe write a watchdog entry with detailed information?

Indeed I've been updating this installation from cvs, so this is not a normal situation, but even so, generating an error message without any reasonable information is not so great...

There's code in the update_script_selection_form() function under the "// Find and label any incompatible updates." comment that looks like it's trying to assemble a list of offenders and report something like "This update will been skipped due to the following missing dependencies:" (sic), but there's no such output.

marcvangend’s picture

It hard to help you debug if I can't reproduce your situation. It would be interesting to know (but maybe a lot of work for you) what would happen if you rebuild your current installation from scratch, just to see if the problem comes back.

Do you work with a debugger? Maybe you can set a breakpoint at the line $incompatible_updates_exist = TRUE; and see which module is causing the problems. Alternatively, assuming that you have devel module installed, you could insert dsm(get_defined_vars()); there and see what it returns.

salvis’s picture

Priority: Major » Critical

Please excuse the long delay — I'm on the road and have very limited connectivity.

I dpm()'ed $updates and here's what I found:

$updates['forum_access']['warning'] is

forum_access module can not be updated. Its schema version is 0. Updates up to and including 6105 have been removed in this release. In order to update forum_access module, you will first need to upgrade to the last version in which these updates were available.

Forum Access is my own module that I'm currently porting to D7, and I have

function forum_access_update_last_removed() {
  return 6105;
}

This raises two questions:

1. FA for D7 implements hook_update_last_removed() and it originally did not have any hook_update_NNN() functions. Thus, FA is installed with a schema version of 0. When a later version of FA suddenly does get a hook_update_NNN() function, then this error is triggered.

I'm sure that's not how it's supposed to work. How should it work? Should the schema be set to 7000 during initial installation of the D7 version?

2. Why is the nice message not displayed? I have an answer to that:

  if (empty($count)) {
    drupal_set_message(t('No pending updates.'));
    unset($form);
    $form['links'] = array(
      '#markup' => theme('item_list', array('items' => update_helpful_links())),
    );
  }

The unset() call trashes it. But there's more weirdness in update_script_selection_form():

  $form['start'] = array(
    '#tree' => TRUE,
    '#type' => 'fieldset',
    '#collapsed' => TRUE,
    '#collapsible' => TRUE,
  );

Why is the fieldset that receives the warnings (which are really errors, because they block the update process!) called 'start'? Why does it not have any #title? Why is it collapsed? The user has no way to continue without resolving the problems described in the collapsed fieldset, so it should be expanded.

      $form['start'][$module] = array(
        '#title' => $module,
        '#item'  => $update['warning'],
        '#prefix' => '<div class="warning">',
        '#suffix' => '</div>',
      );

'#item' is now '#markup'.

The wrapping div has the effect that the background is plastered with warning icons and the text becomes unreadable. This is certainly not what's intended, not here (and probably not anywhere else either...). This may have been reported elsewhere already and maybe even fixed already.

I don't understand the intention of this well enough to propose a fix, but I think this needs to be fixed, so I'm raising it to critical.

Bojhan’s picture

Priority: Critical » Major

There is no argument why this is critical.

salvis’s picture

It has the potential to block an update path, possibly to a security update, requiring fiddling with the database to overcome the problem.

catch’s picture

Priority: Major » Critical
Status: Active » Needs review
Issue tags: +D7 upgrade path
StatusFileSize
new1.07 KB

This is actually critical.

1. Module is installed. At the time of installation, there are some updates in the .install file
2. The module maintainer clears out the old updates and implements hook_update_last_removed()
3. When updating, we check if the schema version is less than the last removed update, and bail out if it isn't. In this case the schema version is 0, because no updates were run.

This is going to affect many, many modules being upgraded from D6 to D7.

Fortunately it's also an easy fix, untested patch for that.

This only deals with part 1 of salvis' post, which is the critical bit for me, part 2 I didn't look into yet but is more of an annoyance.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

The warning got harder to see. I think that’s intended.

webchick’s picture

Status: Reviewed & tested by the community » Needs review

Let's get salvis to report on whether this fixes the issue in FA or not.

tormi’s picture

Status: Needs review » Needs work

Warning in #7 is not translatable.

catch’s picture

Status: Needs work » Needs review

Not added by this patch, feel free to open a new, non-critical issue for it though.

damien tournoud’s picture

Status: Needs review » Needs work

#7 cannot be the correct fix.

The problem is probably that *on install* we set the schema version to the greatest available update function:

$versions = drupal_get_schema_versions($module);
drupal_set_installed_schema_version($module, $versions ? max($versions) : SCHEMA_INSTALLED);

This needs to be modified to account for [module]_last_removed():

$version = SCHEMA_INSTALLED;
if ($versions = drupal_get_schema_versions($module)) {
  $version = max($versions);
}
if ($last_removed = module_invoke($module, 'update_last_removed')) {
  $version = max($version, $last_removed);
}
drupal_set_installed_schema_version($module, $version);
catch’s picture

Status: Needs work » Needs review
StatusFileSize
new1.38 KB

If we do it that way, it could still leave you in a tricky position:

1. Install Drupal 7 version of a module
2. Module maintainer adds hook_update_last_removed() for D6 updates later on.
3. You still end up with schema version 0 and can't upgrade.

However, that's arguably a bug in the module, and my patch would also allow for this to happen, which is worse:

1. Install Drupal 6 version of a module
2. Don't both upgrading it ever.
3. Try to upgrade in D7 despite there having been loads of releases in between.

The snippet provided would result in max(FALSE); which PHP doesn't accept, put back the ternary, added some comments. This should be OK now.

damien tournoud’s picture

Status: Needs review » Reviewed & tested by the community

1. Install Drupal 7 version of a module
2. Module maintainer adds hook_update_last_removed() for D6 updates later on.
3. You still end up with schema version 0 and can't upgrade.

When you install the Drupal 7 version of the module, you will not have a schema version of 0, assuming the module author shipped the D7 version with the D6 updates (which he should).

The snippet provided would result in max(FALSE); which PHP doesn't accept, put back the ternary, added some comments. This should be OK now.

I don't see how ;)

Anyway, #13 looks ok.

catch’s picture

doh, if ($versions) {, clearly I can't read this week :(

On schema version 0 - yes it was if the D7 version shipped without, in other words a bug in the module, we don't need to allow for that case, but that was how I ended up with if !empty() in the first place, just explaining the broken line of thought that got me there...

salvis’s picture

When you install the Drupal 7 version of the module, you will not have a schema version of 0, assuming the module author shipped the D7 version with the D6 updates (which he should).

I've been looking for this piece of information. IF it's true, then it should be stated on http://api.drupal.org/api/function/hook_update_last_removed/7. Since I didn't find it there, I looked inside core code and found that system.install has all D6 update functions removed!

It's actually documented on the http://api.drupal.org/api/function/hook_update_N/7 page, but only as a "good rule of thumb," without any explanation of the implications. IF contribs are supposed to NOT follow core's lead (and save the trouble of porting the hook_update_N() functions), then this should be clarified and stated more prominently.

if the D7 version shipped without, in other words a bug in the module

No, not following a recommendation cannot be considered a bug. We have to make up our collective mind here!

+1 for the patch in #13.

I still think update_script_selection_form() needs to be fixed, but I agree that that second part is not critical, if that code is never executed. ;-)

damien tournoud’s picture

When you install the Drupal 7 version of the module, you will not have a schema version of 0, assuming the module author shipped the D7 version with the D6 updates (which he should), or implemented [module]_update_last_removed()

catch’s picture

Yeah the only case where this could still be broken is if you removed all the updates, didn't implement the hook, then later implemented the hook, but we can't account for that from core.

salvis’s picture

When you install the Drupal 7 version of the module, you will not have a schema version of 0, assuming the module author shipped the D7 version with the D6 updates (which he should), or implemented [module]_update_last_removed()

Ah, good, more clarification! So hook_update_last_removed() is mandatory in D7 if the D6 hook_update_N()'s are removed? That's not readily apparent from

A good rule of thumb is to remove updates older than two major releases of Drupal. See hook_update_last_removed() to notify Drupal about the removals.

on http://api.drupal.org/api/function/hook_update_N/7, at least not to me.

And I'm still not clear about whether the D6 updates may be removed in contrib if hook_update_last_removed() is implemented, as core does.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed #13 to HEAD. Thanks!

It sounds like we need a follow-up, non-critical documentation clarification issue (cross-linked here) for hook_update_last_removed(). salvis, would you be willing to take point on that since you know first-hand what confused you reading this for the first time?

salvis’s picture

salvis, would you be willing to take point on that since you know first-hand what confused you reading this for the first time?

No, I don't understand this well enough (nor am I even confident that the code will behave in a meaningful way) to take on responsibility for this.

No one has been willing to go out on a limb and declare whether the "rule of thumb" cited above is a requirement and why core is ignoring it.

I never got any satisfactory answer to #136078-38: New module update numbering scheme for contrib modules. Until recently I wasn't even aware of hook_update_last_removed(), but its introduction hasn't made things easier. For example, if we have updates like

6101
7101
6201
7201

(in that order in time), then I don't see how this can be managed. Not that I want to start discussing this here.

No, sorry, I have way too many questions and too little competence in this area...

catch’s picture

In what way is core ignoring it? system.module declares the hook, and for core that counts for all other modules too since it's a single project.

salvis’s picture

Core is ignoring

A good rule of thumb is to remove updates older than two major releases of Drupal.

To me this reads like "D7 should keep all the hook_update_6xxx() functions," but they have all been removed from system.install. D7 core only has hook_update_7xxx() functions. Don't you agree?

It depends on how you count whether the rule of thumb says to keep or to remove the hook_update_5xxx() functions — that's ambiguous in my reading. A strict reading of "remove ... older than two..." would mean "keep two", as in keep hook_update_6xxx() and hook_update_5xxx() for D7. But that's not the point. D7 core isn't even keeping one.

catch’s picture

Well the _update_7xxx() functions are from 6.x-7.x, and they'll stay in system.install for the duration of the D7 lifecycle. I'd call that one major release. However a rule of thumb is just that, there's no hard and fast rule for what gets removed, and I'd suggest the rule of thumb being given there is fairly conservative.

Status: Fixed » Closed (fixed)

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

berdir’s picture

Displaying the results of hook_update_last_removed() is still totally broken: #834848: Warning message regarding hook_update_last_removed() is not displayed

mgifford’s picture

Subscribe.

I'm looking at this issue due to a D5 -> D6 -> D7 migration I did earlier today of a simple site.

betarobot’s picture

Component: update system » ajax system

@mgifford while I was looking to solve the same issue (d5->d6->d7) one thing came up: in d5 I had once installed but never used webform module. It was not upgraded in d6 but as soon as I enabled it in d7 the message disappeared.

So just think which modules you had before which are not in your current setup or not enabled. Hope it helps.

mgifford’s picture

Thanks @betarobot I think I got this addressed. However, if it comes up again I'll give that a try.

justdave’s picture

Status: Closed (fixed) » Needs work

This is still broken in the release version of Drupal 7.0.

I've got a Drupal 5.23 site I'm attempting to update to Drupal 7.0. I'm staging the update on an alternate copy so I can revert to a copy of the production site and start over at any time to help test it. I'm upgrading from 5.23 to 6.20, running all updates on 6.20, then updating from there to 7.0.

As mentioned in the comments above, the Webform module appears to be at fault. Removing that module makes the error go away. However, the update system is still not giving any indication what the unmet dependencies are, or even which module is claiming it has unmet dependencies. Tracking down the errant module is quite difficult without at least an indication of which module is reporting the error. There's not even a log entry that I can find (and if there was something in the log, the error message should link to the log viewer for more details).

catch’s picture

Status: Needs work » Closed (duplicate)

That's a duplicate of this issue then #834848: Warning message regarding hook_update_last_removed() is not displayed, see you over there.

Starminder’s picture

Status: Closed (duplicate) » Needs work

I posted in the new issue but no responses yet. Would love any troubleshooting steps I can perform. This one is a showstopper when it happens.

Starminder’s picture

Status: Needs work » Active
catch’s picture

Status: Active » Closed (duplicate)

This is still a duplicate, having two issues open for the same thing just halves the possible attention to the potential fix. I posted on the other issue though.

jessZ’s picture

Issue summary: View changes

Some of the pending updates cannot be applied because their dependencies were not met.

Still can't get rid of this error message. (although i have managed to get rid of all the php errors related to long disabled or removed or uninstalled modules over the course of a 4.7> 5.x>6.x> 7 lifecycle.

David_Rothstein’s picture

Status: Closed (duplicate) » Fixed

Fixing status - the patch here was committed to Drupal 7 many years ago, so the issue can't be a duplicate. If there are still problems related to this, create a new issue and link to it from here.

David_Rothstein’s picture

Status: Fixed » Closed (fixed)
David_Rothstein’s picture

Component: ajax system » database update system
liquidcms’s picture

wow... went looking for this as it shows on my D8 site... and found this 9 yr old, fixed ages ago post. :(