better performance, windows compatibility, exclude patterns

ax - January 7, 2008 - 19:05
Project:API
Version:5.x-1.0
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:patch (reviewed & tested by the community)
Description

api.module currently does not work on windows because it relies on linux path conventions (':' as dir separator, absolute paths starting with '/') only. attached patch fixes this in a transparent manner. please review, test, and apply. thanks!

AttachmentSize
api.patch3.99 KB

#1

ax - February 3, 2008 - 23:12
Title:windows compatibility» better performance, windows compatibility, exclude patterns

* don't loop through all files in all dirs twice (once for reading, once for removing $common_ancestor), but use a custom file_scan_directory() which does this at once
* check for allowed file extensions earlier, don't process those not allowed any further
* now using PATH_SEPARATOR for portability
* (inspired by Doxygen) added 'exclude_pattern', a preg expression of files and dirs matched against the absolute path not to be indexed. great for those test and contrib and symlinked files and dirs lingering around. including update file.

this is working great for me. if anyone else finds it useful, the better.

AttachmentSize
perf-exclude-win.patch10.72 KB

#2

ax - February 13, 2008 - 01:10

missed a case.

would anyone mind to review this? thanks!

AttachmentSize
perf-exclude-win.patch10.52 KB

#3

aclight - March 1, 2008 - 20:42
Status:patch (code needs review)» patch (code needs work)

I ran into the same problem with the API module not working quite right on windows, and applied this patch. It did solve my problem in that respect, but I haven't given the code itself or the other features added by the patch a review.

I would advise breaking this up into several issues, since lumping several improvements/bug fixes together is generally a bad idea.

I would have three issues:
1. bug report for windows path separators
2. feature request for exclude patterns
3. feature request/bug report for performance improvements

#4

jcnventura - September 2, 2008 - 10:42
Version:5.x-1.x-dev» 5.x-1.0
Priority:normal» critical
Status:patch (code needs work)» patch (reviewed & tested by the community)

Hi,

You can't really unlump this, as it all goes into the same api_scan_directories() function.

The closer you can come is to create a patch for the path separator and another for the exclude/performance.

Anyway, I was having the problem that the API module was choking up on the PDF libraries for the print module and with this patch I can now confirm that the exclude pattern is working properly.

So, with aclight having tested it on Windows for the path separator and me testing it in Linux for the exclude patterns and both of us having of course tested that the performance improvements don't break anything, i think it's ready to be committed.

João

 
 

Drupal is a registered trademark of Dries Buytaert.