[wp-trac] [WordPress Trac] #26530: Unnecessary database requests and untidy code in do_enclose
WordPress Trac
noreply at wordpress.org
Wed Dec 11 02:23:48 UTC 2013
#26530: Unnecessary database requests and untidy code in do_enclose
-------------------------+------------------------------
Reporter: joakimf | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch |
-------------------------+------------------------------
Changes (by joakimf):
* cc: frostegard@… (added)
* keywords: => has-patch
Comment:
Regarding the recently uploaded fix_do_enclose.diff: (I'm not sure that
I'm posting this the right way but i couldn't manage to find out how to do
it otherwise.)
Fixes the redundant database calls. Adds the option to avoid suppression
of error messages through setting WP_DEBUG.
Now actually uses header information for links to attempt to determine
mime types. Will not add links pointing to non-multimedia targets, even
though the file extension is mp3, mp4 etc. I think this is better
behaviour than in the patched version, which would only do guessing based
on file names, and thus add such links.
Cleans up the code a lot. Adds three independent functions to wp-
includes/functions.php; I'm not quite sure about the Wordpress policy for
such changes.
I have tested the changes by adding and removing post links to 1) actual
mp3 files 2) 404 pages with an mp3 file extension 3) non-reachable pages.
The code in this patch behaves as it should in all these cases. The unit
tests pass, though with one test incomplete:
{{{
............................................................. 61 / 1903
( 3%)
...........SS...SSSSSS.............S...SS............SS...... 122 / 1903
( 6%)
..........S............S...........................S......... 183 / 1903
( 9%)
.......SSS.......SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS..S........ 244 / 1903
( 12%)
................S............................S.............S. 305 / 1903
( 16%)
..........................SSSSSSSSSS......................... 366 / 1903
( 19%)
.........S..................S.......I........................ 427 / 1903
( 22%)
................................SSSS.S..SSSSS................ 488 / 1903
( 25%)
............................................................. 549 / 1903
( 28%)
............................................................. 610 / 1903
( 32%)
............................................................. 671 / 1903
( 35%)
............................................................. 732 / 1903
( 38%)
............................................................. 793 / 1903
( 41%)
..........S..............................SSSSSSSSSSSSSSSSSSSS 854 / 1903
( 44%)
............................................................. 915 / 1903
( 48%)
..................................SSSSSSSSSSSS............... 976 / 1903
( 51%)
..............SSSSSS.........S.....S......................... 1037 / 1903
( 54%)
...............................S............................. 1098 / 1903
( 57%)
....................S................SSS.......S....SSSS..... 1159 / 1903
( 60%)
SS........................................................... 1220 / 1903
( 64%)
............................................................. 1281 / 1903
( 67%)
............................................................. 1342 / 1903
( 70%)
....S........................................................ 1403 / 1903
( 73%)
...........S.........................SS...................... 1464 / 1903
( 76%)
...........S..S.............................................S 1525 / 1903
( 80%)
...................SSS....................................... 1586 / 1903
( 83%)
............................................................. 1647 / 1903
( 86%)
............................................................. 1708 / 1903
( 89%)
............................................................. 1769 / 1903
( 92%)
............................................................. 1830 / 1903
( 96%)
...SS...............SSSSSSSS
Time: 4.49 minutes, Memory: 202.00Mb
OK, but incomplete or skipped tests!
Tests: 1857, Assertions: 8564, Incomplete: 1, Skipped: 151.
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/26530#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list