Continuation of http://drupal.org/node/13148.

Here's a proposed patch:

  • Only vid is used for node_revisions so the 20th revision limit is gone.
  • ORDER BY clauses added to avoid duplicate work.
  • Only modify those nodes/comments with HTML formats (only if the HTML filter is present, or only if the default Full HTML format is used).
  • Only modify those comments/nodes that were actually modified by the regexps.
  • Report status percentage while update is going on.
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Steven’s picture

Version: 4.6.5 » x.y.z
Steven’s picture

Ack, left $limit at 1 for testing purposes.

matt westgate’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
6.64 KB

I tested the patch against nodes, node revisions and comments and it works great. One very minor tweak was to pass the text by reference as suggested in a previous post.

Steven’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD. Thanks for the review.

Dries’s picture

Status: Fixed » Active

There is a regression. I re-synced http://scratch.drupal.org/ and the support and contribute pages are no longer converted.

Steven’s picture

Status: Active » Closed (works as designed)

That's because drupal.org has the codefilter in there too, so it is seen as a non-standard filter format. Better to be safe than to corrupt people's data.

Dries’s picture

Status: Closed (works as designed) » Active

Are you saying that we can't upgrade a single drupal.org post?! (The default input format has the codefilter enabled so it is available to all users.) Furthermore, the contribute and support page are not using the codefilter. Not upgrading people's data, is corrupting it too.

Dries’s picture

Either your explanation is wrong, or the update script is wrong. Posts that are formatted using the default input format are being upgraded despite the fact they use the codefilter. On drupal.org, posts with format 1 are upgraded. Please elaborate. Thanks!

Added some (handy) information:

mysql> select * from filters order by format;
+------------+--------+--------+-------+
| module     | weight | format | delta |
+------------+--------+--------+-------+
| urlfilter  |      0 |      1 |     0 |
| filter     |      2 |      1 |     2 |
| legacy     |     10 |      1 |     0 |
| filter     |      1 |      1 |     0 |
| codefilter |     10 |      1 |     0 |
| filter     |      0 |      2 |     1 |
| filter     |      0 |      3 |     2 |
| legacy     |     10 |      3 |     0 |
| codefilter |     10 |      3 |     0 |
+------------+--------+--------+-------+
Dries’s picture

Status: Active » Closed (works as designed)

Got it now.

Steven’s picture

Status: Closed (works as designed) » Fixed

I went ahead and added a fallback format condition. Now, any format with HTML in its name is also converted. This should deal with drupal.org correctly (and other sites with a similar set up).

deekayen’s picture

I take issue with the whole point behind update 178. I have relative URLs I don't want to be hard linked to the base_path(). That's why I like filters in Drupal; they don't modify the DB content, just the output. So I ask, why isn't this update done as part of a filter mod instead of gambling with the data source?

killes@www.drop.org’s picture

deekayen: good point, we should not tamper with user's data.

matt westgate’s picture

The reason this wasn't offered as a filter is mostly because of the perfomance impact of rewriting URLs dynamically. We opted for speed over portability, with the intention of making a contrib module to handle the portability aspect. For more details see

http://lists.drupal.org/archives/development/2006-03/msg00193.html

Anonymous’s picture

Status: Fixed » Closed (fixed)