MediaWiki  1.29.2
cleanup.php File Reference

Go to the source code of this file.

Functions

 cleanupArticle (Revision $rev, $regexes, $match)
 An aggressive spam cleanup script. More...
 

Variables

if(! $regexes) $dbr = wfGetDB( DB_SLAVE )
 
 $maxID = $dbr->selectField( 'page', 'MAX(page_id)' )
 
if( $wgSpamBlacklistFiles) $regexes = $sb->getBlacklists()
 
 $reportingInterval = 100
 
 $sb = new SpamBlacklist( $wgSpamBlacklistSettings )
 
 $username = 'Spam cleanup script'
 
if(method_exists( 'User', 'newSystemUser')) else
 
print Searching for spam in $maxID pages n
 

Function Documentation

◆ cleanupArticle()

cleanupArticle ( Revision  $rev,
  $regexes,
  $match 
)

An aggressive spam cleanup script.

Searches the database for matching pages, and reverts them to the last non-spammed revision. If all revisions contain spam, deletes the page Find the latest revision of the article that does not contain spam and revert to it

Definition at line 15 of file cleanup.php.

References $matches, $regexes, $rev, $revId, $title, as, ContentHandler\getContentText(), ContentHandler\makeContent(), and Revision\newFromTitle().

Variable Documentation

◆ $dbr

if (! $regexes) $dbr = wfGetDB( DB_SLAVE )

Definition at line 94 of file cleanup.php.

