summaryrefslogtreecommitdiff
path: root/extensions/Renameuser/Renameuser.php
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/Renameuser/Renameuser.php')
-rw-r--r--extensions/Renameuser/Renameuser.php83
1 files changed, 11 insertions, 72 deletions
diff --git a/extensions/Renameuser/Renameuser.php b/extensions/Renameuser/Renameuser.php
index 962c0f3f..e9e83143 100644
--- a/extensions/Renameuser/Renameuser.php
+++ b/extensions/Renameuser/Renameuser.php
@@ -23,9 +23,8 @@ $wgExtensionCredits['specialpage'][] = array(
);
# Internationalisation files
-$dir = dirname( __FILE__ ) . '/';
-$wgExtensionMessagesFiles['Renameuser'] = $dir . 'Renameuser.i18n.php';
-$wgExtensionMessagesFiles['RenameuserAliases'] = $dir . 'Renameuser.alias.php';
+$wgExtensionMessagesFiles['Renameuser'] = __DIR__ . '/Renameuser.i18n.php';
+$wgExtensionMessagesFiles['RenameuserAliases'] = __DIR__ . '/Renameuser.alias.php';
/**
* Users with more than this number of edits will have their rename operation
@@ -34,79 +33,19 @@ $wgExtensionMessagesFiles['RenameuserAliases'] = $dir . 'Renameuser.alias.php';
define( 'RENAMEUSER_CONTRIBJOB', 5000 );
# Add a new log type
-global $wgLogTypes, $wgLogNames, $wgLogHeaders, $wgLogActions;
-$wgLogTypes[] = 'renameuser';
-$wgLogNames['renameuser'] = 'renameuserlogpage';
-$wgLogHeaders['renameuser'] = 'renameuserlogpagetext';
-# $wgLogActions['renameuser/renameuser'] = 'renameuserlogentry';
-$wgLogActionsHandlers['renameuser/renameuser'] = 'wfRenameUserLogActionText'; // deal with old breakage
+$wgLogTypes[] = 'renameuser';
+$wgLogActionsHandlers['renameuser/renameuser'] = 'RenameuserLogFormatter';
-/**
- * @param $type
- * @param $action
- * @param $title Title
- * @param $skin Skin
- * @param $params array
- * @param $filterWikilinks bool
- * @return String
- */
-function wfRenameUserLogActionText( $type, $action, $title = null, $skin = null, $params = array(), $filterWikilinks = false ) {
- if ( !$title || $title->getNamespace() !== NS_USER ) {
- $rv = ''; // handled in comment, the old way
- } else {
- $titleLink = $skin ?
- $skin->makeLinkObj( $title, htmlspecialchars( $title->getPrefixedText() ) ) : htmlspecialchars( $title->getText() );
- # Add title to params
- array_unshift( $params, $titleLink );
- $rv = wfMsg( 'renameuserlogentry', $params );
- }
- return $rv;
-}
+$wgAutoloadClasses['RenameuserHooks'] = __DIR__ . '/Renameuser.hooks.php';
+$wgAutoloadClasses['RenameUserJob'] = __DIR__ . '/RenameUserJob.php';
+$wgAutoloadClasses['RenameuserLogFormatter'] = __DIR__ . '/RenameuserLogFormatter.php';
+$wgAutoloadClasses['RenameuserSQL'] = __DIR__ . '/RenameuserSQL.php';
+$wgAutoloadClasses['SpecialRenameuser'] = __DIR__ . '/specials/SpecialRenameuser.php';
-$wgAutoloadClasses['SpecialRenameuser'] = dirname( __FILE__ ) . '/Renameuser_body.php';
-$wgAutoloadClasses['RenameUserJob'] = dirname( __FILE__ ) . '/RenameUserJob.php';
$wgSpecialPages['Renameuser'] = 'SpecialRenameuser';
$wgSpecialPageGroups['Renameuser'] = 'users';
$wgJobClasses['renameUser'] = 'RenameUserJob';
-$wgHooks['ShowMissingArticle'][] = 'wfRenameUserShowLog';
-$wgHooks['ContributionsToolLinks'][] = 'wfRenameuserOnContribsLink';
-
-/**
- * Show a log if the user has been renamed and point to the new username.
- * Don't show the log if the $oldUserName exists as a user.
- *
- * @param $article Article
- */
-function wfRenameUserShowLog( $article ) {
- global $wgOut;
- $title = $article->getTitle();
- $oldUser = User::newFromName( $title->getBaseText() );
- if ( ($title->getNamespace() == NS_USER || $title->getNamespace() == NS_USER_TALK ) && ($oldUser && $oldUser->isAnon() )) {
- // Get the title for the base userpage
- $page = Title::makeTitle( NS_USER, str_replace( ' ', '_', $title->getBaseText() ) )->getPrefixedDBkey();
- LogEventsList::showLogExtract( $wgOut, 'renameuser', $page, '', array( 'lim' => 10, 'showIfEmpty' => false,
- 'msgKey' => array( 'renameuser-renamed-notice', $title->getBaseText() ) ) );
- }
- return true;
-}
-
-/**
- * @param $id
- * @param $nt Title
- * @param $tools
- * @return bool
- */
-function wfRenameuserOnContribsLink( $id, $nt, &$tools ) {
- global $wgUser;
+$wgHooks['ShowMissingArticle'][] = 'RenameuserHooks::onShowMissingArticle';
+$wgHooks['ContributionsToolLinks'][] = 'RenameuserHooks::onContributionsToolLinks';
- if ( $wgUser->isAllowed( 'renameuser' ) && $id ) {
- $tools[] = Linker::link(
- SpecialPage::getTitleFor( 'Renameuser' ),
- wfMsg( 'renameuser-linkoncontribs' ),
- array( 'title' => wfMsgExt( 'renameuser-linkoncontribs-text', 'parseinline' ) ),
- array( 'oldusername' => $nt->getText() )
- );
- }
- return true;
-}