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 /** * Check for articles to fix after adding/deleting namespaces * * Copyright © 2005-2007 Brion Vibber <brion@pobox.com> * https://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 * (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 */ use MediaWiki\Linker\LinkTarget; require_once __DIR__ . '/Maintenance.php'; /** * Maintenance script that checks for articles to fix after * adding/deleting namespaces. * * @ingroup Maintenance */ class NamespaceConflictChecker extends Maintenance { /** * @var Database */ protected $db; private $resolvablePages = 0; private $totalPages = 0; private $resolvableLinks = 0; private $totalLinks = 0; public function __construct() { parent::__construct(); $this->addDescription( 'Find and fix pages affected by namespace addition/removal' ); $this->addOption( 'fix', 'Attempt to automatically fix errors' ); $this->addOption( 'merge', "Instead of renaming conflicts, do a history merge with " . "the correct title" ); $this->addOption( 'add-suffix', "Dupes will be renamed with correct namespace with " . "<text> appended after the article name", false, true ); $this->addOption( 'add-prefix', "Dupes will be renamed with correct namespace with " . "<text> prepended before the article name", false, true ); $this->addOption( 'source-pseudo-namespace', "Move all pages with the given source " . "prefix (with an implied colon following it). If --dest-namespace is not specified, " . "the colon will be replaced with a hyphen.", false, true ); $this->addOption( 'dest-namespace', "In combination with --source-pseudo-namespace, " . "specify the namespace ID of the destination.", false, true ); $this->addOption( 'move-talk', "If this is specified, pages in the Talk namespace that " . "begin with a conflicting prefix will be renamed, for example " . "Talk:File:Foo -> File_Talk:Foo" ); } public function execute() { $this->db = $this->getDB( DB_MASTER ); $options = [ 'fix' => $this->hasOption( 'fix' ), 'merge' => $this->hasOption( 'merge' ), 'add-suffix' => $this->getOption( 'add-suffix', '' ), 'add-prefix' => $this->getOption( 'add-prefix', '' ), 'move-talk' => $this->hasOption( 'move-talk' ), 'source-pseudo-namespace' => $this->getOption( 'source-pseudo-namespace', '' ), 'dest-namespace' => intval( $this->getOption( 'dest-namespace', 0 ) ) ]; if ( $options['source-pseudo-namespace'] !== '' ) { $retval = $this->checkPrefix( $options ); } else { $retval = $this->checkAll( $options ); } if ( $retval ) { $this->output( "\nLooks good!\n" ); } else { $this->output( "\nOh noeees\n" ); } } /** * Check all namespaces * * @param array $options Associative array of validated command-line options * * @return bool */ private function checkAll( $options ) { global $wgContLang, $wgNamespaceAliases, $wgCapitalLinks; $spaces = []; // List interwikis first, so they'll be overridden // by any conflicting local namespaces. foreach ( $this->getInterwikiList() as $prefix ) { $name = $wgContLang->ucfirst( $prefix ); $spaces[$name] = 0; } // Now pull in all canonical and alias namespaces... foreach ( MWNamespace::getCanonicalNamespaces() as $ns => $name ) { // This includes $wgExtraNamespaces if ( $name !== '' ) { $spaces[$name] = $ns; } } foreach ( $wgContLang->getNamespaces() as $ns => $name ) { if ( $name !== '' ) { $spaces[$name] = $ns; } } foreach ( $wgNamespaceAliases as $name => $ns ) { $spaces[$name] = $ns; } foreach ( $wgContLang->getNamespaceAliases() as $name => $ns ) { $spaces[$name] = $ns; } // We'll need to check for lowercase keys as well, // since we're doing case-sensitive searches in the db. foreach ( $spaces as $name => $ns ) { $moreNames = []; $moreNames[] = $wgContLang->uc( $name ); $moreNames[] = $wgContLang->ucfirst( $wgContLang->lc( $name ) ); $moreNames[] = $wgContLang->ucwords( $name ); $moreNames[] = $wgContLang->ucwords( $wgContLang->lc( $name ) ); $moreNames[] = $wgContLang->ucwordbreaks( $name ); $moreNames[] = $wgContLang->ucwordbreaks( $wgContLang->lc( $name ) ); if ( !$wgCapitalLinks ) { foreach ( $moreNames as $altName ) { $moreNames[] = $wgContLang->lcfirst( $altName ); } $moreNames[] = $wgContLang->lcfirst( $name ); } foreach ( array_unique( $moreNames ) as $altName ) { if ( $altName !== $name ) { $spaces[$altName] = $ns; } } } // Sort by namespace index, and if there are two with the same index, // break the tie by sorting by name $origSpaces = $spaces; uksort( $spaces, function ( $a, $b ) use ( $origSpaces ) { if ( $origSpaces[$a] < $origSpaces[$b] ) { return -1; } elseif ( $origSpaces[$a] > $origSpaces[$b] ) { return 1; } elseif ( $a < $b ) { return -1; } elseif ( $a > $b ) { return 1; } else { return 0; } } ); $ok = true; foreach ( $spaces as $name => $ns ) { $ok = $this->checkNamespace( $ns, $name, $options ) && $ok; } $this->output( "{$this->totalPages} pages to fix, " . "{$this->resolvablePages} were resolvable.\n\n" ); foreach ( $spaces as $name => $ns ) { if ( $ns != 0 ) { /* Fix up link destinations for non-interwiki links only. * * For example if a page has [[Foo:Bar]] and then a Foo namespace * is introduced, pagelinks needs to be updated to have * page_namespace = NS_FOO. * * If instead an interwiki prefix was introduced called "Foo", * the link should instead be moved to the iwlinks table. If a new * language is introduced called "Foo", or if there is a pagelink * [[fr:Bar]] when interlanguage magic links are turned on, the * link would have to be moved to the langlinks table. Let's put * those cases in the too-hard basket for now. The consequences are * not especially severe. * @fixme Handle interwiki links, and pagelinks to Category:, File: * which probably need reparsing. */ $this->checkLinkTable( 'pagelinks', 'pl', $ns, $name, $options ); $this->checkLinkTable( 'templatelinks', 'tl', $ns, $name, $options ); // The redirect table has interwiki links randomly mixed in, we // need to filter those out. For example [[w:Foo:Bar]] would // have rd_interwiki=w and rd_namespace=0, which would match the // query for a conflicting namespace "Foo" if filtering wasn't done. $this->checkLinkTable( 'redirect', 'rd', $ns, $name, $options, [ 'rd_interwiki' => null ] ); $this->checkLinkTable( 'redirect', 'rd', $ns, $name, $options, [ 'rd_interwiki' => '' ] ); } } $this->output( "{$this->totalLinks} links to fix, " . "{$this->resolvableLinks} were resolvable.\n" ); return $ok; } /** * Get the interwiki list * * @return array */ private function getInterwikiList() { $result = Interwiki::getAllPrefixes(); $prefixes = []; foreach ( $result as $row ) { $prefixes[] = $row['iw_prefix']; } return $prefixes; } /** * Check a given prefix and try to move it into the given destination namespace * * @param int $ns Destination namespace id * @param string $name * @param array $options Associative array of validated command-line options * @return bool */ private function checkNamespace( $ns, $name, $options ) { $targets = $this->getTargetList( $ns, $name, $options ); $count = $targets->numRows(); $this->totalPages += $count; if ( $count == 0 ) { return true; } $dryRunNote = $options['fix'] ? '' : ' DRY RUN ONLY'; $ok = true; foreach ( $targets as $row ) { // Find the new title and determine the action to take $newTitle = $this->getDestinationTitle( $ns, $name, $row->page_namespace, $row->page_title, $options ); $logStatus = false; if ( !$newTitle ) { $logStatus = 'invalid title'; $action = 'abort'; } elseif ( $newTitle->exists() ) { if ( $options['merge'] ) { if ( $this->canMerge( $row->page_id, $newTitle, $logStatus ) ) { $action = 'merge'; } else { $action = 'abort'; } } elseif ( $options['add-prefix'] == '' && $options['add-suffix'] == '' ) { $action = 'abort'; $logStatus = 'dest title exists and --add-prefix not specified'; } else { $newTitle = $this->getAlternateTitle( $newTitle, $options ); if ( !$newTitle ) { $action = 'abort'; $logStatus = 'alternate title is invalid'; } elseif ( $newTitle->exists() ) { $action = 'abort'; $logStatus = 'title conflict'; } else { $action = 'move'; $logStatus = 'alternate'; } } } else { $action = 'move'; $logStatus = 'no conflict'; } // Take the action or log a dry run message $logTitle = "id={$row->page_id} ns={$row->page_namespace} dbk={$row->page_title}"; $pageOK = true; switch ( $action ) { case 'abort': $this->output( "$logTitle *** $logStatus\n" ); $pageOK = false; break; case 'move': $this->output( "$logTitle -> " . $newTitle->getPrefixedDBkey() . " ($logStatus)$dryRunNote\n" ); if ( $options['fix'] ) { $pageOK = $this->movePage( $row->page_id, $newTitle ); } break; case 'merge': $this->output( "$logTitle => " . $newTitle->getPrefixedDBkey() . " (merge)$dryRunNote\n" ); if ( $options['fix'] ) { $pageOK = $this->mergePage( $row, $newTitle ); } break; } if ( $pageOK ) { $this->resolvablePages++; } else { $ok = false; } } return $ok; } /** * Check and repair the destination fields in a link table * @param string $table The link table name * @param string $fieldPrefix The field prefix in the link table * @param int $ns Destination namespace id * @param string $name * @param array $options Associative array of validated command-line options * @param array $extraConds Extra conditions for the SQL query */ private function checkLinkTable( $table, $fieldPrefix, $ns, $name, $options, $extraConds = [] ) { $batchConds = []; $fromField = "{$fieldPrefix}_from"; $namespaceField = "{$fieldPrefix}_namespace"; $titleField = "{$fieldPrefix}_title"; $batchSize = 500; while ( true ) { $res = $this->db->select( $table, [ $fromField, $namespaceField, $titleField ], array_merge( $batchConds, $extraConds, [ $namespaceField => 0, $titleField . $this->db->buildLike( "$name:", $this->db->anyString() ) ] ), __METHOD__, [ 'ORDER BY' => [ $titleField, $fromField ], 'LIMIT' => $batchSize ] ); if ( $res->numRows() == 0 ) { break; } foreach ( $res as $row ) { $logTitle = "from={$row->$fromField} ns={$row->$namespaceField} " . "dbk={$row->$titleField}"; $destTitle = $this->getDestinationTitle( $ns, $name, $row->$namespaceField, $row->$titleField, $options ); $this->totalLinks++; if ( !$destTitle ) { $this->output( "$table $logTitle *** INVALID\n" ); continue; } $this->resolvableLinks++; if ( !$options['fix'] ) { $this->output( "$table $logTitle -> " . $destTitle->getPrefixedDBkey() . " DRY RUN\n" ); continue; } $this->db->update( $table, // SET [ $namespaceField => $destTitle->getNamespace(), $titleField => $destTitle->getDBkey() ], // WHERE [ $namespaceField => 0, $titleField => $row->$titleField, $fromField => $row->$fromField ], __METHOD__, [ 'IGNORE' ] ); $this->output( "$table $logTitle -> " . $destTitle->getPrefixedDBkey() . "\n" ); } $encLastTitle = $this->db->addQuotes( $row->$titleField ); $encLastFrom = $this->db->addQuotes( $row->$fromField ); $batchConds = [ "$titleField > $encLastTitle " . "OR ($titleField = $encLastTitle AND $fromField > $encLastFrom)" ]; wfWaitForSlaves(); } } /** * Move the given pseudo-namespace, either replacing the colon with a hyphen * (useful for pseudo-namespaces that conflict with interwiki links) or move * them to another namespace if specified. * @param array $options Associative array of validated command-line options * @return bool */ private function checkPrefix( $options ) { $prefix = $options['source-pseudo-namespace']; $ns = $options['dest-namespace']; $this->output( "Checking prefix \"$prefix\" vs namespace $ns\n" ); return $this->checkNamespace( $ns, $prefix, $options ); } /** * Find pages in main and talk namespaces that have a prefix of the new * namespace so we know titles that will need migrating * * @param int $ns Destination namespace id * @param string $name Prefix that is being made a namespace * @param array $options Associative array of validated command-line options * * @return ResultWrapper */ private function getTargetList( $ns, $name, $options ) { if ( $options['move-talk'] && MWNamespace::isSubject( $ns ) ) { $checkNamespaces = [ NS_MAIN, NS_TALK ]; } else { $checkNamespaces = NS_MAIN; } return $this->db->select( 'page', [ 'page_id', 'page_title', 'page_namespace', ], [ 'page_namespace' => $checkNamespaces, 'page_title' . $this->db->buildLike( "$name:", $this->db->anyString() ), ], __METHOD__ ); } /** * Get the preferred destination title for a given target page. * @param integer $ns The destination namespace ID * @param string $name The conflicting prefix * @param integer $sourceNs The source namespace * @param integer $sourceDbk The source DB key (i.e. page_title) * @param array $options Associative array of validated command-line options * @return Title|false */ private function getDestinationTitle( $ns, $name, $sourceNs, $sourceDbk, $options ) { $dbk = substr( $sourceDbk, strlen( "$name:" ) ); if ( $ns == 0 ) { // An interwiki; try an alternate encoding with '-' for ':' $dbk = "$name-" . $dbk; } $destNS = $ns; if ( $sourceNs == NS_TALK && MWNamespace::isSubject( $ns ) ) { // This is an associated talk page moved with the --move-talk feature. $destNS = MWNamespace::getTalk( $destNS ); } $newTitle = Title::makeTitleSafe( $destNS, $dbk ); if ( !$newTitle || !$newTitle->canExist() ) { return false; } return $newTitle; } /** * Get an alternative title to move a page to. This is used if the * preferred destination title already exists. * * @param LinkTarget $linkTarget * @param array $options Associative array of validated command-line options * @return Title|bool */ private function getAlternateTitle( LinkTarget $linkTarget, $options ) { $prefix = $options['add-prefix']; $suffix = $options['add-suffix']; if ( $prefix == '' && $suffix == '' ) { return false; } while ( true ) { $dbk = $prefix . $linkTarget->getDBkey() . $suffix; $title = Title::makeTitleSafe( $linkTarget->getNamespace(), $dbk ); if ( !$title ) { return false; } if ( !$title->exists() ) { return $title; } } } /** * Move a page * * @param integer $id The page_id * @param LinkTarget $newLinkTarget The new title link target * @return bool */ private function movePage( $id, LinkTarget $newLinkTarget ) { $this->db->update( 'page', [ "page_namespace" => $newLinkTarget->getNamespace(), "page_title" => $newLinkTarget->getDBkey(), ], [ "page_id" => $id, ], __METHOD__ ); // Update *_from_namespace in links tables $fromNamespaceTables = [ [ 'pagelinks', 'pl' ], [ 'templatelinks', 'tl' ], [ 'imagelinks', 'il' ] ]; foreach ( $fromNamespaceTables as $tableInfo ) { list( $table, $fieldPrefix ) = $tableInfo; $this->db->update( $table, // SET [ "{$fieldPrefix}_from_namespace" => $newLinkTarget->getNamespace() ], // WHERE [ "{$fieldPrefix}_from" => $id ], __METHOD__ ); } return true; } /** * Determine if we can merge a page. * We check if an inaccessible revision would become the latest and * deny the merge if so -- it's theoretically possible to update the * latest revision, but opens a can of worms -- search engine updates, * recentchanges review, etc. * * @param integer $id The page_id * @param LinkTarget $linkTarget The new link target * @param string $logStatus This is set to the log status message on failure * @return bool */ private function canMerge( $id, LinkTarget $linkTarget, &$logStatus ) { $latestDest = Revision::newFromTitle( $linkTarget, 0, Revision::READ_LATEST ); $latestSource = Revision::newFromPageId( $id, 0, Revision::READ_LATEST ); if ( $latestSource->getTimestamp() > $latestDest->getTimestamp() ) { $logStatus = 'cannot merge since source is later'; return false; } else { return true; } } /** * Merge page histories * * @param integer $id The page_id * @param Title $newTitle The new title * @return bool */ private function mergePage( $row, Title $newTitle ) { $id = $row->page_id; // Construct the WikiPage object we will need later, while the // page_id still exists. Note that this cannot use makeTitleSafe(), // we are deliberately constructing an invalid title. $sourceTitle = Title::makeTitle( $row->page_namespace, $row->page_title ); $sourceTitle->resetArticleID( $id ); $wikiPage = new WikiPage( $sourceTitle ); $wikiPage->loadPageData( 'fromdbmaster' ); $destId = $newTitle->getArticleID(); $this->beginTransaction( $this->db, __METHOD__ ); $this->db->update( 'revision', // SET [ 'rev_page' => $destId ], // WHERE [ 'rev_page' => $id ], __METHOD__ ); $this->db->delete( 'page', [ 'page_id' => $id ], __METHOD__ ); $this->commitTransaction( $this->db, __METHOD__ ); /* Call LinksDeletionUpdate to delete outgoing links from the old title, * and update category counts. * * Calling external code with a fake broken Title is a fairly dubious * idea. It's necessary because it's quite a lot of code to duplicate, * but that also makes it fragile since it would be easy for someone to * accidentally introduce an assumption of title validity to the code we * are calling. */ DeferredUpdates::addUpdate( new LinksDeletionUpdate( $wikiPage ) ); DeferredUpdates::doUpdates(); return true; } } $maintClass = "NamespaceConflictChecker"; require_once RUN_MAINTENANCE_IF_MAIN;