r40929 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40928‎ | r40929 | r40930 >
Date:19:34, 16 September 2008
Author:brion
Status:old
Tags:
Comment:
normalize tags to lowercase
Modified paths:
  • /trunk/extensions/CodeReview/CodeRevision.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/CodeRevision.php
@@ -183,14 +183,24 @@
184184 $data[] = array(
185185 'ct_repo_id' => $this->mRepo,
186186 'ct_rev_id' => $this->mId,
187 - 'ct_tag' => $tag );
 187+ 'ct_tag' => $this->normalizeTag( $tag ) );
188188 }
189189 return $data;
190190 }
191191
192 - function isValidTag( $tag ) {
193 - // fixme?
 192+ function normalizeTag( $tag ) {
 193+ global $wgContLang;
 194+ $lower = $wgContLang->lc( $tag );
 195+
194196 $title = Title::newFromText( $tag );
195 - return $title && $title->getPrefixedText() === $tag;
 197+ if( $title && $tag === $wgContLang->lc( $title->getPrefixedText() ) ) {
 198+ return $lower;
 199+ } else {
 200+ return false;
 201+ }
196202 }
 203+
 204+ function isValidTag( $tag ) {
 205+ return ($this->normalizeTag( $tag ) !== false );
 206+ }
197207 }

Status & tagging log