r54528 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54527‎ | r54528 | r54529 >
Date:16:27, 6 August 2009
Author:werdna
Status:deferred
Tags:
Comment:
Normalise out common wikitext subject characters which are invalid in titles when trying to generate a thread title.
Modified paths:
  • /trunk/extensions/LiquidThreads/classes/Threads.php (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/classes/Threads.php
@@ -285,8 +285,11 @@
286286 public static function incrementedTitle( $basename, $namespace ) {
287287 $i = 2;
288288
 289+ $replacements = array_fill_keys( array( '[', ']', '{', '}', '|' ), '_' );
 290+ $basename = strtr( $basename, $replacements );
 291+
289292 $t = Title::makeTitleSafe( $namespace, $basename );
290 - while ( $t->exists() ||
 293+ while ( !$t || $t->exists() ||
291294 in_array( $t->getPrefixedDBkey(), self::$occupied_titles ) ) {
292295 $t = Title::makeTitleSafe( $namespace, $basename . ' (' . $i . ')' );
293296 $i++;

Status & tagging log