When I run update.php, I see:

2 pending updates:
  -Migrate the 'file_directory_temp' variable.
  -Allow all users to view the administration theme.

How does core know what the pending updates do before running the update? So I look into the source and see those strings are in the comments in front of the update hooks. So those string must be parsed and displayed? Is this a feature? If so, it should be documented in hook_update_N().

Comments

mattyoung’s picture

Title: hook_update_N(): is the comment in front of the hook parsed and displayed by update.php? » hook_update_N(): Doc comment is displayed as update description need to be documented
Component: field system » update system
Category: support » task
StatusFileSize
new970 bytes

update.php line 1070:

          $func = new ReflectionFunction($module . '_update_' . $update);
          $description = str_replace(array("\n", '*', '/'), '', $func->getDocComment());
          $ret[$module]['pending'][$update] = "$update - $description";

So the doc comment is used as update description.

mattyoung’s picture

Status: Active » Needs review

Forgot to change status

mattyoung’s picture

StatusFileSize
new970 bytes

"Review updates" screen, not update selection screen

mattyoung’s picture

Bump

mstrelan’s picture

Component: update system » ajax system

To throw a spanner in the works, sometimes the description of my module's hook_update_N() doesn't appear... any ideas why?

Example code

<?php
/**
 * Migrate home and exhibition fields to Flags module.
 */
function gallery_artwork_update_7003(&$sandbox) {
}
?>
rfay’s picture

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

I have no idea how I changed the component, sorry.

rfay’s picture

Not your fault. They changed "update system" to "database update system" a few months ago, and one of my most important jobs as one of the ajax system maintainers is to fix these when they land wrong :-)

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.