# $wgLang->date( $timestamp ),
# $wgLang->time( $timestamp ) ),
# wfMsg( 'currentrev' ) );
-
+
// Don't bother generating the diff if we won't be able to show it
if ( $wgFeedDiffCutoff > 0 ) {
$de = new DifferenceEngine( $title, $oldid, $newid );
*/
public function __construct( $imagePage ) {
global $wgUser, $wgShowArchiveThumbnails;
- $this->skin = $wgUser->getSkin();
+ $this->skin = $this->getSkin();
$this->current = $imagePage->getFile();
$this->img = $imagePage->getDisplayedFile();
$this->title = $imagePage->getTitle();
# with more than a straight list, so we hand them the info, plus
# an OutputPage, and let them get on with it
$this->outputResults( $wgOut,
- $wgUser->getSkin(),
+ $this->getSkin(),
$dbr, # Should use a ResultWrapper for this
$res,
$this->numRows,
}
function getRawText() {
- global $wgUser, $wgOut;
+ global $wgOut;
if( $this->mGen ) {
- $sk = $wgUser->getSkin();
+ $sk = $this->getSkin();
if( !StubObject::isRealObject( $wgOut ) ) {
$wgOut->_unstub( 2 );
}
if ( $fld_mime ) {
$file['mime'] = "$row->fa_major_mime/$row->fa_minor_mime";
}
-
+
if ( $row->fa_deleted & File::DELETED_FILE ) {
$file['filehidden'] = '';
}
$file['suppressed'] = '';
}
-
+
$fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $file );
if ( !$fit ) {
$this->setContinueEnumParameter( 'from', $this->keyToTitle( $row->fa_name ) );
$this->addWhere( array(
'rc_deleted' => 0,
) );
-
+
$db = $this->getDB();
- $this->addWhereRange( 'rc_timestamp', $params['dir'],
- $db->timestamp( $params['start'] ),
+ $this->addWhereRange( 'rc_timestamp', $params['dir'],
+ $db->timestamp( $params['start'] ),
$db->timestamp( $params['end'] ) );
$this->addWhereFld( 'wl_namespace', $params['namespace'] );
$this->addWhereIf( 'rc_this_oldid=page_latest OR rc_type=' . RC_LOG, !$params['allrev'] );
if ( $this->fld_parsedcomment && isset( $row->rc_comment ) ) {
global $wgUser;
- $vals['parsedcomment'] = $wgUser->getSkin()->formatComment( $row->rc_comment, $title );
+ $vals['parsedcomment'] = $this->getSkin()->formatComment( $row->rc_comment, $title );
}
if ( $this->fld_loginfo && $row->rc_type == RC_LOG ) {
// (a) the user can delete revisions, or
// (b) the user can view deleted revision *and* this one is deleted
if ( $canHide || ( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) ) {
- $sk = $wgUser->getSkin();
+ $sk = $this->getSkin();
if ( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
$link = $sk->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
} else {
}
# Add redundant patrol link on bottom...
if ( $this->mRcidMarkPatrolled && $this->mTitle->quickUserCan( 'patrol' ) ) {
- $sk = $wgUser->getSkin();
+ $sk = $this->getSkin();
$token = $wgUser->editToken( $this->mRcidMarkPatrolled );
$wgOut->preventClickjacking();
$wgOut->addHTML(
/**
* Get the local repository, i.e. the one corresponding to the local image
* table. Files are typically uploaded to the local repository.
+ *
+ * @return LocalRepo
*/
function getLocalRepo() {
return $this->getRepo( 'local' );
if ( $this->target instanceof User ) {
# Set the 'relevant user' in the skin, so it displays links like Contributions,
# User logs, UserRights, etc.
- $wgUser->getSkin()->setRelevantUser( $this->target );
+ $this->getSkin()->setRelevantUser( $this->target );
}
list( $this->previousTarget, /*...*/ ) = Block::parseTarget( $wgRequest->getVal( 'wpPreviousTarget' ) );
static $sk, $msg;
if ( empty( $sk ) ) {
- $sk = $wgUser->getSkin();
+ $sk = $this->getSkin();
$msg = array(
'anononlyblock',
'createaccountblock',
}
} else {
$title = SpecialPage::getTitleFor( 'Userlogin' );
- $skin = $wgUser->getSkin();
+ $skin = $this->getSkin();
$llink = $skin->linkKnown(
$title,
wfMsgHtml( 'loginreqlink' ),
$wgOut->setSubtitle( $this->contributionsSub( $nt, $id ) );
$wgOut->setHTMLTitle( wfMsg( 'pagetitle', wfMsgExt( 'contributions-title', array( 'parsemag' ),$target ) ) );
$user = User::newFromName( $target, false );
- if ( is_object($user) ) {
- $wgUser->getSkin()->setRelevantUser( $user );
+ if ( is_object( $user ) ) {
+ $this->getSkin()->setRelevantUser( $user );
}
} else {
$wgOut->setSubtitle( wfMsgHtml( 'sp-contributions-newbies-sub') );
protected function contributionsSub( $nt, $id ) {
global $wgLang, $wgUser, $wgOut;
- $sk = $wgUser->getSkin();
+ $sk = $this->getSkin();
if ( $id === null ) {
$user = htmlspecialchars( $nt->getText() );
function getSubTitle( $nt, $id ) {
global $wgLang, $wgUser, $wgOut;
- $sk = $wgUser->getSkin();
+ $sk = $this->getSkin();
if ( $id === null ) {
$user = htmlspecialchars( $nt->getText() );
# Anons don't get a watchlist
if( $wgUser->isAnon() ) {
$wgOut->setPageTitle( wfMsg( 'watchnologin' ) );
- $llink = $wgUser->getSkin()->linkKnown(
+ $llink = $this->getSkin()->linkKnown(
SpecialPage::getTitleFor( 'Userlogin' ),
wfMsgHtml( 'loginreqlink' ),
array(),
'watchlistfor2',
array( 'parseinline', 'replaceafter' ),
$wgUser->getName(),
- SpecialEditWatchlist::buildTools( $wgUser->getSkin() )
+ SpecialEditWatchlist::buildTools( $this->getSkin() )
);
$wgOut->setSubtitle( $sub );
'watchlistedit-raw-added',
$wgLang->formatNum( count( $toWatch ) )
);
- $this->showTitles( $toWatch, $this->successMessage, $wgUser->getSkin() );
+ $this->showTitles( $toWatch, $this->successMessage, $this->getSkin() );
}
if( count( $toUnwatch ) > 0 ) {
'watchlistedit-raw-removed',
$wgLang->formatNum( count( $toUnwatch ) )
);
- $this->showTitles( $toUnwatch, $this->successMessage, $wgUser->getSkin() );
+ $this->showTitles( $toUnwatch, $this->successMessage, $this->getSkin() );
}
} else {
$this->clearWatchlist( $wgUser );
'watchlistedit-raw-removed',
$wgLang->formatNum( count( $current ) )
);
- $this->showTitles( $current, $this->successMessage, $wgUser->getSkin() );
+ $this->showTitles( $current, $this->successMessage, $this->getSkin() );
}
return true;
}
'watchlistedit-normal-done',
$wgLang->formatNum( count( $removed ) )
);
- $this->showTitles( $removed, $this->successMessage, $wgUser->getSkin() );
+ $this->showTitles( $removed, $this->successMessage, $this->getSkin() );
return true;
} else {
return false;
? wfMsgHtml( 'blanknamespace' )
: htmlspecialchars( $wgLang->getFormattedNsText( $namespace ) );
}
-}
\ No newline at end of file
+}
'From' => array(
'type' => 'info',
'raw' => 1,
- 'default' => $wgUser->getSkin()->link(
+ 'default' => $this->getSkin()->link(
$wgUser->getUserPage(),
htmlspecialchars( $wgUser->getName() )
),
'To' => array(
'type' => 'info',
'raw' => 1,
- 'default' => $wgUser->getSkin()->link(
+ 'default' => $this->getSkin()->link(
$this->mTargetObj->getUserPage(),
htmlspecialchars( $this->mTargetObj->getName() )
),
public function execute( $par ) {
global $wgOut, $wgRequest, $wgSitename, $wgExportAllowListContributors;
global $wgExportAllowHistory, $wgExportMaxHistory, $wgExportMaxLinkDepth;
- global $wgExportFromNamespaces, $wgUser;
+ global $wgExportFromNamespaces;
$this->setHeaders();
$this->outputHeader();
$wgRequest->wasPosted() ? $wgRequest->getCheck( 'wpDownload' ) : true
) . '<br />';
- $form .= Xml::submitButton( wfMsg( 'export-submit' ), $wgUser->getSkin()->tooltipAndAccessKeyAttribs( 'export' ) );
+ $form .= Xml::submitButton( wfMsg( 'export-submit' ), $this->getSkin()->tooltipAndAccessKeyAttribs( 'export' ) );
$form .= Xml::closeElement( 'form' );
$wgOut->addHTML( $form );
* @param $dupes Array of File objects
*/
function showList( $dupes ) {
- global $wgUser, $wgOut;
- $skin = $wgUser->getSkin();
+ global $wgOut;
+ $skin = $this->getSkin();
$html = array();
$html[] = $this->openList( 0 );
<td>
</td>
<td class='mw-submit'>" .
- Xml::submitButton( wfMsg( 'import-interwiki-submit' ), $wgUser->getSkin()->tooltipAndAccessKeyAttribs( 'import' ) ) .
+ Xml::submitButton( wfMsg( 'import-interwiki-submit' ), $this->getSkin()->tooltipAndAccessKeyAttribs( 'import' ) ) .
"</td>
</tr>" .
Xml::closeElement( 'table' ).
$args = func_get_args();
call_user_func_array( $this->mOriginalPageOutCallback, $args );
- $skin = $wgUser->getSkin();
+ $skin = $this->getSkin();
$this->mPageCount++;
}
private function show( FormOptions $opts, array $extraConds ) {
- global $wgOut, $wgUser;
+ global $wgOut;
# Create a LogPager item to get the results and a LogEventsList item to format them...
- $loglist = new LogEventsList( $wgUser->getSkin(), $wgOut, 0 );
+ $loglist = new LogEventsList( $this->getSkin(), $wgOut, 0 );
$pager = new LogPager( $loglist, $opts->getValue( 'type' ), $opts->getValue( 'user' ),
$opts->getValue( 'page' ), $opts->getValue( 'pattern' ), $extraConds, $opts->getValue( 'year' ),
$opts->getValue( 'month' ), $opts->getValue( 'tagfilter' ) );
# Set relevant user
if ( $pager->getUser() ) {
- $wgUser->getSkin()->setRelevantUser( User::newFromName( $pager->getUser() ) );
+ $this->getSkin()->setRelevantUser( User::newFromName( $pager->getUser() ) );
}
# Show form options
private function showHistory() {
global $wgUser, $wgOut;
- $this->sk = $wgUser->getSkin();
+ $this->sk = $this->getSkin();
$wgOut->setPageTitle( wfMsg( 'mergehistory' ) );
function showForm( $err ) {
global $wgOut, $wgUser, $wgContLang, $wgFixDoubleRedirects;
- $skin = $wgUser->getSkin();
+ $skin = $this->getSkin();
$oldTitleLink = $skin->link( $this->oldTitle );
}
$extraOutput = array();
- $skin = $wgUser->getSkin();
+ $skin = $this->getSkin();
$count = 1;
foreach( $extraPages as $oldSubpage ) {
if( $ot->equals( $oldSubpage ) ) {
}
$out->addWikiMsg( 'movesubpagetext', $wgLang->formatNum( $count ) );
- $skin = $wgUser->getSkin();
+ $skin = $this->getSkin();
$out->addHTML( "<ul>\n" );
foreach( $subpages as $subpage ) {
class NewFilesPager extends ReverseChronologicalPager {
function __construct( $par = null ) {
- global $wgRequest, $wgUser;
+ global $wgRequest;
$this->like = $wgRequest->getText( 'like' );
$this->showbots = $wgRequest->getBool( 'showbots' , 0 );
- $this->skin = $wgUser->getSkin();
+ $this->skin = $this->getSkin();
parent::__construct();
}
* @param $from String: list all pages from this name (default FALSE)
*/
function showPrefixChunk( $namespace = NS_MAIN, $prefix, $from = null ) {
- global $wgOut, $wgUser, $wgContLang, $wgLang;
+ global $wgOut, $wgContLang, $wgLang;
- $sk = $wgUser->getSkin();
+ $sk = $this->getSkin();
if (!isset($from)) $from = $prefix;
* @return string
*/
function formatRow( $row ) {
- global $wgUser, $wgLang;
+ global $wgLang;
wfProfileIn( __METHOD__ );
- static $skin=null;
+ static $skin = null;
if( is_null( $skin ) )
- $skin = $wgUser->getSkin();
+ $skin = $this->getSkin();
$title = Title::makeTitleSafe( $row->pt_namespace, $row->pt_title );
$link = $skin->link( $title );
}
function setTopText( OutputPage $out, FormOptions $opts ) {
- global $wgUser;
- $skin = $wgUser->getSkin();
+ $skin = $this->getSkin();
$target = $this->getTargetTitle();
if( $target )
$out->setSubtitle( wfMsg( 'recentchangeslinked-backlink', $skin->link( $target,
// Redirects defaults to true, but we don't know whether it was ticked of or just missing
$default = $request->getBool( 'profile' ) ? 0 : 1;
$this->searchRedirects = $request->getBool( 'redirs', $default ) ? 1 : 0;
- $this->sk = $user->getSkin();
+ $this->sk = $this->getSkin();
$this->didYouMeanHtml = ''; # html of did you mean... link
$this->fulltext = $request->getVal('fulltext');
}
* @param $term String
*/
public function showResults( $term ) {
- global $wgOut, $wgUser, $wgDisableTextSearch, $wgContLang, $wgScript;
+ global $wgOut, $wgDisableTextSearch, $wgContLang, $wgScript;
wfProfileIn( __METHOD__ );
- $sk = $wgUser->getSkin();
+ $sk = $this->getSkin();
$search = $this->getSearchEngine();
$search->setLimitOffset( $this->limit, $this->offset );
* @param $terms Array: terms to highlight
*/
protected function showHit( $result, $terms ) {
- global $wgLang, $wgUser;
+ global $wgLang;
wfProfileIn( __METHOD__ );
if( $result->isBrokenTitle() ) {
return "<!-- Broken link in search result -->\n";
}
- $sk = $wgUser->getSkin();
+ $sk = $this->getSkin();
$t = $result->getTitle();
$titleSnippet = $result->getTitleSnippet($terms);
}
private function getUserStats() {
- global $wgLang, $wgUser, $wgActiveUserDays;
- $sk = $wgUser->getSkin();
+ global $wgLang, $wgActiveUserDays;
+ $sk = $this->getSkin();
return Xml::openElement( 'tr' ) .
Xml::tags( 'th', array( 'colspan' => '2' ), wfMsgExt( 'statistics-header-users', array( 'parseinline' ) ) ) .
Xml::closeElement( 'tr' ) .
}
private function getGroupStats() {
- global $wgGroupPermissions, $wgImplicitGroups, $wgLang, $wgUser;
- $sk = $wgUser->getSkin();
+ global $wgGroupPermissions, $wgImplicitGroups, $wgLang;
+ $sk = $this->getSkin();
$text = '';
foreach( $wgGroupPermissions as $group => $permissions ) {
# Skip generic * and implicit groups
}
private function getMostViewedPages() {
- global $wgLang, $wgUser;
+ global $wgLang;
$text = '';
$dbr = wfGetDB( DB_SLAVE );
- $sk = $wgUser->getSkin();
+ $sk = $this->getSkin();
$res = $dbr->select(
'page',
array(
function doTagRow( $tag, $hitcount ) {
static $sk = null, $doneTags = array();
if ( !$sk ) {
- global $wgUser;
- $sk = $wgUser->getSkin();
+ $sk = $this->getSkin();
}
if ( in_array( $tag, $doneTags ) ) {
unset( $fields['Name'] );
} else {
- global $wgUser;
-
$fields['Target']['default'] = $target;
$fields['Target']['type'] = 'hidden';
switch( $type ){
case Block::TYPE_USER:
case Block::TYPE_IP:
- $skin = $wgUser->getSkin();
+ $skin = $this->getSkin();
$fields['Name']['default'] = $skin->link(
$target->getUserPage(),
$target->getName()
}
if ( $this->mTarget !== '' ) {
$this->mTargetObj = Title::newFromURL( $this->mTarget );
- $wgUser->getSkin()->setRelevantTitle( $this->mTargetObj );
+ $this->getSkin()->setRelevantTitle( $this->mTargetObj );
} else {
$this->mTargetObj = null;
}
$wgOut->addWikiMsg( 'undeletepagetext', $wgLang->formatNum( $result->numRows() ) );
- $sk = $wgUser->getSkin();
+ $sk = $this->getSkin();
$undelete = $this->getTitle();
$wgOut->addHTML( "<ul>\n" );
foreach ( $result as $row ) {
private function showRevision( $timestamp ) {
global $wgLang, $wgUser, $wgOut;
- $skin = $wgUser->getSkin();
+ $skin = $this->getSkin();
if( !preg_match( '/[0-9]{14}/', $timestamp ) ) {
return 0;
global $wgUser;
$canHide = $wgUser->isAllowed( 'deleterevision' );
if( $canHide || ( $rev->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) ) {
- $skin = $wgUser->getSkin();
+ $skin = $this->getSkin();
if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
$revdlink = $skin->revDeleteLinkDisabled( $canHide ); // revision was hidden from sysops
} else {
*/
private function diffHeader( $rev, $prefix ) {
global $wgUser, $wgLang;
- $sk = $wgUser->getSkin();
+ $sk = $this->getSkin();
$isDeleted = !( $rev->getId() && $rev->getTitle() );
if( $isDeleted ) {
/// @todo FIXME: $rev->getTitle() is null for deleted revs...?
$link = wfMsgExt(
$wgUser->isAllowed( 'delete' ) ? 'thisisdeleted' : 'viewdeleted',
array( 'parse', 'replaceafter' ),
- $wgUser->getSkin()->linkKnown(
+ $this->getSkin()->linkKnown(
SpecialPage::getTitleFor( 'Undelete', $title->getPrefixedText() ),
wfMsgExt( 'restorelink', array( 'parsemag', 'escape' ), $count )
)
}
$this->mMaxUploadSize['file'] = UploadBase::getMaxUploadSize( 'file' );
- # Limit to upload_max_filesize unless we are running under HipHop and
+ # Limit to upload_max_filesize unless we are running under HipHop and
# that setting doesn't exist
if ( !wfIsHipHop() ) {
$this->mMaxUploadSize['file'] = min( $this->mMaxUploadSize['file'],
if( $this->mReturnTo ) {
$attr['returnto'] = $this->mReturnTo;
}
- $skin = $wgUser->getSkin();
+ $skin = $this->getSkin();
return $skin->linkKnown(
$self,
htmlspecialchars( $text ),
<td></td>
<td class='mw-submit'>" .
Xml::submitButton( wfMsg( 'saveusergroups' ),
- array( 'name' => 'saveusergroups' ) + $wgUser->getSkin()->tooltipAndAccessKeyAttribs( 'userrights-set' ) ) .
+ array( 'name' => 'saveusergroups' ) + $this->getSkin()->tooltipAndAccessKeyAttribs( 'userrights-set' ) ) .
"</td>
</tr>" .
Xml::closeElement( 'table' ) . "\n" .
$maint->purgeRedundantText( true );
}
}
-}
\ No newline at end of file
+}
* We implement below the simple task of searching inside a dump.
*
* Copyright (C) 2011 Platonides - http://www.mediawiki.org/
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* @file
* @ingroup Maintenance
*/
-
+
require_once( dirname( __FILE__ ) . '/Maintenance.php' );
abstract class DumpIterator extends Maintenance {
if (! ( $this->hasOption('file') ^ $this->hasOption('dump') ) ) {
$this->error("You must provide a file or dump", true);
}
-
+
$this->checkOptions();
-
+
if ( $this->hasOption('file') ) {
$revision = new WikiRevision;
-
+
$revision->setText( file_get_contents( $this->getOption( 'file' ) ) );
$revision->setTitle( Title::newFromText( rawurldecode( basename( $this->getOption( 'file' ), '.txt' ) ) ) );
$this->handleRevision( $revision );
return;
}
-
+
$this->startTime = wfTime();
if ( $this->getOption('dump') == '-' ) {
$importer->setRevisionCallback(
array( &$this, 'handleRevision' ) );
-
+
$this->from = $this->getOption( 'from', null );
$this->count = 0;
$importer->doImport();
-
+
$this->conclusions();
-
+
$delta = wfTime() - $this->startTime;
$this->error( "Done {$this->count} revisions in " . round($delta, 2) . " seconds " );
if ($delta > 0)
$this->error( round($this->count / $delta, 2) . " pages/sec" );
-
+
# Perform the memory_get_peak_usage() when all the other data has been output so there's no damage if it dies.
# It is only available since 5.2.0 (since 5.2.1 if you haven't compiled with --enable-memory-limit)
$this->error( "Memory peak usage of " . memory_get_peak_usage() . " bytes\n" );
}
-
+
public function finalSetup() {
parent::finalSetup();
return false;
}
-
+
/**
- * Callback function for each revision, child classes should override
+ * Callback function for each revision, child classes should override
* processRevision instead.
* @param $rev Revision
*/
$this->error( "Got bogus revision with null title!" );
return;
}
-
+
$this->count++;
if ( isset( $this->from ) ) {
if ( $this->from != $title )
return;
$this->output( "Skipped " . ($this->count - 1) . " pages\n" );
-
+
$this->count = 1;
$this->from = null;
}
-
+
$this->processRevision( $rev );
}
-
+
/* Stub function for processing additional options */
public function checkOptions() {
return;
}
-
+
/* Stub function for giving data about what was computed */
public function conclusions() {
return;
}
class SearchDump extends DumpIterator {
-
+
public function __construct() {
parent::__construct();
$this->mDescription = "Runs a regex in the revisions from a dump";
$this->addOption( 'regex', 'Searching regex', true, true );
}
-
+
public function getDbType() {
return Maintenance::DB_NONE;
}
-
+
+ /**
+ * @param $rev Revision
+ */
public function processRevision( $rev ) {
if ( preg_match( $this->getOption( 'regex' ), $rev->getText() ) ) {
$this->output( $rev->getTitle() . " matches at edit from " . $rev->getTimestamp() . "\n" );
$this->templates = array();
}
+ /**
+ * @param $title Title
+ */
function templateHook( $title ) {
$titleText = $title->getPrefixedDBkey();
}
}
+ /**
+ * @return FileRepo
+ */
function getRepo() {
if ( !isset( $this->repo ) ) {
$this->repo = RepoGroup::singleton()->getLocalRepo();
class RebuildTextIndex extends Maintenance {
const RTI_CHUNK_SIZE = 500;
+
+ /**
+ * @var DatabaseBase
+ */
private $db;
public function __construct() {