Update filter module to use drupal_static()

JamesAn - June 3, 2009 - 03:22
Project:Drupal
Version:7.x-dev
Component:filter.module
Category:task
Priority:normal
Assigned:Unassigned
Status:won't fix
Issue tags:Novice
Description

This is a child task for #422380: convert all core module to use new static caching API focusing on the filter module.

#1

JamesAn - June 3, 2009 - 03:39
Status:active» needs review
AttachmentSizeStatusTest resultOperations
jamesan_480416-1.patch2.91 KBIdleFailed: Failed to install HEAD.View details | Re-test

#2

catch - June 7, 2009 - 02:18
Status:needs review» reviewed & tested by the community

Not sure why htmlcorrectory needs the statics at all there, but looks good anyway.

#3

Dries - June 7, 2009 - 02:25

Shouldn't +  $no_nesting = &drupal_static(__FUNCTION__, drupal_map_assoc(array('li', 'p'))); be +  $no_nesting = &drupal_static(__FUNCTION__ . ":no_nesting", drupal_map_assoc(array('li', 'p'))); for consistency?

#4

catch - June 7, 2009 - 02:28

Generally we've only been suffixing statics when we have to (i.e. http://api.drupal.org/api/function/taxonomy_get_tree/7 which was one of the first patches to go in), I can see arguments both ways though.

#5

JamesAn - June 7, 2009 - 03:12

Yes, the pattern seemed to not suffix the first static var.

#6

catch - June 7, 2009 - 03:16

The reasoning for this is documented in the update docs: http://drupal.org/node/224333#static_variable_api

#7

System Message - June 24, 2009 - 01:30
Status:reviewed & tested by the community» needs work

The last submitted patch failed testing.

#8

Dave Reid - July 7, 2009 - 21:44

Adding novice tag.

#9

JamesAn - July 9, 2009 - 20:48
Status:needs work» needs review

Rerolled.

AttachmentSizeStatusTest resultOperations
480416-9.patch2.91 KBIdleFailed: Failed to apply patch.View details | Re-test

#10

System Message - July 28, 2009 - 19:55
Status:needs review» needs work

The last submitted patch failed testing.

#11

JuliaKM - August 1, 2009 - 01:04
Status:needs work» needs review

This patch is re-rolled minus the changes to _filter_htmlcorrector, which has been rewritten to use PHP5 and no longer needs &drupal_static(__FUNCTION__).

AttachmentSizeStatusTest resultOperations
480416-10.patch1.92 KBIdleFailed: Failed to apply patch.View details | Re-test

#12

System Message - August 25, 2009 - 22:07
Status:needs review» needs work

The last submitted patch failed testing.

#14

alonpeer - September 1, 2009 - 12:20
Status:needs work» needs review

Patch re-work.

AttachmentSizeStatusTest resultOperations
480416-11.patch1.93 KBIdleFailed: Failed to apply patch.View details | Re-test

#15

System Message - September 11, 2009 - 16:05
Status:needs review» needs work

The last submitted patch failed testing.

#16

JamesAn - October 28, 2009 - 06:33
Status:needs work» needs review

Rerolled. Some of the changes were already made so the patch is smaller.

AttachmentSizeStatusTest resultOperations
480416-16.patch1.07 KBIdlePassed: 14709 passes, 0 fails, 0 exceptionsView details | Re-test

#17

sun - November 9, 2009 - 20:55
Status:needs review» needs work

+++ modules/filter/filter.module 28 Oct 2009 06:32:32 -0000
@@ -1069,7 +1069,7 @@ function _filter_url_parse_partial_links
function _filter_url_trim($text, $length = NULL) {
-  static $_length;
+  $_length = &drupal_static(__FUNCTION__);
   if ($length !== NULL) {

This conversion makes no sense, because this function is an internal preg_replace callback for _filter_url(). No module has a chance to intercept the operation anyway.

However, while being there and reverting the change, please change the if condition to use isset($length) instead of this awkward NULL test.

This review is powered by Dreditor.

#18

sun - November 28, 2009 - 15:09
Status:needs work» reviewed & tested by the community
AttachmentSizeStatusTest resultOperations
drupal.filter-drupal-static.patch1014 bytesIdlePassed on all environments.View details | Re-test

#19

sun - November 28, 2009 - 16:37
Status:reviewed & tested by the community» won't fix

#562932: {filter_format}.cache is not saved will remove this static entirely.

 
 

Drupal is a registered trademark of Dries Buytaert.