In update_verify_update_archive() there is a test to see if a project directory looks like the Drupal root directory:

  // Make sure this isn't a tarball of Drupal core.
  if (
    && file_exists("$directory/$project/update.php")
    && file_exists("$directory/$project/includes/")
    && file_exists("$directory/$project/modules/node/node.module")
    && file_exists("$directory/$project/modules/system/system.module")
  ) {
  // ...

(This is the D7 version; in D8, all but index.php are inside thecore/ subdirectory.)

Let's modify s:DrupalRoot() to use the same checks.


benjifisher’s picture

Status: Active » Fixed

Fixed and committed: c3795d2.

benjifisher’s picture

Commit: e6febb4.

Micro-efficiency note: Before the commit in #1, the strategy was to glob() for all files in the candidate Drupal root and its core/ subdirectory, then do pattern matching, looking for the markers. One call to glob(), many calls to match(). If the candidate directory is something like /var/www/html, the string returned by glob() might be very big. The new strategy is to glob() for specific markers: many calls to glob(), no pattern matching. Since glob() is built in to vim, this should be pretty fast.

This commit tweaks the code for readability, including replacing glob() with globpath().

Status: Fixed » Closed (fixed)

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