r102409 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102408‎ | r102409 | r102410 >
Date:16:10, 8 November 2011
Author:catrope
Status:reverted
Tags:
Comment:
[RL2] Consistently use $title->getDBKey() instead of $title->getText() to build gadget IDs. Gadget IDs containing spaces were causing trouble. TODO need to define and enforce forbidden characters in gadget IDs and other IDs (repos, categories)
Modified paths:
  • /branches/RL2/extensions/Gadgets/Gadgets.hooks.php (modified) (history)

Diff [purge]

Index: branches/RL2/extensions/Gadgets/Gadgets.hooks.php
@@ -19,7 +19,7 @@
2020 * @return string Gadget id or null if not a gadget definition page
2121 */
2222 public static function getIDFromTitle( Title $title ) {
23 - $id = $title->getText();
 23+ $id = $title->getDBKey();
2424 if ( $title->getNamespace() !== NS_GADGET_DEFINITION || !preg_match( '!\.js$!u', $id ) ) {
2525 // Not a gadget definition page
2626 return null;
@@ -411,7 +411,7 @@
412412
413413 public static function titleIsCssOrJsPage( $title, &$result ) {
414414 if ( ( $title->getNamespace() == NS_GADGET || $title->getNamespace() == NS_GADGET_DEFINITION ) &&
415 - preg_match( '!\.(css|js)$!u', $title->getText() ) )
 415+ preg_match( '!\.(css|js)$!u', $title->getDBKey() ) )
416416 {
417417 $result = true;
418418 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r102789[RL2] Use custom names and IDs for gadgets on the preferences page, and set t...catrope15:19, 11 November 2011
r102790[RL2] Revert r102409, this is just getting in the way and causing underscores...catrope15:28, 11 November 2011

Status & tagging log