Difference between revisions of "Issue:DPLMain calls private Title function prefix()"
From FollowTheScore
(patch) |
(→Patch) |
||
| Line 24: | Line 24: | ||
because the Title::prefix() method is now private. I suspect you should be calling Title::getPrefixedDBkey() if you want underscores, or Title::getPrefixedText if you want space characters. | because the Title::prefix() method is now private. I suspect you should be calling Title::getPrefixedDBkey() if you want underscores, or Title::getPrefixedText if you want space characters. | ||
| − | == Patch == | + | == Patch against DPL 2.0 == |
<pre> | <pre> | ||
--- DPLMain.php (revision 18287) | --- DPLMain.php (revision 18287) | ||
Revision as of 21:34, 19 December 2011
| Description: | DPLMain calls Title::prefix which is private as of MediaWiki 1.18.0 |
| Extension / Version: | DPL / 2.0 |
| Type / Status: | Bug / open |
Problem
This fatal error in DPL 2.0 and MediaWiki 1.18.0:
PHP Fatal error: Call to private method Title::prefix() from context 'DPLMain' in /var/www/html/w/extensions/DynamicPageList/DPLMain.php on line 2631
is caused by this line of code:
if ($bShowNamespace) $sTitleText = str_replace( '_', ' ', $title->prefix($sTitleText) );
because the Title::prefix() method is now private. I suspect you should be calling Title::getPrefixedDBkey() if you want underscores, or Title::getPrefixedText if you want space characters.
Patch against DPL 2.0
--- DPLMain.php (revision 18287)
+++ DPLMain.php (revision 18288)
@@ -2628,7 +2628,7 @@
//chop off title if "too long"
if( isset($iTitleMaxLen) && (strlen($sTitleText) > $iTitleMaxLen) ) $sTitleText = substr($sTitleText, 0, $iTitleMaxLen) . '...';
- if ($bShowNamespace) $sTitleText = str_replace( '_', ' ', $title->prefix($sTitleText) );
+ if ($bShowNamespace) $sTitleText = str_replace( '_', ' ', self::prefix($title, $sTitleText) );
if ($bShowCurID && isset($row->page_id)) {
//$articleLink = '<html>'.$sk->makeKnownLinkObj($title, htmlspecialchars($sTitleText),'curid='.$row->page_id).'</html>';
$articleLink = '[{{fullurl:'.$title->getText().'|curid='.$row->page_id.'}} '.htmlspecialchars($sTitleText).']';
@@ -2950,6 +2950,18 @@
// auxiliary functions ===============================================================================
+ // Copy of Title::prefix(), now private
+ private static function prefix($title, $name) {
+ $p = '';
+ if ( $title->getInterwiki() != '') {
+ $p = $title->getInterwiki() . ':';
+ }
+
+ if ( 0 != $title->getNamespace() ) {
+ $p .= $title->getNsText() . ':';
+ }
+ return $p . $name;
+ }
// get a list of valid page names; returns true if valid args found
private static function getPageNameList($cmd, $text, &$aLinks, &$bSelectionCriteriaFound, $logger, $mustExist=true) {