Posted by benjifisher on November 4, 2012 at 2:58pm
2 followers
Jump to:
| Project: | Vim Plugin For Drupal |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | minor |
| Assigned: | benjifisher |
| Status: | closed (fixed) |
Issue Summary
In update_verify_update_archive() there is a test to see if a project directory looks like the Drupal root directory:
<?php
// Make sure this isn't a tarball of Drupal core.
if (
file_exists("$directory/$project/index.php")
&& file_exists("$directory/$project/update.php")
&& file_exists("$directory/$project/includes/bootstrap.inc")
&& 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.
Comments
#1
Fixed and committed: c3795d2.
#2
Commit: e6febb4.
Micro-efficiency note: Before the commit in #1, the strategy was to
glob()for all files in the candidate Drupal root and itscore/subdirectory, then do pattern matching, looking for the markers. One call toglob(), many calls tomatch(). If the candidate directory is something like/var/www/html, the string returned byglob()might be very big. The new strategy is toglob()for specific markers: many calls toglob(), no pattern matching. Sinceglob()is built in to vim, this should be pretty fast.This commit tweaks the code for readability, including replacing
glob()withglobpath().#3
Automatically closed -- issue fixed for 2 weeks with no activity.