Referenced by SpecialRandomrootpage\__construct(), MergeHistoryPager\__construct(), ImageListPager\__construct(), ChangesListSpecialPage\__construct(), OutputPage\addCategoryLinksToLBAndGetResult(), LinkCache\addLinkObj(), ExternalStoreDB\batchFetchBlobs(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\beginPrimaryAuthentication(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\beginPrimaryAuthentication(), SpecialRecentChanges\buildQuery(), SpecialWatchlist\buildQuery(), ChangesListSpecialPage\buildQuery(), ImageListPager\buildQueryConds(), SiteStatsUpdate\cacheUpdate(), UserOptions\CHANGER(), CheckStorage\check(), FindOrphanedFiles\checkFiles(), Pingback\checkIfSent(), TrackBlobs\checkIntegrity(), SpecialRecentChanges\checkLastModified(), User\checkNewtalk(), LocalRepo\checkRedirect(), RenameUserCleanup\checkRenameLog(), RevisionDeleter\checkRevisionExistence(), RecompressTracked\checkTrackingTable(), CleanupInvalidDbKeys\cleanupTable(), CompressOld\compressWithConcat(), Title\countRevisionsBetween(), WatchedItemStore\countUnreadNotifications(), WatchedItemStore\countVisitingWatchers(), WatchedItemStore\countVisitingWatchersMultiple(), WatchedItemStore\countWatchedItems(), WatchedItemStore\countWatchers(), WatchedItemStore\countWatchersMultiple(), SearchEngineFactory\create(), Block\defaultRetroactiveAutoblock(), PrefixSearch\defaultSearchBackend(), Article\delete(), DifferenceEngine\deletedLink(), RefreshLinks\deleteLinksFromNonexistent(), RefreshLinks\dfnCheckInterval(), SpecialRedirect\dispatchLog(), RecompressTracked\doAllOrphans(), RecompressTracked\doAllPages(), ActiveUsersPager\doBatchLookups(), UsersPager\doBatchLookups(), CategoryViewer\doCategoryQuery(), FixDefaultJsonContentPages\doDBUpdates(), JobQueueDB\doGetAbandonedCount(), JobQueueDB\doGetAcquiredCount(), JobQueueDB\doGetSiblingQueueSizes(), JobQueueDB\doGetSiblingQueuesWithJobs(), JobQueueDB\doGetSize(), JobQueueDB\doIsEmpty(), PopulateRevisionLength\doLenUpdates(), SpecialRecentChangesLinked\doMainQuery(), SpecialRecentChanges\doMainQuery(), SpecialWatchlist\doMainQuery(), ChangesListSpecialPage\doMainQuery(), RecompressTracked\doPage(), UserCache\doQuery(), GenderCache\doQuery(), LinkBatch\doQuery(), RefreshLinks\doRefreshLinks(), MovePageForm\doSubmit(), LinkHolderArray\doVariants(), Title\estimateRevisionCount(), SpecialRenameuser\execute(), RemoveInvalidEmails\execute(), StorageTypeStats\execute(), CompareParserCache\execute(), FindMissingFiles\execute(), CheckBadRedirects\execute(), InitUserPreference\execute(), DumpRev\execute(), CheckImages\execute(), ClearInterwikiCache\execute(), DeleteDefaultMessages\execute(), InitEditCount\execute(), RemoveUnusedAccounts\execute(), CheckUsernames\execute(), UpdateArticleCount\execute(), CleanupSpam\execute(), UploadStashCleanup\execute(), ApiQueryContributions\execute(), FixDoubleRedirects\execute(), RefreshFileHeaders\execute(), FixT22757\execute(), OrphanStats\execute(), ShowSiteStats\execute(), DumpLinks\execute(), PurgeChangedPages\execute(), ResetUserTokens\execute(), RebuildFileCache\execute(), UpdateCollation\execute(), PurgeChangedFiles\execute(), QueryPage\execute(), ExternalStoreDB\fetchBlob(), UploadStash\fetchFileMetadata(), QueryPage\fetchFromCache(), UploadDumper\fetchLocal(), HistoryAction\fetchRevisions(), UploadDumper\fetchUsed(), TitleCleanup\fileExists(), ChangesListSpecialPage\filterOnUserExperienceLevel(), LocalRepo\findBySha1(), LocalRepo\findBySha1s(), LocalRepo\findFiles(), LocalRepo\findFilesByPrefix(), User\findUsersByGroup(), RecompressTracked\finishIncompleteMoves(), DoubleRedirectsPage\formatResult(), PageProps\getAllProperties(), Title\getAuthorsBetween(), ContentHandler\getAutoDeleteReason(), Title\getBrokenLinksFrom(), QueryPage\getCachedTimestamp(), BacklinkCache\getCascadeProtectedLinks(), Title\getCascadeProtectionSources(), WikiPage\getCategories(), WikiPage\getContributors(), SpamBlacklist\getCurrentLinks(), AllMessagesTablePager\getCustomisedStatuses(), ForeignDBFile\getDescriptionShortUrl(), User\getEditCount(), ResourceLoaderModule\getFileDependencies(), User\getFirstEditTimestamp(), WikiFilePage\getForeignCategories(), SpecialBotPasswords\getFormFields(), GadgetDefinitionNamespaceRepo\getGadgetIds(), WikiPage\getHiddenCategories(), LocalFile\getHistory(), SpecialActiveUsers\getIntroText(), JobQueueDB\getJobIterator(), EditPage\getLastDelete(), PageArchive\getLastRevisionText(), SpecialExport\getLinks(), SimpleCaptcha\getLinksFromTracker(), Category\getMembers(), SpecialRandomInCategory\getMinAndMaxForCat(), MessageCache\getMsgFromNamespace(), User\getNewMessageLinks(), SpecialNuke\getNewPages(), WatchedItemStore\getNotificationTimestampsBatch(), SpecialExport\getPagesFromCategory(), SpecialExport\getPagesFromNamespace(), Title\getParentCategories(), PageArchive\getPreviousRevision(), PageProps\getProperties(), WantedPagesPage\getQueryInfo(), NewFilesPager\getQueryInfo(), BrokenRedirectsPage\getQueryInfo(), MediaStatisticsPage\getQueryInfo(), UnwatchedpagesPage\getQueryInfo(), UncategorizedCategoriesPage\getQueryInfo(), SpecialGadgetUsage\getQueryInfo(), ActiveUsersPager\getQueryInfo(), WithoutInterwikiPage\getQueryInfo(), UsersPager\getQueryInfo(), LinkSearchPage\getQueryInfo(), SpecialRandomInCategory\getQueryInfo(), ImageListPager\getQueryInfoReal(), Block\getRangeCond(), Revision\getRecentChange(), Title\getRedirectsHere(), WikiPage\getRedirectTarget(), BenchmarkParse\getRevIdForTime(), PageArchive\getRevision(), FixT22757\getRevTextMap(), OutputPage\getRlClient(), Linker\getRollbackEditCount(), RollbackEdits\getRollbackTitles(), Title\getSubpages(), MIMEsearchPage\getSuggestionsForTypes(), HistoryBlobStub\getText(), HistoryBlobCurStub\getText(), TrackBlobs\getTextClause(), PageArchive\getTextFromRow(), Revision\getTitle(), ResourceLoaderWikiModule\getTitleInfo(), Title\getTitleProtectionInternal(), SpecialUpload\getUploadForm(), CheckStorage\importRevision(), User\incEditCountImmediate(), User\initEditCount(), Category\initialize(), BackupDumper\initProgress(), Title\isBigDeletion(), PageArchive\isDeleted(), Title\isDeleted(), Title\isDeletedQuick(), Title\isNewPage(), PageArchive\listAllPages(), ChangeTags\listExplicitlyDefinedTags(), PageArchive\listFiles(), UploadStash\listFiles(), PageArchive\listPages(), PageArchive\listPagesByPrefix(), PageArchive\listPagesBySearch(), PageArchive\listRevisions(), ArchivedFile\load(), MediaWiki\Interwiki\ClassicInterwikiLookup\load(), OldLocalFile\loadExtraFromDB(), LocalFile\loadFieldsWithTimestamp(), OldLocalFile\loadFromDB(), LocalFile\loadFromDB(), MessageCache\loadFromDB(), WikiPage\loadLastEdit(), Revision\loadMutableFields(), User\loadOptions(), Title\loadRestrictions(), Title\loadRestrictionsFromRows(), DifferenceEngine\loadRevisionData(), DBSiteStore\loadSites(), WatchedItemStore\loadWatchedItem(), SearchMySQL\minSearchLength(), ChangesListStringOptionsFilterGroup\modifyQuery(), ChangesListBooleanFilter\modifyQuery(), ChangesListStringOptionsFilterGroupTest\modifyQueryHelper(), moveToExternal(), LinkSearchPage\mungeQuery(), Title\nameOf(), Block\newFromID(), UserArray\newFromIDs(), Title\newFromIDs(), OldLocalFile\newFromKey(), LocalFile\newFromKey(), UserArray\newFromNames(), LocalFile\nextHistoryLine(), SiteStats\numberingroup(), InterwikiHooks\onInterwikiLoadPrefix(), HistoryAction\onView(), ImagePage\openShowImage(), SpecialRecentChanges\outputChangesList(), SpecialWatchlist\outputChangesList(), InfoAction\pageCounts(), WikiPage\pageData(), WikiPage\pageDataFromId(), Article\pageDataFromId(), WikiPage\pageDataFromTitle(), Article\pageDataFromTitle(), SiteStats\pagesInNs(), PurgeChangedFiles\purgeFromArchiveTable(), PurgeChangedFiles\purgeFromLogType(), PurgeList\purgeNamespace(), ImagePage\queryImageLinks(), QueryPage\reallyDoQuery(), DoubleRedirectsPage\reallyGetQueryInfo(), RefreshLinks\refreshCategory(), LinkHolderArray\replaceInternal(), WikiPage\replaceSectionContent(), resolveStub(), resolveStubs(), CheckStorage\restoreText(), CategoryMembershipChangeJob\run(), TableCleanup\runTable(), UserNamePrefixSearch\search(), RandomPage\selectRandomPageFromDB(), SpecialRandomInCategory\selectRandomPageFromDB(), SpecialAllPages\showChunk(), SpecialInterwiki\showForm(), MovePageForm\showForm(), SpecialWhatLinksHere\showIndirectLinks(), EditPage\showIntro(), Article\showMissingArticle(), Article\showPatrolFooter(), SpecialPrefixindex\showPrefixChunk(), SpecialVersion\softwareInformation(), RecompressTracked\syncDBs(), ChangeTags\tagUsageStatistics(), RevisionStorageTest\testConstructFromRow(), WikiPageTest\testDoDeleteArticle(), WikiPageTest\testDoDeleteUpdates(), WikiPageTest\testDoEditContent(), LBFactoryTest\testLBFactoryMulti(), LBFactoryTest\testLBFactorySimpleServer(), LBFactoryTest\testLBFactorySimpleServers(), ChangesListStringOptionsFilterGroupTest\testModifyQuery(), RevisionStorageTest\testNewFromArchiveRow(), RevisionStorageTest\testNewFromRow(), ChangesListStringOptionsFilterGroupTest\testNoOpModifyQuery(), MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider\testUserCanAuthenticate(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\testUserCanAuthenticate(), TrackBlobs\trackOrphanText(), TrackBlobs\trackRevisions(), UserOptions\USAGER(), and ApiTag\validateLogId().

◆ $maxID

$maxID = $dbr->selectField( 'page', 'MAX(page_id)' )

Definition at line 95 of file cleanup.php.

Referenced by moveToExternal(), and resolveStubs().

◆ $regexes

◆ $reportingInterval

$reportingInterval = 100

Definition at line 96 of file cleanup.php.

◆ $sb

$sb = new SpamBlacklist( $wgSpamBlacklistSettings )

Definition at line 84 of file cleanup.php.

◆ $username

$username = 'Spam cleanup script'

Definition at line 62 of file cleanup.php.

◆ else

if ($wgUser->idForName()==0) if (isset($options[ 'n'])) else
Initial value:

Definition at line 65 of file cleanup.php.

◆ n

$wgUser
$wgUser
Definition: Setup.php:781
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:556
$username
$username
Definition: cleanup.php:62