r82193 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82192‎ | r82193 | r82194 >
Date:21:34, 15 February 2011
Author:reedy
Status:ok
Tags:
Comment:
* (bug 18523) Tags with spaces don't work

Normalise to, and save as db key (ie spaces replaced with _)

Add some documentation to go with it, and a couple of braces
Modified paths:
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -1024,7 +1024,7 @@
10251025 }
10261026
10271027 /**
1028 - * @param $tags
 1028+ * @param $tags Array
10291029 * @return array
10301030 */
10311031 protected function normalizeTags( $tags ) {
@@ -1036,13 +1036,15 @@
10371037 }
10381038
10391039 /**
1040 - * @param $tags
 1040+ * @param $tags Array
10411041 * @return array
10421042 */
10431043 protected function tagData( $tags ) {
10441044 $data = array();
10451045 foreach ( $tags as $tag ) {
1046 - if ( $tag == '' ) continue;
 1046+ if ( $tag == '' ) {
 1047+ continue;
 1048+ }
10471049 $data[] = array(
10481050 'ct_repo_id' => $this->repoId,
10491051 'ct_rev_id' => $this->id,
@@ -1052,23 +1054,21 @@
10531055 }
10541056
10551057 /**
1056 - * @param $tag
 1058+ * @param $tag String
10571059 * @return bool
10581060 */
10591061 public function normalizeTag( $tag ) {
1060 - global $wgContLang;
1061 - $lower = $wgContLang->lc( $tag );
1062 -
10631062 $title = Title::newFromText( $tag );
1064 - if ( $title && $lower === $wgContLang->lc( $title->getPrefixedText() ) ) {
1065 - return $lower;
1066 - } else {
1067 - return false;
 1063+ if ( $title ) {
 1064+ global $wgContLang;
 1065+ return $wgContLang->lc( $title->getDbKey() );
10681066 }
 1067+
 1068+ return false;
10691069 }
10701070
10711071 /**
1072 - * @param $tag
 1072+ * @param $tag String
10731073 * @return bool
10741074 */
10751075 public function isValidTag( $tag ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r839321.17wmf1: MFT r78990, r79844, r81548, r82022, r82193, r83061, r83067, r83583,...catrope17:59, 14 March 2011

Status & tagging log