Hi,

Just noticed that view_unpublished.install has an update hook:

function view_unpublished_update_6000() {
  db_query("UPDATE {system} SET weight = 1 WHERE name = 'view_unpublished' and type = 'module'");
}

However, there is no hook_install() to set the module weight, so on fresh installs the weight will be the default of 0.

Comments

ryan_courtnage’s picture

StatusFileSize
new712 bytes

patch attached

ryan_courtnage’s picture

Status: Active » Needs review
hefox’s picture

Status: Needs review » Needs work

Generally issues with the original query, so piggy backing here.

1) queries done in updatedb should be done using the update_sql function http://api.drupal.org/api/drupal/includes--database.inc/function/update_... so users are informed what happened. Aka, leave the queries separate, but use $ret = array(); $ret[] = update_sql(" .. "); return $ret; instead there.

2) if someone has already customized their weight it gets overridden -- I had it at -2 to be compatible with space and that got overridden, so had to add another update in a custom module to re-fix it :(.

3) The _install is missing it's Implementation of hook_install().

hefox’s picture

StatusFileSize
new1 KB

Haven't tested yet, but here's a patch updated to comments above.

There's absolutely no need for an empty install TMK, btw. Updates run fine without it last I tried.

The update function numbering is wrong (000 is for updates of 5.x to 6.x), but all well, it's already run on a few sites, so didn't fix it.

hefox’s picture

Status: Needs work » Needs review
entendu’s picture

Correct about update_sql().

I added that in an update because people already had the module installed w/o a hook_install().

Committed #4 to 6x-dev.

entendu’s picture

Status: Needs review » Closed (fixed)