dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Followup r87340: Post-hook swap bodytext into a new bodycontent key and append printf...
[lhc/web/wiklou.git]
/
includes
/
SpecialPageFactory.php
diff --git
a/includes/SpecialPageFactory.php
b/includes/SpecialPageFactory.php
index
c119b11
..
ba9a918
100644
(file)
--- a/
includes/SpecialPageFactory.php
+++ b/
includes/SpecialPageFactory.php
@@
-126,6
+126,8
@@
class SpecialPageFactory {
// Page tools
'ComparePages' => 'SpecialComparePages',
'Export' => 'SpecialExport',
// Page tools
'ComparePages' => 'SpecialComparePages',
'Export' => 'SpecialExport',
+ 'Globalfileusage' => 'SpecialGlobalFileUsage',
+ 'Globaltemplateusage' => 'SpecialGlobalTemplateUsage',
'Import' => 'SpecialImport',
'Undelete' => 'SpecialUndelete',
'Whatlinkshere' => 'SpecialWhatlinkshere',
'Import' => 'SpecialImport',
'Undelete' => 'SpecialUndelete',
'Whatlinkshere' => 'SpecialWhatlinkshere',
@@
-160,6
+162,7
@@
class SpecialPageFactory {
static function getList() {
global $wgSpecialPages;
global $wgDisableCounters, $wgDisableInternalSearch, $wgEmailAuthentication;
static function getList() {
global $wgSpecialPages;
global $wgDisableCounters, $wgDisableInternalSearch, $wgEmailAuthentication;
+ global $wgEnableEmail;
if ( !is_object( self::$mList ) ) {
wfProfileIn( __METHOD__ );
if ( !is_object( self::$mList ) ) {
wfProfileIn( __METHOD__ );
@@
-177,6
+180,10
@@
class SpecialPageFactory {
self::$mList['Invalidateemail'] = 'EmailInvalidation';
}
self::$mList['Invalidateemail'] = 'EmailInvalidation';
}
+ if ( $wgEnableEmail ) {
+ self::$mList['ChangeEmail'] = 'SpecialChangeEmail';
+ }
+
// Add extension special pages
self::$mList = array_merge( self::$mList, $wgSpecialPages );
// Add extension special pages
self::$mList = array_merge( self::$mList, $wgSpecialPages );
@@
-257,38
+264,42
@@
class SpecialPageFactory {
/**
* Add a page to a certain display group for Special:SpecialPages
*
/**
* Add a page to a certain display group for Special:SpecialPages
*
- * @param $page
Mixed: SpecialPage or
string
+ * @param $page
SpecialPage|
string
* @param $group String
*/
public static function setGroup( $page, $group ) {
global $wgSpecialPageGroups;
* @param $group String
*/
public static function setGroup( $page, $group ) {
global $wgSpecialPageGroups;
- $name = is_object( $page ) ? $page->
mName
: $page;
+ $name = is_object( $page ) ? $page->
getName()
: $page;
$wgSpecialPageGroups[$name] = $group;
}
/**
$wgSpecialPageGroups[$name] = $group;
}
/**
- *
Add a page to a certain display group for Special:SpecialPages
+ *
Get the group that the special page belongs in on Special:SpecialPage
*
* @param $page SpecialPage
*
* @param $page SpecialPage
+ *
+ * @return string
*/
public static function getGroup( &$page ) {
*/
public static function getGroup( &$page ) {
+ $name = $page->getName();
+
global $wgSpecialPageGroups;
static $specialPageGroupsCache = array();
global $wgSpecialPageGroups;
static $specialPageGroupsCache = array();
- if ( isset( $specialPageGroupsCache[$
page->mN
ame] ) ) {
- return $specialPageGroupsCache[$
page->mN
ame];
+ if ( isset( $specialPageGroupsCache[$
n
ame] ) ) {
+ return $specialPageGroupsCache[$
n
ame];
}
}
- $msg = wfMessage( 'specialpages-specialpagegroup-' . strtolower( $
page->mN
ame ) );
+ $msg = wfMessage( 'specialpages-specialpagegroup-' . strtolower( $
n
ame ) );
if ( !$msg->isBlank() ) {
$group = $msg->text();
} else {
if ( !$msg->isBlank() ) {
$group = $msg->text();
} else {
- $group = isset( $wgSpecialPageGroups[$
page->mN
ame] )
- ? $wgSpecialPageGroups[$
page->mN
ame]
+ $group = isset( $wgSpecialPageGroups[$
n
ame] )
+ ? $wgSpecialPageGroups[$
n
ame]
: '-';
}
if ( $group == '-' ) {
$group = 'other';
}
: '-';
}
if ( $group == '-' ) {
$group = 'other';
}
- $specialPageGroupsCache[$
page->mN
ame] = $group;
+ $specialPageGroupsCache[$
n
ame] = $group;
return $group;
}
return $group;
}
@@
-464,36
+475,47
@@
class SpecialPageFactory {
}
/**
}
/**
- * Just like executePath() except it returns the HTML instead of outputting it
- * Returns false if there was no such special page, or a title object if it was
+ * Just like executePath() but will override global variables and execute
+ * the page in "inclusion" mode. Returns true if the excution was successful
+ * or false if there was no such special page, or a title object if it was
* a redirect.
*
* a redirect.
*
+ * Also saves the current $wgTitle, $wgOut, $wgRequest, $wgUser and $wgLang
+ * variables so that the special page will get the context it'd expect on a
+ * normal request, and then restores them to their previous values after.
+ *
* @param $title Title
* @param $title Title
+ * @param $context RequestContext
*
* @return String: HTML fragment
*/
*
* @return String: HTML fragment
*/
- static function capturePath(
&$title
) {
- global $wgOut, $wgTitle, $wgRequest;
+ static function capturePath(
Title $title, RequestContext $context
) {
+ global $wgOut, $wgTitle, $wgRequest
, $wgUser, $wgLang
;
+ // Save current globals
$oldTitle = $wgTitle;
$oldOut = $wgOut;
$oldRequest = $wgRequest;
$oldTitle = $wgTitle;
$oldOut = $wgOut;
$oldRequest = $wgRequest;
+ $oldUser = $wgUser;
+ $oldLang = $wgLang;
- // Don't want special pages interpreting ?feed=atom parameters.
- $wgRequest = new FauxRequest( array() );
-
- $context = new RequestContext;
- $context->setTitle( $title );
- $context->setRequest( $wgRequest );
+ // Set the globals to the current context
+ $wgTitle = $title;
$wgOut = $context->getOutput();
$wgOut = $context->getOutput();
+ $wgRequest = $context->getRequest();
+ $wgUser = $context->getUser();
+ $wgLang = $context->getLang();
+ // The useful part
$ret = self::executePath( $title, $context, true );
$ret = self::executePath( $title, $context, true );
- if ( $ret === true ) {
- $ret = $wgOut->getHTML();
- }
+
+ // And restore that globals
$wgTitle = $oldTitle;
$wgOut = $oldOut;
$wgRequest = $oldRequest;
$wgTitle = $oldTitle;
$wgOut = $oldOut;
$wgRequest = $oldRequest;
+ $wgUser = $oldUser;
+ $wgLang = $oldLang;
+
return $ret;
}
return $ret;
}
@@
-508,7
+530,7
@@
class SpecialPageFactory {
static function getLocalNameFor( $name, $subpage = false ) {
global $wgContLang;
$aliases = $wgContLang->getSpecialPageAliases();
static function getLocalNameFor( $name, $subpage = false ) {
global $wgContLang;
$aliases = $wgContLang->getSpecialPageAliases();
-
+
if ( isset( $aliases[$name][0] ) ) {
$name = $aliases[$name][0];
} else {
if ( isset( $aliases[$name][0] ) ) {
$name = $aliases[$name][0];
} else {