summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
committerPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
commit9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch)
tree46d1a0dee7febef5c2d57a9f7b972be16a163b3d /includes
parent78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff)
update to MediaWiki 1.17.0
Diffstat (limited to 'includes')
-rw-r--r--includes/AjaxDispatcher.php60
-rw-r--r--includes/AjaxFunctions.php85
-rw-r--r--includes/AjaxResponse.php19
-rw-r--r--includes/Article.php1138
-rw-r--r--includes/AuthPlugin.php60
-rw-r--r--includes/AutoLoader.php283
-rw-r--r--includes/Autopromote.php69
-rw-r--r--includes/BacklinkCache.php24
-rw-r--r--includes/BagOStuff.php239
-rw-r--r--includes/Block.php66
-rw-r--r--includes/CacheDependency.php17
-rw-r--r--includes/Category.php38
-rw-r--r--includes/CategoryPage.php358
-rw-r--r--includes/Categoryfinder.php50
-rw-r--r--includes/Cdb.php9
-rw-r--r--includes/Cdb_PHP.php9
-rw-r--r--includes/ChangeTags.php14
-rw-r--r--includes/ChangesFeed.php19
-rw-r--r--includes/ChangesList.php114
-rw-r--r--includes/Collation.php307
-rw-r--r--includes/ConfEditor.php26
-rw-r--r--includes/Credits.php134
-rw-r--r--includes/DatabaseFunctions.php412
-rw-r--r--includes/DefaultSettings.php5328
-rw-r--r--includes/Defines.php135
-rw-r--r--includes/DjVuImage.php37
-rw-r--r--includes/EditPage.php468
-rw-r--r--includes/Exception.php109
-rw-r--r--includes/Exif.php16
-rw-r--r--includes/Export.php108
-rw-r--r--includes/ExternalEdit.php9
-rw-r--r--includes/ExternalStore.php13
-rw-r--r--includes/ExternalStoreDB.php35
-rw-r--r--includes/ExternalUser.php37
-rw-r--r--includes/Feed.php52
-rw-r--r--includes/FeedUtils.php16
-rw-r--r--includes/FileDeleteForm.php38
-rw-r--r--includes/FileRevertForm.php4
-rw-r--r--includes/ForkController.php2
-rw-r--r--includes/FormOptions.php40
-rw-r--r--includes/GlobalFunctions.php1271
-rw-r--r--includes/HTMLCacheUpdate.php1
-rw-r--r--includes/HTMLFileCache.php41
-rw-r--r--includes/HTMLForm.php745
-rw-r--r--includes/HistoryBlob.php41
-rw-r--r--includes/HistoryPage.php238
-rw-r--r--includes/Hooks.php60
-rw-r--r--includes/Html.php188
-rw-r--r--includes/HttpFunctions.old.php12
-rw-r--r--includes/HttpFunctions.php519
-rw-r--r--includes/IP.php676
-rw-r--r--includes/ImageFunctions.php105
-rw-r--r--includes/ImageGallery.php115
-rw-r--r--includes/ImagePage.php435
-rw-r--r--includes/Import.php1431
-rw-r--r--includes/Interwiki.php48
-rw-r--r--includes/JSMin.php290
-rw-r--r--includes/Licenses.php14
-rw-r--r--includes/LinkBatch.php87
-rw-r--r--includes/LinkCache.php46
-rw-r--r--includes/Linker.php797
-rw-r--r--includes/LinksUpdate.php164
-rw-r--r--includes/LocalisationCache.php33
-rw-r--r--includes/LogEventsList.php343
-rw-r--r--includes/LogPage.php251
-rw-r--r--includes/MacBinary.php25
-rw-r--r--includes/MagicWord.php37
-rw-r--r--includes/Math.php27
-rw-r--r--includes/MemcachedSessions.php43
-rw-r--r--includes/Message.php360
-rw-r--r--includes/MessageBlobStore.php370
-rw-r--r--includes/MessageCache.php219
-rw-r--r--includes/Metadata.php30
-rw-r--r--includes/MimeMagic.php238
-rw-r--r--includes/Namespace.php56
-rw-r--r--includes/NamespaceCompat.php9
-rw-r--r--includes/ObjectCache.php4
-rw-r--r--includes/OutputHandler.php5
-rw-r--r--includes/OutputPage.php883
-rw-r--r--includes/PageQueryPage.php7
-rw-r--r--includes/Pager.php150
-rw-r--r--includes/PoolCounter.php203
-rw-r--r--includes/Preferences.php1430
-rw-r--r--includes/PrefixSearch.php27
-rw-r--r--includes/Profiler.php43
-rw-r--r--includes/ProfilerSimple.php6
-rw-r--r--includes/ProfilerSimpleText.php24
-rw-r--r--includes/ProfilerSimpleTrace.php30
-rw-r--r--includes/ProfilerStub.php10
-rw-r--r--includes/ProtectionForm.php65
-rw-r--r--includes/ProxyTools.php16
-rw-r--r--includes/QueryPage.php43
-rw-r--r--includes/RawPage.php96
-rw-r--r--includes/RecentChange.php25
-rw-r--r--includes/Revision.php12
-rw-r--r--includes/Sanitizer.php96
-rw-r--r--includes/SeleniumWebSettings.php72
-rw-r--r--includes/Setup.php83
-rw-r--r--includes/SiteConfiguration.php10
-rw-r--r--includes/SiteStats.php116
-rw-r--r--includes/Skin.php878
-rw-r--r--includes/SkinTemplate.php223
-rw-r--r--includes/SpecialPage.php237
-rw-r--r--includes/SquidPurgeClient.php6
-rw-r--r--includes/SquidUpdate.php7
-rw-r--r--includes/Status.php154
-rw-r--r--includes/StreamFile.php14
-rw-r--r--includes/StringUtils.php29
-rw-r--r--includes/StubObject.php65
-rw-r--r--includes/Title.php1904
-rw-r--r--includes/User.php532
-rw-r--r--includes/UserMailer.php249
-rw-r--r--includes/UserRightsProxy.php56
-rw-r--r--includes/WatchedItem.php7
-rw-r--r--includes/WatchlistEditor.php63
-rw-r--r--includes/WebRequest.php525
-rw-r--r--includes/WebResponse.php6
-rw-r--r--includes/WebStart.php64
-rw-r--r--includes/Wiki.php157
-rw-r--r--includes/WikiError.php16
-rw-r--r--includes/WikiMap.php11
-rw-r--r--includes/Xml.php181
-rw-r--r--includes/XmlFunctions.php86
-rw-r--r--includes/ZhClient.php20
-rw-r--r--includes/ZhConversion.php1311
-rw-r--r--includes/api/ApiBase.php275
-rw-r--r--includes/api/ApiBlock.php38
-rw-r--r--includes/api/ApiDelete.php81
-rw-r--r--includes/api/ApiDisabled.php14
-rw-r--r--includes/api/ApiEditPage.php293
-rw-r--r--includes/api/ApiEmailUser.php111
-rw-r--r--includes/api/ApiExpandTemplates.php39
-rw-r--r--includes/api/ApiFeedWatchlist.php104
-rw-r--r--includes/api/ApiFormatBase.php85
-rw-r--r--includes/api/ApiFormatDbg.php22
-rw-r--r--includes/api/ApiFormatDump.php64
-rw-r--r--includes/api/ApiFormatJson.php44
-rw-r--r--includes/api/ApiFormatPhp.php22
-rw-r--r--includes/api/ApiFormatRaw.php39
-rw-r--r--includes/api/ApiFormatTxt.php22
-rw-r--r--includes/api/ApiFormatWddx.php47
-rw-r--r--includes/api/ApiFormatXml.php115
-rw-r--r--includes/api/ApiFormatYaml.php24
-rw-r--r--includes/api/ApiHelp.php115
-rw-r--r--includes/api/ApiImport.php115
-rw-r--r--includes/api/ApiLogin.php24
-rw-r--r--includes/api/ApiLogout.php29
-rw-r--r--includes/api/ApiMain.php422
-rw-r--r--includes/api/ApiMove.php158
-rw-r--r--includes/api/ApiOpenSearch.php74
-rw-r--r--includes/api/ApiPageSet.php239
-rw-r--r--includes/api/ApiParamInfo.php148
-rw-r--r--includes/api/ApiParse.php445
-rw-r--r--includes/api/ApiPatrol.php58
-rw-r--r--includes/api/ApiProtect.php141
-rw-r--r--includes/api/ApiPurge.php57
-rw-r--r--includes/api/ApiQuery.php329
-rw-r--r--includes/api/ApiQueryAllCategories.php91
-rw-r--r--includes/api/ApiQueryAllLinks.php148
-rw-r--r--includes/api/ApiQueryAllUsers.php141
-rw-r--r--includes/api/ApiQueryAllimages.php107
-rw-r--r--includes/api/ApiQueryAllmessages.php81
-rw-r--r--includes/api/ApiQueryAllpages.php158
-rw-r--r--includes/api/ApiQueryBacklinks.php268
-rw-r--r--includes/api/ApiQueryBase.php185
-rw-r--r--includes/api/ApiQueryBlocks.php221
-rw-r--r--includes/api/ApiQueryCategories.php139
-rw-r--r--includes/api/ApiQueryCategoryInfo.php42
-rw-r--r--includes/api/ApiQueryCategoryMembers.php312
-rw-r--r--includes/api/ApiQueryDeletedrevs.php210
-rw-r--r--includes/api/ApiQueryDisabled.php27
-rw-r--r--includes/api/ApiQueryDuplicateFiles.php83
-rw-r--r--includes/api/ApiQueryExtLinksUsage.php117
-rw-r--r--includes/api/ApiQueryExternalLinks.php65
-rw-r--r--includes/api/ApiQueryFilearchive.php264
-rw-r--r--includes/api/ApiQueryIWBacklinks.php217
-rw-r--r--includes/api/ApiQueryIWLinks.php158
-rw-r--r--includes/api/ApiQueryImageInfo.php379
-rw-r--r--includes/api/ApiQueryImages.php92
-rw-r--r--includes/api/ApiQueryInfo.php355
-rw-r--r--includes/api/ApiQueryLangLinks.php89
-rw-r--r--includes/api/ApiQueryLinks.php159
-rw-r--r--includes/api/ApiQueryLogEvents.php221
-rw-r--r--includes/api/ApiQueryPageProps.php150
-rw-r--r--includes/api/ApiQueryProtectedTitles.php123
-rw-r--r--includes/api/ApiQueryRandom.php77
-rw-r--r--includes/api/ApiQueryRecentChanges.php382
-rw-r--r--includes/api/ApiQueryRevisions.php376
-rw-r--r--includes/api/ApiQuerySearch.php166
-rw-r--r--includes/api/ApiQuerySiteinfo.php191
-rw-r--r--includes/api/ApiQueryStashImageInfo.php152
-rw-r--r--includes/api/ApiQueryTags.php141
-rw-r--r--includes/api/ApiQueryUserContributions.php260
-rw-r--r--includes/api/ApiQueryUserInfo.php113
-rw-r--r--includes/api/ApiQueryUsers.php190
-rw-r--r--includes/api/ApiQueryWatchlist.php269
-rw-r--r--includes/api/ApiQueryWatchlistRaw.php135
-rw-r--r--includes/api/ApiResult.php171
-rw-r--r--includes/api/ApiRollback.php146
-rw-r--r--includes/api/ApiRsd.php180
-rw-r--r--includes/api/ApiUnblock.php67
-rw-r--r--includes/api/ApiUndelete.php86
-rw-r--r--includes/api/ApiUpload.php455
-rw-r--r--includes/api/ApiUserrights.php92
-rw-r--r--includes/api/ApiWatch.php55
-rw-r--r--includes/db/Database.php1654
-rw-r--r--includes/db/DatabaseIbm_db2.php1341
-rw-r--r--includes/db/DatabaseMssql.php1684
-rw-r--r--includes/db/DatabaseMysql.php240
-rw-r--r--includes/db/DatabaseOracle.php664
-rw-r--r--includes/db/DatabasePostgres.php922
-rw-r--r--includes/db/DatabaseSqlite.php247
-rw-r--r--includes/db/LBFactory.php76
-rw-r--r--includes/db/LBFactory_Multi.php6
-rw-r--r--includes/db/LBFactory_Single.php57
-rw-r--r--includes/db/LoadBalancer.php123
-rw-r--r--includes/db/LoadMonitor.php22
-rw-r--r--includes/diff/DifferenceEngine.php2002
-rw-r--r--includes/diff/DifferenceInterface.php1024
-rw-r--r--includes/diff/WikiDiff.php1241
-rw-r--r--includes/diff/WikiDiff3.php (renamed from includes/diff/Diff.php)322
-rw-r--r--includes/extauth/Hardcoded.php39
-rw-r--r--includes/extauth/MediaWiki.php56
-rw-r--r--includes/extauth/vB.php47
-rw-r--r--includes/filerepo/ArchivedFile.php18
-rw-r--r--includes/filerepo/FSRepo.php30
-rw-r--r--includes/filerepo/File.php128
-rw-r--r--includes/filerepo/FileRepo.php173
-rw-r--r--includes/filerepo/FileRepoStatus.php6
-rw-r--r--includes/filerepo/ForeignAPIFile.php83
-rw-r--r--includes/filerepo/ForeignAPIRepo.php258
-rw-r--r--includes/filerepo/ForeignDBFile.php8
-rw-r--r--includes/filerepo/ForeignDBRepo.php23
-rw-r--r--includes/filerepo/ForeignDBViaLBRepo.php7
-rw-r--r--includes/filerepo/Image.php16
-rw-r--r--includes/filerepo/LocalFile.php409
-rw-r--r--includes/filerepo/LocalRepo.php20
-rw-r--r--includes/filerepo/NullRepo.php6
-rw-r--r--includes/filerepo/OldLocalFile.php29
-rw-r--r--includes/filerepo/RepoGroup.php31
-rw-r--r--includes/filerepo/UnregisteredLocalFile.php8
-rw-r--r--includes/installer/CliInstaller.php171
-rw-r--r--includes/installer/DatabaseInstaller.php580
-rw-r--r--includes/installer/DatabaseUpdater.php574
-rw-r--r--includes/installer/Installer.i18n.php12267
-rw-r--r--includes/installer/Installer.php1511
-rw-r--r--includes/installer/LocalSettingsGenerator.php349
-rw-r--r--includes/installer/MysqlInstaller.php589
-rw-r--r--includes/installer/MysqlUpdater.php832
-rw-r--r--includes/installer/OracleInstaller.php279
-rw-r--r--includes/installer/OracleUpdater.php114
-rw-r--r--includes/installer/PhpBugTests.php72
-rw-r--r--includes/installer/PostgresInstaller.php601
-rw-r--r--includes/installer/PostgresUpdater.php628
-rw-r--r--includes/installer/SqliteInstaller.php190
-rw-r--r--includes/installer/SqliteUpdater.php84
-rw-r--r--includes/installer/WebInstaller.php1034
-rw-r--r--includes/installer/WebInstallerOutput.php269
-rw-r--r--includes/installer/WebInstallerPage.php1238
-rw-r--r--includes/job/DoubleRedirectJob.php (renamed from includes/DoubleRedirectJob.php)6
-rw-r--r--includes/job/EmaillingJob.php (renamed from includes/EmaillingJob.php)9
-rw-r--r--includes/job/EnotifNotifyJob.php (renamed from includes/EnotifNotifyJob.php)6
-rw-r--r--includes/job/JobQueue.php (renamed from includes/JobQueue.php)52
-rw-r--r--includes/job/RefreshLinksJob.php (renamed from includes/RefreshLinksJob.php)8
-rw-r--r--includes/job/UploadFromUrlJob.php153
-rw-r--r--includes/json/FormatJson.php54
-rw-r--r--includes/json/Services_JSON.php48
-rw-r--r--includes/libs/CSSJanus.php323
-rw-r--r--includes/libs/CSSMin.php214
-rw-r--r--includes/libs/IEContentAnalyzer.php (renamed from includes/IEContentAnalyzer.php)16
-rw-r--r--includes/libs/IEUrlExtension.php247
-rw-r--r--includes/libs/JavaScriptMinifier.php579
-rw-r--r--includes/libs/README4
-rw-r--r--includes/libs/spyc.php (renamed from includes/api/ApiFormatYaml_spyc.php)64
-rw-r--r--includes/media/BMP.php4
-rw-r--r--includes/media/Bitmap.php533
-rw-r--r--includes/media/Bitmap_ClientOnly.php14
-rw-r--r--includes/media/DjVu.php7
-rw-r--r--includes/media/GIF.php43
-rw-r--r--includes/media/GIFMetadataExtractor.php21
-rw-r--r--includes/media/Generic.php51
-rw-r--r--includes/media/MediaTransformOutput.php (renamed from includes/MediaTransformOutput.php)36
-rw-r--r--includes/media/PNG.php82
-rw-r--r--includes/media/PNGMetadataExtractor.php104
-rw-r--r--includes/media/SVG.php121
-rw-r--r--includes/media/SVGMetadataExtractor.php313
-rw-r--r--includes/media/Tiff.php6
-rw-r--r--includes/memcached-client.php277
-rw-r--r--includes/mime.info30
-rw-r--r--includes/mime.types46
-rw-r--r--includes/normal/CleanUpTest.php53
-rw-r--r--includes/normal/RandomTest.php38
-rw-r--r--includes/normal/Utf8Case.php11
-rw-r--r--includes/normal/Utf8CaseGenerate.php53
-rw-r--r--includes/normal/Utf8Test.php53
-rw-r--r--includes/normal/UtfNormal.php162
-rw-r--r--includes/normal/UtfNormalBench.php42
-rw-r--r--includes/normal/UtfNormalData.inc13
-rw-r--r--includes/normal/UtfNormalDataK.inc7
-rw-r--r--includes/normal/UtfNormalDefines.php6
-rw-r--r--includes/normal/UtfNormalGenerate.php60
-rw-r--r--includes/normal/UtfNormalTest.php54
-rw-r--r--includes/normal/UtfNormalTest2.php239
-rw-r--r--includes/normal/UtfNormalUtil.php39
-rw-r--r--includes/parser/CoreLinkFunctions.php5
-rw-r--r--includes/parser/CoreParserFunctions.php64
-rw-r--r--includes/parser/CoreTagHooks.php11
-rw-r--r--includes/parser/DateFormatter.php10
-rw-r--r--includes/parser/LinkHolderArray.php108
-rw-r--r--includes/parser/Parser.php2105
-rw-r--r--includes/parser/ParserCache.php172
-rw-r--r--includes/parser/ParserOptions.php185
-rw-r--r--includes/parser/ParserOutput.php178
-rw-r--r--includes/parser/Parser_DiffTest.php16
-rw-r--r--includes/parser/Parser_LinkHooks.php26
-rw-r--r--includes/parser/Preprocessor.php8
-rw-r--r--includes/parser/Preprocessor_DOM.php90
-rw-r--r--includes/parser/Preprocessor_Hash.php72
-rw-r--r--includes/parser/Tidy.php28
-rw-r--r--includes/proxy_check.php2
-rw-r--r--includes/resourceloader/ResourceLoader.php740
-rw-r--r--includes/resourceloader/ResourceLoaderContext.php176
-rw-r--r--includes/resourceloader/ResourceLoaderFileModule.php509
-rw-r--r--includes/resourceloader/ResourceLoaderModule.php239
-rw-r--r--includes/resourceloader/ResourceLoaderSiteModule.php63
-rw-r--r--includes/resourceloader/ResourceLoaderStartUpModule.php225
-rw-r--r--includes/resourceloader/ResourceLoaderUserModule.php50
-rw-r--r--includes/resourceloader/ResourceLoaderUserOptionsModule.php121
-rw-r--r--includes/resourceloader/ResourceLoaderWikiModule.php171
-rw-r--r--includes/revisiondelete/RevisionDelete.php690
-rw-r--r--includes/revisiondelete/RevisionDeleteAbstracts.php454
-rw-r--r--includes/revisiondelete/RevisionDeleter.php270
-rw-r--r--includes/search/SearchEngine.php761
-rw-r--r--includes/search/SearchIBM_DB2.php53
-rw-r--r--includes/search/SearchMssql.php254
-rw-r--r--includes/search/SearchMySQL.php52
-rw-r--r--includes/search/SearchMySQL4.php34
-rw-r--r--includes/search/SearchOracle.php62
-rw-r--r--includes/search/SearchPostgres.php64
-rw-r--r--includes/search/SearchSqlite.php82
-rw-r--r--includes/search/SearchUpdate.php31
-rw-r--r--includes/specials/SpecialActiveusers.php90
-rw-r--r--includes/specials/SpecialAllmessages.php84
-rw-r--r--includes/specials/SpecialAllpages.php66
-rw-r--r--includes/specials/SpecialAncientpages.php38
-rw-r--r--includes/specials/SpecialBlankpage.php22
-rw-r--r--includes/specials/SpecialBlockip.php195
-rw-r--r--includes/specials/SpecialBlockme.php66
-rw-r--r--includes/specials/SpecialBooksources.php31
-rw-r--r--includes/specials/SpecialBrokenRedirects.php22
-rw-r--r--includes/specials/SpecialCategories.php68
-rw-r--r--includes/specials/SpecialComparePages.php170
-rw-r--r--includes/specials/SpecialConfirmemail.php46
-rw-r--r--includes/specials/SpecialContributions.php231
-rw-r--r--includes/specials/SpecialDeadendpages.php19
-rw-r--r--includes/specials/SpecialDeletedContributions.php32
-rw-r--r--includes/specials/SpecialDisambiguations.php33
-rw-r--r--includes/specials/SpecialDoubleRedirects.php21
-rw-r--r--includes/specials/SpecialEmailuser.php514
-rw-r--r--includes/specials/SpecialExport.php267
-rw-r--r--includes/specials/SpecialFewestrevisions.php17
-rw-r--r--includes/specials/SpecialFileDuplicateSearch.php28
-rw-r--r--includes/specials/SpecialFilepath.php94
-rw-r--r--includes/specials/SpecialImport.php89
-rw-r--r--includes/specials/SpecialIpblocklist.php275
-rw-r--r--includes/specials/SpecialLinkSearch.php41
-rw-r--r--includes/specials/SpecialListfiles.php123
-rw-r--r--includes/specials/SpecialListgrouprights.php62
-rw-r--r--includes/specials/SpecialListredirects.php26
-rw-r--r--includes/specials/SpecialListusers.php69
-rw-r--r--includes/specials/SpecialLockdb.php140
-rw-r--r--includes/specials/SpecialLog.php185
-rw-r--r--includes/specials/SpecialLonelypages.php18
-rw-r--r--includes/specials/SpecialLongpages.php17
-rw-r--r--includes/specials/SpecialMIMEsearch.php24
-rw-r--r--includes/specials/SpecialMergeHistory.php90
-rw-r--r--includes/specials/SpecialMostcategories.php25
-rw-r--r--includes/specials/SpecialMostimages.php27
-rw-r--r--includes/specials/SpecialMostlinked.php31
-rw-r--r--includes/specials/SpecialMostlinkedcategories.php27
-rw-r--r--includes/specials/SpecialMostlinkedtemplates.php25
-rw-r--r--includes/specials/SpecialMostrevisions.php25
-rw-r--r--includes/specials/SpecialMovepage.php181
-rw-r--r--includes/specials/SpecialNewimages.php42
-rw-r--r--includes/specials/SpecialNewpages.php100
-rw-r--r--includes/specials/SpecialPopularpages.php20
-rw-r--r--includes/specials/SpecialPreferences.php37
-rw-r--r--includes/specials/SpecialPrefixindex.php54
-rw-r--r--includes/specials/SpecialProtectedpages.php94
-rw-r--r--includes/specials/SpecialProtectedtitles.php71
-rw-r--r--includes/specials/SpecialRandompage.php30
-rw-r--r--includes/specials/SpecialRandomredirect.php24
-rw-r--r--includes/specials/SpecialRecentchanges.php113
-rw-r--r--includes/specials/SpecialRecentchangeslinked.php43
-rw-r--r--includes/specials/SpecialRemoveRestrictions.php60
-rw-r--r--includes/specials/SpecialResetpass.php39
-rw-r--r--includes/specials/SpecialRevisiondelete.php1283
-rw-r--r--includes/specials/SpecialSearch.php185
-rw-r--r--includes/specials/SpecialShortpages.php28
-rw-r--r--includes/specials/SpecialSpecialpages.php166
-rw-r--r--includes/specials/SpecialStatistics.php92
-rw-r--r--includes/specials/SpecialTags.php38
-rw-r--r--includes/specials/SpecialUncategorizedcategories.php22
-rw-r--r--includes/specials/SpecialUncategorizedimages.php19
-rw-r--r--includes/specials/SpecialUncategorizedpages.php18
-rw-r--r--includes/specials/SpecialUncategorizedtemplates.php19
-rw-r--r--includes/specials/SpecialUndelete.php253
-rw-r--r--includes/specials/SpecialUnlockdb.php127
-rw-r--r--includes/specials/SpecialUnusedcategories.php17
-rw-r--r--includes/specials/SpecialUnusedimages.php37
-rw-r--r--includes/specials/SpecialUnusedtemplates.php26
-rw-r--r--includes/specials/SpecialUnwatchedpages.php24
-rw-r--r--includes/specials/SpecialUpload.php422
-rw-r--r--includes/specials/SpecialUploadStash.php394
-rw-r--r--includes/specials/SpecialUserlogin.php256
-rw-r--r--includes/specials/SpecialUserlogout.php72
-rw-r--r--includes/specials/SpecialUserrights.php107
-rw-r--r--includes/specials/SpecialVersion.php353
-rw-r--r--includes/specials/SpecialWantedcategories.php23
-rw-r--r--includes/specials/SpecialWantedfiles.php44
-rw-r--r--includes/specials/SpecialWantedpages.php22
-rw-r--r--includes/specials/SpecialWantedtemplates.php30
-rw-r--r--includes/specials/SpecialWatchlist.php108
-rw-r--r--includes/specials/SpecialWhatlinkshere.php48
-rw-r--r--includes/specials/SpecialWithoutinterwiki.php23
-rw-r--r--includes/templates/NoLocalSettings.php48
-rw-r--r--includes/templates/PHP4.php6
-rw-r--r--includes/templates/Userlogin.php81
-rw-r--r--includes/upload/UploadBase.php372
-rw-r--r--includes/upload/UploadFromFile.php61
-rw-r--r--includes/upload/UploadFromStash.php17
-rw-r--r--includes/upload/UploadFromUrl.php221
-rw-r--r--includes/upload/UploadStash.php397
-rw-r--r--includes/zhtable/Makefile.py596
-rw-r--r--includes/zhtable/simp2trad.manual7
-rw-r--r--includes/zhtable/simpphrases.manual11
-rw-r--r--includes/zhtable/simpphrases_exclude.manual3
-rw-r--r--includes/zhtable/toCN.manual3
-rw-r--r--includes/zhtable/toHK.manual1
-rw-r--r--includes/zhtable/toSimp.manual20
-rw-r--r--includes/zhtable/toTW.manual4
-rw-r--r--includes/zhtable/toTrad.manual42
-rw-r--r--includes/zhtable/trad2simp.manual3
-rw-r--r--includes/zhtable/tradphrases.manual376
-rw-r--r--includes/zhtable/tradphrases_exclude.manual9
445 files changed, 70793 insertions, 28724 deletions
diff --git a/includes/AjaxDispatcher.php b/includes/AjaxDispatcher.php
index 5bd7cfa4..e36787fd 100644
--- a/includes/AjaxDispatcher.php
+++ b/includes/AjaxDispatcher.php
@@ -42,31 +42,27 @@ class AjaxDispatcher {
}
switch( $this->mode ) {
-
- case 'get':
- $this->func_name = isset( $_GET["rs"] ) ? $_GET["rs"] : '';
- if ( ! empty( $_GET["rsargs"] ) ) {
- $this->args = $_GET["rsargs"];
- } else {
- $this->args = array();
- }
- break;
-
- case 'post':
- $this->func_name = isset( $_POST["rs"] ) ? $_POST["rs"] : '';
- if ( ! empty( $_POST["rsargs"] ) ) {
- $this->args = $_POST["rsargs"];
- } else {
- $this->args = array();
- }
- break;
-
- default:
- wfProfileOut( __METHOD__ );
- return;
- # Or we could throw an exception:
- # throw new MWException( __METHOD__ . ' called without any data (mode empty).' );
-
+ case 'get':
+ $this->func_name = isset( $_GET["rs"] ) ? $_GET["rs"] : '';
+ if ( ! empty( $_GET["rsargs"] ) ) {
+ $this->args = $_GET["rsargs"];
+ } else {
+ $this->args = array();
+ }
+ break;
+ case 'post':
+ $this->func_name = isset( $_POST["rs"] ) ? $_POST["rs"] : '';
+ if ( ! empty( $_POST["rsargs"] ) ) {
+ $this->args = $_POST["rsargs"];
+ } else {
+ $this->args = array();
+ }
+ break;
+ default:
+ wfProfileOut( __METHOD__ );
+ return;
+ # Or we could throw an exception:
+ # throw new MWException( __METHOD__ . ' called without any data (mode empty).' );
}
wfProfileOut( __METHOD__ );
@@ -89,8 +85,11 @@ class AjaxDispatcher {
if ( ! in_array( $this->func_name, $wgAjaxExportList ) ) {
wfDebug( __METHOD__ . ' Bad Request for unknown function ' . $this->func_name . "\n" );
- wfHttpError( 400, 'Bad Request',
- "unknown function " . (string) $this->func_name );
+ wfHttpError(
+ 400,
+ 'Bad Request',
+ "unknown function " . (string) $this->func_name
+ );
} else {
wfDebug( __METHOD__ . ' dispatching ' . $this->func_name . "\n" );
@@ -99,6 +98,7 @@ class AjaxDispatcher {
} else {
$func = $this->func_name;
}
+
try {
$result = call_user_func_array( $func, $this->args );
@@ -109,8 +109,7 @@ class AjaxDispatcher {
wfHttpError( 500, 'Internal Error',
"{$this->func_name} returned no data" );
- }
- else {
+ } else {
if ( is_string( $result ) ) {
$result = new AjaxResponse( $result );
}
@@ -120,7 +119,6 @@ class AjaxDispatcher {
wfDebug( __METHOD__ . ' dispatch complete for ' . $this->func_name . "\n" );
}
-
} catch ( Exception $e ) {
wfDebug( __METHOD__ . ' ERROR while dispatching '
. $this->func_name . "(" . var_export( $this->args, true ) . "): "
@@ -135,7 +133,7 @@ class AjaxDispatcher {
}
}
- wfProfileOut( __METHOD__ );
$wgOut = null;
+ wfProfileOut( __METHOD__ );
}
}
diff --git a/includes/AjaxFunctions.php b/includes/AjaxFunctions.php
index e3180e0a..8e5de31b 100644
--- a/includes/AjaxFunctions.php
+++ b/includes/AjaxFunctions.php
@@ -1,5 +1,7 @@
<?php
/**
+ * Handler functions for Ajax requests
+ *
* @file
* @ingroup Ajax
*/
@@ -28,6 +30,7 @@ function js_unescape( $source, $iconv_to = 'UTF-8' ) {
if ( $charAt == '%' ) {
$pos++;
$charAt = substr ( $source, $pos, 1 );
+
if ( $charAt == 'u' ) {
// we got a unicode character
$pos++;
@@ -48,7 +51,7 @@ function js_unescape( $source, $iconv_to = 'UTF-8' ) {
}
if ( $iconv_to != "UTF-8" ) {
- $decodedStr = iconv( "UTF-8", $iconv_to, $decodedStr );
+ $decodedStr = iconv( "utf-8", $iconv_to, $decodedStr );
}
return $decodedStr;
@@ -62,84 +65,23 @@ function js_unescape( $source, $iconv_to = 'UTF-8' ) {
* @return utf8char
*/
function code2utf( $num ) {
- if ( $num < 128 )
+ if ( $num < 128 ) {
return chr( $num );
- if ( $num < 2048 )
- return chr( ( $num >> 6 ) + 192 ) . chr( ( $num&63 ) + 128 );
- if ( $num < 65536 )
- return chr( ( $num >> 12 ) + 224 ) . chr( ( ( $num >> 6 )&63 ) + 128 ) . chr( ( $num&63 ) + 128 );
- if ( $num < 2097152 )
- return chr( ( $num >> 18 ) + 240 ) . chr( ( ( $num >> 12 )&63 ) + 128 ) . chr( ( ( $num >> 6 )&63 ) + 128 ) . chr( ( $num&63 ) + 128 );
- return '';
-}
-
-/**
- * Called for AJAX watch/unwatch requests.
- * @param $pagename Prefixed title string for page to watch/unwatch
- * @param $watch String 'w' to watch, 'u' to unwatch
- * @return String '<w#>' or '<u#>' on successful watch or unwatch,
- * respectively, followed by an HTML message to display in the alert box; or
- * '<err#>' on error
- */
-function wfAjaxWatch( $pagename = "", $watch = "" ) {
- if ( wfReadOnly() ) {
- // redirect to action=(un)watch, which will display the database lock
- // message
- return '<err#>';
}
- if ( 'w' !== $watch && 'u' !== $watch ) {
- return '<err#>';
+ if ( $num < 2048 ) {
+ return chr( ( $num >> 6 ) + 192 ) . chr( ( $num&63 ) + 128 );
}
- $watch = 'w' === $watch;
- $title = Title::newFromDBkey( $pagename );
- if ( !$title ) {
- // Invalid title
- return '<err#>';
+ if ( $num < 65536 ) {
+ return chr( ( $num >> 12 ) + 224 ) . chr( ( ( $num >> 6 )&63 ) + 128 ) . chr( ( $num&63 ) + 128 );
}
- $article = new Article( $title );
- $watching = $title->userIsWatching();
- if ( $watch ) {
- if ( !$watching ) {
- $dbw = wfGetDB( DB_MASTER );
- $dbw->begin();
- $ok = $article->doWatch();
- $dbw->commit();
- }
- } else {
- if ( $watching ) {
- $dbw = wfGetDB( DB_MASTER );
- $dbw->begin();
- $ok = $article->doUnwatch();
- $dbw->commit();
- }
- }
- // Something stopped the change
- if ( isset( $ok ) && !$ok ) {
- return '<err#>';
- }
- if ( $watch ) {
- return '<w#>' . wfMsgExt( 'addedwatchtext', array( 'parse' ), $title->getPrefixedText() );
- } else {
- return '<u#>' . wfMsgExt( 'removedwatchtext', array( 'parse' ), $title->getPrefixedText() );
+ if ( $num < 2097152 ) {
+ return chr( ( $num >> 18 ) + 240 ) . chr( ( ( $num >> 12 )&63 ) + 128 ) . chr( ( ( $num >> 6 )&63 ) + 128 ) . chr( ( $num&63 ) + 128 );
}
-}
-
-/**
- * Called in some places (currently just extensions)
- * to get the thumbnail URL for a given file at a given resolution.
- */
-function wfAjaxGetThumbnailUrl( $file, $width, $height ) {
- $file = wfFindFile( $file );
-
- if ( !$file || !$file->exists() )
- return null;
-
- $url = $file->getThumbnail( $width, $height )->url;
- return $url;
+ return '';
}
/**
@@ -149,8 +91,9 @@ function wfAjaxGetThumbnailUrl( $file, $width, $height ) {
function wfAjaxGetFileUrl( $file ) {
$file = wfFindFile( $file );
- if ( !$file || !$file->exists() )
+ if ( !$file || !$file->exists() ) {
return null;
+ }
$url = $file->getUrl();
diff --git a/includes/AjaxResponse.php b/includes/AjaxResponse.php
index f7495666..014798f8 100644
--- a/includes/AjaxResponse.php
+++ b/includes/AjaxResponse.php
@@ -1,5 +1,7 @@
<?php
/**
+ * Response handler for Ajax requests
+ *
* @file
* @ingroup Ajax
*/
@@ -15,7 +17,6 @@ if ( !defined( 'MEDIAWIKI' ) ) {
* @ingroup Ajax
*/
class AjaxResponse {
-
/** Number of seconds to get the response cached by a proxy */
private $mCacheDuration;
@@ -99,19 +100,16 @@ class AjaxResponse {
if ( $this->mLastModified ) {
header ( "Last-Modified: " . $this->mLastModified );
- }
- else {
+ } else {
header ( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . " GMT" );
}
if ( $this->mCacheDuration ) {
-
# If squid caches are configured, tell them to cache the response,
# and tell the client to always check with the squid. Otherwise,
# tell the client to use a cached copy, without a way to purge it.
if ( $wgUseSquid ) {
-
# Expect explicite purge of the proxy cache, but require end user agents
# to revalidate against the proxy on each visit.
# Surrogate-Control controls our Squid, Cache-Control downstream caches
@@ -127,7 +125,7 @@ class AjaxResponse {
# Let the client do the caching. Cache is not purged.
header ( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $this->mCacheDuration ) . " GMT" );
- header ( "Cache-Control: s-max-age={$this->mCacheDuration},public,max-age={$this->mCacheDuration}" );
+ header ( "Cache-Control: s-maxage={$this->mCacheDuration},public,max-age={$this->mCacheDuration}" );
}
} else {
@@ -156,10 +154,12 @@ class AjaxResponse {
wfDebug( "$fname: CACHE DISABLED, NO TIMESTAMP\n" );
return;
}
+
if ( !$wgCachePages ) {
wfDebug( "$fname: CACHE DISABLED\n", false );
return;
}
+
if ( $wgUser->getOption( 'nocache' ) ) {
wfDebug( "$fname: USER DISABLED CACHE\n", false );
return;
@@ -177,6 +177,7 @@ class AjaxResponse {
$ismodsince = wfTimestamp( TS_MW, $modsinceTime ? $modsinceTime : 1 );
wfDebug( "$fname: -- client send If-Modified-Since: " . $modsince . "\n", false );
wfDebug( "$fname: -- we might send Last-Modified : $lastmod\n", false );
+
if ( ( $ismodsince >= $timestamp ) && $wgUser->validateCache( $ismodsince ) && $ismodsince >= $wgCacheEpoch ) {
ini_set( 'zlib.output_compression', 0 );
$this->setResponseCode( "304 Not Modified" );
@@ -198,7 +199,10 @@ class AjaxResponse {
function loadFromMemcached( $mckey, $touched ) {
global $wgMemc;
- if ( !$touched ) return false;
+
+ if ( !$touched ) {
+ return false;
+ }
$mcvalue = $wgMemc->get( $mckey );
if ( $mcvalue ) {
@@ -206,6 +210,7 @@ class AjaxResponse {
if ( $touched <= $mcvalue['timestamp'] ) {
wfDebug( "Got $mckey from cache\n" );
$this->mText = $mcvalue['value'];
+
return true;
} else {
wfDebug( "$mckey has expired\n" );
diff --git a/includes/Article.php b/includes/Article.php
index 5edfc10d..3e8cfd5e 100644
--- a/includes/Article.php
+++ b/includes/Article.php
@@ -11,6 +11,7 @@
* Note: edit user interface and cache support functions have been
* moved to separate EditPage and HTMLFileCache classes.
*
+ * @internal documentation reviewed 15 Mar 2010
*/
class Article {
/**@{{
@@ -33,15 +34,15 @@ class Article {
var $mRedirectTarget = null; // !< Title object if set
var $mRedirectUrl = false; // !<
var $mRevIdFetched = 0; // !<
- var $mRevision; // !<
+ var $mRevision; // !< Revision object if set
var $mTimestamp = ''; // !<
- var $mTitle; // !<
+ var $mTitle; // !< Title object
var $mTotalAdjustment = 0; // !<
var $mTouched = '19700101000000'; // !<
var $mUser = -1; // !< Not loaded
- var $mUserText = ''; // !<
- var $mParserOptions; // !<
- var $mParserOutput; // !<
+ var $mUserText = ''; // !< username from Revision if set
+ var $mParserOptions; // !< ParserOptions object
+ var $mParserOutput; // !< ParserCache object if set
/**@}}*/
/**
@@ -50,12 +51,13 @@ class Article {
* @param $oldId Integer revision ID, null to fetch from request, zero for current
*/
public function __construct( Title $title, $oldId = null ) {
+ // FIXME: does the reference play any role here?
$this->mTitle =& $title;
$this->mOldId = $oldId;
}
/**
- * Constructor from an article article
+ * Constructor from an page id
* @param $id The article ID to load
*/
public static function newFromID( $id ) {
@@ -70,7 +72,7 @@ class Article {
* from another page on the wiki.
* @param $from Title object.
*/
- public function setRedirectedFrom( $from ) {
+ public function setRedirectedFrom( Title $from ) {
$this->mRedirectedFrom = $from;
}
@@ -82,20 +84,29 @@ class Article {
* @return mixed Title object, or null if this page is not a redirect
*/
public function getRedirectTarget() {
- if ( !$this->mTitle || !$this->mTitle->isRedirect() )
+ if ( !$this->mTitle->isRedirect() ) {
return null;
- if ( !is_null( $this->mRedirectTarget ) )
+ }
+
+ if ( $this->mRedirectTarget !== null ) {
return $this->mRedirectTarget;
+ }
+
# Query the redirect table
$dbr = wfGetDB( DB_SLAVE );
$row = $dbr->selectRow( 'redirect',
- array( 'rd_namespace', 'rd_title' ),
+ array( 'rd_namespace', 'rd_title', 'rd_fragment', 'rd_interwiki' ),
array( 'rd_from' => $this->getID() ),
__METHOD__
);
- if ( $row ) {
- return $this->mRedirectTarget = Title::makeTitle( $row->rd_namespace, $row->rd_title );
+
+ // rd_fragment and rd_interwiki were added later, populate them if empty
+ if ( $row && !is_null( $row->rd_fragment ) && !is_null( $row->rd_interwiki ) ) {
+ return $this->mRedirectTarget = Title::makeTitle(
+ $row->rd_namespace, $row->rd_title,
+ $row->rd_fragment, $row->rd_interwiki );
}
+
# This page doesn't have an entry in the redirect table
return $this->mRedirectTarget = $this->insertRedirect();
}
@@ -104,43 +115,66 @@ class Article {
* Insert an entry for this page into the redirect table.
*
* Don't call this function directly unless you know what you're doing.
- * @return Title object
+ * @return Title object or null if not a redirect
*/
public function insertRedirect() {
- $retval = Title::newFromRedirect( $this->getContent() );
+ // recurse through to only get the final target
+ $retval = Title::newFromRedirectRecurse( $this->getContent() );
if ( !$retval ) {
return null;
}
+ $this->insertRedirectEntry( $retval );
+ return $retval;
+ }
+
+ /**
+ * Insert or update the redirect table entry for this page to indicate
+ * it redirects to $rt .
+ * @param $rt Title redirect target
+ */
+ public function insertRedirectEntry( $rt ) {
$dbw = wfGetDB( DB_MASTER );
$dbw->replace( 'redirect', array( 'rd_from' ),
array(
'rd_from' => $this->getID(),
- 'rd_namespace' => $retval->getNamespace(),
- 'rd_title' => $retval->getDBkey()
+ 'rd_namespace' => $rt->getNamespace(),
+ 'rd_title' => $rt->getDBkey(),
+ 'rd_fragment' => $rt->getFragment(),
+ 'rd_interwiki' => $rt->getInterwiki(),
),
__METHOD__
);
- return $retval;
}
/**
- * Get the Title object this page redirects to
+ * Get the Title object or URL this page redirects to
*
* @return mixed false, Title of in-wiki target, or string with URL
*/
public function followRedirect() {
- $text = $this->getContent();
- return $this->followRedirectText( $text );
+ return $this->getRedirectURL( $this->getRedirectTarget() );
}
/**
* Get the Title object this text redirects to
*
+ * @param $text string article content containing redirect info
* @return mixed false, Title of in-wiki target, or string with URL
+ * @deprecated
*/
public function followRedirectText( $text ) {
- $rt = Title::newFromRedirectRecurse( $text ); // recurse through to only get the final target
- # process if title object is valid and not special:userlogout
+ // recurse through to only get the final target
+ return $this->getRedirectURL( Title::newFromRedirectRecurse( $text ) );
+ }
+
+ /**
+ * Get the Title object or URL to use for a redirect. We use Title
+ * objects for same-wiki, non-special redirects and URLs for everything
+ * else.
+ * @param $rt Title Redirect target
+ * @return mixed false, Title object of local target, or string with URL
+ */
+ public function getRedirectURL( $rt ) {
if ( $rt ) {
if ( $rt->getInterwiki() != '' ) {
if ( $rt->isLocal() ) {
@@ -164,15 +198,18 @@ class Article {
return $rt->getFullURL();
}
}
+
return $rt;
}
}
+
// No or invalid redirect
return false;
}
/**
- * get the title object of the article
+ * Get the title object of the article
+ * @return Title object of this page
*/
public function getTitle() {
return $this->mTitle;
@@ -180,6 +217,7 @@ class Article {
/**
* Clear the object
+ * FIXME: shouldn't this be public?
* @private
*/
public function clear() {
@@ -204,31 +242,38 @@ class Article {
/**
* Note that getContent/loadContent do not follow redirects anymore.
* If you need to fetch redirectable content easily, try
- * the shortcut in Article::followContent()
+ * the shortcut in Article::followRedirect()
+ *
+ * This function has side effects! Do not use this function if you
+ * only want the real revision text if any.
*
* @return Return the text of this revision
*/
public function getContent() {
- global $wgUser, $wgContLang, $wgOut, $wgMessageCache;
+ global $wgUser, $wgContLang, $wgMessageCache;
+
wfProfileIn( __METHOD__ );
+
if ( $this->getID() === 0 ) {
# If this is a MediaWiki:x message, then load the messages
# and return the message value for x.
if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
# If this is a system message, get the default text.
list( $message, $lang ) = $wgMessageCache->figureMessage( $wgContLang->lcfirst( $this->mTitle->getText() ) );
- $wgMessageCache->loadAllMessages( $lang );
$text = wfMsgGetKey( $message, false, $lang, false );
+
if ( wfEmptyMsg( $message, $text ) )
$text = '';
} else {
$text = wfMsgExt( $wgUser->isLoggedIn() ? 'noarticletext' : 'noarticletextanon', 'parsemag' );
}
wfProfileOut( __METHOD__ );
+
return $text;
} else {
$this->loadContent();
wfProfileOut( __METHOD__ );
+
return $this->mContent;
}
}
@@ -243,8 +288,10 @@ class Article {
if ( $this->mContentLoaded && $this->mOldId == 0 ) {
return $this->mContent;
}
+
$rev = Revision::newFromTitle( $this->mTitle );
$text = $rev ? $rev->getRawText() : false;
+
return $text;
}
@@ -274,16 +321,25 @@ class Article {
* @return mixed string on success, false on failure
*/
public function getUndoText( Revision $undo, Revision $undoafter = null ) {
+ $currentRev = Revision::newFromTitle( $this->mTitle );
+ if ( !$currentRev ) {
+ return false; // no page
+ }
$undo_text = $undo->getText();
$undoafter_text = $undoafter->getText();
- $cur_text = $this->getContent();
+ $cur_text = $currentRev->getText();
+
if ( $cur_text == $undo_text ) {
# No use doing a merge if it's just a straight revert.
return $undoafter_text;
}
+
$undone_text = '';
- if ( !wfMerge( $undo_text, $undoafter_text, $cur_text, $undone_text ) )
+
+ if ( !wfMerge( $undo_text, $undoafter_text, $cur_text, $undone_text ) ) {
return false;
+ }
+
return $undone_text;
}
@@ -295,6 +351,7 @@ class Article {
if ( is_null( $this->mOldId ) ) {
$this->mOldId = $this->getOldIDFromRequest();
}
+
return $this->mOldId;
}
@@ -305,13 +362,16 @@ class Article {
*/
public function getOldIDFromRequest() {
global $wgRequest;
+
$this->mRedirectUrl = false;
+
$oldid = $wgRequest->getVal( 'oldid' );
+
if ( isset( $oldid ) ) {
$oldid = intval( $oldid );
if ( $wgRequest->getVal( 'direction' ) == 'next' ) {
$nextid = $this->mTitle->getNextRevisionID( $oldid );
- if ( $nextid ) {
+ if ( $nextid ) {
$oldid = $nextid;
} else {
$this->mRedirectUrl = $this->mTitle->getFullURL( 'redirect=no' );
@@ -323,9 +383,11 @@ class Article {
}
}
}
+
if ( !$oldid ) {
$oldid = 0;
}
+
return $oldid;
}
@@ -333,22 +395,24 @@ class Article {
* Load the revision (including text) into this object
*/
function loadContent() {
- if ( $this->mContentLoaded ) return;
+ if ( $this->mContentLoaded ) {
+ return;
+ }
+
wfProfileIn( __METHOD__ );
- # Query variables :P
+
$oldid = $this->getOldID();
- # Pre-fill content with error message so that if something
- # fails we'll have something telling us what we intended.
$this->mOldId = $oldid;
$this->fetchContent( $oldid );
+
wfProfileOut( __METHOD__ );
}
-
/**
* Fetch a page record with the given conditions
* @param $dbr Database object
* @param $conditions Array
+ * @return mixed Database result resource, or false on failure
*/
protected function pageData( $dbr, $conditions ) {
$fields = array(
@@ -364,20 +428,23 @@ class Article {
'page_latest',
'page_len',
);
+
wfRunHooks( 'ArticlePageDataBefore', array( &$this, &$fields ) );
- $row = $dbr->selectRow(
- 'page',
- $fields,
- $conditions,
- __METHOD__
- );
+
+ $row = $dbr->selectRow( 'page', $fields, $conditions, __METHOD__ );
+
wfRunHooks( 'ArticlePageDataAfter', array( &$this, &$row ) );
- return $row ;
+
+ return $row;
}
/**
+ * Fetch a page record matching the Title object's namespace and title
+ * using a sanitized title string
+ *
* @param $dbr Database object
* @param $title Title object
+ * @return mixed Database result resource, or false on failure
*/
public function pageDataFromTitle( $dbr, $title ) {
return $this->pageData( $dbr, array(
@@ -386,6 +453,8 @@ class Article {
}
/**
+ * Fetch a page record matching the requested ID
+ *
* @param $dbr Database
* @param $id Integer
*/
@@ -406,8 +475,9 @@ class Article {
}
$lc = LinkCache::singleton();
+
if ( $data ) {
- $lc->addGoodLinkObj( $data->page_id, $this->mTitle, $data->page_len, $data->page_is_redirect );
+ $lc->addGoodLinkObj( $data->page_id, $this->mTitle, $data->page_len, $data->page_is_redirect, $data->page_latest );
$this->mTitle->mArticleID = intval( $data->page_id );
@@ -419,20 +489,19 @@ class Article {
$this->mIsRedirect = intval( $data->page_is_redirect );
$this->mLatest = intval( $data->page_latest );
} else {
- if ( is_object( $this->mTitle ) ) {
- $lc->addBadLinkObj( $this->mTitle );
- }
+ $lc->addBadLinkObj( $this->mTitle );
$this->mTitle->mArticleID = 0;
}
- $this->mDataLoaded = true;
+ $this->mDataLoaded = true;
}
/**
* Get text of an article from database
* Does *NOT* follow redirects.
+ *
* @param $oldid Int: 0 for whatever the latest revision is
- * @return string
+ * @return mixed string containing article contents, or false if null
*/
function fetchContent( $oldid = 0 ) {
if ( $this->mContentLoaded ) {
@@ -449,28 +518,33 @@ class Article {
if ( $oldid ) {
$revision = Revision::newFromId( $oldid );
- if ( is_null( $revision ) ) {
+ if ( $revision === null ) {
wfDebug( __METHOD__ . " failed to retrieve specified revision, id $oldid\n" );
return false;
}
+
$data = $this->pageDataFromId( $dbr, $revision->getPage() );
+
if ( !$data ) {
wfDebug( __METHOD__ . " failed to get page data linked to revision id $oldid\n" );
return false;
}
+
$this->mTitle = Title::makeTitle( $data->page_namespace, $data->page_title );
$this->loadPageData( $data );
} else {
if ( !$this->mDataLoaded ) {
$data = $this->pageDataFromTitle( $dbr, $this->mTitle );
+
if ( !$data ) {
wfDebug( __METHOD__ . " failed to find page data for title " . $this->mTitle->getPrefixedText() . "\n" );
return false;
}
+
$this->loadPageData( $data );
}
$revision = Revision::newFromId( $this->mLatest );
- if ( is_null( $revision ) ) {
+ if ( $revision === null ) {
wfDebug( __METHOD__ . " failed to retrieve current page, rev_id {$this->mLatest}\n" );
return false;
}
@@ -489,7 +563,7 @@ class Article {
$this->mContentLoaded = true;
$this->mRevision =& $revision;
- wfRunHooks( 'ArticleAfterFetchContent', array( &$this, &$this->mContent ) ) ;
+ wfRunHooks( 'ArticleAfterFetchContent', array( &$this, &$this->mContent ) );
return $this->mContent;
}
@@ -498,23 +572,13 @@ class Article {
* Read/write accessor to select FOR UPDATE
*
* @param $x Mixed: FIXME
+ * @return mixed value of $x, or value stored in Article::mForUpdate
*/
public function forUpdate( $x = null ) {
return wfSetVar( $this->mForUpdate, $x );
}
/**
- * Get the database which should be used for reads
- *
- * @return Database
- * @deprecated - just call wfGetDB( DB_MASTER ) instead
- */
- function getDB() {
- wfDeprecated( __METHOD__ );
- return wfGetDB( DB_MASTER );
- }
-
- /**
* Get options for all SELECT statements
*
* @param $options Array: an optional options array which'll be appended to
@@ -529,6 +593,7 @@ class Article {
$options = 'FOR UPDATE';
}
}
+
return $options;
}
@@ -536,11 +601,7 @@ class Article {
* @return int Page ID
*/
public function getID() {
- if ( $this->mTitle ) {
- return $this->mTitle->getArticleID();
- } else {
- return 0;
- }
+ return $this->mTitle->getArticleID();
}
/**
@@ -568,6 +629,7 @@ class Article {
public function getCount() {
if ( -1 == $this->mCounter ) {
$id = $this->getID();
+
if ( $id == 0 ) {
$this->mCounter = 0;
} else {
@@ -580,11 +642,12 @@ class Article {
);
}
}
+
return $this->mCounter;
}
/**
- * Determine whether a page would be suitable for being counted as an
+ * Determine whether a page would be suitable for being counted as an
* article in the site_stats table based on the title & its content
*
* @param $text String: text to analyze
@@ -594,13 +657,14 @@ class Article {
global $wgUseCommaCount;
$token = $wgUseCommaCount ? ',' : '[[';
+
return $this->mTitle->isContentPage() && !$this->isRedirect( $text ) && in_string( $token, $text );
}
/**
* Tests if the article text represents a redirect
*
- * @param $text String: FIXME
+ * @param $text mixed string containing article contents, or boolean
* @return bool
*/
public function isRedirect( $text = false ) {
@@ -608,12 +672,14 @@ class Article {
if ( $this->mDataLoaded ) {
return $this->mIsRedirect;
}
+
// Apparently loadPageData was never called
$this->loadContent();
$titleObj = Title::newFromRedirectRecurse( $this->fetchContent() );
} else {
$titleObj = Title::newFromRedirect( $text );
}
+
return $titleObj !== null;
}
@@ -627,6 +693,7 @@ class Article {
if ( $this->getOldID() == 0 ) {
return true;
}
+
return $this->exists() && isset( $this->mRevision ) && $this->mRevision->isCurrent();
}
@@ -635,12 +702,15 @@ class Article {
* This isn't necessary for all uses, so it's only done if needed.
*/
protected function loadLastEdit() {
- if ( -1 != $this->mUser )
+ if ( -1 != $this->mUser ) {
return;
+ }
# New or non-existent articles have no user information
$id = $this->getID();
- if ( 0 == $id ) return;
+ if ( 0 == $id ) {
+ return;
+ }
$this->mLastRevision = Revision::loadFromPageId( wfGetDB( DB_MASTER ), $id );
if ( !is_null( $this->mLastRevision ) ) {
@@ -653,46 +723,71 @@ class Article {
}
}
+ /**
+ * @return string GMT timestamp of last article revision
+ **/
+
public function getTimestamp() {
// Check if the field has been filled by ParserCache::get()
if ( !$this->mTimestamp ) {
$this->loadLastEdit();
}
+
return wfTimestamp( TS_MW, $this->mTimestamp );
}
+ /**
+ * @return int user ID for the user that made the last article revision
+ */
public function getUser() {
$this->loadLastEdit();
return $this->mUser;
}
+ /**
+ * @return string username of the user that made the last article revision
+ */
public function getUserText() {
$this->loadLastEdit();
return $this->mUserText;
}
+ /**
+ * @return string Comment stored for the last article revision
+ */
public function getComment() {
$this->loadLastEdit();
return $this->mComment;
}
+ /**
+ * Returns true if last revision was marked as "minor edit"
+ *
+ * @return boolean Minor edit indicator for the last article revision.
+ */
public function getMinorEdit() {
$this->loadLastEdit();
return $this->mMinorEdit;
}
- /* Use this to fetch the rev ID used on page views */
+ /**
+ * Use this to fetch the rev ID used on page views
+ *
+ * @return int revision ID of last article revision
+ */
public function getRevIdFetched() {
$this->loadLastEdit();
return $this->mRevIdFetched;
}
/**
+ * FIXME: this does what?
* @param $limit Integer: default 0.
* @param $offset Integer: default 0.
+ * @return UserArrayFromResult object with User objects of article contributors for requested range
*/
public function getContributors( $limit = 0, $offset = 0 ) {
- # XXX: this is expensive; cache this info somewhere.
+ # FIXME: this is expensive; cache this info somewhere.
$dbr = wfGetDB( DB_SLAVE );
$revTable = $dbr->tableName( 'revision' );
@@ -701,6 +796,7 @@ class Article {
$pageId = $this->getId();
$user = $this->getUser();
+
if ( $user ) {
$excludeCond = "AND rev_user != $user";
} else {
@@ -718,8 +814,9 @@ class Article {
GROUP BY rev_user, rev_user_text
ORDER BY timestamp DESC";
- if ( $limit > 0 )
+ if ( $limit > 0 ) {
$sql = $dbr->limitResult( $sql, $limit, $offset );
+ }
$sql .= ' ' . $this->getSelectOptions();
$res = $dbr->query( $sql, __METHOD__ );
@@ -732,9 +829,8 @@ class Article {
* page of the given title.
*/
public function view() {
- global $wgUser, $wgOut, $wgRequest, $wgContLang;
- global $wgEnableParserCache, $wgStylePath, $wgParser;
- global $wgUseTrackbacks, $wgUseFileCache;
+ global $wgUser, $wgOut, $wgRequest, $wgParser;
+ global $wgUseFileCache, $wgUseETag;
wfProfileIn( __METHOD__ );
@@ -742,22 +838,26 @@ class Article {
$oldid = $this->getOldID();
$parserCache = ParserCache::singleton();
- $parserOptions = clone $this->getParserOptions();
+ $parserOptions = $this->getParserOptions();
# Render printable version, use printable version cache
if ( $wgOut->isPrintable() ) {
$parserOptions->setIsPrintable( true );
+ $parserOptions->setEditSection( false );
+ } else if ( $wgUseETag && !$this->mTitle->quickUserCan( 'edit' ) ) {
+ $parserOptions->setEditSection( false );
}
# Try client and file cache
if ( $oldid === 0 && $this->checkTouched() ) {
- global $wgUseETag;
if ( $wgUseETag ) {
$wgOut->setETag( $parserCache->getETag( $this, $parserOptions ) );
}
- # Is is client cached?
+
+ # Is it client cached?
if ( $wgOut->checkLastModified( $this->getTouched() ) ) {
wfDebug( __METHOD__ . ": done 304\n" );
wfProfileOut( __METHOD__ );
+
return;
# Try file cache
} else if ( $wgUseFileCache && $this->tryFileCache() ) {
@@ -766,17 +866,17 @@ class Article {
$wgOut->disable();
$this->viewUpdates();
wfProfileOut( __METHOD__ );
+
return;
}
}
- $sk = $wgUser->getSkin();
-
# getOldID may want us to redirect somewhere else
if ( $this->mRedirectUrl ) {
$wgOut->redirect( $this->mRedirectUrl );
wfDebug( __METHOD__ . ": redirecting due to oldid\n" );
wfProfileOut( __METHOD__ );
+
return;
}
@@ -785,20 +885,25 @@ class Article {
$wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
# If we got diff in the query, we want to see a diff page instead of the article.
- if ( !is_null( $wgRequest->getVal( 'diff' ) ) ) {
+ if ( $wgRequest->getCheck( 'diff' ) ) {
wfDebug( __METHOD__ . ": showing diff page\n" );
$this->showDiffPage();
wfProfileOut( __METHOD__ );
+
return;
}
# Allow frames by default
$wgOut->allowClickjacking();
+ if ( !$wgUseETag && !$this->mTitle->quickUserCan( 'edit' ) ) {
+ $parserOptions->setEditSection( false );
+ }
+
# Should the parser cache be used?
$useParserCache = $this->useParserCache( $oldid );
wfDebug( 'Article::view using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" );
- if ( $wgUser->getOption( 'stubthreshold' ) ) {
+ if ( $wgUser->getStubThreshold() ) {
wfIncrStats( 'pcache_miss_stub' );
}
@@ -810,16 +915,17 @@ class Article {
$pass = 0;
$outputDone = false;
$this->mParserOutput = false;
+
while ( !$outputDone && ++$pass ) {
switch( $pass ) {
case 1:
wfRunHooks( 'ArticleViewHeader', array( &$this, &$outputDone, &$useParserCache ) );
break;
-
case 2:
# Try the parser cache
if ( $useParserCache ) {
$this->mParserOutput = $parserCache->get( $this, $parserOptions );
+
if ( $this->mParserOutput !== false ) {
wfDebug( __METHOD__ . ": showing parser cache contents\n" );
$wgOut->addParserOutput( $this->mParserOutput );
@@ -830,7 +936,6 @@ class Article {
}
}
break;
-
case 3:
$text = $this->getContent();
if ( $text === false || $this->getID() == 0 ) {
@@ -853,22 +958,22 @@ class Article {
# Are we looking at an old revision
if ( $oldid && !is_null( $this->mRevision ) ) {
$this->setOldSubtitle( $oldid );
+
if ( !$this->showDeletedRevisionHeader() ) {
wfDebug( __METHOD__ . ": cannot view deleted revision\n" );
wfProfileOut( __METHOD__ );
return;
}
+
# If this "old" version is the current, then try the parser cache...
if ( $oldid === $this->getLatest() && $this->useParserCache( false ) ) {
$this->mParserOutput = $parserCache->get( $this, $parserOptions );
if ( $this->mParserOutput ) {
- wfDebug( __METHOD__ . ": showing parser cache for current rev permalink\n" );
+ wfDebug( __METHOD__ . ": showing parser cache for current rev permalink\n" );
$wgOut->addParserOutput( $this->mParserOutput );
$wgOut->setRevisionId( $this->mLatest );
- $this->showViewFooter();
- $this->viewUpdates();
- wfProfileOut( __METHOD__ );
- return;
+ $outputDone = true;
+ break;
}
}
}
@@ -882,36 +987,35 @@ class Article {
wfDebug( __METHOD__ . ": showing CSS/JS source\n" );
$this->showCssOrJsPage();
$outputDone = true;
- } else if ( $rt = Title::newFromRedirectArray( $text ) ) {
- wfDebug( __METHOD__ . ": showing redirect=no page\n" );
- # Viewing a redirect page (e.g. with parameter redirect=no)
- # Don't append the subtitle if this was an old revision
- $wgOut->addHTML( $this->viewRedirect( $rt, !$wasRedirected && $this->isCurrent() ) );
- # Parse just to get categories, displaytitle, etc.
- $this->mParserOutput = $wgParser->parse( $text, $this->mTitle, $parserOptions );
- $wgOut->addParserOutputNoText( $this->mParserOutput );
- $outputDone = true;
+ } else {
+ $rt = Title::newFromRedirectArray( $text );
+ if ( $rt ) {
+ wfDebug( __METHOD__ . ": showing redirect=no page\n" );
+ # Viewing a redirect page (e.g. with parameter redirect=no)
+ # Don't append the subtitle if this was an old revision
+ $wgOut->addHTML( $this->viewRedirect( $rt, !$wasRedirected && $this->isCurrent() ) );
+ # Parse just to get categories, displaytitle, etc.
+ $this->mParserOutput = $wgParser->parse( $text, $this->mTitle, $parserOptions );
+ $wgOut->addParserOutputNoText( $this->mParserOutput );
+ $outputDone = true;
+ }
}
break;
-
case 4:
# Run the parse, protected by a pool counter
wfDebug( __METHOD__ . ": doing uncached parse\n" );
- $key = $parserCache->getKey( $this, $parserOptions );
- $poolCounter = PoolCounter::factory( 'Article::view', $key );
- $dirtyCallback = $useParserCache ? array( $this, 'tryDirtyCache' ) : false;
- $status = $poolCounter->executeProtected( array( $this, 'doViewParse' ), $dirtyCallback );
- if ( !$status->isOK() ) {
+ $key = $parserCache->getKey( $this, $parserOptions );
+ $poolArticleView = new PoolWorkArticleView( $this, $key, $useParserCache, $parserOptions );
+
+ if ( !$poolArticleView->execute() ) {
# Connection or timeout error
- $this->showPoolError( $status );
wfProfileOut( __METHOD__ );
return;
} else {
$outputDone = true;
}
break;
-
# Should be unreachable, but just in case...
default:
break 2;
@@ -921,6 +1025,7 @@ class Article {
# Adjust the title if it was set by displaytitle, -{T|}- or language conversion
if ( $this->mParserOutput ) {
$titleText = $this->mParserOutput->getTitleText();
+
if ( strval( $titleText ) !== '' ) {
$wgOut->setPageTitle( $titleText );
}
@@ -929,6 +1034,7 @@ class Article {
# For the main page, overwrite the <title> element with the con-
# tents of 'pagetitle-view-mainpage' instead of the default (if
# that's not empty).
+ # This message always exists because it is in the i18n files
if ( $this->mTitle->equals( Title::newMainPage() )
&& ( $m = wfMsgForContent( 'pagetitle-view-mainpage' ) ) !== '' )
{
@@ -951,7 +1057,7 @@ class Article {
* Article::view() only, other callers should use the DifferenceEngine class.
*/
public function showDiffPage() {
- global $wgOut, $wgRequest, $wgUser;
+ global $wgRequest, $wgUser;
$diff = $wgRequest->getVal( 'diff' );
$rcid = $wgRequest->getVal( 'rcid' );
@@ -980,9 +1086,11 @@ class Article {
* This is hooked by SyntaxHighlight_GeSHi to do syntax highlighting of these
* page views.
*/
- public function showCssOrJsPage() {
+ protected function showCssOrJsPage() {
global $wgOut;
- $wgOut->addHTML( wfMsgExt( 'clearyourcache', 'parse' ) );
+
+ $wgOut->wrapWikiMsg( "<div id='mw-clearyourcache'>\n$1\n</div>", 'clearyourcache' );
+
// Give hooks a chance to customise the output
if ( wfRunHooks( 'ShowRawCssJs', array( $this->mContent, $this->mTitle, $wgOut ) ) ) {
// Wrap the whole lot in a <pre> and don't parse
@@ -995,52 +1103,48 @@ class Article {
}
/**
- * Get the robot policy to be used for the current action=view request.
- * @return String the policy that should be set
- * @deprecated use getRobotPolicy() instead, which returns an associative
- * array
- */
- public function getRobotPolicyForView() {
- wfDeprecated( __FUNC__ );
- $policy = $this->getRobotPolicy( 'view' );
- return $policy['index'] . ',' . $policy['follow'];
- }
-
- /**
* Get the robot policy to be used for the current view
* @param $action String the action= GET parameter
* @return Array the policy that should be set
* TODO: actions other than 'view'
*/
public function getRobotPolicy( $action ) {
-
global $wgOut, $wgArticleRobotPolicies, $wgNamespaceRobotPolicies;
global $wgDefaultRobotPolicy, $wgRequest;
$ns = $this->mTitle->getNamespace();
+
if ( $ns == NS_USER || $ns == NS_USER_TALK ) {
# Don't index user and user talk pages for blocked users (bug 11443)
if ( !$this->mTitle->isSubpage() ) {
$block = new Block();
if ( $block->load( $this->mTitle->getText() ) ) {
- return array( 'index' => 'noindex',
- 'follow' => 'nofollow' );
+ return array(
+ 'index' => 'noindex',
+ 'follow' => 'nofollow'
+ );
}
}
}
if ( $this->getID() === 0 || $this->getOldID() ) {
# Non-articles (special pages etc), and old revisions
- return array( 'index' => 'noindex',
- 'follow' => 'nofollow' );
+ return array(
+ 'index' => 'noindex',
+ 'follow' => 'nofollow'
+ );
} elseif ( $wgOut->isPrintable() ) {
# Discourage indexing of printable versions, but encourage following
- return array( 'index' => 'noindex',
- 'follow' => 'follow' );
+ return array(
+ 'index' => 'noindex',
+ 'follow' => 'follow'
+ );
} elseif ( $wgRequest->getInt( 'curid' ) ) {
# For ?curid=x urls, disallow indexing
- return array( 'index' => 'noindex',
- 'follow' => 'follow' );
+ return array(
+ 'index' => 'noindex',
+ 'follow' => 'follow'
+ );
}
# Otherwise, construct the policy based on the various config variables.
@@ -1048,24 +1152,29 @@ class Article {
if ( isset( $wgNamespaceRobotPolicies[$ns] ) ) {
# Honour customised robot policies for this namespace
- $policy = array_merge( $policy,
- self::formatRobotPolicy( $wgNamespaceRobotPolicies[$ns] ) );
+ $policy = array_merge(
+ $policy,
+ self::formatRobotPolicy( $wgNamespaceRobotPolicies[$ns] )
+ );
}
if ( $this->mTitle->canUseNoindex() && is_object( $this->mParserOutput ) && $this->mParserOutput->getIndexPolicy() ) {
# __INDEX__ and __NOINDEX__ magic words, if allowed. Incorporates
# a final sanity check that we have really got the parser output.
- $policy = array_merge( $policy,
- array( 'index' => $this->mParserOutput->getIndexPolicy() ) );
+ $policy = array_merge(
+ $policy,
+ array( 'index' => $this->mParserOutput->getIndexPolicy() )
+ );
}
if ( isset( $wgArticleRobotPolicies[$this->mTitle->getPrefixedText()] ) ) {
# (bug 14900) site config can override user-defined __INDEX__ or __NOINDEX__
- $policy = array_merge( $policy,
- self::formatRobotPolicy( $wgArticleRobotPolicies[$this->mTitle->getPrefixedText()] ) );
+ $policy = array_merge(
+ $policy,
+ self::formatRobotPolicy( $wgArticleRobotPolicies[$this->mTitle->getPrefixedText()] )
+ );
}
return $policy;
-
}
/**
@@ -1093,6 +1202,7 @@ class Article {
$arr['follow'] = $var;
}
}
+
return $arr;
}
@@ -1100,12 +1210,15 @@ class Article {
* If this request is a redirect view, send "redirected from" subtitle to
* $wgOut. Returns true if the header was needed, false if this is not a
* redirect view. Handles both local and remote redirects.
+ *
+ * @return boolean
*/
public function showRedirectedFromHeader() {
global $wgOut, $wgUser, $wgRequest, $wgRedirectSources;
$rdfrom = $wgRequest->getVal( 'rdfrom' );
$sk = $wgUser->getSkin();
+
if ( isset( $this->mRedirectedFrom ) ) {
// This is an internally redirected page view.
// We'll need a backlink to the source page for navigation.
@@ -1117,6 +1230,7 @@ class Article {
array( 'redirect' => 'no' ),
array( 'known', 'noclasses' )
);
+
$s = wfMsgExt( 'redirectedfrom', array( 'parseinline', 'replaceafter' ), $redir );
$wgOut->setSubtitle( $s );
@@ -1130,6 +1244,7 @@ class Article {
$wgOut->addLink( array( 'rel' => 'canonical',
'href' => $this->mTitle->getLocalURL() )
);
+
return true;
}
} elseif ( $rdfrom ) {
@@ -1139,9 +1254,11 @@ class Article {
$redir = $sk->makeExternalLink( $rdfrom, $rdfrom );
$s = wfMsgExt( 'redirectedfrom', array( 'parseinline', 'replaceafter' ), $redir );
$wgOut->setSubtitle( $s );
+
return true;
}
}
+
return false;
}
@@ -1151,10 +1268,11 @@ class Article {
*/
public function showNamespaceHeader() {
global $wgOut;
+
if ( $this->mTitle->isTalkPage() ) {
$msg = wfMsgNoTrans( 'talkpageheader' );
if ( $msg !== '-' && !wfEmptyMsg( 'talkpageheader', $msg ) ) {
- $wgOut->wrapWikiMsg( "<div class=\"mw-talkpageheader\">\n$1</div>", array( 'talkpageheader' ) );
+ $wgOut->wrapWikiMsg( "<div class=\"mw-talkpageheader\">\n$1\n</div>", array( 'talkpageheader' ) );
}
}
}
@@ -1163,7 +1281,8 @@ class Article {
* Show the footer section of an ordinary page view
*/
public function showViewFooter() {
- global $wgOut, $wgUseTrackbacks, $wgRequest;
+ global $wgOut, $wgUseTrackbacks;
+
# check if we're displaying a [[User talk:x.x.x.x]] anonymous talk page
if ( $this->mTitle->getNamespace() == NS_USER_TALK && IP::isValid( $this->mTitle->getText() ) ) {
$wgOut->addWikiMsg( 'anontalkpagetext' );
@@ -1186,13 +1305,16 @@ class Article {
*/
public function showPatrolFooter() {
global $wgOut, $wgRequest, $wgUser;
+
$rcid = $wgRequest->getVal( 'rcid' );
- if ( !$rcid || !$this->mTitle->exists() || !$this->mTitle->quickUserCan( 'patrol' ) ) {
+ if ( !$rcid || !$this->mTitle->quickUserCan( 'patrol' ) ) {
return;
}
$sk = $wgUser->getSkin();
+ $token = $wgUser->editToken( $rcid );
+ $wgOut->preventClickjacking();
$wgOut->addHTML(
"<div class='patrollink'>" .
@@ -1204,7 +1326,8 @@ class Article {
array(),
array(
'action' => 'markpatrolled',
- 'rcid' => $rcid
+ 'rcid' => $rcid,
+ 'token' => $token,
),
array( 'known', 'noclasses' )
)
@@ -1226,8 +1349,9 @@ class Article {
$rootPart = $parts[0];
$user = User::newFromName( $rootPart, false /* allow IP users*/ );
$ip = User::isIP( $rootPart );
+
if ( !$user->isLoggedIn() && !$ip ) { # User does not exist
- $wgOut->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n\$1</div>",
+ $wgOut->wrapWikiMsg( "<div class=\"mw-userpage-userdoesnotexist error\">\n\$1\n</div>",
array( 'userpage-userdoesnotexist-view', $rootPart ) );
} else if ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
LogEventsList::showLogExtract(
@@ -1246,7 +1370,9 @@ class Article {
);
}
}
+
wfRunHooks( 'ShowMissingArticle', array( $this ) );
+
# Show delete and move logs
LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->mTitle->getPrefixedText(), '',
array( 'lim' => 10,
@@ -1269,35 +1395,42 @@ class Article {
$editErrors = $this->mTitle->getUserPermissionsErrors( 'edit', $wgUser );
$errors = array_merge( $createErrors, $editErrors );
- if ( !count( $errors ) )
+ if ( !count( $errors ) ) {
$text = wfMsgNoTrans( 'noarticletext' );
- else
+ } else {
$text = wfMsgNoTrans( 'noarticletext-nopermission' );
+ }
}
$text = "<div class='noarticletext'>\n$text\n</div>";
+
if ( !$this->hasViewableContent() ) {
// If there's no backing content, send a 404 Not Found
// for better machine handling of broken links.
- $wgRequest->response()->header( "HTTP/1.x 404 Not Found" );
+ $wgRequest->response()->header( "HTTP/1.1 404 Not Found" );
}
+
$wgOut->addWikiText( $text );
}
/**
* If the revision requested for view is deleted, check permissions.
* Send either an error message or a warning header to $wgOut.
- * Returns true if the view is allowed, false if not.
+ *
+ * @return boolean true if the view is allowed, false if not.
*/
public function showDeletedRevisionHeader() {
global $wgOut, $wgRequest;
+
if ( !$this->mRevision->isDeleted( Revision::DELETED_TEXT ) ) {
// Not deleted
return true;
}
+
// If the user is not allowed to see it...
if ( !$this->mRevision->userCan( Revision::DELETED_TEXT ) ) {
- $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1</div>\n",
+ $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n",
'rev-deleted-text-permission' );
+
return false;
// If the user needs to confirm that they want to see it...
} else if ( $wgRequest->getInt( 'unhide' ) != 1 ) {
@@ -1306,26 +1439,30 @@ class Article {
$link = $this->mTitle->getFullUrl( "oldid={$oldid}&unhide=1" );
$msg = $this->mRevision->isDeleted( Revision::DELETED_RESTRICTED ) ?
'rev-suppressed-text-unhide' : 'rev-deleted-text-unhide';
- $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1</div>\n",
+ $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n",
array( $msg, $link ) );
+
return false;
// We are allowed to see...
} else {
$msg = $this->mRevision->isDeleted( Revision::DELETED_RESTRICTED ) ?
'rev-suppressed-text-view' : 'rev-deleted-text-view';
- $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1</div>\n", $msg );
+ $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n", $msg );
+
return true;
}
}
- /*
- * Should the parser cache be used?
- */
+ /**
+ * Should the parser cache be used?
+ *
+ * @return boolean
+ */
public function useParserCache( $oldid ) {
global $wgUser, $wgEnableParserCache;
return $wgEnableParserCache
- && intval( $wgUser->getOption( 'stubthreshold' ) ) == 0
+ && $wgUser->getStubThreshold() == 0
&& $this->exists()
&& empty( $oldid )
&& !$this->mTitle->isCssOrJsPage()
@@ -1337,15 +1474,22 @@ class Article {
*/
public function doViewParse() {
global $wgOut;
+
$oldid = $this->getOldID();
- $useParserCache = $this->useParserCache( $oldid );
- $parserOptions = clone $this->getParserOptions();
+ $parserOptions = $this->getParserOptions();
+
# Render printable version, use printable version cache
$parserOptions->setIsPrintable( $wgOut->isPrintable() );
+
# Don't show section-edit links on old revisions... this way lies madness.
- $parserOptions->setEditSection( $this->isCurrent() );
+ if ( !$this->isCurrent() || $wgOut->isPrintable() || !$this->mTitle->quickUserCan( 'edit' ) ) {
+ $parserOptions->setEditSection( false );
+ }
+
$useParserCache = $this->useParserCache( $oldid );
$this->outputWikiText( $this->getContent(), $useParserCache, $parserOptions );
+
+ return true;
}
/**
@@ -1353,13 +1497,21 @@ class Article {
* output it and return true. If it is not present, output nothing and
* return false. This is used as a callback function for
* PoolCounter::executeProtected().
+ *
+ * @return boolean
*/
public function tryDirtyCache() {
global $wgOut;
$parserCache = ParserCache::singleton();
$options = $this->getParserOptions();
- $options->setIsPrintable( $wgOut->isPrintable() );
+
+ if ( $wgOut->isPrintable() ) {
+ $options->setIsPrintable( true );
+ $options->setEditSection( false );
+ }
+
$output = $parserCache->getDirty( $this, $options );
+
if ( $output ) {
wfDebug( __METHOD__ . ": sending dirty output\n" );
wfDebugLog( 'dirty', "dirty output " . $parserCache->getKey( $this, $options ) . "\n" );
@@ -1367,126 +1519,123 @@ class Article {
$this->mParserOutput = $output;
$wgOut->addParserOutput( $output );
$wgOut->addHTML( "<!-- parser cache is expired, sending anyway due to pool overload-->\n" );
+
return true;
} else {
wfDebugLog( 'dirty', "dirty missing\n" );
wfDebug( __METHOD__ . ": no dirty cache\n" );
+
return false;
}
}
/**
- * Show an error page for an error from the pool counter.
- * @param $status Status
- */
- public function showPoolError( $status ) {
- global $wgOut;
- $wgOut->clearHTML(); // for release() errors
- $wgOut->enableClientCache( false );
- $wgOut->setRobotPolicy( 'noindex,nofollow' );
- $wgOut->addWikiText(
- '<div class="errorbox">' .
- $status->getWikiText( false, 'view-pool-error' ) .
- '</div>'
- );
- }
-
- /**
* View redirect
+ *
* @param $target Title object or Array of destination(s) to redirect
* @param $appendSubtitle Boolean [optional]
* @param $forceKnown Boolean: should the image be shown as a bluelink regardless of existence?
+ * @return string containing HMTL with redirect link
*/
public function viewRedirect( $target, $appendSubtitle = true, $forceKnown = false ) {
global $wgOut, $wgContLang, $wgStylePath, $wgUser;
- # Display redirect
+
if ( !is_array( $target ) ) {
$target = array( $target );
}
+
$imageDir = $wgContLang->getDir();
- $imageUrl = $wgStylePath . '/common/images/redirect' . $imageDir . '.png';
- $imageUrl2 = $wgStylePath . '/common/images/nextredirect' . $imageDir . '.png';
- $alt2 = $wgContLang->isRTL() ? '&larr;' : '&rarr;'; // should -> and <- be used instead of entities?
if ( $appendSubtitle ) {
$wgOut->appendSubtitle( wfMsgHtml( 'redirectpagesub' ) );
}
+
$sk = $wgUser->getSkin();
// the loop prepends the arrow image before the link, so the first case needs to be outside
$title = array_shift( $target );
+
if ( $forceKnown ) {
- $link = $sk->link(
- $title,
- htmlspecialchars( $title->getFullText() ),
- array(),
- array(),
- array( 'known', 'noclasses' )
- );
+ $link = $sk->linkKnown( $title, htmlspecialchars( $title->getFullText() ) );
} else {
$link = $sk->link( $title, htmlspecialchars( $title->getFullText() ) );
}
- // automatically append redirect=no to each link, since most of them are redirect pages themselves
+
+ $nextRedirect = $wgStylePath . '/common/images/nextredirect' . $imageDir . '.png';
+ $alt = $wgContLang->isRTL() ? '←' : '→';
+ // Automatically append redirect=no to each link, since most of them are redirect pages themselves.
+ // FIXME: where this happens?
foreach ( $target as $rt ) {
+ $link .= Html::element( 'img', array( 'src' => $nextRedirect, 'alt' => $alt ) );
if ( $forceKnown ) {
- $link .= '<img src="' . $imageUrl2 . '" alt="' . $alt2 . ' " />'
- . $sk->link(
- $rt,
- htmlspecialchars( $rt->getFullText() ),
- array(),
- array(),
- array( 'known', 'noclasses' )
- );
+ $link .= $sk->linkKnown( $rt, htmlspecialchars( $rt->getFullText() ) );
} else {
- $link .= '<img src="' . $imageUrl2 . '" alt="' . $alt2 . ' " />'
- . $sk->link( $rt, htmlspecialchars( $rt->getFullText() ) );
+ $link .= $sk->link( $rt, htmlspecialchars( $rt->getFullText() ) );
}
}
- return '<img src="' . $imageUrl . '" alt="#REDIRECT " />' .
- '<span class="redirectText">' . $link . '</span>';
+ $imageUrl = $wgStylePath . '/common/images/redirect' . $imageDir . '.png';
+ return '<div class="redirectMsg">' .
+ Html::element( 'img', array( 'src' => $imageUrl, 'alt' => '#REDIRECT' ) ) .
+ '<span class="redirectText">' . $link . '</span></div>';
}
+ /**
+ * Builds trackback links for article display if $wgUseTrackbacks is set to true
+ */
public function addTrackbacks() {
global $wgOut, $wgUser;
+
$dbr = wfGetDB( DB_SLAVE );
$tbs = $dbr->select( 'trackbacks',
array( 'tb_id', 'tb_title', 'tb_url', 'tb_ex', 'tb_name' ),
array( 'tb_page' => $this->getID() )
);
- if ( !$dbr->numRows( $tbs ) ) return;
+
+ if ( !$dbr->numRows( $tbs ) ) {
+ return;
+ }
$wgOut->preventClickjacking();
$tbtext = "";
- while ( $o = $dbr->fetchObject( $tbs ) ) {
+ foreach ( $tbs as $o ) {
$rmvtxt = "";
+
if ( $wgUser->isAllowed( 'trackback' ) ) {
$delurl = $this->mTitle->getFullURL( "action=deletetrackback&tbid=" .
$o->tb_id . "&token=" . urlencode( $wgUser->editToken() ) );
$rmvtxt = wfMsg( 'trackbackremove', htmlspecialchars( $delurl ) );
}
+
$tbtext .= "\n";
- $tbtext .= wfMsg( strlen( $o->tb_ex ) ? 'trackbackexcerpt' : 'trackback',
+ $tbtext .= wfMsgNoTrans( strlen( $o->tb_ex ) ? 'trackbackexcerpt' : 'trackback',
$o->tb_title,
$o->tb_url,
$o->tb_ex,
$o->tb_name,
$rmvtxt );
}
- $wgOut->wrapWikiMsg( "<div id='mw_trackbacks'>$1</div>\n", array( 'trackbackbox', $tbtext ) );
- $this->mTitle->invalidateCache();
+
+ $wgOut->wrapWikiMsg( "<div id='mw_trackbacks'>\n$1\n</div>\n", array( 'trackbackbox', $tbtext ) );
}
+ /**
+ * Removes trackback record for current article from trackbacks table
+ */
public function deletetrackback() {
global $wgUser, $wgRequest, $wgOut;
+
if ( !$wgUser->matchEditToken( $wgRequest->getVal( 'token' ) ) ) {
$wgOut->addWikiMsg( 'sessionfailure' );
+
return;
}
$permission_errors = $this->mTitle->getUserPermissionsErrors( 'delete', $wgUser );
+
if ( count( $permission_errors ) ) {
$wgOut->showPermissionsErrorPage( $permission_errors );
+
return;
}
@@ -1497,8 +1646,13 @@ class Article {
$this->mTitle->invalidateCache();
}
+ /**
+ * Handle action=render
+ */
+
public function render() {
global $wgOut;
+
$wgOut->setArticleBodyOnly( true );
$this->view();
}
@@ -1508,22 +1662,30 @@ class Article {
*/
public function purge() {
global $wgUser, $wgRequest, $wgOut;
+
if ( $wgUser->isAllowed( 'purge' ) || $wgRequest->wasPosted() ) {
+ //FIXME: shouldn't this be in doPurge()?
if ( wfRunHooks( 'ArticlePurge', array( &$this ) ) ) {
$this->doPurge();
$this->view();
}
} else {
- $action = htmlspecialchars( $wgRequest->getRequestURL() );
- $button = wfMsgExt( 'confirm_purge_button', array( 'escapenoentities' ) );
- $form = "<form method=\"post\" action=\"$action\">\n" .
- "<input type=\"submit\" name=\"submit\" value=\"$button\" />\n" .
- "</form>\n";
- $top = wfMsgExt( 'confirm-purge-top', array( 'parse' ) );
- $bottom = wfMsgExt( 'confirm-purge-bottom', array( 'parse' ) );
+ $formParams = array(
+ 'method' => 'post',
+ 'action' => $wgRequest->getRequestURL(),
+ );
+
+ $wgOut->addWikiMsg( 'confirm-purge-top' );
+
+ $form = Html::openElement( 'form', $formParams );
+ $form .= Xml::submitButton( wfMsg( 'confirm_purge_button' ) );
+ $form .= Html::closeElement( 'form' );
+
+ $wgOut->addHTML( $form );
+ $wgOut->addWikiMsg( 'confirm-purge-bottom' );
+
$wgOut->setPageTitle( $this->mTitle->getPrefixedText() );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
- $wgOut->addHTML( $top . $form . $bottom );
}
}
@@ -1532,6 +1694,7 @@ class Article {
*/
public function doPurge() {
global $wgUseSquid;
+
// Invalidate the cache
$this->mTitle->invalidateCache();
@@ -1544,13 +1707,16 @@ class Article {
$update = SquidUpdate::newSimplePurge( $this->mTitle );
$update->doUpdate();
}
+
if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
global $wgMessageCache;
+
if ( $this->getID() == 0 ) {
$text = false;
} else {
$text = $this->getRawText();
}
+
$wgMessageCache->replace( $this->mTitle->getDBkey(), $text );
}
}
@@ -1558,7 +1724,7 @@ class Article {
/**
* Insert a new empty page record for this article.
* This *must* be followed up by creating a revision
- * and running $this->updateToLatest( $rev_id );
+ * and running $this->updateRevisionOn( ... );
* or else the record will be left in a funky state.
* Best if all done inside a transaction.
*
@@ -1585,18 +1751,20 @@ class Article {
), __METHOD__, 'IGNORE' );
$affected = $dbw->affectedRows();
+
if ( $affected ) {
$newid = $dbw->insertId();
$this->mTitle->resetArticleId( $newid );
}
wfProfileOut( __METHOD__ );
+
return $affected ? $newid : false;
}
/**
* Update the page record to point to a newly saved revision.
*
- * @param $dbw Database object
+ * @param $dbw DatabaseBase: object
* @param $revision Revision: For ID number, and text used to set
length and redirect status fields
* @param $lastRevision Integer: if given, will not overwrite the page field
@@ -1612,9 +1780,10 @@ class Article {
wfProfileIn( __METHOD__ );
$text = $revision->getText();
- $rt = Title::newFromRedirect( $text );
+ $rt = Title::newFromRedirectRecurse( $text );
$conditions = array( 'page_id' => $this->getId() );
+
if ( !is_null( $lastRevision ) ) {
# An extra check against threads stepping on each other
$conditions['page_latest'] = $lastRevision;
@@ -1656,27 +1825,25 @@ class Article {
// Update/Insert if we don't know if the last revision was a redirect or not
// Delete if changing from redirect to non-redirect
$isRedirect = !is_null( $redirectTitle );
+
if ( $isRedirect || is_null( $lastRevIsRedirect ) || $lastRevIsRedirect !== $isRedirect ) {
wfProfileIn( __METHOD__ );
if ( $isRedirect ) {
- // This title is a redirect, Add/Update row in the redirect table
- $set = array( /* SET */
- 'rd_namespace' => $redirectTitle->getNamespace(),
- 'rd_title' => $redirectTitle->getDBkey(),
- 'rd_from' => $this->getId(),
- );
- $dbw->replace( 'redirect', array( 'rd_from' ), $set, __METHOD__ );
+ $this->insertRedirectEntry( $redirectTitle );
} else {
// This is not a redirect, remove row from redirect table
$where = array( 'rd_from' => $this->getId() );
$dbw->delete( 'redirect', $where, __METHOD__ );
}
+
if ( $this->getTitle()->getNamespace() == NS_FILE ) {
RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect( $this->getTitle() );
}
wfProfileOut( __METHOD__ );
+
return ( $dbw->affectedRows() != 0 );
}
+
return true;
}
@@ -1686,9 +1853,11 @@ class Article {
*
* @param $dbw Database object
* @param $revision Revision object
+ * @return mixed
*/
public function updateIfNewerOn( &$dbw, $revision ) {
wfProfileIn( __METHOD__ );
+
$row = $dbw->selectRow(
array( 'revision', 'page' ),
array( 'rev_id', 'rev_timestamp', 'page_is_redirect' ),
@@ -1696,6 +1865,7 @@ class Article {
'page_id' => $this->getId(),
'page_latest=rev_id' ),
__METHOD__ );
+
if ( $row ) {
if ( wfTimestamp( TS_MW, $row->rev_timestamp ) >= $revision->getTimestamp() ) {
wfProfileOut( __METHOD__ );
@@ -1708,17 +1878,23 @@ class Article {
$prev = 0;
$lastRevIsRedirect = null;
}
+
$ret = $this->updateRevisionOn( $dbw, $revision, $prev, $lastRevIsRedirect );
+
wfProfileOut( __METHOD__ );
return $ret;
}
/**
* @param $section empty/null/false or a section number (0, 1, 2, T1, T2...)
+ * @param $text String: new text of the section
+ * @param $summary String: new section's subject, only if $section is 'new'
+ * @param $edittime String: revision timestamp or null to use the current revision
* @return string Complete article text, or null if error
*/
public function replaceSection( $section, $text, $summary = '', $edittime = null ) {
wfProfileIn( __METHOD__ );
+
if ( strval( $section ) == '' ) {
// Whole-page edit; let the whole text through
} else {
@@ -1728,11 +1904,14 @@ class Article {
$dbw = wfGetDB( DB_MASTER );
$rev = Revision::loadFromTimestamp( $dbw, $this->mTitle, $edittime );
}
+
if ( !$rev ) {
wfDebug( "Article::replaceSection asked for bogus section (page: " .
$this->getId() . "; section: $section; edittime: $edittime)\n" );
+ wfProfileOut( __METHOD__ );
return null;
}
+
$oldtext = $rev->getText();
if ( $section == 'new' ) {
@@ -1744,9 +1923,11 @@ class Article {
} else {
# Replacing an existing section; roll out the big guns
global $wgParser;
+
$text = $wgParser->replaceSection( $oldtext, $section, $text );
}
}
+
wfProfileOut( __METHOD__ );
return $text;
}
@@ -1765,7 +1946,6 @@ class Article {
if ( $comment && $summary != "" ) {
$text = wfMsgForContent( 'newsectionheaderdefaultlevel', $summary ) . "\n\n" . $text;
}
-
$this->doEdit( $text, $summary, $flags );
$dbw = wfGetDB( DB_MASTER );
@@ -1794,6 +1974,7 @@ class Article {
( $forceBot ? EDIT_FORCE_BOT : 0 );
$status = $this->doEdit( $text, $summary, $flags );
+
if ( !$status->isOK() ) {
return false;
}
@@ -1821,6 +2002,23 @@ class Article {
}
/**
+ * Check flags and add EDIT_NEW or EDIT_UPDATE to them as needed.
+ * @param $flags Int
+ * @return Int updated $flags
+ */
+ function checkFlags( $flags ) {
+ if ( !( $flags & EDIT_NEW ) && !( $flags & EDIT_UPDATE ) ) {
+ if ( $this->mTitle->getArticleID() ) {
+ $flags |= EDIT_UPDATE;
+ } else {
+ $flags |= EDIT_NEW;
+ }
+ }
+
+ return $flags;
+ }
+
+ /**
* Article::doEdit()
*
* Change an existing article or create a new article. Updates RC and all necessary caches,
@@ -1874,7 +2072,7 @@ class Article {
global $wgUser, $wgDBtransactions, $wgUseAutomaticEditSummaries;
# Low-level sanity check
- if ( $this->mTitle->getText() == '' ) {
+ if ( $this->mTitle->getText() === '' ) {
throw new MWException( 'Something is trying to edit an article with an empty title' );
}
@@ -1886,23 +2084,18 @@ class Article {
# Load $this->mTitle->getArticleID() and $this->mLatest if it's not already
$this->loadPageData();
- if ( !( $flags & EDIT_NEW ) && !( $flags & EDIT_UPDATE ) ) {
- $aid = $this->mTitle->getArticleID();
- if ( $aid ) {
- $flags |= EDIT_UPDATE;
- } else {
- $flags |= EDIT_NEW;
- }
- }
+ $flags = $this->checkFlags( $flags );
if ( !wfRunHooks( 'ArticleSave', array( &$this, &$user, &$text, &$summary,
$flags & EDIT_MINOR, null, null, &$flags, &$status ) ) )
{
wfDebug( __METHOD__ . ": ArticleSave hook aborted save!\n" );
- wfProfileOut( __METHOD__ );
+
if ( $status->isOK() ) {
$status->fatal( 'edit-hook-aborted' );
}
+
+ wfProfileOut( __METHOD__ );
return $status;
}
@@ -1929,13 +2122,12 @@ class Article {
if ( $flags & EDIT_UPDATE ) {
# Update article, but only if changed.
$status->value['new'] = false;
+
# Make sure the revision is either completely inserted or not inserted at all
if ( !$wgDBtransactions ) {
$userAbort = ignore_user_abort( true );
}
- $revisionId = 0;
-
$changed = ( strcmp( $text, $oldtext ) != 0 );
if ( $changed ) {
@@ -1947,6 +2139,7 @@ class Article {
# Article gone missing
wfDebug( __METHOD__ . ": EDIT_UPDATE specified but article doesn't exist\n" );
$status->fatal( 'edit-gone-missing' );
+
wfProfileOut( __METHOD__ );
return $status;
}
@@ -1959,7 +2152,7 @@ class Article {
'parent_id' => $this->mLatest,
'user' => $user->getId(),
'user_text' => $user->getName(),
- ) );
+ ) );
$dbw->begin();
$revisionId = $revision->insertOn( $dbw );
@@ -1976,10 +2169,12 @@ class Article {
if ( !$ok ) {
/* Belated edit conflict! Run away!! */
$status->fatal( 'edit-conflict' );
+
# Delete the invalid revision if the DB is not transactional
if ( !$wgDBtransactions ) {
$dbw->delete( 'revision', array( 'rev_id' => $revisionId ), __METHOD__ );
}
+
$revisionId = 0;
$dbw->rollback();
} else {
@@ -1994,6 +2189,7 @@ class Article {
$this->mLatest, $this->getTimestamp(), $bot, '', $oldsize, $newsize,
$revisionId, $patrolled
);
+
# Log auto-patrolled edits
if ( $patrolled ) {
PatrolLog::record( $rc, true );
@@ -2015,6 +2211,7 @@ class Article {
if ( !$wgDBtransactions ) {
ignore_user_abort( $userAbort );
}
+
// Now that ignore_user_abort is restored, we can respond to fatal errors
if ( !$status->isOK() ) {
wfProfileOut( __METHOD__ );
@@ -2045,6 +2242,7 @@ class Article {
if ( $newid === false ) {
$dbw->rollback();
$status->fatal( 'edit-already-exists' );
+
wfProfileOut( __METHOD__ );
return $status;
}
@@ -2066,14 +2264,17 @@ class Article {
$this->updateRevisionOn( $dbw, $revision, 0 );
wfRunHooks( 'NewRevisionFromEditComplete', array( $this, $revision, false, $user ) );
+
# Update recentchanges
if ( !( $flags & EDIT_SUPPRESS_RC ) ) {
global $wgUseRCPatrol, $wgUseNPPatrol;
+
# Mark as patrolled if the user can do so
$patrolled = ( $wgUseRCPatrol || $wgUseNPPatrol ) && $this->mTitle->userCan( 'autopatrol' );
# Add RC row to the DB
$rc = RecentChange::notifyNew( $now, $this->mTitle, $isminor, $user, $summary, $bot,
'', strlen( $text ), $revisionId, $patrolled );
+
# Log auto-patrolled edits
if ( $patrolled ) {
PatrolLog::record( $rc, true );
@@ -2125,13 +2326,15 @@ class Article {
*/
public function doRedirect( $noRedir = false, $sectionAnchor = '', $extraQuery = '' ) {
global $wgOut;
+
if ( $noRedir ) {
$query = 'redirect=no';
if ( $extraQuery )
- $query .= "&$query";
+ $query .= "&$extraQuery";
} else {
$query = $extraQuery;
}
+
$wgOut->redirect( $this->mTitle->getFullURL( $query ) . $sectionAnchor );
}
@@ -2139,12 +2342,20 @@ class Article {
* Mark this particular edit/page as patrolled
*/
public function markpatrolled() {
- global $wgOut, $wgRequest, $wgUseRCPatrol, $wgUseNPPatrol, $wgUser;
+ global $wgOut, $wgUser, $wgRequest;
+
$wgOut->setRobotPolicy( 'noindex,nofollow' );
# If we haven't been given an rc_id value, we can't do anything
$rcid = (int) $wgRequest->getVal( 'rcid' );
+
+ if ( !$wgUser->matchEditToken( $wgRequest->getVal( 'token' ), $rcid ) ) {
+ $wgOut->showErrorPage( 'sessionfailure-title', 'sessionfailure' );
+ return;
+ }
+
$rc = RecentChange::newFromId( $rcid );
+
if ( is_null( $rc ) ) {
$wgOut->showErrorPage( 'markedaspatrollederror', 'markedaspatrollederrortext' );
return;
@@ -2154,11 +2365,11 @@ class Article {
$returnto = $rc->getAttribute( 'rc_type' ) == RC_NEW ? 'Newpages' : 'Recentchanges';
$return = SpecialPage::getTitleFor( $returnto );
- $dbw = wfGetDB( DB_MASTER );
$errors = $rc->doMarkPatrolled();
if ( in_array( array( 'rcpatroldisabled' ), $errors ) ) {
$wgOut->showErrorPage( 'rcpatroldisabled', 'rcpatroldisabledtext' );
+
return;
}
@@ -2171,11 +2382,13 @@ class Article {
$wgOut->setPageTitle( wfMsg( 'markedaspatrollederror' ) );
$wgOut->addWikiMsg( 'markedaspatrollederror-noautopatrol' );
$wgOut->returnToMain( false, $return );
+
return;
}
if ( !empty( $errors ) ) {
$wgOut->showPermissionsErrorPage( $errors );
+
return;
}
@@ -2190,35 +2403,45 @@ class Article {
*/
public function watch() {
global $wgUser, $wgOut;
+
if ( $wgUser->isAnon() ) {
$wgOut->showErrorPage( 'watchnologin', 'watchnologintext' );
return;
}
+
if ( wfReadOnly() ) {
$wgOut->readOnlyPage();
return;
}
+
if ( $this->doWatch() ) {
$wgOut->setPagetitle( wfMsg( 'addedwatch' ) );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->addWikiMsg( 'addedwatchtext', $this->mTitle->getPrefixedText() );
}
+
$wgOut->returnToMain( true, $this->mTitle->getPrefixedText() );
}
/**
* Add this page to $wgUser's watchlist
+ *
+ * This is safe to be called multiple times
+ *
* @return bool true on successful watch operation
*/
public function doWatch() {
global $wgUser;
+
if ( $wgUser->isAnon() ) {
return false;
}
+
if ( wfRunHooks( 'WatchArticle', array( &$wgUser, &$this ) ) ) {
$wgUser->addWatch( $this->mTitle );
return wfRunHooks( 'WatchArticleComplete', array( &$wgUser, &$this ) );
}
+
return false;
}
@@ -2227,19 +2450,23 @@ class Article {
*/
public function unwatch() {
global $wgUser, $wgOut;
+
if ( $wgUser->isAnon() ) {
$wgOut->showErrorPage( 'watchnologin', 'watchnologintext' );
return;
}
+
if ( wfReadOnly() ) {
$wgOut->readOnlyPage();
return;
}
+
if ( $this->doUnwatch() ) {
$wgOut->setPagetitle( wfMsg( 'removedwatch' ) );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->addWikiMsg( 'removedwatchtext', $this->mTitle->getPrefixedText() );
}
+
$wgOut->returnToMain( true, $this->mTitle->getPrefixedText() );
}
@@ -2249,13 +2476,16 @@ class Article {
*/
public function doUnwatch() {
global $wgUser;
+
if ( $wgUser->isAnon() ) {
return false;
}
+
if ( wfRunHooks( 'UnwatchArticle', array( &$wgUser, &$this ) ) ) {
$wgUser->removeWatch( $this->mTitle );
return wfRunHooks( 'UnwatchArticleComplete', array( &$wgUser, &$this ) );
}
+
return false;
}
@@ -2289,8 +2519,9 @@ class Article {
$restrictionTypes = $this->mTitle->getRestrictionTypes();
$id = $this->mTitle->getArticleID();
+
if ( $id <= 0 ) {
- wfDebug( "updateRestrictions failed: $id <= 0\n" );
+ wfDebug( "updateRestrictions failed: article id $id <= 0\n" );
return false;
}
@@ -2316,6 +2547,7 @@ class Article {
$current = array();
$updated = Article::flattenRestrictions( $limit );
$changed = false;
+
foreach ( $restrictionTypes as $action ) {
if ( isset( $expiry[$action] ) ) {
# Get current restrictions on $action
@@ -2323,6 +2555,7 @@ class Article {
$current[$action] = implode( '', $aLimits );
# Are any actual restrictions being dealt with here?
$aRChanged = count( $aLimits ) || !empty( $limit[$action] );
+
# If something changed, we need to log it. Checking $aRChanged
# assures that "unprotecting" a page that is not protected does
# not log just because the expiry was "changed".
@@ -2341,38 +2574,44 @@ class Article {
# If nothing's changed, do nothing
if ( $changed ) {
if ( wfRunHooks( 'ArticleProtect', array( &$this, &$wgUser, $limit, $reason ) ) ) {
-
$dbw = wfGetDB( DB_MASTER );
# Prepare a null revision to be added to the history
$modified = $current != '' && $protect;
+
if ( $protect ) {
$comment_type = $modified ? 'modifiedarticleprotection' : 'protectedarticle';
} else {
$comment_type = 'unprotectedarticle';
}
+
$comment = $wgContLang->ucfirst( wfMsgForContent( $comment_type, $this->mTitle->getPrefixedText() ) );
# Only restrictions with the 'protect' right can cascade...
# Otherwise, people who cannot normally protect can "protect" pages via transclusion
$editrestriction = isset( $limit['edit'] ) ? array( $limit['edit'] ) : $this->mTitle->getRestrictions( 'edit' );
+
# The schema allows multiple restrictions
- if ( !in_array( 'protect', $editrestriction ) && !in_array( 'sysop', $editrestriction ) )
+ if ( !in_array( 'protect', $editrestriction ) && !in_array( 'sysop', $editrestriction ) ) {
$cascade = false;
+ }
+
$cascade_description = '';
+
if ( $cascade ) {
$cascade_description = ' [' . wfMsgForContent( 'protect-summary-cascade' ) . ']';
}
- if ( $reason )
+ if ( $reason ) {
$comment .= ": $reason";
+ }
$editComment = $comment;
$encodedExpiry = array();
$protect_description = '';
- foreach ( $limit as $action => $restrictions ) {
+ foreach ( $limit as $action => $restrictions ) {
if ( !isset( $expiry[$action] ) )
- $expiry[$action] = 'infinite';
+ $expiry[$action] = Block::infinity();
$encodedExpiry[$action] = Block::encodeExpiry( $expiry[$action], $dbw );
if ( $restrictions != '' ) {
@@ -2385,15 +2624,20 @@ class Article {
} else {
$protect_description .= wfMsgForContent( 'protect-expiry-indefinite' );
}
+
$protect_description .= ') ';
}
}
$protect_description = trim( $protect_description );
- if ( $protect_description && $protect )
+ if ( $protect_description && $protect ) {
$editComment .= " ($protect_description)";
- if ( $cascade )
+ }
+
+ if ( $cascade ) {
$editComment .= "$cascade_description";
+ }
+
# Update restrictions table
foreach ( $limit as $action => $restrictions ) {
if ( $restrictions != '' ) {
@@ -2402,7 +2646,10 @@ class Article {
'pr_type' => $action,
'pr_level' => $restrictions,
'pr_cascade' => ( $cascade && $action == 'edit' ) ? 1 : 0,
- 'pr_expiry' => $encodedExpiry[$action] ), __METHOD__ );
+ 'pr_expiry' => $encodedExpiry[$action]
+ ),
+ __METHOD__
+ );
} else {
$dbw->delete( 'page_restrictions', array( 'pr_page' => $id,
'pr_type' => $action ), __METHOD__ );
@@ -2436,7 +2683,6 @@ class Article {
} else {
$log->addEntry( 'unprotect', $this->mTitle, $reason );
}
-
} # End hook
} # End "changed" check
@@ -2453,35 +2699,46 @@ class Article {
if ( !is_array( $limit ) ) {
throw new MWException( 'Article::flattenRestrictions given non-array restriction set' );
}
+
$bits = array();
ksort( $limit );
+
foreach ( $limit as $action => $restrictions ) {
if ( $restrictions != '' ) {
$bits[] = "$action=$restrictions";
}
}
+
return implode( ':', $bits );
}
/**
* Auto-generates a deletion reason
+ *
* @param &$hasHistory Boolean: whether the page has a history
+ * @return mixed String containing deletion reason or empty string, or boolean false
+ * if no revision occurred
*/
public function generateReason( &$hasHistory ) {
global $wgContLang;
+
$dbw = wfGetDB( DB_MASTER );
// Get the last revision
$rev = Revision::newFromTitle( $this->mTitle );
- if ( is_null( $rev ) )
+
+ if ( is_null( $rev ) ) {
return false;
+ }
// Get the article's contents
$contents = $rev->getText();
$blank = false;
+
// If the page is blank, use the text from the previous revision,
// which can only be blank if there's a move/import/protect dummy revision involved
if ( $contents == '' ) {
$prev = $rev->getPrevious();
+
if ( $prev ) {
$contents = $prev->getText();
$blank = true;
@@ -2495,21 +2752,27 @@ class Article {
__METHOD__,
array( 'LIMIT' => 20 )
);
- if ( $res === false )
+
+ if ( $res === false ) {
// This page has no revisions, which is very weird
return false;
+ }
$hasHistory = ( $res->numRows() > 1 );
$row = $dbw->fetchObject( $res );
- $onlyAuthor = $row->rev_user_text;
- // Try to find a second contributor
- foreach ( $res as $row ) {
- if ( $row->rev_user_text != $onlyAuthor ) {
- $onlyAuthor = false;
- break;
+
+ if ( $row ) { // $row is false if the only contributor is hidden
+ $onlyAuthor = $row->rev_user_text;
+ // Try to find a second contributor
+ foreach ( $res as $row ) {
+ if ( $row->rev_user_text != $onlyAuthor ) { // Bug 22999
+ $onlyAuthor = false;
+ break;
+ }
}
+ } else {
+ $onlyAuthor = false;
}
- $dbw->freeResult( $res );
// Generate the summary with a '$1' placeholder
if ( $blank ) {
@@ -2517,10 +2780,11 @@ class Article {
// blank. It's just not our lucky day
$reason = wfMsgForContent( 'exbeforeblank', '$1' );
} else {
- if ( $onlyAuthor )
+ if ( $onlyAuthor ) {
$reason = wfMsgForContent( 'excontentauthor', '$1', $onlyAuthor );
- else
+ } else {
$reason = wfMsgForContent( 'excontent', '$1' );
+ }
}
if ( $reason == '-' ) {
@@ -2538,6 +2802,7 @@ class Article {
$contents = preg_replace( '/\[\[([^\]]*)\]?$/', '$1', $contents );
// Now replace the '$1' placeholder
$reason = str_replace( '$1', $contents, $reason );
+
return $reason;
}
@@ -2562,6 +2827,7 @@ class Article {
} elseif ( $reason == 'other' ) {
$reason = $this->DeleteReason;
}
+
# Flag to hide all contents of the archived revisions
$suppress = $wgRequest->getVal( 'wpSuppress' ) && $wgUser->isAllowed( 'suppressrevision' );
@@ -2570,6 +2836,7 @@ class Article {
# Read-only check...
if ( wfReadOnly() ) {
$wgOut->readOnlyPage();
+
return;
}
@@ -2578,6 +2845,7 @@ class Article {
if ( count( $permission_errors ) > 0 ) {
$wgOut->showPermissionsErrorPage( $permission_errors );
+
return;
}
@@ -2601,6 +2869,7 @@ class Article {
'delete',
$this->mTitle->getPrefixedText()
);
+
return;
}
@@ -2608,38 +2877,47 @@ class Article {
$bigHistory = $this->isBigDeletion();
if ( $bigHistory && !$this->mTitle->userCan( 'bigdelete' ) ) {
global $wgLang, $wgDeleteRevisionsLimit;
- $wgOut->wrapWikiMsg( "<div class='error'>\n$1</div>\n",
+
+ $wgOut->wrapWikiMsg( "<div class='error'>\n$1\n</div>\n",
array( 'delete-toobig', $wgLang->formatNum( $wgDeleteRevisionsLimit ) ) );
+
return;
}
if ( $confirm ) {
$this->doDelete( $reason, $suppress );
+
if ( $wgRequest->getCheck( 'wpWatch' ) && $wgUser->isLoggedIn() ) {
$this->doWatch();
} elseif ( $this->mTitle->userIsWatching() ) {
$this->doUnwatch();
}
+
return;
}
// Generate deletion reason
$hasHistory = false;
- if ( !$reason ) $reason = $this->generateReason( $hasHistory );
+ if ( !$reason ) {
+ $reason = $this->generateReason( $hasHistory );
+ }
// If the page has a history, insert a warning
if ( $hasHistory && !$confirm ) {
global $wgLang;
+
$skin = $wgUser->getSkin();
$revisions = $this->estimateRevisionCount();
+ //FIXME: lego
$wgOut->addHTML( '<strong class="mw-delete-warning-revisions">' .
wfMsgExt( 'historywarning', array( 'parseinline' ), $wgLang->formatNum( $revisions ) ) .
wfMsgHtml( 'word-separator' ) . $skin->historyLink() .
'</strong>'
);
+
if ( $bigHistory ) {
global $wgDeleteRevisionsLimit;
- $wgOut->wrapWikiMsg( "<div class='error'>\n$1</div>\n",
+ $wgOut->wrapWikiMsg( "<div class='error'>\n$1\n</div>\n",
array( 'delete-warning-toobig', $wgLang->formatNum( $wgDeleteRevisionsLimit ) ) );
}
}
@@ -2652,10 +2930,13 @@ class Article {
*/
public function isBigDeletion() {
global $wgDeleteRevisionsLimit;
+
if ( $wgDeleteRevisionsLimit ) {
$revCount = $this->estimateRevisionCount();
+
return $revCount > $wgDeleteRevisionsLimit;
}
+
return false;
}
@@ -2664,6 +2945,7 @@ class Article {
*/
public function estimateRevisionCount() {
$dbr = wfGetDB( DB_SLAVE );
+
// For an exact count...
// return $dbr->selectField( 'revision', 'COUNT(*)',
// array( 'rev_page' => $this->getId() ), __METHOD__ );
@@ -2683,6 +2965,7 @@ class Article {
// If that doesn't have the latest revision, try the master
$continue = 2;
$db = wfGetDB( DB_SLAVE );
+
do {
$res = $db->select( array( 'page', 'revision' ),
array( 'rev_id', 'rev_user_text' ),
@@ -2695,11 +2978,14 @@ class Article {
'LIMIT' => $num
) )
);
+
if ( !$res ) {
wfProfileOut( __METHOD__ );
return array();
}
+
$row = $db->fetchObject( $res );
+
if ( $continue == 2 && $revLatest && $row->rev_id != $revLatest ) {
$db = wfGetDB( DB_MASTER );
$continue--;
@@ -2709,15 +2995,18 @@ class Article {
} while ( $continue );
$authors = array( $row->rev_user_text );
- while ( $row = $db->fetchObject( $res ) ) {
+
+ foreach ( $res as $row ) {
$authors[] = $row->rev_user_text;
}
+
wfProfileOut( __METHOD__ );
return $authors;
}
/**
* Output deletion confirmation dialog
+ * FIXME: Move to another file?
* @param $reason String: prefilled reason
*/
public function confirmDelete( $reason ) {
@@ -2725,13 +3014,7 @@ class Article {
wfDebug( "Article::confirmDelete\n" );
- $deleteBackLink = $wgUser->getSkin()->link(
- $this->mTitle,
- null,
- array(),
- array(),
- array( 'known', 'noclasses' )
- );
+ $deleteBackLink = $wgUser->getSkin()->linkKnown( $this->mTitle );
$wgOut->setSubtitle( wfMsgHtml( 'delete-backlink', $deleteBackLink ) );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->addWikiMsg( 'confirmdeletetext' );
@@ -2780,7 +3063,8 @@ class Article {
) ) .
"</td>
</tr>";
- # Dissalow watching is user is not logged in
+
+ # Disallow watching if user is not logged in
if ( $wgUser->isLoggedIn() ) {
$form .= "
<tr>
@@ -2791,6 +3075,7 @@ class Article {
"</td>
</tr>";
}
+
$form .= "
$suppress
<tr>
@@ -2802,7 +3087,7 @@ class Article {
</tr>" .
Xml::closeElement( 'table' ) .
Xml::closeElement( 'fieldset' ) .
- Xml::hidden( 'wpEditToken', $wgUser->editToken() ) .
+ Html::hidden( 'wpEditToken', $wgUser->editToken() ) .
Xml::closeElement( 'form' );
if ( $wgUser->isAllowed( 'editinterface' ) ) {
@@ -2819,9 +3104,7 @@ class Article {
$wgOut->addHTML( $form );
$wgOut->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) );
- LogEventsList::showLogExtract(
- $wgOut,
- 'delete',
+ LogEventsList::showLogExtract( $wgOut, 'delete',
$this->mTitle->getPrefixedText()
);
}
@@ -2831,7 +3114,8 @@ class Article {
*/
public function doDelete( $reason, $suppress = false ) {
global $wgOut, $wgUser;
- $id = $this->mTitle->getArticleID( GAID_FOR_UPDATE );
+
+ $id = $this->mTitle->getArticleID( Title::GAID_FOR_UPDATE );
$error = '';
if ( wfRunHooks( 'ArticleDelete', array( &$this, &$wgUser, &$reason, &$error ) ) ) {
@@ -2856,7 +3140,9 @@ class Article {
wfMsgExt( 'cannotdelete', array( 'parse' ), $this->mTitle->getPrefixedText() )
)
);
+
$wgOut->addHTML( Xml::element( 'h2', null, LogPage::logName( 'delete' ) ) );
+
LogEventsList::showLogExtract(
$wgOut,
'delete',
@@ -2871,20 +3157,27 @@ class Article {
/**
* Back-end article deletion
* Deletes the article with database consistency, writes logs, purges caches
- * Returns success
+ *
+ * @param $reason string delete reason for deletion log
+ * @param suppress bitfield
+ * Revision::DELETED_TEXT
+ * Revision::DELETED_COMMENT
+ * Revision::DELETED_USER
+ * Revision::DELETED_RESTRICTED
+ * @param $id int article ID
+ * @param $commit boolean defaults to true, triggers transaction end
+ * @return boolean true if successful
*/
- public function doDeleteArticle( $reason, $suppress = false, $id = 0 ) {
- global $wgUseSquid, $wgDeferredUpdateList;
- global $wgUseTrackbacks;
+ public function doDeleteArticle( $reason, $suppress = false, $id = 0, $commit = true ) {
+ global $wgDeferredUpdateList, $wgUseTrackbacks;
wfDebug( __METHOD__ . "\n" );
$dbw = wfGetDB( DB_MASTER );
- $ns = $this->mTitle->getNamespace();
$t = $this->mTitle->getDBkey();
- $id = $id ? $id : $this->mTitle->getArticleID( GAID_FOR_UPDATE );
+ $id = $id ? $id : $this->mTitle->getArticleID( Title::GAID_FOR_UPDATE );
- if ( $t == '' || $id == 0 ) {
+ if ( $t === '' || $id == 0 ) {
return false;
}
@@ -2942,6 +3235,7 @@ class Article {
# Now that it's safely backed up, delete it
$dbw->delete( 'page', array( 'page_id' => $id ), __METHOD__ );
$ok = ( $dbw->affectedRows() > 0 ); // getArticleId() uses slave, could be laggy
+
if ( !$ok ) {
$dbw->rollback();
return false;
@@ -2950,9 +3244,11 @@ class Article {
# Fix category table counts
$cats = array();
$res = $dbw->select( 'categorylinks', 'cl_to', array( 'cl_from' => $id ), __METHOD__ );
+
foreach ( $res as $row ) {
$cats [] = $row->cl_to;
}
+
$this->updateCategoryCounts( array(), $cats );
# If using cascading deletes, we can skip some explicit deletes
@@ -2969,6 +3265,7 @@ class Article {
$dbw->delete( 'templatelinks', array( 'tl_from' => $id ) );
$dbw->delete( 'externallinks', array( 'el_from' => $id ) );
$dbw->delete( 'langlinks', array( 'll_from' => $id ) );
+ $dbw->delete( 'iwlinks', array( 'iwl_from' => $id ) );
$dbw->delete( 'redirect', array( 'rd_from' => $id ) );
}
@@ -2998,7 +3295,9 @@ class Article {
# Make sure logging got through
$log->addEntry( 'delete', $this->mTitle, $reason, array() );
- $dbw->commit();
+ if ( $commit ) {
+ $dbw->commit();
+ }
return true;
}
@@ -3026,6 +3325,7 @@ class Article {
*/
public function doRollback( $fromP, $summary, $token, $bot, &$resultDetails ) {
global $wgUser;
+
$resultDetails = null;
# Check permissions
@@ -3033,15 +3333,18 @@ class Article {
$rollbackErrors = $this->mTitle->getUserPermissionsErrors( 'rollback', $wgUser );
$errors = array_merge( $editErrors, wfArrayDiff2( $rollbackErrors, $editErrors ) );
- if ( !$wgUser->matchEditToken( $token, array( $this->mTitle->getPrefixedText(), $fromP ) ) )
+ if ( !$wgUser->matchEditToken( $token, array( $this->mTitle->getPrefixedText(), $fromP ) ) ) {
$errors[] = array( 'sessionfailure' );
+ }
if ( $wgUser->pingLimiter( 'rollback' ) || $wgUser->pingLimiter() ) {
$errors[] = array( 'actionthrottledtext' );
}
+
# If there were errors, bail out now
- if ( !empty( $errors ) )
+ if ( !empty( $errors ) ) {
return $errors;
+ }
return $this->commitRollback( $fromP, $summary, $bot, $resultDetails );
}
@@ -3057,6 +3360,7 @@ class Article {
*/
public function commitRollback( $fromP, $summary, $bot, &$resultDetails ) {
global $wgUseRCPatrol, $wgUser, $wgLang;
+
$dbw = wfGetDB( DB_MASTER );
if ( wfReadOnly() ) {
@@ -3092,12 +3396,12 @@ class Article {
"rev_user != {$user} OR rev_user_text != {$user_text}"
), __METHOD__,
array( 'USE INDEX' => 'page_timestamp',
- 'ORDER BY' => 'rev_timestamp DESC' )
+ 'ORDER BY' => 'rev_timestamp DESC' )
);
if ( $s === false ) {
# No one else ever edited this page
return array( array( 'cantrollback' ) );
- } else if ( $s->rev_deleted & REVISION::DELETED_TEXT || $s->rev_deleted & REVISION::DELETED_USER ) {
+ } else if ( $s->rev_deleted & Revision::DELETED_TEXT || $s->rev_deleted & Revision::DELETED_USER ) {
# Only admins can see this text
return array( array( 'notvisiblerev' ) );
}
@@ -3107,6 +3411,7 @@ class Article {
# Mark all reverted edits as bot
$set['rc_bot'] = 1;
}
+
if ( $wgUseRCPatrol ) {
# Mark all reverted edits as patrolled
$set['rc_patrolled'] = 1;
@@ -3143,11 +3448,14 @@ class Article {
# Save
$flags = EDIT_UPDATE;
- if ( $wgUser->isAllowed( 'minoredit' ) )
+ if ( $wgUser->isAllowed( 'minoredit' ) ) {
$flags |= EDIT_MINOR;
+ }
- if ( $bot && ( $wgUser->isAllowed( 'markbotedits' ) || $wgUser->isAllowed( 'bot' ) ) )
+ if ( $bot && ( $wgUser->isAllowed( 'markbotedits' ) || $wgUser->isAllowed( 'bot' ) ) ) {
$flags |= EDIT_FORCE_BOT;
+ }
+
# Actually store the edit
$status = $this->doEdit( $target->getText(), $summary, $flags, $target->getId() );
if ( !empty( $status->value['revision'] ) ) {
@@ -3164,6 +3472,7 @@ class Article {
'target' => $target,
'newid' => $revId
);
+
return array();
}
@@ -3171,7 +3480,8 @@ class Article {
* User interface for rollback operations
*/
public function rollback() {
- global $wgUser, $wgOut, $wgRequest, $wgUseRCPatrol;
+ global $wgUser, $wgOut, $wgRequest;
+
$details = null;
$result = $this->doRollback(
@@ -3186,26 +3496,31 @@ class Article {
$wgOut->rateLimited();
return;
}
+
if ( isset( $result[0][0] ) && ( $result[0][0] == 'alreadyrolled' || $result[0][0] == 'cantrollback' ) ) {
$wgOut->setPageTitle( wfMsg( 'rollbackfailed' ) );
$errArray = $result[0];
$errMsg = array_shift( $errArray );
$wgOut->addWikiMsgArray( $errMsg, $errArray );
+
if ( isset( $details['current'] ) ) {
$current = $details['current'];
+
if ( $current->getComment() != '' ) {
$wgOut->addWikiMsgArray( 'editcomment', array(
$wgUser->getSkin()->formatComment( $current->getComment() ) ), array( 'replaceafter' ) );
}
}
+
return;
}
+
# Display permissions errors before read-only message -- there's no
# point in misleading the user into thinking the inability to rollback
# is only temporary.
if ( !empty( $result ) && $result !== array( array( 'readonlytext' ) ) ) {
- # array_diff is completely broken for arrays of arrays, sigh. Re-
- # move any 'readonlytext' error manually.
+ # array_diff is completely broken for arrays of arrays, sigh.
+ # Remove any 'readonlytext' error manually.
$out = array();
foreach ( $result as $error ) {
if ( $error != array( 'readonlytext' ) ) {
@@ -3213,10 +3528,13 @@ class Article {
}
}
$wgOut->showPermissionsErrorPage( $out );
+
return;
}
+
if ( $result == array( array( 'readonlytext' ) ) ) {
$wgOut->readOnlyPage();
+
return;
}
@@ -3225,12 +3543,14 @@ class Article {
$newId = $details['newid'];
$wgOut->setPageTitle( wfMsg( 'actioncomplete' ) );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
+
if ( $current->getUserText() === '' ) {
$old = wfMsg( 'rev-deleted-user' );
} else {
$old = $wgUser->getSkin()->userLink( $current->getUser(), $current->getUserText() )
. $wgUser->getSkin()->userToolLinks( $current->getUser(), $current->getUserText() );
}
+
$new = $wgUser->getSkin()->userLink( $target->getUser(), $target->getUserText() )
. $wgUser->getSkin()->userToolLinks( $target->getUser(), $target->getUserText() );
$wgOut->addHTML( wfMsgExt( 'rollback-success', array( 'parse', 'replaceafter' ), $old, $new ) );
@@ -3242,7 +3562,6 @@ class Article {
}
}
-
/**
* Do standard deferred updates after page view
*/
@@ -3251,12 +3570,14 @@ class Article {
if ( wfReadOnly() ) {
return;
}
+
# Don't update page view counters on views from bot users (bug 14044)
if ( !$wgDisableCounters && !$wgUser->isAllowed( 'bot' ) && $this->getID() ) {
Article::incViewCount( $this->getID() );
$u = new SiteStatsUpdate( 1, 0, 0 );
array_push( $wgDeferredUpdateList, $u );
}
+
# Update newtalk / watchlist notification status
$wgUser->clearNotification( $this->mTitle );
}
@@ -3270,15 +3591,19 @@ class Article {
// Already prepared
return $this->mPreparedEdit;
}
+
global $wgParser;
+
$edit = (object)array();
$edit->revid = $revid;
$edit->newText = $text;
$edit->pst = $this->preSaveTransform( $text );
- $options = $this->getParserOptions();
- $edit->output = $wgParser->parse( $edit->pst, $this->mTitle, $options, true, true, $revid );
+ $edit->popts = $this->getParserOptions();
+ $edit->output = $wgParser->parse( $edit->pst, $this->mTitle, $edit->popts, true, true, $revid );
$edit->oldText = $this->getContent();
+
$this->mPreparedEdit = $edit;
+
return $edit;
}
@@ -3289,12 +3614,12 @@ class Article {
* Every 100th edit, prune the recent changes table.
*
* @private
- * @param $text New text of the article
- * @param $summary Edit summary
- * @param $minoredit Minor edit
+ * @param $text String: New text of the article
+ * @param $summary String: Edit summary
+ * @param $minoredit Boolean: Minor edit
* @param $timestamp_of_pagechange Timestamp associated with the page change
- * @param $newid rev_id value of the new revision
- * @param $changed Whether or not the content actually changed
+ * @param $newid Integer: rev_id value of the new revision
+ * @param $changed Boolean: Whether or not the content actually changed
*/
public function editUpdates( $text, $summary, $minoredit, $timestamp_of_pagechange, $newid, $changed = true ) {
global $wgDeferredUpdateList, $wgMessageCache, $wgUser, $wgEnableParserCache;
@@ -3313,9 +3638,8 @@ class Article {
# Save it to the parser cache
if ( $wgEnableParserCache ) {
- $popts = $this->getParserOptions();
$parserCache = ParserCache::singleton();
- $parserCache->save( $editInfo->output, $this, $popts );
+ $parserCache->save( $editInfo->output, $this, $editInfo->popts );
}
# Update the links tables
@@ -3329,10 +3653,12 @@ class Article {
// Flush old entries from the `recentchanges` table; we do this on
// random requests so as to avoid an increase in writes for no good reason
global $wgRCMaxAge;
+
$dbw = wfGetDB( DB_MASTER );
$cutoff = $dbw->timestamp( time() - $wgRCMaxAge );
$recentchanges = $dbw->tableName( 'recentchanges' );
$sql = "DELETE FROM $recentchanges WHERE rc_timestamp < '{$cutoff}'";
+
$dbw->query( $sql );
}
}
@@ -3356,7 +3682,8 @@ class Article {
# load of user talk pages and piss people off, nor if it's a minor edit
# by a properly-flagged bot.
if ( $this->mTitle->getNamespace() == NS_USER_TALK && $shortTitle != $wgUser->getTitleKey() && $changed
- && !( $minoredit && $wgUser->isAllowed( 'nominornewtalk' ) ) ) {
+ && !( $minoredit && $wgUser->isAllowed( 'nominornewtalk' ) )
+ ) {
if ( wfRunHooks( 'ArticleEditUpdateNewTalk', array( &$this ) ) ) {
$other = User::newFromName( $shortTitle, false );
if ( !$other ) {
@@ -3410,13 +3737,14 @@ class Article {
return;
}
- $unhide = $wgRequest->getInt( 'unhide' ) == 1 &&
- $wgUser->matchEditToken( $wgRequest->getVal( 'token' ), $oldid );
+ $unhide = $wgRequest->getInt( 'unhide' ) == 1;
+
# Cascade unhide param in links for easy deletion browsing
$extraParams = array();
if ( $wgRequest->getVal( 'unhide' ) ) {
$extraParams['unhide'] = 1;
}
+
$revision = Revision::newFromId( $oldid );
$current = ( $oldid == $this->mLatest );
@@ -3496,6 +3824,7 @@ class Article {
);
$cdel = '';
+
// User can delete revisions or view deleted revisions...
$canHide = $wgUser->isAllowed( 'deleterevision' );
if ( $canHide || ( $revision->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) ) {
@@ -3534,6 +3863,7 @@ class Article {
"</div>\n" .
"\n\t\t\t\t<div id=\"mw-revision-nav\">" . $cdel . wfMsgExt( 'revision-nav', array( 'escapenoentities', 'parsemag', 'replaceafter' ),
$prevdiff, $prevlink, $lnk, $curdiff, $nextlink, $nextdiff ) . "</div>\n\t\t\t";
+
$wgOut->setSubtitle( $r );
}
@@ -3541,10 +3871,13 @@ class Article {
* This function is called right before saving the wikitext,
* so we can do things like signatures and links-in-context.
*
- * @param $text String
+ * @param $text String article contents
+ * @return string article contents with altered wikitext markup (signatures
+ * converted, {{subst:}}, templates, etc.)
*/
public function preSaveTransform( $text ) {
global $wgParser, $wgUser;
+
return $wgParser->preSaveTransform( $text, $this->mTitle, $wgUser, ParserOptions::newFromUser( $wgUser ) );
}
@@ -3554,13 +3887,17 @@ class Article {
* checkLastModified returns true if it has taken care of all
* output to the client that is necessary for this request.
* (that is, it has sent a cached version of the page)
+ *
+ * @return boolean true if cached version send, false otherwise
*/
protected function tryFileCache() {
static $called = false;
+
if ( $called ) {
wfDebug( "Article::tryFileCache(): called twice!?\n" );
return false;
}
+
$called = true;
if ( $this->isFileCacheable() ) {
$cache = new HTMLFileCache( $this->mTitle );
@@ -3575,6 +3912,7 @@ class Article {
} else {
wfDebug( "Article::tryFileCache(): not cacheable\n" );
}
+
return false;
}
@@ -3584,45 +3922,51 @@ class Article {
*/
public function isFileCacheable() {
$cacheable = false;
+
if ( HTMLFileCache::useFileCache() ) {
- $cacheable = $this->getID() && !$this->mRedirectedFrom;
+ $cacheable = $this->getID() && !$this->mRedirectedFrom && !$this->mTitle->isRedirect();
// Extension may have reason to disable file caching on some pages.
if ( $cacheable ) {
$cacheable = wfRunHooks( 'IsFileCacheable', array( &$this ) );
}
}
+
return $cacheable;
}
/**
* Loads page_touched and returns a value indicating if it should be used
- *
+ * @return boolean true if not a redirect
*/
public function checkTouched() {
if ( !$this->mDataLoaded ) {
$this->loadPageData();
}
+
return !$this->mIsRedirect;
}
/**
* Get the page_touched field
+ * @return string containing GMT timestamp
*/
public function getTouched() {
- # Ensure that page data has been loaded
if ( !$this->mDataLoaded ) {
$this->loadPageData();
}
+
return $this->mTouched;
}
/**
* Get the page_latest field
+ * @return integer rev_id of current revision
*/
public function getLatest() {
if ( !$this->mDataLoaded ) {
$this->loadPageData();
}
+
return (int)$this->mLatest;
}
@@ -3648,6 +3992,7 @@ class Article {
$revision->insertOn( $dbw );
$this->updateRevisionOn( $dbw, $revision );
+ global $wgUser;
wfRunHooks( 'NewRevisionFromEditComplete', array( $this, $revision, false, $wgUser ) );
wfProfileOut( __METHOD__ );
@@ -3660,6 +4005,7 @@ class Article {
*/
public static function incViewCount( $id ) {
$id = intval( $id );
+
global $wgHitcounterUpdateFreq;
$dbw = wfGetDB( DB_MASTER );
@@ -3670,6 +4016,7 @@ class Article {
if ( $wgHitcounterUpdateFreq <= 1 || $dbType == 'sqlite' ) {
$dbw->query( "UPDATE $pageTable SET page_counter = page_counter + 1 WHERE page_id = $id" );
+
return;
}
@@ -3682,12 +4029,14 @@ class Article {
if ( ( rand() % $checkfreq != 0 ) or ( $dbw->lastErrno() != 0 ) ) {
# Most of the time (or on SQL errors), skip row count check
$dbw->ignoreErrors( $oldignore );
+
return;
}
$res = $dbw->query( "SELECT COUNT(*) as n FROM $hitcounterTable" );
$row = $dbw->fetchObject( $res );
$rown = intval( $row->n );
+
if ( $rown >= $wgHitcounterUpdateFreq ) {
wfProfileIn( 'Article::incViewCount-collect' );
$old_user_abort = ignore_user_abort( true );
@@ -3699,11 +4048,11 @@ class Article {
'GROUP BY hc_id', __METHOD__ );
$dbw->delete( 'hitcounter', '*', __METHOD__ );
$dbw->unlockTables( __METHOD__ );
+
if ( $dbType == 'mysql' ) {
$dbw->query( "UPDATE $pageTable,$acchitsTable SET page_counter=page_counter + hc_n " .
'WHERE page_id = hc_id', __METHOD__ );
- }
- else {
+ } else {
$dbw->query( "UPDATE $pageTable SET page_counter=page_counter + hc_n " .
"FROM $acchitsTable WHERE page_id = hc_id", __METHOD__ );
}
@@ -3712,6 +4061,7 @@ class Article {
ignore_user_abort( $old_user_abort );
wfProfileOut( 'Article::incViewCount-collect' );
}
+
$dbw->ignoreErrors( $oldignore );
}
@@ -3733,6 +4083,7 @@ class Article {
} else {
$other = $title->getTalkPage();
}
+
$other->invalidateCache();
$other->purgeSquid();
@@ -3741,14 +4092,19 @@ class Article {
$title->deleteTitleProtection();
}
+ /**
+ * Clears caches when article is deleted
+ */
public static function onArticleDelete( $title ) {
global $wgMessageCache;
+
# Update existence markers on article/talk tabs...
if ( $title->isTalkPage() ) {
$other = $title->getSubjectPage();
} else {
$other = $title->getTalkPage();
}
+
$other->invalidateCache();
$other->purgeSquid();
@@ -3762,24 +4118,30 @@ class Article {
if ( $title->getNamespace() == NS_MEDIAWIKI ) {
$wgMessageCache->replace( $title->getDBkey(), false );
}
+
# Images
if ( $title->getNamespace() == NS_FILE ) {
$update = new HTMLCacheUpdate( $title, 'imagelinks' );
$update->doUpdate();
}
+
# User talk pages
if ( $title->getNamespace() == NS_USER_TALK ) {
$user = User::newFromName( $title->getText(), false );
$user->setNewtalk( false );
}
+
# Image redirects
RepoGroup::singleton()->getLocalRepo()->invalidateImageRedirect( $title );
}
/**
* Purge caches on page update etc
+ *
+ * @param $title Title object
+ * @todo: verify that $title is always a Title object (and never false or null), add Title hint to parameter $title
*/
- public static function onArticleEdit( $title, $flags = '' ) {
+ public static function onArticleEdit( $title ) {
global $wgDeferredUpdateList;
// Invalidate caches of articles which include this page
@@ -3836,6 +4198,7 @@ class Article {
: 'noarticletextanon';
$wgOut->addHTML( wfMsgExt( $msg, 'parse' ) );
}
+
$wgOut->addHTML( '</div>' );
} else {
$dbr = wfGetDB( DB_SLAVE );
@@ -3852,15 +4215,21 @@ class Article {
$pageInfo = $this->pageCountInfo( $page );
$talkInfo = $this->pageCountInfo( $page->getTalkPage() );
+
+ //FIXME: unescaped messages
$wgOut->addHTML( "<ul><li>" . wfMsg( "numwatchers", $wgLang->formatNum( $numwatchers ) ) . '</li>' );
$wgOut->addHTML( "<li>" . wfMsg( 'numedits', $wgLang->formatNum( $pageInfo['edits'] ) ) . '</li>' );
+
if ( $talkInfo ) {
$wgOut->addHTML( '<li>' . wfMsg( "numtalkedits", $wgLang->formatNum( $talkInfo['edits'] ) ) . '</li>' );
}
+
$wgOut->addHTML( '<li>' . wfMsg( "numauthors", $wgLang->formatNum( $pageInfo['authors'] ) ) . '</li>' );
+
if ( $talkInfo ) {
$wgOut->addHTML( '<li>' . wfMsg( 'numtalkauthors', $wgLang->formatNum( $talkInfo['authors'] ) ) . '</li>' );
}
+
$wgOut->addHTML( '</ul>' );
}
}
@@ -3870,13 +4239,15 @@ class Article {
* on a given page. If page does not exist, returns false.
*
* @param $title Title object
- * @return array
+ * @return mixed array or boolean false
*/
public function pageCountInfo( $title ) {
$id = $title->getArticleId();
+
if ( $id == 0 ) {
return false;
}
+
$dbr = wfGetDB( DB_SLAVE );
$rev_clause = array( 'rev_page' => $id );
$edits = $dbr->selectField(
@@ -3893,6 +4264,7 @@ class Article {
__METHOD__,
$this->getSelectOptions()
);
+
return array( 'edits' => $edits, 'authors' => $authors );
}
@@ -3905,20 +4277,23 @@ class Article {
public function getUsedTemplates() {
$result = array();
$id = $this->mTitle->getArticleID();
+
if ( $id == 0 ) {
return array();
}
+
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( array( 'templatelinks' ),
array( 'tl_namespace', 'tl_title' ),
array( 'tl_from' => $id ),
__METHOD__ );
+
if ( $res !== false ) {
foreach ( $res as $row ) {
$result[] = Title::makeTitle( $row->tl_namespace, $row->tl_title );
}
}
- $dbr->freeResult( $res );
+
return $result;
}
@@ -3931,21 +4306,24 @@ class Article {
public function getHiddenCategories() {
$result = array();
$id = $this->mTitle->getArticleID();
+
if ( $id == 0 ) {
return array();
}
+
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( array( 'categorylinks', 'page_props', 'page' ),
array( 'cl_to' ),
array( 'cl_from' => $id, 'pp_page=page_id', 'pp_propname' => 'hiddencat',
'page_namespace' => NS_CATEGORY, 'page_title=cl_to' ),
__METHOD__ );
+
if ( $res !== false ) {
foreach ( $res as $row ) {
$result[] = Title::makeTitle( NS_CATEGORY, $row->cl_to );
}
}
- $dbr->freeResult( $res );
+
return $result;
}
@@ -3957,11 +4335,14 @@ class Article {
* @return string An appropriate autosummary, or an empty string.
*/
public static function getAutosummary( $oldtext, $newtext, $flags ) {
+ global $wgContLang;
+
# Decide what kind of autosummary is needed.
# Redirect autosummaries
$ot = Title::newFromRedirect( $oldtext );
$rt = Title::newFromRedirect( $newtext );
+
if ( is_object( $rt ) && ( !is_object( $ot ) || !$rt->equals( $ot ) || $ot->getFragment() != $rt->getFragment() ) ) {
return wfMsgForContent( 'autoredircomment', $rt->getFullText() );
}
@@ -3969,10 +4350,11 @@ class Article {
# New page autosummaries
if ( $flags & EDIT_NEW && strlen( $newtext ) ) {
# If they're making a new article, give its text, truncated, in the summary.
- global $wgContLang;
+
$truncatedtext = $wgContLang->truncate(
str_replace( "\n", ' ', $newtext ),
max( 0, 200 - strlen( wfMsgForContent( 'autosumm-new' ) ) ) );
+
return wfMsgForContent( 'autosumm-new', $truncatedtext );
}
@@ -3981,10 +4363,11 @@ class Article {
return wfMsgForContent( 'autosumm-blank' );
} elseif ( strlen( $oldtext ) > 10 * strlen( $newtext ) && strlen( $newtext ) < 500 ) {
# Removing more than 90% of the article
- global $wgContLang;
+
$truncatedtext = $wgContLang->truncate(
$newtext,
max( 0, 200 - strlen( wfMsgForContent( 'autosumm-replace' ) ) ) );
+
return wfMsgForContent( 'autosumm-replace', $truncatedtext );
}
@@ -4000,6 +4383,7 @@ class Article {
*
* @param $text String
* @param $cache Boolean
+ * @param $parserOptions mixed ParserOptions object, or boolean false
*/
public function outputWikiText( $text, $cache = true, $parserOptions = false ) {
global $wgOut;
@@ -4012,9 +4396,14 @@ class Article {
* This does all the heavy lifting for outputWikitext, except it returns the parser
* output instead of sending it straight to $wgOut. Makes things nice and simple for,
* say, embedding thread pages within a discussion system (LiquidThreads)
+ *
+ * @param $text string
+ * @param $cache boolean
+ * @param $parserOptions parsing options, defaults to false
+ * @return string containing parsed output
*/
public function getOutputFromWikitext( $text, $cache = true, $parserOptions = false ) {
- global $wgParser, $wgOut, $wgEnableParserCache, $wgUseFileCache;
+ global $wgParser, $wgEnableParserCache, $wgUseFileCache;
if ( !$parserOptions ) {
$parserOptions = $this->getParserOptions();
@@ -4031,33 +4420,46 @@ class Article {
$this->mTitle->getPrefixedDBkey() ) );
}
- if ( $wgEnableParserCache && $cache && $this && $this->mParserOutput->getCacheTime() != -1 ) {
+ if ( $wgEnableParserCache && $cache && $this->mParserOutput->isCacheable() ) {
$parserCache = ParserCache::singleton();
$parserCache->save( $this->mParserOutput, $this, $parserOptions );
}
+
// Make sure file cache is not used on uncacheable content.
// Output that has magic words in it can still use the parser cache
// (if enabled), though it will generally expire sooner.
- if ( $this->mParserOutput->getCacheTime() == -1 || $this->mParserOutput->containsOldMagic() ) {
+ if ( !$this->mParserOutput->isCacheable() || $this->mParserOutput->containsOldMagic() ) {
$wgUseFileCache = false;
}
+
$this->doCascadeProtectionUpdates( $this->mParserOutput );
+
return $this->mParserOutput;
}
/**
* Get parser options suitable for rendering the primary article wikitext
+ * @return mixed ParserOptions object or boolean false
*/
public function getParserOptions() {
global $wgUser;
+
if ( !$this->mParserOptions ) {
$this->mParserOptions = new ParserOptions( $wgUser );
$this->mParserOptions->setTidy( true );
$this->mParserOptions->enableLimitReport();
}
- return $this->mParserOptions;
+
+ // Clone to allow modifications of the return value without affecting
+ // the cache
+ return clone $this->mParserOptions;
}
+ /**
+ * Updates cascading protections
+ *
+ * @param $parserOutput mixed ParserOptions object, or boolean false
+ **/
protected function doCascadeProtectionUpdates( $parserOutput ) {
if ( !$this->isCurrent() || wfReadOnly() || !$this->mTitle->areRestrictionsCascading() ) {
return;
@@ -4079,9 +4481,9 @@ class Article {
$res = $dbr->select( array( 'templatelinks' ),
array( 'tl_namespace', 'tl_title' ),
array( 'tl_from' => $id ),
- __METHOD__ );
+ __METHOD__
+ );
- global $wgContLang;
foreach ( $res as $row ) {
$tlTemplates["{$row->tl_namespace}:{$row->tl_title}"] = true;
}
@@ -4095,7 +4497,6 @@ class Article {
}
# Get the diff
- # Note that we simulate array_diff_key in PHP <5.0.x
$templates_diff = array_diff_key( $poTemplates, $tlTemplates );
if ( count( $templates_diff ) > 0 ) {
@@ -4111,7 +4512,6 @@ class Article {
*
* @param $added array The names of categories that were added
* @param $deleted array The names of categories that were deleted
- * @return null
*/
public function updateCategoryCounts( $added, $deleted ) {
$ns = $this->mTitle->getNamespace();
@@ -4128,7 +4528,9 @@ class Article {
# Okay, nothing to do
return;
}
+
$insertRows = array();
+
foreach ( $insertCats as $cat ) {
$insertRows[] = array(
'cat_id' => $dbw->nextSequenceValue( 'category_cat_id_seq' ),
@@ -4139,6 +4541,7 @@ class Article {
$addFields = array( 'cat_pages = cat_pages + 1' );
$removeFields = array( 'cat_pages = cat_pages - 1' );
+
if ( $ns == NS_CATEGORY ) {
$addFields[] = 'cat_subcats = cat_subcats + 1';
$removeFields[] = 'cat_subcats = cat_subcats - 1';
@@ -4155,6 +4558,7 @@ class Article {
__METHOD__
);
}
+
if ( $deleted ) {
$dbw->update(
'category',
@@ -4165,21 +4569,27 @@ class Article {
}
}
- /** Lightweight method to get the parser output for a page, checking the parser cache
+ /**
+ * Lightweight method to get the parser output for a page, checking the parser cache
* and so on. Doesn't consider most of the stuff that Article::view is forced to
* consider, so it's not appropriate to use there.
+ *
+ * @since 1.16 (r52326) for LiquidThreads
+ *
+ * @param $oldid mixed integer Revision ID or null
*/
- function getParserOutput( $oldid = null ) {
- global $wgEnableParserCache, $wgUser, $wgOut;
+ public function getParserOutput( $oldid = null ) {
+ global $wgEnableParserCache, $wgUser;
// Should the parser cache be used?
$useParserCache = $wgEnableParserCache &&
- intval( $wgUser->getOption( 'stubthreshold' ) ) == 0 &&
- $this->exists() &&
- $oldid === null;
+ $wgUser->getStubThreshold() == 0 &&
+ $this->exists() &&
+ $oldid === null;
wfDebug( __METHOD__ . ': using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" );
- if ( $wgUser->getOption( 'stubthreshold' ) ) {
+
+ if ( $wgUser->getStubThreshold() ) {
wfIncrStats( 'pcache_miss_stub' );
}
@@ -4197,4 +4607,66 @@ class Article {
return $parserOutput;
}
}
+
+ // Deprecated methods
+ /**
+ * Get the database which should be used for reads
+ *
+ * @return Database
+ * @deprecated - just call wfGetDB( DB_MASTER ) instead
+ */
+ function getDB() {
+ wfDeprecated( __METHOD__ );
+ return wfGetDB( DB_MASTER );
+ }
+
+}
+
+class PoolWorkArticleView extends PoolCounterWork {
+ private $mArticle;
+
+ function __construct( $article, $key, $useParserCache, $parserOptions ) {
+ parent::__construct( 'ArticleView', $key );
+ $this->mArticle = $article;
+ $this->cacheable = $useParserCache;
+ $this->parserOptions = $parserOptions;
+ }
+
+ function doWork() {
+ return $this->mArticle->doViewParse();
+ }
+
+ function getCachedWork() {
+ global $wgOut;
+
+ $parserCache = ParserCache::singleton();
+ $this->mArticle->mParserOutput = $parserCache->get( $this->mArticle, $this->parserOptions );
+
+ if ( $this->mArticle->mParserOutput !== false ) {
+ wfDebug( __METHOD__ . ": showing contents parsed by someone else\n" );
+ $wgOut->addParserOutput( $this->mArticle->mParserOutput );
+ # Ensure that UI elements requiring revision ID have
+ # the correct version information.
+ $wgOut->setRevisionId( $this->mArticle->getLatest() );
+ return true;
+ }
+ return false;
+ }
+
+ function fallback() {
+ return $this->mArticle->tryDirtyCache();
+ }
+
+ function error( $status ) {
+ global $wgOut;
+
+ $wgOut->clearHTML(); // for release() errors
+ $wgOut->enableClientCache( false );
+ $wgOut->setRobotPolicy( 'noindex,nofollow' );
+
+ $errortext = $status->getWikiText( false, 'view-pool-error' );
+ $wgOut->addWikiText( '<div class="errorbox">' . $errortext . '</div>' );
+
+ return false;
+ }
}
diff --git a/includes/AuthPlugin.php b/includes/AuthPlugin.php
index 87ac8adb..7dc99259 100644
--- a/includes/AuthPlugin.php
+++ b/includes/AuthPlugin.php
@@ -1,23 +1,27 @@
<?php
/**
+ * Authentication plugin interface
+ *
+ * Copyright © 2004 Brion Vibber <brion@pobox.com>
+ * 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
+ * (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
*/
-# Copyright (C) 2004 Brion Vibber <brion@pobox.com>
-# 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
-# (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
/**
* Authentication plugin interface. Instantiate a subclass of AuthPlugin
@@ -105,7 +109,6 @@ class AuthPlugin {
return true;
}
-
/**
* Return true if the wiki should create a new local account automatically
* when asked to login a user who doesn't exist locally but does in the
@@ -131,11 +134,11 @@ class AuthPlugin {
* @return Boolean
*/
public function allowPropChange( $prop = '' ) {
- if( $prop == 'realname' && is_callable( array( $this, 'allowRealNameChange' ) ) ) {
+ if ( $prop == 'realname' && is_callable( array( $this, 'allowRealNameChange' ) ) ) {
return $this->allowRealNameChange();
- } elseif( $prop == 'emailaddress' && is_callable( array( $this, 'allowEmailChange' ) ) ) {
+ } elseif ( $prop == 'emailaddress' && is_callable( array( $this, 'allowEmailChange' ) ) ) {
return $this->allowEmailChange();
- } elseif( $prop == 'nickname' && is_callable( array( $this, 'allowNickChange' ) ) ) {
+ } elseif ( $prop == 'nickname' && is_callable( array( $this, 'allowNickChange' ) ) ) {
return $this->allowNickChange();
} else {
return true;
@@ -197,11 +200,10 @@ class AuthPlugin {
* @param $realname String
* @return Boolean
*/
- public function addUser( $user, $password, $email='', $realname='' ) {
+ public function addUser( $user, $password, $email = '', $realname = '' ) {
return true;
}
-
/**
* Return true to prevent logins that don't authenticate here from being
* checked against the local database's password fields.
@@ -236,7 +238,7 @@ class AuthPlugin {
* @param $user User object.
* @param $autocreate Boolean: True if user is being autocreated on login
*/
- public function initUser( &$user, $autocreate=false ) {
+ public function initUser( &$user, $autocreate = false ) {
# Override this to do something.
}
@@ -247,7 +249,7 @@ class AuthPlugin {
public function getCanonicalName( $username ) {
return $username;
}
-
+
/**
* Get an instance of a User object
*
@@ -262,22 +264,22 @@ class AuthPluginUser {
function __construct( $user ) {
# Override this!
}
-
+
public function getId() {
# Override this!
return -1;
}
-
+
public function isLocked() {
# Override this!
return false;
}
-
+
public function isHidden() {
# Override this!
return false;
}
-
+
public function resetAuthToken() {
# Override this!
return true;
diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php
index cecb53f9..f1605a56 100644
--- a/includes/AutoLoader.php
+++ b/includes/AutoLoader.php
@@ -1,10 +1,17 @@
<?php
-/* This defines autoloading handler for whole MediaWiki framework */
+/**
+ * This defines autoloading handler for whole MediaWiki framework
+ *
+ * @file
+ */
-# Locations of core classes
-# Extension classes are specified with $wgAutoloadClasses
-# This array is a global instead of a static member of AutoLoader to work around a bug in APC
+/**
+ * Locations of core classes
+ * Extension classes are specified with $wgAutoloadClasses
+ * This array is a global instead of a static member of AutoLoader to work around a bug in APC
+ */
global $wgAutoloadLocalClasses;
+
$wgAutoloadLocalClasses = array(
# Includes
'AjaxDispatcher' => 'includes/AjaxDispatcher.php',
@@ -20,6 +27,7 @@ $wgAutoloadLocalClasses = array(
'BagOStuff' => 'includes/BagOStuff.php',
'Block' => 'includes/Block.php',
'CacheDependency' => 'includes/CacheDependency.php',
+ 'CacheTime' => 'includes/parser/ParserOutput.php',
'Category' => 'includes/Category.php',
'Categoryfinder' => 'includes/Categoryfinder.php',
'CategoryPage' => 'includes/CategoryPage.php',
@@ -35,6 +43,7 @@ $wgAutoloadLocalClasses = array(
'ChangesFeed' => 'includes/ChangesFeed.php',
'ChangeTags' => 'includes/ChangeTags.php',
'ChannelFeed' => 'includes/Feed.php',
+ 'Collation' => 'includes/Collation.php',
'Cookie' => 'includes/HttpFunctions.php',
'CookieJar' => 'includes/HttpFunctions.php',
'ConcatenatedGzipHistoryBlob' => 'includes/HistoryBlob.php',
@@ -44,12 +53,13 @@ $wgAutoloadLocalClasses = array(
'ConstantDependency' => 'includes/CacheDependency.php',
'CreativeCommonsRdf' => 'includes/Metadata.php',
'Credits' => 'includes/Credits.php',
+ 'CSSJanus' => 'includes/libs/CSSJanus.php',
+ 'CSSMin' => 'includes/libs/CSSMin.php',
'DBABagOStuff' => 'includes/BagOStuff.php',
'DependencyWrapper' => 'includes/CacheDependency.php',
'DiffHistoryBlob' => 'includes/HistoryBlob.php',
'DjVuImage' => 'includes/DjVuImage.php',
'DoubleReplacer' => 'includes/StringUtils.php',
- 'DoubleRedirectJob' => 'includes/DoubleRedirectJob.php',
'DublinCoreRdf' => 'includes/Metadata.php',
'Dump7ZipOutput' => 'includes/Export.php',
'DumpBZip2Output' => 'includes/Export.php',
@@ -64,10 +74,8 @@ $wgAutoloadLocalClasses = array(
'DumpPipeOutput' => 'includes/Export.php',
'eAccelBagOStuff' => 'includes/BagOStuff.php',
'EditPage' => 'includes/EditPage.php',
- 'EmaillingJob' => 'includes/EmaillingJob.php',
'EmailNotification' => 'includes/UserMailer.php',
'EnhancedChangesList' => 'includes/ChangesList.php',
- 'EnotifNotifyJob' => 'includes/EnotifNotifyJob.php',
'ErrorPageError' => 'includes/Exception.php',
'Exif' => 'includes/Exif.php',
'ExplodeIterator' => 'includes/StringUtils.php',
@@ -76,9 +84,6 @@ $wgAutoloadLocalClasses = array(
'ExternalStoreHttp' => 'includes/ExternalStoreHttp.php',
'ExternalStore' => 'includes/ExternalStore.php',
'ExternalUser' => 'includes/ExternalUser.php',
- 'ExternalUser_Hardcoded' => 'includes/extauth/Hardcoded.php',
- 'ExternalUser_MediaWiki' => 'includes/extauth/MediaWiki.php',
- 'ExternalUser_vB' => 'includes/extauth/vB.php',
'FatalError' => 'includes/Exception.php',
'FakeTitle' => 'includes/FakeTitle.php',
'FakeMemCachedClient' => 'includes/ObjectCache.php',
@@ -92,8 +97,6 @@ $wgAutoloadLocalClasses = array(
'ForkController' => 'includes/ForkController.php',
'FormatExif' => 'includes/Exif.php',
'FormOptions' => 'includes/FormOptions.php',
- 'GIFMetadataExtractor' => 'includes/media/GIFMetadataExtractor.php',
- 'GIFHandler' => 'includes/media/GIF.php',
'GlobalDependency' => 'includes/CacheDependency.php',
'HashBagOStuff' => 'includes/BagOStuff.php',
'HashtableReplacer' => 'includes/StringUtils.php',
@@ -122,8 +125,8 @@ $wgAutoloadLocalClasses = array(
'HTMLRadioField' => 'includes/HTMLForm.php',
'HTMLInfoField' => 'includes/HTMLForm.php',
'Http' => 'includes/HttpFunctions.php',
- 'HttpRequest' => 'includes/HttpFunctions.php',
- 'IEContentAnalyzer' => 'includes/IEContentAnalyzer.php',
+ 'HttpRequest' => 'includes/HttpFunctions.old.php',
+ 'IcuCollation' => 'includes/Collation.php',
'ImageGallery' => 'includes/ImageGallery.php',
'ImageHistoryList' => 'includes/ImagePage.php',
'ImageHistoryPseudoPager' => 'includes/ImagePage.php',
@@ -133,8 +136,7 @@ $wgAutoloadLocalClasses = array(
'IndexPager' => 'includes/Pager.php',
'Interwiki' => 'includes/Interwiki.php',
'IP' => 'includes/IP.php',
- 'Job' => 'includes/JobQueue.php',
- 'JSMin' => 'includes/JSMin.php',
+ 'JavaScriptMinifier' => 'includes/libs/JavaScriptMinifier.php',
'LCStore_DB' => 'includes/LocalisationCache.php',
'LCStore_CDB' => 'includes/LocalisationCache.php',
'LCStore_Null' => 'includes/LocalisationCache.php',
@@ -157,18 +159,18 @@ $wgAutoloadLocalClasses = array(
'MagicWord' => 'includes/MagicWord.php',
'MailAddress' => 'includes/UserMailer.php',
'MathRenderer' => 'includes/Math.php',
- 'MediaTransformError' => 'includes/MediaTransformOutput.php',
- 'MediaTransformOutput' => 'includes/MediaTransformOutput.php',
'MediaWikiBagOStuff' => 'includes/BagOStuff.php',
'MediaWiki_I18N' => 'includes/SkinTemplate.php',
'MediaWiki' => 'includes/Wiki.php',
'MemCachedClientforWiki' => 'includes/memcached-client.php',
+ 'Message' => 'includes/Message.php',
+ 'MessageBlobStore' => 'includes/MessageBlobStore.php',
'MessageCache' => 'includes/MessageCache.php',
'MimeMagic' => 'includes/MimeMagic.php',
'MWException' => 'includes/Exception.php',
+ 'MWHttpRequest' => 'includes/HttpFunctions.php',
'MWMemcached' => 'includes/memcached-client.php',
'MWNamespace' => 'includes/Namespace.php',
- 'Namespace' => 'includes/NamespaceCompat.php', // Compat
'OldChangesList' => 'includes/ChangesList.php',
'OutputPage' => 'includes/OutputPage.php',
'PageQueryPage' => 'includes/PageQueryPage.php',
@@ -177,8 +179,10 @@ $wgAutoloadLocalClasses = array(
'Pager' => 'includes/Pager.php',
'PasswordError' => 'includes/User.php',
'PatrolLog' => 'includes/PatrolLog.php',
+ 'PhpHttpRequest' => 'includes/HttpFunctions.php',
'PoolCounter' => 'includes/PoolCounter.php',
'PoolCounter_Stub' => 'includes/PoolCounter.php',
+ 'PoolCounterWork' => 'includes/PoolCounter.php',
'Preferences' => 'includes/Preferences.php',
'PrefixSearch' => 'includes/PrefixSearch.php',
'Profiler' => 'includes/Profiler.php',
@@ -192,13 +196,21 @@ $wgAutoloadLocalClasses = array(
'RCCacheEntry' => 'includes/ChangesList.php',
'RdfMetaData' => 'includes/Metadata.php',
'RecentChange' => 'includes/RecentChange.php',
- 'RefreshLinksJob' => 'includes/RefreshLinksJob.php',
- 'RefreshLinksJob2' => 'includes/RefreshLinksJob.php',
'RegexlikeReplacer' => 'includes/StringUtils.php',
'ReplacementArray' => 'includes/StringUtils.php',
'Replacer' => 'includes/StringUtils.php',
+ 'ResourceLoader' => 'includes/resourceloader/ResourceLoader.php',
+ 'ResourceLoaderContext' => 'includes/resourceloader/ResourceLoaderContext.php',
+ 'ResourceLoaderModule' => 'includes/resourceloader/ResourceLoaderModule.php',
+ 'ResourceLoaderWikiModule' => 'includes/resourceloader/ResourceLoaderWikiModule.php',
+ 'ResourceLoaderFileModule' => 'includes/resourceloader/ResourceLoaderFileModule.php',
+ 'ResourceLoaderSiteModule' => 'includes/resourceloader/ResourceLoaderSiteModule.php',
+ 'ResourceLoaderUserModule' => 'includes/resourceloader/ResourceLoaderUserModule.php',
+ 'ResourceLoaderUserOptionsModule' => 'includes/resourceloader/ResourceLoaderUserOptionsModule.php',
+ 'ResourceLoaderStartUpModule' => 'includes/resourceloader/ResourceLoaderStartUpModule.php',
'ReverseChronologicalPager' => 'includes/Pager.php',
'Revision' => 'includes/Revision.php',
+ 'RevisionDelete' => 'includes/revisiondelete/RevisionDelete.php',
'RSSFeed' => 'includes/Feed.php',
'Sanitizer' => 'includes/Sanitizer.php',
'SiteConfiguration' => 'includes/SiteConfiguration.php',
@@ -218,24 +230,17 @@ $wgAutoloadLocalClasses = array(
'SquidPurgeClientPool' => 'includes/SquidPurgeClient.php',
'Status' => 'includes/Status.php',
'StubContLang' => 'includes/StubObject.php',
- 'StubUser' => 'includes/StubObject.php',
'StubUserLang' => 'includes/StubObject.php',
'StubObject' => 'includes/StubObject.php',
'StringUtils' => 'includes/StringUtils.php',
'TablePager' => 'includes/Pager.php',
- 'ThumbnailImage' => 'includes/MediaTransformOutput.php',
- 'TiffHandler' => 'includes/media/Tiff.php',
'TitleDependency' => 'includes/CacheDependency.php',
'Title' => 'includes/Title.php',
'TitleArray' => 'includes/TitleArray.php',
'TitleArrayFromResult' => 'includes/TitleArray.php',
'TitleListDependency' => 'includes/CacheDependency.php',
- 'TransformParameterError' => 'includes/MediaTransformOutput.php',
'UnlistedSpecialPage' => 'includes/SpecialPage.php',
- 'UploadBase' => 'includes/upload/UploadBase.php',
- 'UploadFromStash' => 'includes/upload/UploadFromStash.php',
- 'UploadFromFile' => 'includes/upload/UploadFromFile.php',
- 'UploadFromUrl' => 'includes/upload/UploadFromUrl.php',
+ 'UppercaseCollation' => 'includes/Collation.php',
'User' => 'includes/User.php',
'UserArray' => 'includes/UserArray.php',
'UserArrayFromResult' => 'includes/UserArray.php',
@@ -245,6 +250,7 @@ $wgAutoloadLocalClasses = array(
'WatchedItem' => 'includes/WatchedItem.php',
'WatchlistEditor' => 'includes/WatchlistEditor.php',
'WebRequest' => 'includes/WebRequest.php',
+ 'WebRequestUpload' => 'includes/WebRequest.php',
'WebResponse' => 'includes/WebResponse.php',
'WikiError' => 'includes/WikiError.php',
'WikiErrorMsg' => 'includes/WikiError.php',
@@ -252,9 +258,11 @@ $wgAutoloadLocalClasses = array(
'WikiMap' => 'includes/WikiMap.php',
'WikiReference' => 'includes/WikiMap.php',
'WikiXmlError' => 'includes/WikiError.php',
+ 'WinCacheBagOStuff' => 'includes/BagOStuff.php',
'XCacheBagOStuff' => 'includes/BagOStuff.php',
'XmlDumpWriter' => 'includes/Export.php',
'Xml' => 'includes/Xml.php',
+ 'XmlJsCode' => 'includes/Xml.php',
'XmlSelect' => 'includes/Xml.php',
'XmlTypeCheck' => 'includes/XmlTypeCheck.php',
'ZhClient' => 'includes/ZhClient.php',
@@ -270,6 +278,7 @@ $wgAutoloadLocalClasses = array(
'ApiFeedWatchlist' => 'includes/api/ApiFeedWatchlist.php',
'ApiFormatBase' => 'includes/api/ApiFormatBase.php',
'ApiFormatDbg' => 'includes/api/ApiFormatDbg.php',
+ 'ApiFormatDump' => 'includes/api/ApiFormatDump.php',
'ApiFormatFeedWrapper' => 'includes/api/ApiFormatBase.php',
'ApiFormatJson' => 'includes/api/ApiFormatJson.php',
'ApiFormatPhp' => 'includes/api/ApiFormatPhp.php',
@@ -292,6 +301,7 @@ $wgAutoloadLocalClasses = array(
'ApiPatrol' => 'includes/api/ApiPatrol.php',
'ApiProtect' => 'includes/api/ApiProtect.php',
'ApiPurge' => 'includes/api/ApiPurge.php',
+ 'ApiRsd' => 'includes/api/ApiRsd.php',
'ApiQuery' => 'includes/api/ApiQuery.php',
'ApiQueryAllCategories' => 'includes/api/ApiQueryAllCategories.php',
'ApiQueryAllimages' => 'includes/api/ApiQueryAllimages.php',
@@ -310,20 +320,25 @@ $wgAutoloadLocalClasses = array(
'ApiQueryDisabled' => 'includes/api/ApiQueryDisabled.php',
'ApiQueryDuplicateFiles' => 'includes/api/ApiQueryDuplicateFiles.php',
'ApiQueryExtLinksUsage' => 'includes/api/ApiQueryExtLinksUsage.php',
+ 'ApiQueryFilearchive' => 'includes/api/ApiQueryFilearchive.php',
'ApiQueryExternalLinks' => 'includes/api/ApiQueryExternalLinks.php',
'ApiQueryGeneratorBase' => 'includes/api/ApiQueryBase.php',
'ApiQueryImageInfo' => 'includes/api/ApiQueryImageInfo.php',
'ApiQueryImages' => 'includes/api/ApiQueryImages.php',
'ApiQueryInfo' => 'includes/api/ApiQueryInfo.php',
+ 'ApiQueryIWLinks' => 'includes/api/ApiQueryIWLinks.php',
+ 'ApiQueryIWBacklinks' => 'includes/api/ApiQueryIWBacklinks.php',
'ApiQueryLangLinks' => 'includes/api/ApiQueryLangLinks.php',
'ApiQueryLinks' => 'includes/api/ApiQueryLinks.php',
'ApiQueryLogEvents' => 'includes/api/ApiQueryLogEvents.php',
+ 'ApiQueryPageProps' => 'includes/api/ApiQueryPageProps.php',
'ApiQueryProtectedTitles' => 'includes/api/ApiQueryProtectedTitles.php',
'ApiQueryRandom' => 'includes/api/ApiQueryRandom.php',
- 'ApiQueryRecentChanges'=> 'includes/api/ApiQueryRecentChanges.php',
+ 'ApiQueryRecentChanges' => 'includes/api/ApiQueryRecentChanges.php',
'ApiQueryRevisions' => 'includes/api/ApiQueryRevisions.php',
'ApiQuerySearch' => 'includes/api/ApiQuerySearch.php',
'ApiQuerySiteinfo' => 'includes/api/ApiQuerySiteinfo.php',
+ 'ApiQueryStashImageInfo' => 'includes/api/ApiQueryStashImageInfo.php',
'ApiQueryTags' => 'includes/api/ApiQueryTags.php',
'ApiQueryUserInfo' => 'includes/api/ApiQueryUserInfo.php',
'ApiQueryUsers' => 'includes/api/ApiQueryUsers.php',
@@ -337,9 +352,13 @@ $wgAutoloadLocalClasses = array(
'ApiUpload' => 'includes/api/ApiUpload.php',
'ApiWatch' => 'includes/api/ApiWatch.php',
- 'Spyc' => 'includes/api/ApiFormatYaml_spyc.php',
'UsageException' => 'includes/api/ApiMain.php',
+ # includes/extauth
+ 'ExternalUser_Hardcoded' => 'includes/extauth/Hardcoded.php',
+ 'ExternalUser_MediaWiki' => 'includes/extauth/MediaWiki.php',
+ 'ExternalUser_vB' => 'includes/extauth/vB.php',
+
# includes/json
'Services_JSON' => 'includes/json/Services_JSON.php',
'Services_JSON_Error' => 'includes/json/Services_JSON.php',
@@ -356,23 +375,26 @@ $wgAutoloadLocalClasses = array(
'DatabasePostgres' => 'includes/db/DatabasePostgres.php',
'DatabaseSqlite' => 'includes/db/DatabaseSqlite.php',
'DatabaseSqliteStandalone' => 'includes/db/DatabaseSqlite.php',
+ 'DatabaseType' => 'includes/db/Database.php',
'DBConnectionError' => 'includes/db/Database.php',
'DBError' => 'includes/db/Database.php',
'DBObject' => 'includes/db/Database.php',
'DBQueryError' => 'includes/db/Database.php',
'DBUnexpectedError' => 'includes/db/Database.php',
+ 'FakeResultWrapper' => 'includes/db/Database.php',
+ 'Field' => 'includes/db/Database.php',
'IBM_DB2Blob' => 'includes/db/DatabaseIbm_db2.php',
'LBFactory' => 'includes/db/LBFactory.php',
'LBFactory_Multi' => 'includes/db/LBFactory_Multi.php',
'LBFactory_Simple' => 'includes/db/LBFactory.php',
+ 'LBFactory_Single' => 'includes/db/LBFactory_Single.php',
'LikeMatch' => 'includes/db/Database.php',
'LoadBalancer' => 'includes/db/LoadBalancer.php',
+ 'LoadBalancer_Single' => 'includes/db/LBFactory_Single.php',
'LoadMonitor' => 'includes/db/LoadMonitor.php',
'LoadMonitor_MySQL' => 'includes/db/LoadMonitor.php',
- 'MSSQLField' => 'includes/db/DatabaseMssql.php',
- 'MySQLField' => 'includes/db/Database.php',
+ 'MySQLField' => 'includes/db/DatabaseMysql.php',
'MySQLMasterPos' => 'includes/db/DatabaseMysql.php',
- 'ORABlob' => 'includes/db/DatabaseOracle.php',
'ORAField' => 'includes/db/DatabaseOracle.php',
'ORAResult' => 'includes/db/DatabaseOracle.php',
'PostgresField' => 'includes/db/DatabasePostgres.php',
@@ -382,23 +404,23 @@ $wgAutoloadLocalClasses = array(
'IBM_DB2Field' => 'includes/db/DatabaseIbm_db2.php',
# includes/diff
- 'ArrayDiffFormatter' => 'includes/diff/DifferenceEngine.php',
- '_DiffEngine' => 'includes/diff/DifferenceEngine.php',
- 'DifferenceEngine' => 'includes/diff/DifferenceInterface.php',
- 'DiffFormatter' => 'includes/diff/DifferenceEngine.php',
- 'Diff' => 'includes/diff/DifferenceEngine.php',
- '_DiffOp_Add' => 'includes/diff/DifferenceEngine.php',
- '_DiffOp_Change' => 'includes/diff/DifferenceEngine.php',
- '_DiffOp_Copy' => 'includes/diff/DifferenceEngine.php',
- '_DiffOp_Delete' => 'includes/diff/DifferenceEngine.php',
- '_DiffOp' => 'includes/diff/DifferenceEngine.php',
- '_HWLDF_WordAccumulator' => 'includes/diff/DifferenceEngine.php',
- 'MappedDiff' => 'includes/diff/DifferenceEngine.php',
- 'RangeDifference' => 'includes/diff/Diff.php',
- 'TableDiffFormatter' => 'includes/diff/DifferenceEngine.php',
- 'UnifiedDiffFormatter' => 'includes/diff/DifferenceEngine.php',
- 'WikiDiff3' => 'includes/diff/Diff.php',
- 'WordLevelDiff' => 'includes/diff/DifferenceEngine.php',
+ 'ArrayDiffFormatter' => 'includes/diff/WikiDiff.php',
+ '_DiffEngine' => 'includes/diff/WikiDiff.php',
+ 'DifferenceEngine' => 'includes/diff/DifferenceEngine.php',
+ 'DiffFormatter' => 'includes/diff/WikiDiff.php',
+ 'Diff' => 'includes/diff/WikiDiff.php',
+ '_DiffOp_Add' => 'includes/diff/WikiDiff.php',
+ '_DiffOp_Change' => 'includes/diff/WikiDiff.php',
+ '_DiffOp_Copy' => 'includes/diff/WikiDiff.php',
+ '_DiffOp_Delete' => 'includes/diff/WikiDiff.php',
+ '_DiffOp' => 'includes/diff/WikiDiff.php',
+ '_HWLDF_WordAccumulator' => 'includes/diff/WikiDiff.php',
+ 'MappedDiff' => 'includes/diff/WikiDiff.php',
+ 'RangeDifference' => 'includes/diff/WikiDiff3.php',
+ 'TableDiffFormatter' => 'includes/diff/WikiDiff.php',
+ 'UnifiedDiffFormatter' => 'includes/diff/WikiDiff.php',
+ 'WikiDiff3' => 'includes/diff/WikiDiff3.php',
+ 'WordLevelDiff' => 'includes/diff/WikiDiff.php',
# includes/filerepo
'ArchivedFile' => 'includes/filerepo/ArchivedFile.php',
@@ -421,14 +443,59 @@ $wgAutoloadLocalClasses = array(
'RepoGroup' => 'includes/filerepo/RepoGroup.php',
'UnregisteredLocalFile' => 'includes/filerepo/UnregisteredLocalFile.php',
+ # includes/installer
+ 'CliInstaller' => 'includes/installer/CliInstaller.php',
+ 'Installer' => 'includes/installer/Installer.php',
+ 'DatabaseInstaller' => 'includes/installer/DatabaseInstaller.php',
+ 'DatabaseUpdater' => 'includes/installer/DatabaseUpdater.php',
+ 'LBFactory_InstallerFake' => 'includes/installer/Installer.php',
+ 'LocalSettingsGenerator' => 'includes/installer/LocalSettingsGenerator.php',
+ 'WebInstaller' => 'includes/installer/WebInstaller.php',
+ 'WebInstallerPage' => 'includes/installer/WebInstallerPage.php',
+ 'WebInstallerOutput' => 'includes/installer/WebInstallerOutput.php',
+ 'MysqlInstaller' => 'includes/installer/MysqlInstaller.php',
+ 'MysqlUpdater' => 'includes/installer/MysqlUpdater.php',
+ 'PhpXmlBugTester' => 'includes/installer/PhpBugTests.php',
+ 'PhpRefCallBugTester' => 'includes/installer/PhpBugTests.php',
+ 'PostgresInstaller' => 'includes/installer/PostgresInstaller.php',
+ 'PostgresUpdater' => 'includes/installer/PostgresUpdater.php',
+ 'SqliteInstaller' => 'includes/installer/SqliteInstaller.php',
+ 'SqliteUpdater' => 'includes/installer/SqliteUpdater.php',
+ 'OracleInstaller' => 'includes/installer/OracleInstaller.php',
+ 'OracleUpdater' => 'includes/installer/OracleUpdater.php',
+
+ # includes/job
+ 'DoubleRedirectJob' => 'includes/job/DoubleRedirectJob.php',
+ 'EmaillingJob' => 'includes/job/EmaillingJob.php',
+ 'EnotifNotifyJob' => 'includes/job/EnotifNotifyJob.php',
+ 'Job' => 'includes/job/JobQueue.php',
+ 'RefreshLinksJob' => 'includes/job/RefreshLinksJob.php',
+ 'RefreshLinksJob2' => 'includes/job/RefreshLinksJob.php',
+ 'UploadFromUrlJob' => 'includes/job/UploadFromUrlJob.php',
+
+ # includes/libs
+ 'IEContentAnalyzer' => 'includes/libs/IEContentAnalyzer.php',
+ 'IEUrlExtension' => 'includes/libs/IEUrlExtension.php',
+ 'Spyc' => 'includes/libs/spyc.php',
+
# includes/media
'BitmapHandler' => 'includes/media/Bitmap.php',
'BitmapHandler_ClientOnly' => 'includes/media/Bitmap_ClientOnly.php',
'BmpHandler' => 'includes/media/BMP.php',
'DjVuHandler' => 'includes/media/DjVu.php',
+ 'GIFHandler' => 'includes/media/GIF.php',
+ 'GIFMetadataExtractor' => 'includes/media/GIFMetadataExtractor.php',
'ImageHandler' => 'includes/media/Generic.php',
'MediaHandler' => 'includes/media/Generic.php',
+ 'MediaTransformError' => 'includes/media/MediaTransformOutput.php',
+ 'MediaTransformOutput' => 'includes/media/MediaTransformOutput.php',
+ 'PNGHandler' => 'includes/media/PNG.php',
+ 'PNGMetadataExtractor' => 'includes/media/PNGMetadataExtractor.php',
'SvgHandler' => 'includes/media/SVG.php',
+ 'SVGMetadataExtractor' => 'includes/media/SVGMetadataExtractor.php',
+ 'ThumbnailImage' => 'includes/media/MediaTransformOutput.php',
+ 'TiffHandler' => 'includes/media/Tiff.php',
+ 'TransformParameterError' => 'includes/media/MediaTransformOutput.php',
# includes/normal
'UtfNormal' => 'includes/normal/UtfNormal.php',
@@ -481,7 +548,7 @@ $wgAutoloadLocalClasses = array(
'SearchEngine' => 'includes/search/SearchEngine.php',
'SearchHighlighter' => 'includes/search/SearchEngine.php',
'SearchIBM_DB2' => 'includes/search/SearchIBM_DB2.php',
- 'SearchMySQL4' => 'includes/search/SearchMySQL4.php',
+ 'SearchMssql' => 'includes/search/SearchMssql.php',
'SearchMySQL' => 'includes/search/SearchMySQL.php',
'SearchOracle' => 'includes/search/SearchOracle.php',
'SearchPostgres' => 'includes/search/SearchPostgres.php',
@@ -510,8 +577,7 @@ $wgAutoloadLocalClasses = array(
'DoubleRedirectsPage' => 'includes/specials/SpecialDoubleRedirects.php',
'EmailConfirmation' => 'includes/specials/SpecialConfirmemail.php',
'EmailInvalidation' => 'includes/specials/SpecialConfirmemail.php',
- 'EmailUserForm' => 'includes/specials/SpecialEmailuser.php',
- 'FakeResultWrapper' => 'includes/specials/SpecialAllmessages.php',
+ 'SpecialEmailUser' => 'includes/specials/SpecialEmailuser.php',
'FewestrevisionsPage' => 'includes/specials/SpecialFewestrevisions.php',
'FileDuplicateSearchPage' => 'includes/specials/SpecialFileDuplicateSearch.php',
'IPBlockForm' => 'includes/specials/SpecialBlockip.php',
@@ -541,35 +607,50 @@ $wgAutoloadLocalClasses = array(
'PreferencesForm' => 'includes/Preferences.php',
'RandomPage' => 'includes/specials/SpecialRandompage.php',
'SpecialRevisionDelete' => 'includes/specials/SpecialRevisiondelete.php',
- 'RevisionDeleter' => 'includes/specials/SpecialRevisiondelete.php',
- 'RevDel_RevisionList' => 'includes/specials/SpecialRevisiondelete.php',
- 'RevDel_RevisionItem' => 'includes/specials/SpecialRevisiondelete.php',
- 'RevDel_ArchiveList' => 'includes/specials/SpecialRevisiondelete.php',
- 'RevDel_ArchiveItem' => 'includes/specials/SpecialRevisiondelete.php',
- 'RevDel_FileList' => 'includes/specials/SpecialRevisiondelete.php',
- 'RevDel_FileItem' => 'includes/specials/SpecialRevisiondelete.php',
- 'RevDel_ArchivedFileList' => 'includes/specials/SpecialRevisiondelete.php',
- 'RevDel_ArchivedFileItem' => 'includes/specials/SpecialRevisiondelete.php',
- 'RevDel_LogList' => 'includes/specials/SpecialRevisiondelete.php',
- 'RevDel_LogItem' => 'includes/specials/SpecialRevisiondelete.php',
+ 'RevisionDeleter' => 'includes/revisiondelete/RevisionDeleter.php',
+ 'RevDel_List' => 'includes/revisiondelete/RevisionDeleteAbstracts.php',
+ 'RevDel_Item' => 'includes/revisiondelete/RevisionDeleteAbstracts.php',
+ 'RevDel_RevisionList' => 'includes/revisiondelete/RevisionDelete.php',
+ 'RevDel_RevisionItem' => 'includes/revisiondelete/RevisionDelete.php',
+ 'RevDel_ArchiveList' => 'includes/revisiondelete/RevisionDelete.php',
+ 'RevDel_ArchiveItem' => 'includes/revisiondelete/RevisionDelete.php',
+ 'RevDel_FileList' => 'includes/revisiondelete/RevisionDelete.php',
+ 'RevDel_FileItem' => 'includes/revisiondelete/RevisionDelete.php',
+ 'RevDel_ArchivedFileList' => 'includes/revisiondelete/RevisionDelete.php',
+ 'RevDel_ArchivedFileItem' => 'includes/revisiondelete/RevisionDelete.php',
+ 'RevDel_LogList' => 'includes/revisiondelete/RevisionDelete.php',
+ 'RevDel_LogItem' => 'includes/revisiondelete/RevisionDelete.php',
'ShortPagesPage' => 'includes/specials/SpecialShortpages.php',
'SpecialActiveUsers' => 'includes/specials/SpecialActiveusers.php',
'SpecialAllpages' => 'includes/specials/SpecialAllpages.php',
'SpecialBlankpage' => 'includes/specials/SpecialBlankpage.php',
+ 'SpecialBlockme' => 'includes/specials/SpecialBlockme.php',
'SpecialBookSources' => 'includes/specials/SpecialBooksources.php',
+ 'SpecialCategories' => 'includes/specials/SpecialCategories.php',
+ 'SpecialComparePages' => 'includes/specials/SpecialComparePages.php',
'SpecialExport' => 'includes/specials/SpecialExport.php',
+ 'SpecialFilepath' => 'includes/specials/SpecialFilepath.php',
'SpecialImport' => 'includes/specials/SpecialImport.php',
'SpecialListGroupRights' => 'includes/specials/SpecialListgrouprights.php',
+ 'SpecialLockdb' => 'includes/specials/SpecialLockdb.php',
+ 'SpecialLog' => 'includes/specials/SpecialLog.php',
+ 'SpecialMergeHistory' => 'includes/specials/SpecialMergeHistory.php',
'SpecialMostlinkedtemplates' => 'includes/specials/SpecialMostlinkedtemplates.php',
'SpecialPreferences' => 'includes/specials/SpecialPreferences.php',
'SpecialPrefixindex' => 'includes/specials/SpecialPrefixindex.php',
+ 'SpecialProtectedpages' => 'includes/specials/SpecialProtectedpages.php',
+ 'SpecialProtectedtitles' => 'includes/specials/SpecialProtectedtitles.php',
'SpecialRandomredirect' => 'includes/specials/SpecialRandomredirect.php',
'SpecialRecentChanges' => 'includes/specials/SpecialRecentchanges.php',
'SpecialRecentchangeslinked' => 'includes/specials/SpecialRecentchangeslinked.php',
'SpecialSearch' => 'includes/specials/SpecialSearch.php',
+ 'SpecialUploadStash' => 'includes/specials/SpecialUploadStash.php',
+ 'SpecialSpecialpages' => 'includes/specials/SpecialSpecialpages.php',
'SpecialStatistics' => 'includes/specials/SpecialStatistics.php',
'SpecialTags' => 'includes/specials/SpecialTags.php',
+ 'SpecialUnlockdb' => 'includes/specials/SpecialUnlockdb.php',
'SpecialUpload' => 'includes/specials/SpecialUpload.php',
+ 'SpecialUserlogout' => 'includes/specials/SpecialUserlogout.php',
'SpecialVersion' => 'includes/specials/SpecialVersion.php',
'SpecialWhatlinkshere' => 'includes/specials/SpecialWhatlinkshere.php',
'SpecialWhatLinksHere' => 'includes/specials/SpecialWhatlinkshere.php',
@@ -598,18 +679,66 @@ $wgAutoloadLocalClasses = array(
'UsercreateTemplate' => 'includes/templates/Userlogin.php',
'UserloginTemplate' => 'includes/templates/Userlogin.php',
+ # includes/upload
+ 'UploadBase' => 'includes/upload/UploadBase.php',
+ 'UploadFromStash' => 'includes/upload/UploadFromStash.php',
+ 'UploadFromFile' => 'includes/upload/UploadFromFile.php',
+ 'UploadFromUrl' => 'includes/upload/UploadFromUrl.php',
+ 'UploadStash' => 'includes/upload/UploadStash.php',
+ 'UploadStashFile' => 'includes/upload/UploadStash.php',
+ 'UploadStashNotAvailableException' => 'includes/upload/UploadStash.php',
+ 'UploadStashFileNotFoundException' => 'includes/upload/UploadStash.php',
+ 'UploadStashBadPathException' => 'includes/upload/UploadStash.php',
+ 'UploadStashBadVersionException' => 'includes/upload/UploadStash.php',
+ 'UploadStashFileException' => 'includes/upload/UploadStash.php',
+ 'UploadStashZeroLengthFileException' => 'includes/upload/UploadStash.php',
+
# languages
'Language' => 'languages/Language.php',
'FakeConverter' => 'languages/Language.php',
'LanguageConverter' => 'languages/LanguageConverter.php',
+ # maintenance
+ 'AnsiTermColorer' => 'maintenance/tests/testHelpers.inc',
+ 'ConvertLinks' => 'maintenance/convertLinks.php',
+ 'DbTestPreviewer' => 'maintenance/tests/testHelpers.inc',
+ 'DbTestRecorder' => 'maintenance/tests/testHelpers.inc',
+ 'DeleteArchivedFilesImplementation' => 'maintenance/deleteArchivedFiles.inc',
+ 'DeleteArchivedRevisionsImplementation' => 'maintenance/deleteArchivedRevisions.inc',
+ 'DeleteDefaultMessages' => 'maintenance/deleteDefaultMessages.php',
+ 'DummyTermColorer' => 'maintenance/tests/testHelpers.inc',
+ 'ParserTest' => 'maintenance/tests/parser/parserTest.inc',
+ 'ParserTestParserHook' => 'maintenance/tests/parser/parserTestsParserHook.php',
+ 'ParserTestStaticParserHook' => 'maintenance/tests/parser/parserTestsStaticParserHook.php',
+ 'PopulateCategory' => 'maintenance/populateCategory.php',
+ 'PopulateLogSearch' => 'maintenance/populateLogSearch.php',
+ 'PopulateLogUsertext' => 'maintenance/populateLogUsertext.php',
+ 'PopulateParentId' => 'maintenance/populateParentId.php',
+ 'PopulateRevisionLength' => 'maintenance/populateRevisionLength.php',
+ 'RemoteTestRecorder' => 'maintenance/tests/testHelpers.inc',
+ 'SevenZipStream' => 'maintenance/7zip.inc',
+ 'Sqlite' => 'maintenance/sqlite.inc',
+ 'TestFileIterator' => 'maintenance/tests/testHelpers.inc',
+ 'TestRecorder' => 'maintenance/tests/testHelpers.inc',
+ 'UpdateCollation' => 'maintenance/updateCollation.php',
+ 'UpdateRestrictions' => 'maintenance/updateRestrictions.php',
+ 'UserDupes' => 'maintenance/userDupes.inc',
+
+ # maintenance/tests/selenium
+ 'Selenium' => 'maintenance/tests/selenium/Selenium.php',
+ 'SeleniumLoader' => 'maintenance/tests/selenium/SeleniumLoader.php',
+ 'SeleniumTestCase' => 'maintenance/tests/selenium/SeleniumTestCase.php',
+ 'SeleniumTestConsoleLogger' => 'maintenance/tests/selenium/SeleniumTestConsoleLogger.php',
+ 'SeleniumTestHTMLLogger' => 'maintenance/tests/selenium/SeleniumTestHTMLLogger.php',
+ 'SeleniumTestListener' => 'maintenance/tests/selenium/SeleniumTestListener.php',
+ 'SeleniumTestSuite' => 'maintenance/tests/selenium/SeleniumTestSuite.php',
+ 'SeleniumConfig' => 'maintenance/tests/selenium/SeleniumConfig.php',
+
# maintenance/language
+ 'csvStatsOutput' => 'maintenance/language/StatOutputs.php',
'statsOutput' => 'maintenance/language/StatOutputs.php',
- 'wikiStatsOutput' => 'maintenance/language/StatOutputs.php',
'textStatsOutput' => 'maintenance/language/StatOutputs.php',
- 'csvStatsOutput' => 'maintenance/language/StatOutputs.php',
- 'SevenZipStream' => 'maintenance/7zip.inc',
-
+ 'wikiStatsOutput' => 'maintenance/language/StatOutputs.php',
);
class AutoLoader {
@@ -633,14 +762,18 @@ class AutoLoader {
# The case can sometimes be wrong when unserializing PHP 4 objects
$filename = false;
$lowerClass = strtolower( $className );
+
foreach ( $wgAutoloadLocalClasses as $class2 => $file2 ) {
if ( strtolower( $class2 ) == $lowerClass ) {
$filename = $file2;
}
}
+
if ( !$filename ) {
- if( function_exists( 'wfDebug' ) )
+ if ( function_exists( 'wfDebug' ) ) {
wfDebug( "Class {$className} not found; skipped loading\n" );
+ }
+
# Give up
return false;
}
@@ -651,15 +784,17 @@ class AutoLoader {
global $IP;
$filename = "$IP/$filename";
}
+
require( $filename );
+
return true;
}
static function loadAllExtensions() {
global $wgAutoloadClasses;
- foreach( $wgAutoloadClasses as $class => $file ) {
- if( !( class_exists( $class, false ) || interface_exists( $class, false ) ) ) {
+ foreach ( $wgAutoloadClasses as $class => $file ) {
+ if ( !( class_exists( $class, false ) || interface_exists( $class, false ) ) ) {
require( $file );
}
}
@@ -677,10 +812,6 @@ class AutoLoader {
}
}
-function wfLoadAllExtensions() {
- AutoLoader::loadAllExtensions();
-}
-
if ( function_exists( 'spl_autoload_register' ) ) {
spl_autoload_register( array( 'AutoLoader', 'autoload' ) );
} else {
diff --git a/includes/Autopromote.php b/includes/Autopromote.php
index c0adff43..b4d89b24 100644
--- a/includes/Autopromote.php
+++ b/includes/Autopromote.php
@@ -3,6 +3,7 @@
* This class checks if user can get extra rights
* because of conditions specified in $wgAutopromote
*/
+
class Autopromote {
/**
* Get the groups for the given user based on $wgAutopromote.
@@ -12,10 +13,13 @@ class Autopromote {
*/
public static function getAutopromoteGroups( User $user ) {
global $wgAutopromote;
+
$promote = array();
- foreach( $wgAutopromote as $group => $cond ) {
- if( self::recCheckCondition( $cond, $user ) )
+
+ foreach ( $wgAutopromote as $group => $cond ) {
+ if ( self::recCheckCondition( $cond, $user ) ) {
$promote[] = $group;
+ }
}
wfRunHooks( 'GetAutoPromoteGroups', array( $user, &$promote ) );
@@ -41,38 +45,52 @@ class Autopromote {
*/
private static function recCheckCondition( $cond, User $user ) {
$validOps = array( '&', '|', '^', '!' );
- if( is_array( $cond ) && count( $cond ) >= 2 && in_array( $cond[0], $validOps ) ) {
+
+ if ( is_array( $cond ) && count( $cond ) >= 2 && in_array( $cond[0], $validOps ) ) {
# Recursive condition
- if( $cond[0] == '&' ) {
- foreach( array_slice( $cond, 1 ) as $subcond )
- if( !self::recCheckCondition( $subcond, $user ) )
+ if ( $cond[0] == '&' ) {
+ foreach ( array_slice( $cond, 1 ) as $subcond ) {
+ if ( !self::recCheckCondition( $subcond, $user ) ) {
return false;
+ }
+ }
+
return true;
- } elseif( $cond[0] == '|' ) {
- foreach( array_slice( $cond, 1 ) as $subcond )
- if( self::recCheckCondition( $subcond, $user ) )
+ } elseif ( $cond[0] == '|' ) {
+ foreach ( array_slice( $cond, 1 ) as $subcond ) {
+ if ( self::recCheckCondition( $subcond, $user ) ) {
return true;
+ }
+ }
+
return false;
- } elseif( $cond[0] == '^' ) {
+ } elseif ( $cond[0] == '^' ) {
$res = null;
- foreach( array_slice( $cond, 1 ) as $subcond ) {
- if( is_null( $res ) )
+ foreach ( array_slice( $cond, 1 ) as $subcond ) {
+ if ( is_null( $res ) ) {
$res = self::recCheckCondition( $subcond, $user );
- else
- $res = ($res xor self::recCheckCondition( $subcond, $user ));
+ } else {
+ $res = ( $res xor self::recCheckCondition( $subcond, $user ) );
+ }
}
+
return $res;
- } elseif ( $cond[0] = '!' ) {
- foreach( array_slice( $cond, 1 ) as $subcond )
- if( self::recCheckCondition( $subcond, $user ) )
+ } elseif ( $cond[0] == '!' ) {
+ foreach ( array_slice( $cond, 1 ) as $subcond ) {
+ if ( self::recCheckCondition( $subcond, $user ) ) {
return false;
+ }
+ }
+
return true;
}
}
# If we got here, the array presumably does not contain other condi-
# tions; it's not recursive. Pass it off to self::checkCondition.
- if( !is_array( $cond ) )
+ if ( !is_array( $cond ) ) {
$cond = array( $cond );
+ }
+
return self::checkCondition( $cond, $user );
}
@@ -87,13 +105,15 @@ class Autopromote {
* @return bool Whether the condition is true for the user
*/
private static function checkCondition( $cond, User $user ) {
- if( count( $cond ) < 1 )
+ global $wgEmailAuthentication;
+ if ( count( $cond ) < 1 ) {
return false;
+ }
+
switch( $cond[0] ) {
case APCOND_EMAILCONFIRMED:
- if( User::isValidEmailAddr( $user->getEmail() ) ) {
- global $wgEmailAuthentication;
- if( $wgEmailAuthentication ) {
+ if ( User::isValidEmailAddr( $user->getEmail() ) ) {
+ if ( $wgEmailAuthentication ) {
return (bool)$user->getEmailAuthenticationTimestamp();
} else {
return true;
@@ -120,10 +140,11 @@ class Autopromote {
default:
$result = null;
wfRunHooks( 'AutopromoteCondition', array( $cond[0], array_slice( $cond, 1 ), $user, &$result ) );
- if( $result === null ) {
+ if ( $result === null ) {
throw new MWException( "Unrecognized condition {$cond[0]} for autopromotion!" );
}
- return $result ? true : false;
+
+ return (bool)$result;
}
}
}
diff --git a/includes/BacklinkCache.php b/includes/BacklinkCache.php
index 53f92dd9..02b0f170 100644
--- a/includes/BacklinkCache.php
+++ b/includes/BacklinkCache.php
@@ -22,6 +22,14 @@ class BacklinkCache {
}
/**
+ * Serialization handler, diasallows to serialize the database to prevent
+ * failures after this class is deserialized from cache with dead DB connection.
+ */
+ function __sleep() {
+ return array( 'partitionCache', 'fullResultCache', 'title' );
+ }
+
+ /**
* Clear locally stored data
*/
function clear() {
@@ -41,6 +49,7 @@ class BacklinkCache {
if ( !isset( $this->db ) ) {
$this->db = wfGetDB( DB_SLAVE );
}
+
return $this->db;
}
@@ -60,14 +69,17 @@ class BacklinkCache {
// Partial range, not cached
wfDebug( __METHOD__ . ": from DB (uncacheable range)\n" );
$conds = $this->getConditions( $table );
+
// Use the from field in the condition rather than the joined page_id,
// because databases are stupid and don't necessarily propagate indexes.
if ( $startId ) {
$conds[] = "$fromField >= " . intval( $startId );
}
+
if ( $endId ) {
$conds[] = "$fromField <= " . intval( $endId );
}
+
$res = $this->getDB()->select(
array( $table, 'page' ),
array( 'page_namespace', 'page_title', 'page_id' ),
@@ -78,6 +90,7 @@ class BacklinkCache {
'ORDER BY' => $fromField
) );
$ta = TitleArray::newFromResult( $res );
+
wfProfileOut( __METHOD__ );
return $ta;
}
@@ -95,7 +108,9 @@ class BacklinkCache {
) );
$this->fullResultCache[$table] = $res;
}
+
$ta = TitleArray::newFromResult( $this->fullResultCache[$table] );
+
wfProfileOut( __METHOD__ );
return $ta;
}
@@ -150,6 +165,7 @@ class BacklinkCache {
default:
throw new MWException( "Invalid table \"$table\" in " . __CLASS__ );
}
+
return $conds;
}
@@ -167,6 +183,7 @@ class BacklinkCache {
}
$titleArray = $this->getLinks( $table );
+
return $titleArray->count();
}
@@ -193,29 +210,35 @@ class BacklinkCache {
if ( isset( $this->fullResultCache[$table] ) ) {
$cacheEntry = $this->partitionResult( $this->fullResultCache[$table], $batchSize );
wfDebug( __METHOD__ . ": got from full result cache\n" );
+
return $cacheEntry['batches'];
}
// Try memcached
global $wgMemc;
+
$memcKey = wfMemcKey(
'backlinks',
md5( $this->title->getPrefixedDBkey() ),
$table,
$batchSize
);
+
$memcValue = $wgMemc->get( $memcKey );
if ( is_array( $memcValue ) ) {
$cacheEntry = $memcValue;
wfDebug( __METHOD__ . ": got from memcached $memcKey\n" );
+
return $cacheEntry['batches'];
}
+
// Fetch from database
$this->getLinks( $table );
$cacheEntry = $this->partitionResult( $this->fullResultCache[$table], $batchSize );
// Save to memcached
$wgMemc->set( $memcKey, $cacheEntry, self::CACHE_EXPIRY );
+
wfDebug( __METHOD__ . ": got from database\n" );
return $cacheEntry['batches'];
}
@@ -254,6 +277,7 @@ class BacklinkCache {
$batches[] = array( $start, $end );
}
+
return array( 'numRows' => $numRows, 'batches' => $batches );
}
}
diff --git a/includes/BagOStuff.php b/includes/BagOStuff.php
index ac0263d8..63c96de7 100644
--- a/includes/BagOStuff.php
+++ b/includes/BagOStuff.php
@@ -1,31 +1,34 @@
<?php
-#
-# Copyright (C) 2003-2004 Brion Vibber <brion@pobox.com>
-# 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
-# (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
-
/**
- * @defgroup Cache Cache
+ * Classes to cache objects in PHP accelerators, SQL database or DBA files
+ *
+ * Copyright © 2003-2004 Brion Vibber <brion@pobox.com>
+ * 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
+ * (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 Cache
*/
/**
+ * @defgroup Cache Cache
+ */
+
+/**
* interface is intended to be more or less compatible with
* the PHP memcached client.
*
@@ -102,8 +105,9 @@ abstract class BagOStuff {
}
public function add( $key, $value, $exptime = 0 ) {
- if ( $this->get( $key ) == false ) {
+ if ( !$this->get( $key ) ) {
$this->set( $key, $value, $exptime );
+
return true;
}
}
@@ -126,18 +130,24 @@ abstract class BagOStuff {
}
}
+ /**
+ * @param $key String: Key to increase
+ * @param $value Integer: Value to add to $key (Default 1)
+ * @return null if lock is not possible else $key value increased by $value
+ */
public function incr( $key, $value = 1 ) {
if ( !$this->lock( $key ) ) {
- return false;
+ return null;
}
+
$value = intval( $value );
- $n = false;
if ( ( $n = $this->get( $key ) ) !== false ) {
$n += $value;
$this->set( $key, $n ); // exptime?
}
$this->unlock( $key );
+
return $n;
}
@@ -146,15 +156,16 @@ abstract class BagOStuff {
}
public function debug( $text ) {
- if ( $this->debugMode )
+ if ( $this->debugMode ) {
wfDebug( "BagOStuff debug: $text\n" );
+ }
}
/**
* Convert an optionally relative time to an absolute time
*/
protected function convertExpiry( $exptime ) {
- if ( ( $exptime != 0 ) && ( $exptime < 3600 * 24 * 30 ) ) {
+ if ( ( $exptime != 0 ) && ( $exptime < 86400 * 3650 /* 10 years */ ) ) {
return time() + $exptime;
} else {
return $exptime;
@@ -178,10 +189,13 @@ class HashBagOStuff extends BagOStuff {
protected function expire( $key ) {
$et = $this->bag[$key][1];
+
if ( ( $et == 0 ) || ( $et > time() ) ) {
return false;
}
+
$this->delete( $key );
+
return true;
}
@@ -189,9 +203,11 @@ class HashBagOStuff extends BagOStuff {
if ( !isset( $this->bag[$key] ) ) {
return false;
}
+
if ( $this->expire( $key ) ) {
return false;
}
+
return $this->bag[$key][0];
}
@@ -203,7 +219,9 @@ class HashBagOStuff extends BagOStuff {
if ( !isset( $this->bag[$key] ) ) {
return false;
}
+
unset( $this->bag[$key] );
+
return true;
}
@@ -223,6 +241,7 @@ class SqlBagOStuff extends BagOStuff {
protected function getDB() {
global $wgDBtype;
+
if ( !isset( $this->db ) ) {
/* We must keep a separate connection to MySQL in order to avoid deadlocks
* However, SQLite has an opposite behaviour.
@@ -236,6 +255,7 @@ class SqlBagOStuff extends BagOStuff {
$this->db->clearFlag( DBO_TRX );
}
}
+
return $this->db;
}
@@ -245,12 +265,14 @@ class SqlBagOStuff extends BagOStuff {
$db = $this->getDB();
$row = $db->selectRow( 'objectcache', array( 'value', 'exptime' ),
array( 'keyname' => $key ), __METHOD__ );
+
if ( !$row ) {
$this->debug( 'get: no matching rows' );
return false;
}
$this->debug( "get: retrieved data; expiry time is " . $row->exptime );
+
if ( $this->isExpired( $row->exptime ) ) {
$this->debug( "get: key has expired, deleting" );
try {
@@ -266,26 +288,35 @@ class SqlBagOStuff extends BagOStuff {
} catch ( DBQueryError $e ) {
$this->handleWriteError( $e );
}
+
return false;
}
+
return $this->unserialize( $db->decodeBlob( $row->value ) );
}
public function set( $key, $value, $exptime = 0 ) {
$db = $this->getDB();
$exptime = intval( $exptime );
- if ( $exptime < 0 ) $exptime = 0;
+
+ if ( $exptime < 0 ) {
+ $exptime = 0;
+ }
+
if ( $exptime == 0 ) {
$encExpiry = $this->getMaxDateTime();
} else {
- if ( $exptime < 3.16e8 ) # ~10 years
+ if ( $exptime < 3.16e8 ) { # ~10 years
$exptime += time();
+ }
+
$encExpiry = $db->timestamp( $exptime );
}
try {
$db->begin();
- $db->delete( 'objectcache', array( 'keyname' => $key ), __METHOD__ );
- $db->insert( 'objectcache',
+ // (bug 24425) use a replace if the db supports it instead of
+ // delete/insert to avoid clashes with conflicting keynames
+ $db->replace( 'objectcache', array( 'keyname' ),
array(
'keyname' => $key,
'value' => $db->encodeBlob( $this->serialize( $value ) ),
@@ -294,21 +325,26 @@ class SqlBagOStuff extends BagOStuff {
$db->commit();
} catch ( DBQueryError $e ) {
$this->handleWriteError( $e );
+
return false;
}
+
return true;
}
public function delete( $key, $time = 0 ) {
$db = $this->getDB();
+
try {
$db->begin();
$db->delete( 'objectcache', array( 'keyname' => $key ), __METHOD__ );
$db->commit();
} catch ( DBQueryError $e ) {
$this->handleWriteError( $e );
+
return false;
}
+
return true;
}
@@ -323,13 +359,15 @@ class SqlBagOStuff extends BagOStuff {
if ( $row === false ) {
// Missing
$db->commit();
- return false;
+
+ return null;
}
$db->delete( 'objectcache', array( 'keyname' => $key ), __METHOD__ );
if ( $this->isExpired( $row->exptime ) ) {
// Expired, do not reinsert
$db->commit();
- return false;
+
+ return null;
}
$oldValue = intval( $this->unserialize( $db->decodeBlob( $row->value ) ) );
@@ -339,12 +377,19 @@ class SqlBagOStuff extends BagOStuff {
'keyname' => $key,
'value' => $db->encodeBlob( $this->serialize( $newValue ) ),
'exptime' => $row->exptime
- ), __METHOD__ );
+ ), __METHOD__, 'IGNORE' );
+
+ if ( $db->affectedRows() == 0 ) {
+ // Race condition. See bug 28611
+ $newValue = null;
+ }
$db->commit();
} catch ( DBQueryError $e ) {
$this->handleWriteError( $e );
- return false;
+
+ return null;
}
+
return $newValue;
}
@@ -352,9 +397,11 @@ class SqlBagOStuff extends BagOStuff {
$db = $this->getDB();
$res = $db->select( 'objectcache', array( 'keyname' ), false, __METHOD__ );
$result = array();
+
foreach ( $res as $row ) {
$result[] = $row->keyname;
}
+
return $result;
}
@@ -385,6 +432,7 @@ class SqlBagOStuff extends BagOStuff {
public function expireAll() {
$db = $this->getDB();
$now = $db->timestamp();
+
try {
$db->begin();
$db->delete( 'objectcache', array( 'exptime < ' . $db->addQuotes( $now ) ), __METHOD__ );
@@ -396,6 +444,7 @@ class SqlBagOStuff extends BagOStuff {
public function deleteAll() {
$db = $this->getDB();
+
try {
$db->begin();
$db->delete( 'objectcache', '*', __METHOD__ );
@@ -415,6 +464,7 @@ class SqlBagOStuff extends BagOStuff {
*/
protected function serialize( &$data ) {
$serial = serialize( $data );
+
if ( function_exists( 'gzdeflate' ) ) {
return gzdeflate( $serial );
} else {
@@ -430,11 +480,14 @@ class SqlBagOStuff extends BagOStuff {
protected function unserialize( $serial ) {
if ( function_exists( 'gzinflate' ) ) {
$decomp = @gzinflate( $serial );
+
if ( false !== $decomp ) {
$serial = $decomp;
}
}
+
$ret = unserialize( $serial );
+
return $ret;
}
@@ -444,13 +497,16 @@ class SqlBagOStuff extends BagOStuff {
*/
protected function handleWriteError( $exception ) {
$db = $this->getDB();
+
if ( !$db->wasReadOnlyError() ) {
throw $exception;
}
+
try {
$db->rollback();
} catch ( DBQueryError $e ) {
}
+
wfDebug( __METHOD__ . ": ignoring query error\n" );
$db->ignoreErrors( false );
}
@@ -469,19 +525,23 @@ class MediaWikiBagOStuff extends SqlBagOStuff { }
class APCBagOStuff extends BagOStuff {
public function get( $key ) {
$val = apc_fetch( $key );
+
if ( is_string( $val ) ) {
$val = unserialize( $val );
}
+
return $val;
}
public function set( $key, $value, $exptime = 0 ) {
apc_store( $key, serialize( $value ), $exptime );
+
return true;
}
public function delete( $key, $time = 0 ) {
apc_delete( $key );
+
return true;
}
@@ -489,9 +549,11 @@ class APCBagOStuff extends BagOStuff {
$info = apc_cache_info( 'user' );
$list = $info['cache_list'];
$keys = array();
+
foreach ( $list as $entry ) {
$keys[] = $entry['info'];
}
+
return $keys;
}
}
@@ -507,29 +569,35 @@ class APCBagOStuff extends BagOStuff {
class eAccelBagOStuff extends BagOStuff {
public function get( $key ) {
$val = eaccelerator_get( $key );
+
if ( is_string( $val ) ) {
$val = unserialize( $val );
}
+
return $val;
}
public function set( $key, $value, $exptime = 0 ) {
eaccelerator_put( $key, serialize( $value ), $exptime );
+
return true;
}
public function delete( $key, $time = 0 ) {
eaccelerator_rm( $key );
+
return true;
}
public function lock( $key, $waitTimeout = 0 ) {
eaccelerator_lock( $key );
+
return true;
}
public function unlock( $key ) {
eaccelerator_unlock( $key );
+
return true;
}
}
@@ -541,7 +609,6 @@ class eAccelBagOStuff extends BagOStuff {
* @ingroup Cache
*/
class XCacheBagOStuff extends BagOStuff {
-
/**
* Get a value from the XCache object cache
*
@@ -550,8 +617,11 @@ class XCacheBagOStuff extends BagOStuff {
*/
public function get( $key ) {
$val = xcache_get( $key );
- if ( is_string( $val ) )
+
+ if ( is_string( $val ) ) {
$val = unserialize( $val );
+ }
+
return $val;
}
@@ -565,6 +635,7 @@ class XCacheBagOStuff extends BagOStuff {
*/
public function set( $key, $value, $expire = 0 ) {
xcache_set( $key, serialize( $value ), $expire );
+
return true;
}
@@ -577,6 +648,7 @@ class XCacheBagOStuff extends BagOStuff {
*/
public function delete( $key, $time = 0 ) {
xcache_unset( $key );
+
return true;
}
}
@@ -594,10 +666,12 @@ class DBABagOStuff extends BagOStuff {
public function __construct( $dir = false ) {
global $wgDBAhandler;
+
if ( $dir === false ) {
global $wgTmpDirectory;
$dir = $wgTmpDirectory;
}
+
$this->mFile = "$dir/mw-cache-" . wfWikiID();
$this->mFile .= '.db';
wfDebug( __CLASS__ . ": using cache file {$this->mFile}\n" );
@@ -610,6 +684,7 @@ class DBABagOStuff extends BagOStuff {
function encode( $value, $expiry ) {
# Convert to absolute time
$expiry = $this->convertExpiry( $expiry );
+
return sprintf( '%010u', intval( $expiry ) ) . ' ' . serialize( $value );
}
@@ -633,29 +708,37 @@ class DBABagOStuff extends BagOStuff {
} else {
$handle = $this->getWriter();
}
+
if ( !$handle ) {
wfDebug( "Unable to open DBA cache file {$this->mFile}\n" );
}
+
return $handle;
}
function getWriter() {
$handle = dba_open( $this->mFile, 'cl', $this->mHandler );
+
if ( !$handle ) {
wfDebug( "Unable to open DBA cache file {$this->mFile}\n" );
}
+
return $handle;
}
function get( $key ) {
wfProfileIn( __METHOD__ );
wfDebug( __METHOD__ . "($key)\n" );
+
$handle = $this->getReader();
if ( !$handle ) {
+ wfProfileOut( __METHOD__ );
return null;
}
+
$val = dba_fetch( $key, $handle );
list( $val, $expiry ) = $this->decode( $val );
+
# Must close ASAP because locks are held
dba_close( $handle );
@@ -667,6 +750,7 @@ class DBABagOStuff extends BagOStuff {
wfDebug( __METHOD__ . ": $key expired\n" );
$val = null;
}
+
wfProfileOut( __METHOD__ );
return $val;
}
@@ -674,13 +758,18 @@ class DBABagOStuff extends BagOStuff {
function set( $key, $value, $exptime = 0 ) {
wfProfileIn( __METHOD__ );
wfDebug( __METHOD__ . "($key)\n" );
+
$blob = $this->encode( $value, $exptime );
+
$handle = $this->getWriter();
if ( !$handle ) {
+ wfProfileOut( __METHOD__ );
return false;
}
+
$ret = dba_replace( $key, $blob, $handle );
dba_close( $handle );
+
wfProfileOut( __METHOD__ );
return $ret;
}
@@ -688,27 +777,38 @@ class DBABagOStuff extends BagOStuff {
function delete( $key, $time = 0 ) {
wfProfileIn( __METHOD__ );
wfDebug( __METHOD__ . "($key)\n" );
+
$handle = $this->getWriter();
if ( !$handle ) {
+ wfProfileOut( __METHOD__ );
return false;
}
+
$ret = dba_delete( $key, $handle );
dba_close( $handle );
+
wfProfileOut( __METHOD__ );
return $ret;
}
function add( $key, $value, $exptime = 0 ) {
wfProfileIn( __METHOD__ );
+
$blob = $this->encode( $value, $exptime );
+
$handle = $this->getWriter();
+
if ( !$handle ) {
+ wfProfileOut( __METHOD__ );
return false;
}
+
$ret = dba_insert( $key, $blob, $handle );
+
# Insert failed, check to see if it failed due to an expired key
if ( !$ret ) {
list( $value, $expiry ) = $this->decode( dba_fetch( $key, $handle ) );
+
if ( $expiry < time() ) {
# Yes expired, delete and try again
dba_delete( $key, $handle );
@@ -718,6 +818,7 @@ class DBABagOStuff extends BagOStuff {
}
dba_close( $handle );
+
wfProfileOut( __METHOD__ );
return $ret;
}
@@ -725,13 +826,81 @@ class DBABagOStuff extends BagOStuff {
function keys() {
$reader = $this->getReader();
$k1 = dba_firstkey( $reader );
+
if ( !$k1 ) {
return array();
}
+
$result[] = $k1;
+
while ( $key = dba_nextkey( $reader ) ) {
$result[] = $key;
}
+
return $result;
}
}
+
+/**
+ * Wrapper for WinCache object caching functions; identical interface
+ * to the APC wrapper
+ *
+ * @ingroup Cache
+ */
+class WinCacheBagOStuff extends BagOStuff {
+
+ /**
+ * Get a value from the WinCache object cache
+ *
+ * @param $key String: cache key
+ * @return mixed
+ */
+ public function get( $key ) {
+ $val = wincache_ucache_get( $key );
+
+ if ( is_string( $val ) ) {
+ $val = unserialize( $val );
+ }
+
+ return $val;
+ }
+
+ /**
+ * Store a value in the WinCache object cache
+ *
+ * @param $key String: cache key
+ * @param $value Mixed: object to store
+ * @param $expire Int: expiration time
+ * @return bool
+ */
+ public function set( $key, $value, $expire = 0 ) {
+ wincache_ucache_set( $key, serialize( $value ), $expire );
+
+ return true;
+ }
+
+ /**
+ * Remove a value from the WinCache object cache
+ *
+ * @param $key String: cache key
+ * @param $time Int: not used in this implementation
+ * @return bool
+ */
+ public function delete( $key, $time = 0 ) {
+ wincache_ucache_delete( $key );
+
+ return true;
+ }
+
+ public function keys() {
+ $info = wincache_ucache_info();
+ $list = $info['ucache_entries'];
+ $keys = array();
+
+ foreach ( $list as $entry ) {
+ $keys[] = $entry['key_name'];
+ }
+
+ return $keys;
+ }
+}
diff --git a/includes/Block.php b/includes/Block.php
index 187ff2db..7c5f0ddd 100644
--- a/includes/Block.php
+++ b/includes/Block.php
@@ -24,8 +24,8 @@ class Block {
const EB_RANGE_ONLY = 4;
function __construct( $address = '', $user = 0, $by = 0, $reason = '',
- $timestamp = '' , $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0,
- $hideName = 0, $blockEmail = 0, $allowUsertalk = 0 )
+ $timestamp = 0, $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0,
+ $hideName = 0, $blockEmail = 0, $allowUsertalk = 0, $byName = false )
{
$this->mId = 0;
# Expand valid IPv6 addresses
@@ -45,7 +45,7 @@ class Block {
$this->mAllowUsertalk = $allowUsertalk;
$this->mForUpdate = false;
$this->mFromMaster = false;
- $this->mByName = false;
+ $this->mByName = $byName;
$this->mAngryAutoblock = false;
$this->initialiseRange();
}
@@ -63,6 +63,7 @@ class Block {
public static function newFromDB( $address, $user = 0, $killExpired = true ) {
$block = new Block;
$block->load( $address, $user, $killExpired );
+
if ( $block->isValid() ) {
return $block;
} else {
@@ -81,6 +82,7 @@ class Block {
$res = $dbr->resultObject( $dbr->select( 'ipblocks', '*',
array( 'ipb_id' => $id ), __METHOD__ ) );
$block = new Block;
+
if ( $block->loadFromResult( $res ) ) {
return $block;
} else {
@@ -142,6 +144,7 @@ class Block {
$db = wfGetDB( DB_SLAVE );
$options = array();
}
+
return $db;
}
@@ -158,11 +161,12 @@ class Block {
wfDebug( "Block::load: '$address', '$user', $killExpired\n" );
$options = array();
- $db =& $this->getDBOptions( $options );
+ $db = $this->getDBOptions( $options );
- if ( 0 == $user && $address == '' ) {
+ if ( 0 == $user && $address === '' ) {
# Invalid user specification, not blocked
$this->clear();
+
return false;
}
@@ -170,6 +174,7 @@ class Block {
if ( $user ) {
$res = $db->resultObject( $db->select( 'ipblocks', '*', array( 'ipb_user' => $user ),
__METHOD__, $options ) );
+
if ( $this->loadFromResult( $res, $killExpired ) ) {
return true;
}
@@ -178,7 +183,7 @@ class Block {
# Try IP block
# TODO: improve performance by merging this query with the autoblock one
# Slightly tricky while handling killExpired as well
- if ( $address ) {
+ if ( $address !== '' ) {
$conds = array( 'ipb_address' => $address, 'ipb_auto' => 0 );
$res = $db->resultObject( $db->select( 'ipblocks', '*', $conds, __METHOD__, $options ) );
@@ -190,6 +195,7 @@ class Block {
if ( !$this->mCreateAccount ) {
$this->clear();
}
+
return false;
} else {
return true;
@@ -204,6 +210,7 @@ class Block {
if ( !$this->mCreateAccount ) {
$this->clear();
}
+
return false;
} else {
return true;
@@ -266,6 +273,7 @@ class Block {
}
}
$res->free();
+
return $ret;
}
@@ -275,7 +283,7 @@ class Block {
*
* @param $address String: IP address range
* @param $killExpired Boolean: whether to delete expired rows while loading
- * @param $userid Integer: if not 0, then sets ipb_anon_only
+ * @param $user Integer: if not 0, then sets ipb_anon_only
* @return Boolean
*/
public function loadRange( $address, $killExpired = true, $user = 0 ) {
@@ -291,7 +299,7 @@ class Block {
$range = substr( $iaddr, 0, 4 );
$options = array();
- $db =& $this->getDBOptions( $options );
+ $db = $this->getDBOptions( $options );
$conds = array(
'ipb_range_start' . $db->buildLike( $range, $db->anyString() ),
"ipb_range_start <= '$iaddr'",
@@ -304,6 +312,7 @@ class Block {
$res = $db->resultObject( $db->select( 'ipblocks', '*', $conds, __METHOD__, $options ) );
$success = $this->loadFromResult( $res, $killExpired );
+
return $success;
}
@@ -368,6 +377,7 @@ class Block {
$dbw = wfGetDB( DB_MASTER );
$dbw->delete( 'ipblocks', array( 'ipb_id' => $this->mId ), __METHOD__ );
+
return $dbw->affectedRows() > 0;
}
@@ -377,9 +387,11 @@ class Block {
*
* @return Boolean: whether or not the insertion was successful.
*/
- public function insert() {
+ public function insert( $dbw = null ) {
wfDebug( "Block::insert; timestamp {$this->mTimestamp}\n" );
- $dbw = wfGetDB( DB_MASTER );
+
+ if ( $dbw === null )
+ $dbw = wfGetDB( DB_MASTER );
$this->validateBlockParams();
$this->initialiseRange();
@@ -475,6 +487,7 @@ class Block {
if ( !$this->mUser && $this->mAnonOnly ) {
$this->mBlockEmail = 0;
}
+
if ( !$this->mByName ) {
if ( $this->mBy ) {
$this->mByName = User::whoIs( $this->mBy );
@@ -518,9 +531,10 @@ class Block {
# No results, don't autoblock anything
wfDebug( "No IP found to retroactively autoblock\n" );
} else {
- while ( $row = $dbr->fetchObject( $res ) ) {
- if ( $row->rc_ip )
+ foreach ( $res as $row ) {
+ if ( $row->rc_ip ) {
$this->doAutoblock( $row->rc_ip );
+ }
}
}
}
@@ -601,13 +615,16 @@ class Block {
# exceed the user block. If it would exceed, then do nothing, else
# prolong block time
if ( $this->mExpiry &&
- ( $this->mExpiry < Block::getAutoblockExpiry( $ipblock->mTimestamp ) ) ) {
+ ( $this->mExpiry < Block::getAutoblockExpiry( $ipblock->mTimestamp ) )
+ ) {
return;
}
+
# Just update the timestamp
if ( !$justInserted ) {
$ipblock->updateTimestamp();
}
+
return;
} else {
$ipblock = new Block;
@@ -626,6 +643,7 @@ class Block {
# Continue suppressing the name if needed
$ipblock->mHideName = $this->mHideName;
$ipblock->mAllowUsertalk = $this->mAllowUsertalk;
+
# If the user is already blocked with an expiry date, we don't
# want to pile on top of that!
if ( $this->mExpiry ) {
@@ -633,6 +651,7 @@ class Block {
} else {
$ipblock->mExpiry = Block::getAutoblockExpiry( $this->mTimestamp );
}
+
# Insert it
return $ipblock->insert();
}
@@ -643,6 +662,7 @@ class Block {
*/
public function deleteIfExpired() {
wfProfileIn( __METHOD__ );
+
if ( $this->isExpired() ) {
wfDebug( "Block::deleteIfExpired() -- deleting\n" );
$this->delete();
@@ -651,6 +671,7 @@ class Block {
wfDebug( "Block::deleteIfExpired() -- not expired\n" );
$retVal = false;
}
+
wfProfileOut( __METHOD__ );
return $retVal;
}
@@ -661,6 +682,7 @@ class Block {
*/
public function isExpired() {
wfDebug( "Block::isExpired() checking current " . wfTimestampNow() . " vs $this->mExpiry\n" );
+
if ( !$this->mExpiry ) {
return false;
} else {
@@ -777,6 +799,7 @@ class Block {
*/
public static function getAutoblockExpiry( $timestamp ) {
global $wgAutoblockExpiry;
+
return wfTimestamp( TS_MW, wfTimestamp( TS_UNIX, $timestamp ) + $wgAutoblockExpiry );
}
@@ -792,7 +815,7 @@ class Block {
// IPv6
if ( IP::isIPv6( $range ) && $parts[1] >= 64 && $parts[1] <= 128 ) {
$bits = $parts[1];
- $ipint = IP::toUnsigned6( $parts[0] );
+ $ipint = IP::toUnsigned( $parts[0] );
# Native 32 bit functions WON'T work here!!!
# Convert to a padded binary number
$network = wfBaseConvert( $ipint, 10, 2, 128 );
@@ -812,6 +835,7 @@ class Block {
$range = "$newip/{$parts[1]}";
}
}
+
return $range;
}
@@ -833,6 +857,16 @@ class Block {
public static function infinity() {
# This is a special keyword for timestamps in PostgreSQL, and
# works with CHAR(14) as well because "i" sorts after all numbers.
+
+ # BEGIN DatabaseMssql hack
+ # Since MSSQL doesn't recognize the infinity keyword, set date manually.
+ # TO-DO: Refactor for better DB portability and remove magic date
+ $dbr = wfGetDB( DB_SLAVE );
+ if ( $dbr->getType() == 'mssql' ) {
+ return '3000-01-31 00:00:00.000';
+ }
+ # End DatabaseMssql hack
+
return 'infinity';
}
@@ -848,6 +882,7 @@ class Block {
if ( is_null( $msg ) ) {
$msg = array();
$keys = array( 'infiniteblock', 'expiringblock' );
+
foreach ( $keys as $key ) {
$msg[$key] = wfMsgHtml( $key );
}
@@ -862,6 +897,7 @@ class Block {
$expiretimestr = htmlspecialchars( $wgLang->time( $expiry, true ) );
$expirystr = wfMsgReplaceArgs( $msg['expiringblock'], array( $expiredatestr, $expiretimestr ) );
}
+
return $expirystr;
}
@@ -880,7 +916,7 @@ class Block {
return false;
}
}
+
return $expiry;
}
-
}
diff --git a/includes/CacheDependency.php b/includes/CacheDependency.php
index 11e70738..74ca2864 100644
--- a/includes/CacheDependency.php
+++ b/includes/CacheDependency.php
@@ -1,10 +1,11 @@
<?php
/**
* This class stores an arbitrary value along with its dependencies.
- * Users should typically only use DependencyWrapper::getFromCache(), rather
- * than instantiating one of these objects directly.
+ * Users should typically only use DependencyWrapper::getValueFromCache(),
+ * rather than instantiating one of these objects directly.
* @ingroup Cache
*/
+
class DependencyWrapper {
var $value;
var $deps;
@@ -17,9 +18,11 @@ class DependencyWrapper {
*/
function __construct( $value = false, $deps = array() ) {
$this->value = $value;
+
if ( !is_array( $deps ) ) {
$deps = array( $deps );
}
+
$this->deps = $deps;
}
@@ -32,6 +35,7 @@ class DependencyWrapper {
return true;
}
}
+
return false;
}
@@ -81,6 +85,7 @@ class DependencyWrapper {
$callbackParams = array(), $deps = array() )
{
$obj = $cache->get( $key );
+
if ( is_object( $obj ) && $obj instanceof DependencyWrapper && !$obj->isExpired() ) {
$value = $obj->value;
} elseif ( $callback ) {
@@ -91,6 +96,7 @@ class DependencyWrapper {
} else {
$value = null;
}
+
return $value;
}
}
@@ -207,6 +213,7 @@ class TitleDependency extends CacheDependency {
if ( !isset( $this->titleObj ) ) {
$this->titleObj = Title::makeTitle( $this->ns, $this->dbk );
}
+
return $this->titleObj;
}
@@ -255,6 +262,7 @@ class TitleListDependency extends CacheDependency {
foreach ( $this->getLinkBatch()->data as $ns => $dbks ) {
if ( count( $dbks ) > 0 ) {
$timestamps[$ns] = array();
+
foreach ( $dbks as $dbk => $value ) {
$timestamps[$ns][$dbk] = false;
}
@@ -272,10 +280,11 @@ class TitleListDependency extends CacheDependency {
__METHOD__
);
- while ( $row = $dbr->fetchObject( $res ) ) {
+ foreach ( $res as $row ) {
$timestamps[$row->page_namespace][$row->page_title] = $row->page_touched;
}
}
+
return $timestamps;
}
@@ -297,6 +306,7 @@ class TitleListDependency extends CacheDependency {
function isExpired() {
$newTimestamps = $this->calculateTimestamps();
+
foreach ( $this->timestamps as $ns => $dbks ) {
foreach ( $dbks as $dbk => $oldTimestamp ) {
$newTimestamp = $newTimestamps[$ns][$dbk];
@@ -319,6 +329,7 @@ class TitleListDependency extends CacheDependency {
}
}
}
+
return false;
}
}
diff --git a/includes/Category.php b/includes/Category.php
index e9ffaecf..614933ff 100644
--- a/includes/Category.php
+++ b/includes/Category.php
@@ -25,9 +25,6 @@ class Category {
* @return bool True on success, false on failure.
*/
protected function initialize() {
- if ( $this->mName === null && $this->mTitle )
- $this->mName = $title->getDBkey();
-
if ( $this->mName === null && $this->mID === null ) {
throw new MWException( __METHOD__ . ' has both names and IDs null' );
} elseif ( $this->mID === null ) {
@@ -248,28 +245,33 @@ class Category {
if ( wfReadOnly() ) {
return false;
}
- $dbw = wfGetDB( DB_MASTER );
- $dbw->begin();
+
# Note, we must use names for this, since categorylinks does.
if ( $this->mName === null ) {
if ( !$this->initialize() ) {
return false;
}
- } else {
- # Let's be sure that the row exists in the table. We don't need to
- # do this if we got the row from the table in initialization!
- $seqVal = $dbw->nextSequenceValue( 'category_cat_id_seq' );
- $dbw->insert(
- 'category',
- array(
- 'cat_id' => $seqVal,
- 'cat_title' => $this->mName
- ),
- __METHOD__,
- 'IGNORE'
- );
}
+ $dbw = wfGetDB( DB_MASTER );
+ $dbw->begin();
+
+ # Insert the row if it doesn't exist yet (e.g., this is being run via
+ # update.php from a pre-1.16 schema). TODO: This will cause lots and
+ # lots of gaps on some non-MySQL DBMSes if you run populateCategory.php
+ # repeatedly. Plus it's an extra query that's unneeded almost all the
+ # time. This should be rewritten somehow, probably.
+ $seqVal = $dbw->nextSequenceValue( 'category_cat_id_seq' );
+ $dbw->insert(
+ 'category',
+ array(
+ 'cat_id' => $seqVal,
+ 'cat_title' => $this->mName
+ ),
+ __METHOD__,
+ 'IGNORE'
+ );
+
$cond1 = $dbw->conditional( 'page_namespace=' . NS_CATEGORY, 1, 'NULL' );
$cond2 = $dbw->conditional( 'page_namespace=' . NS_FILE, 1, 'NULL' );
$result = $dbw->selectRow(
diff --git a/includes/CategoryPage.php b/includes/CategoryPage.php
index 56f85faa..f990b79b 100644
--- a/includes/CategoryPage.php
+++ b/includes/CategoryPage.php
@@ -1,33 +1,41 @@
<?php
/**
- * Special handling for category description pages
- * Modelled after ImagePage.php
+ * Special handling for category description pages.
+ * Modelled after ImagePage.php.
*
+ * @file
*/
if ( !defined( 'MEDIAWIKI' ) )
die( 1 );
/**
+ * Special handling for category description pages, showing pages,
+ * subcategories and file that belong to the category
*/
class CategoryPage extends Article {
+ # Subclasses can change this to override the viewer class.
+ protected $mCategoryViewerClass = 'CategoryViewer';
+
function view() {
global $wgRequest, $wgUser;
$diff = $wgRequest->getVal( 'diff' );
$diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) );
- if ( isset( $diff ) && $diffOnly )
- return Article::view();
+ if ( isset( $diff ) && $diffOnly ) {
+ return parent::view();
+ }
- if ( !wfRunHooks( 'CategoryPageView', array( &$this ) ) )
+ if ( !wfRunHooks( 'CategoryPageView', array( &$this ) ) ) {
return;
+ }
if ( NS_CATEGORY == $this->mTitle->getNamespace() ) {
$this->openShowCategory();
}
- Article::view();
+ parent::view();
if ( NS_CATEGORY == $this->mTitle->getNamespace() ) {
$this->closeShowCategory();
@@ -36,14 +44,23 @@ class CategoryPage extends Article {
/**
* Don't return a 404 for categories in use.
+ * In use defined as: either the actual page exists
+ * or the category currently has members.
*/
function hasViewableContent() {
if ( parent::hasViewableContent() ) {
return true;
} else {
$cat = Category::newFromTitle( $this->mTitle );
- return $cat->getId() != 0;
+ // If any of these are not 0, then has members
+ if ( $cat->getPageCount()
+ || $cat->getSubcatCount()
+ || $cat->getFileCount()
+ ) {
+ return true;
+ }
}
+ return false;
}
function openShowCategory() {
@@ -52,10 +69,14 @@ class CategoryPage extends Article {
function closeShowCategory() {
global $wgOut, $wgRequest;
- $from = $wgRequest->getVal( 'from' );
- $until = $wgRequest->getVal( 'until' );
- $viewer = new CategoryViewer( $this->mTitle, $from, $until );
+ $from = $until = array();
+ foreach ( array( 'page', 'subcat', 'file' ) as $type ) {
+ $from[$type] = $wgRequest->getVal( "{$type}from" );
+ $until[$type] = $wgRequest->getVal( "{$type}until" );
+ }
+
+ $viewer = new $this->mCategoryViewerClass( $this->mTitle, $from, $until, $wgRequest->getValues() );
$wgOut->addHTML( $viewer->getHTML() );
}
}
@@ -65,27 +86,32 @@ class CategoryViewer {
$articles, $articles_start_char,
$children, $children_start_char,
$showGallery, $gallery,
- $skin;
- /** Category object for this page */
+ $imgsNoGalley, $imgsNoGallery_start_char,
+ $skin, $collation;
+ # Category object for this page
private $cat;
+ # The original query array, to be used in generating paging links.
+ private $query;
- function __construct( $title, $from = '', $until = '' ) {
+ function __construct( $title, $from = '', $until = '', $query = array() ) {
global $wgCategoryPagingLimit;
$this->title = $title;
$this->from = $from;
$this->until = $until;
$this->limit = $wgCategoryPagingLimit;
$this->cat = Category::newFromTitle( $title );
+ $this->query = $query;
+ $this->collation = Collation::singleton();
+ unset( $this->query['title'] );
}
/**
* Format the category data list.
*
* @return string HTML output
- * @private
*/
- function getHTML() {
- global $wgOut, $wgCategoryMagicGallery, $wgCategoryPagingLimit, $wgContLang;
+ public function getHTML() {
+ global $wgOut, $wgCategoryMagicGallery, $wgContLang;
wfProfileIn( __METHOD__ );
$this->showGallery = $wgCategoryMagicGallery && !$wgOut->mNoGallery;
@@ -128,6 +154,9 @@ class CategoryViewer {
if ( $this->showGallery ) {
$this->gallery = new ImageGallery();
$this->gallery->setHideBadImages();
+ } else {
+ $this->imgsNoGallery = array();
+ $this->imgsNoGallery_start_char = array();
}
}
@@ -142,26 +171,29 @@ class CategoryViewer {
/**
* Add a subcategory to the internal lists, using a Category object
*/
- function addSubcategoryObject( $cat, $sortkey, $pageLength ) {
+ function addSubcategoryObject( Category $cat, $sortkey, $pageLength ) {
+ // Subcategory; strip the 'Category' namespace from the link text.
$title = $cat->getTitle();
- $this->addSubcategory( $title, $sortkey, $pageLength );
+
+ $link = $this->getSkin()->link( $title, $title->getText() );
+ if ( $title->isRedirect() ) {
+ // This didn't used to add redirect-in-category, but might
+ // as well be consistent with the rest of the sections
+ // on a category page.
+ $link = '<span class="redirect-in-category">' . $link . '</span>';
+ }
+ $this->children[] = $link;
+
+ $this->children_start_char[] =
+ $this->getSubcategorySortChar( $cat->getTitle(), $sortkey );
}
/**
* Add a subcategory to the internal lists, using a title object
* @deprecated kept for compatibility, please use addSubcategoryObject instead
*/
- function addSubcategory( $title, $sortkey, $pageLength ) {
- // Subcategory; strip the 'Category' namespace from the link text.
- $this->children[] = $this->getSkin()->link(
- $title,
- null,
- array(),
- array(),
- array( 'known', 'noclasses' )
- );
-
- $this->children_start_char[] = $this->getSubcategorySortChar( $title, $sortkey );
+ function addSubcategory( Title $title, $sortkey, $pageLength ) {
+ $this->addSubcategoryObject( Category::newFromTitle( $title ), $sortkey, $pageLength );
}
/**
@@ -170,16 +202,21 @@ class CategoryViewer {
* entry in the categorylinks table is Category:A, not A, which it SHOULD be.
* Workaround: If sortkey == "Category:".$title, than use $title for sorting,
* else use sortkey...
+ *
+ * @param Title $title
+ * @param string $sortkey The human-readable sortkey (before transforming to icu or whatever).
*/
function getSubcategorySortChar( $title, $sortkey ) {
global $wgContLang;
if ( $title->getPrefixedText() == $sortkey ) {
- $firstChar = $wgContLang->firstChar( $title->getDBkey() );
+ $word = $title->getDBkey();
} else {
- $firstChar = $wgContLang->firstChar( $sortkey );
+ $word = $sortkey;
}
+ $firstChar = $this->collation->getFirstLetter( $word );
+
return $wgContLang->convert( $firstChar );
}
@@ -187,14 +224,25 @@ class CategoryViewer {
* Add a page in the image namespace
*/
function addImage( Title $title, $sortkey, $pageLength, $isRedirect = false ) {
+ global $wgContLang;
if ( $this->showGallery ) {
- if ( $this->flip ) {
+ $flip = $this->flip['file'];
+ if ( $flip ) {
$this->gallery->insert( $title );
} else {
$this->gallery->add( $title );
}
} else {
- $this->addPage( $title, $sortkey, $pageLength, $isRedirect );
+ $link = $this->getSkin()->link( $title );
+ if ( $isRedirect ) {
+ // This seems kind of pointless given 'mw-redirect' class,
+ // but keeping for back-compatibility with user css.
+ $link = '<span class="redirect-in-category">' . $link . '</span>';
+ }
+ $this->imgsNoGallery[] = $link;
+
+ $this->imgsNoGallery_start_char[] = $wgContLang->convert(
+ $this->collation->getFirstLetter( $sortkey ) );
}
}
@@ -203,74 +251,104 @@ class CategoryViewer {
*/
function addPage( $title, $sortkey, $pageLength, $isRedirect = false ) {
global $wgContLang;
- $this->articles[] = $isRedirect
- ? '<span class="redirect-in-category">' .
- $this->getSkin()->link(
- $title,
- null,
- array(),
- array(),
- array( 'known', 'noclasses' )
- ) . '</span>'
- : $this->getSkin()->makeSizeLinkObj( $pageLength, $title );
- $this->articles_start_char[] = $wgContLang->convert( $wgContLang->firstChar( $sortkey ) );
+
+ $link = $this->getSkin()->link( $title );
+ if ( $isRedirect ) {
+ // This seems kind of pointless given 'mw-redirect' class,
+ // but keeping for back-compatiability with user css.
+ $link = '<span class="redirect-in-category">' . $link . '</span>';
+ }
+ $this->articles[] = $link;
+
+ $this->articles_start_char[] = $wgContLang->convert(
+ $this->collation->getFirstLetter( $sortkey ) );
}
function finaliseCategoryState() {
- if ( $this->flip ) {
+ if ( $this->flip['subcat'] ) {
$this->children = array_reverse( $this->children );
$this->children_start_char = array_reverse( $this->children_start_char );
+ }
+ if ( $this->flip['page'] ) {
$this->articles = array_reverse( $this->articles );
$this->articles_start_char = array_reverse( $this->articles_start_char );
}
+ if ( !$this->showGallery && $this->flip['file'] ) {
+ $this->imgsNoGallery = array_reverse( $this->imgsNoGallery );
+ $this->imgsNoGallery_start_char = array_reverse( $this->imgsNoGallery_start_char );
+ }
}
function doCategoryQuery() {
$dbr = wfGetDB( DB_SLAVE, 'category' );
- if ( $this->from != '' ) {
- $pageCondition = 'cl_sortkey >= ' . $dbr->addQuotes( $this->from );
- $this->flip = false;
- } elseif ( $this->until != '' ) {
- $pageCondition = 'cl_sortkey < ' . $dbr->addQuotes( $this->until );
- $this->flip = true;
- } else {
- $pageCondition = '1 = 1';
- $this->flip = false;
- }
- $res = $dbr->select(
- array( 'page', 'categorylinks', 'category' ),
- array( 'page_title', 'page_namespace', 'page_len', 'page_is_redirect', 'cl_sortkey',
- 'cat_id', 'cat_title', 'cat_subcats', 'cat_pages', 'cat_files' ),
- array( $pageCondition, 'cl_to' => $this->title->getDBkey() ),
- __METHOD__,
- array( 'ORDER BY' => $this->flip ? 'cl_sortkey DESC' : 'cl_sortkey',
- 'USE INDEX' => array( 'categorylinks' => 'cl_sortkey' ),
- 'LIMIT' => $this->limit + 1 ),
- array( 'categorylinks' => array( 'INNER JOIN', 'cl_from = page_id' ),
- 'category' => array( 'LEFT JOIN', 'cat_title = page_title AND page_namespace = ' . NS_CATEGORY ) )
+ $this->nextPage = array(
+ 'page' => null,
+ 'subcat' => null,
+ 'file' => null,
);
+ $this->flip = array( 'page' => false, 'subcat' => false, 'file' => false );
+
+ foreach ( array( 'page', 'subcat', 'file' ) as $type ) {
+ # Get the sortkeys for start/end, if applicable. Note that if
+ # the collation in the database differs from the one
+ # set in $wgCategoryCollation, pagination might go totally haywire.
+ $extraConds = array( 'cl_type' => $type );
+ if ( $this->from[$type] !== null ) {
+ $extraConds[] = 'cl_sortkey >= '
+ . $dbr->addQuotes( $this->collation->getSortKey( $this->from[$type] ) );
+ } elseif ( $this->until[$type] !== null ) {
+ $extraConds[] = 'cl_sortkey < '
+ . $dbr->addQuotes( $this->collation->getSortKey( $this->until[$type] ) );
+ $this->flip[$type] = true;
+ }
- $count = 0;
- $this->nextPage = null;
+ $res = $dbr->select(
+ array( 'page', 'categorylinks', 'category' ),
+ array( 'page_id', 'page_title', 'page_namespace', 'page_len',
+ 'page_is_redirect', 'cl_sortkey', 'cat_id', 'cat_title',
+ 'cat_subcats', 'cat_pages', 'cat_files',
+ 'cl_sortkey_prefix', 'cl_collation' ),
+ array( 'cl_to' => $this->title->getDBkey() ) + $extraConds,
+ __METHOD__,
+ array(
+ 'USE INDEX' => array( 'categorylinks' => 'cl_sortkey' ),
+ 'LIMIT' => $this->limit + 1,
+ 'ORDER BY' => $this->flip[$type] ? 'cl_sortkey DESC' : 'cl_sortkey',
+ ),
+ array(
+ 'categorylinks' => array( 'INNER JOIN', 'cl_from = page_id' ),
+ 'category' => array( 'LEFT JOIN', 'cat_title = page_title AND page_namespace = ' . NS_CATEGORY )
+ )
+ );
- while ( $x = $dbr->fetchObject ( $res ) ) {
- if ( ++$count > $this->limit ) {
- // We've reached the one extra which shows that there are
- // additional pages to be had. Stop here...
- $this->nextPage = $x->cl_sortkey;
- break;
- }
+ $count = 0;
+ foreach ( $res as $row ) {
+ $title = Title::newFromRow( $row );
+ if ( $row->cl_collation === '' ) {
+ // Hack to make sure that while updating from 1.16 schema
+ // and db is inconsistent, that the sky doesn't fall.
+ // See r83544. Could perhaps be removed in a couple decades...
+ $humanSortkey = $row->cl_sortkey;
+ } else {
+ $humanSortkey = $title->getCategorySortkey( $row->cl_sortkey_prefix );
+ }
- $title = Title::makeTitle( $x->page_namespace, $x->page_title );
+ if ( ++$count > $this->limit ) {
+ # We've reached the one extra which shows that there
+ # are additional pages to be had. Stop here...
+ $this->nextPage[$type] = $humanSortkey;
+ break;
+ }
- if ( $title->getNamespace() == NS_CATEGORY ) {
- $cat = Category::newFromRow( $x, $title );
- $this->addSubcategoryObject( $cat, $x->cl_sortkey, $x->page_len );
- } elseif ( $this->showGallery && $title->getNamespace() == NS_FILE ) {
- $this->addImage( $title, $x->cl_sortkey, $x->page_len, $x->page_is_redirect );
- } else {
- $this->addPage( $title, $x->cl_sortkey, $x->page_len, $x->page_is_redirect );
+ if ( $title->getNamespace() == NS_CATEGORY ) {
+ $cat = Category::newFromRow( $row, $title );
+ $this->addSubcategoryObject( $cat, $humanSortkey, $row->page_len );
+ } elseif ( $title->getNamespace() == NS_FILE ) {
+ $this->addImage( $title, $humanSortkey, $row->page_len, $row->page_is_redirect );
+ } else {
+ $this->addPage( $title, $humanSortkey, $row->page_len, $row->page_is_redirect );
+ }
}
}
}
@@ -294,7 +372,9 @@ class CategoryViewer {
$r .= "<div id=\"mw-subcategories\">\n";
$r .= '<h2>' . wfMsg( 'subcategories' ) . "</h2>\n";
$r .= $countmsg;
+ $r .= $this->getSectionPagingLinks( 'subcat' );
$r .= $this->formatList( $this->children, $this->children_start_char );
+ $r .= $this->getSectionPagingLinks( 'subcat' );
$r .= "\n</div>";
}
return $r;
@@ -318,36 +398,57 @@ class CategoryViewer {
$r = "<div id=\"mw-pages\">\n";
$r .= '<h2>' . wfMsg( 'category_header', $ti ) . "</h2>\n";
$r .= $countmsg;
+ $r .= $this->getSectionPagingLinks( 'page' );
$r .= $this->formatList( $this->articles, $this->articles_start_char );
+ $r .= $this->getSectionPagingLinks( 'page' );
$r .= "\n</div>";
}
return $r;
}
function getImageSection() {
- if ( $this->showGallery && ! $this->gallery->isEmpty() ) {
+ $r = '';
+ $rescnt = $this->showGallery ? $this->gallery->count() : count( $this->imgsNoGallery );
+ if ( $rescnt > 0 ) {
$dbcnt = $this->cat->getFileCount();
- $rescnt = $this->gallery->count();
$countmsg = $this->getCountMessage( $rescnt, $dbcnt, 'file' );
- return "<div id=\"mw-category-media\">\n" .
- '<h2>' . wfMsg( 'category-media-header', htmlspecialchars( $this->title->getText() ) ) . "</h2>\n" .
- $countmsg . $this->gallery->toHTML() . "\n</div>";
- } else {
- return '';
+ $r .= "<div id=\"mw-category-media\">\n";
+ $r .= '<h2>' . wfMsg( 'category-media-header', htmlspecialchars( $this->title->getText() ) ) . "</h2>\n";
+ $r .= $countmsg;
+ $r .= $this->getSectionPagingLinks( 'file' );
+ if ( $this->showGallery ) {
+ $r .= $this->gallery->toHTML();
+ } else {
+ $r .= $this->formatList( $this->imgsNoGallery, $this->imgsNoGallery_start_char );
+ }
+ $r .= $this->getSectionPagingLinks( 'file' );
+ $r .= "\n</div>";
}
+ return $r;
}
- function getCategoryBottom() {
- if ( $this->until != '' ) {
- return $this->pagingLinks( $this->title, $this->nextPage, $this->until, $this->limit );
- } elseif ( $this->nextPage != '' || $this->from != '' ) {
- return $this->pagingLinks( $this->title, $this->from, $this->nextPage, $this->limit );
+ /**
+ * Get the paging links for a section (subcats/pages/files), to go at the top and bottom
+ * of the output.
+ *
+ * @param $type String: 'page', 'subcat', or 'file'
+ * @return String: HTML output, possibly empty if there are no other pages
+ */
+ private function getSectionPagingLinks( $type ) {
+ if ( $this->until[$type] !== null ) {
+ return $this->pagingLinks( $this->nextPage[$type], $this->until[$type], $type );
+ } elseif ( $this->nextPage[$type] !== null || $this->from[$type] !== null ) {
+ return $this->pagingLinks( $this->from[$type], $this->nextPage[$type], $type );
} else {
return '';
}
}
+ function getCategoryBottom() {
+ return '';
+ }
+
/**
* Format a list of articles chunked by letter, either as a
* bullet list or a columnar format, depending on the length.
@@ -360,10 +461,10 @@ class CategoryViewer {
*/
function formatList( $articles, $articles_start_char, $cutoff = 6 ) {
if ( count ( $articles ) > $cutoff ) {
- return $this->columnList( $articles, $articles_start_char );
+ return self::columnList( $articles, $articles_start_char );
} elseif ( count( $articles ) > 0 ) {
// for short lists of articles in categories.
- return $this->shortList( $articles, $articles_start_char );
+ return self::shortList( $articles, $articles_start_char );
}
return '';
}
@@ -383,7 +484,7 @@ class CategoryViewer {
* @return String
* @private
*/
- function columnList( $articles, $articles_start_char ) {
+ static function columnList( $articles, $articles_start_char ) {
$columns = array_combine( $articles, $articles_start_char );
# Split into three columns
$columns = array_chunk( $columns, ceil( count( $columns ) / 3 ), true /* preserve keys */ );
@@ -435,7 +536,7 @@ class CategoryViewer {
* @return String
* @private
*/
- function shortList( $articles, $articles_start_char ) {
+ static function shortList( $articles, $articles_start_char ) {
$r = '<h3>' . htmlspecialchars( $articles_start_char[0] ) . "</h3>\n";
$r .= '<ul><li>' . $articles[0] . '</li>';
for ( $index = 1; $index < count( $articles ); $index++ )
@@ -452,26 +553,27 @@ class CategoryViewer {
}
/**
- * @param $title Title object
- * @param $first String
- * @param $last String
- * @param $limit Int
- * @param $query Array: additional query options to pass
- * @return String
- * @private
+ * Create paging links, as a helper method to getSectionPagingLinks().
+ *
+ * @param $first String The 'until' parameter for the generated URL
+ * @param $last String The 'from' parameter for the genererated URL
+ * @param $type String A prefix for parameters, 'page' or 'subcat' or
+ * 'file'
+ * @return String HTML
*/
- function pagingLinks( $title, $first, $last, $limit, $query = array() ) {
+ private function pagingLinks( $first, $last, $type = '' ) {
global $wgLang;
$sk = $this->getSkin();
- $limitText = $wgLang->formatNum( $limit );
+ $limitText = $wgLang->formatNum( $this->limit );
$prevLink = wfMsgExt( 'prevn', array( 'escape', 'parsemag' ), $limitText );
if ( $first != '' ) {
- $prevQuery = $query;
- $prevQuery['until'] = $first;
+ $prevQuery = $this->query;
+ $prevQuery["{$type}until"] = $first;
+ unset( $prevQuery["{$type}from"] );
$prevLink = $sk->linkKnown(
- $title,
+ $this->title,
$prevLink,
array(),
$prevQuery
@@ -481,10 +583,11 @@ class CategoryViewer {
$nextLink = wfMsgExt( 'nextn', array( 'escape', 'parsemag' ), $limitText );
if ( $last != '' ) {
- $lastQuery = $query;
- $lastQuery['from'] = $last;
+ $lastQuery = $this->query;
+ $lastQuery["{$type}from"] = $last;
+ unset( $lastQuery["{$type}until"] );
$nextLink = $sk->linkKnown(
- $title,
+ $this->title,
$nextLink,
array(),
$lastQuery
@@ -496,8 +599,8 @@ class CategoryViewer {
/**
* What to do if the category table conflicts with the number of results
- * returned? This function says what. It works the same whether the
- * things being counted are articles, subcategories, or files.
+ * returned? This function says what. Each type is considered independantly
+ * of the other types.
*
* Note for grepping: uses the messages category-article-count,
* category-article-count-limited, category-subcat-count,
@@ -520,15 +623,28 @@ class CategoryViewer {
# than $this->limit and there's no offset. In this case we still
# know the right figure.
# 3) We have no idea.
- $totalrescnt = count( $this->articles ) + count( $this->children ) +
- ( $this->showGallery ? $this->gallery->count() : 0 );
- if ( $dbcnt == $rescnt || ( ( $totalrescnt == $this->limit || $this->from
- || $this->until ) && $dbcnt > $rescnt ) )
+ # Check if there's a "from" or "until" for anything
+
+ // This is a little ugly, but we seem to use different names
+ // for the paging types then for the messages.
+ if ( $type === 'article' ) {
+ $pagingType = 'page';
+ } else {
+ $pagingType = $type;
+ }
+
+ $fromOrUntil = false;
+ if ( $this->from[$pagingType] !== null || $this->until[$pagingType] !== null ) {
+ $fromOrUntil = true;
+ }
+
+ if ( $dbcnt == $rescnt || ( ( $rescnt == $this->limit || $fromOrUntil )
+ && $dbcnt > $rescnt ) )
{
# Case 1: seems sane.
$totalcnt = $dbcnt;
- } elseif ( $totalrescnt < $this->limit && !$this->from && !$this->until ) {
+ } elseif ( $rescnt < $this->limit && !$fromOrUntil ) {
# Case 2: not sane, but salvageable. Use the number of results.
# Since there are fewer than 200, we can also take this opportunity
# to refresh the incorrect category table entry -- which should be
diff --git a/includes/Categoryfinder.php b/includes/Categoryfinder.php
index 5ac8a9be..1f08b7f8 100644
--- a/includes/Categoryfinder.php
+++ b/includes/Categoryfinder.php
@@ -10,14 +10,14 @@
* # Determines whether the article with the page_id 12345 is in both
* # "Category 1" and "Category 2" or their subcategories, respectively
*
- * $cf = new Categoryfinder ;
- * $cf->seed (
- * array ( 12345 ) ,
- * array ( "Category 1","Category 2" ) ,
- * "AND"
- * ) ;
- * $a = $cf->run() ;
- * print implode ( "," , $a ) ;
+ * $cf = new Categoryfinder;
+ * $cf->seed(
+ * array( 12345 ),
+ * array( 'Category 1', 'Category 2' ),
+ * 'AND'
+ * );
+ * $a = $cf->run();
+ * print implode( ',' , $a );
* </code>
*
*/
@@ -43,7 +43,7 @@ class Categoryfinder {
* @param $categories FIXME
* @param $mode String: FIXME, default 'AND'.
*/
- function seed( $article_ids, $categories, $mode = "AND" ) {
+ function seed( $article_ids, $categories, $mode = 'AND' ) {
$this->articles = $article_ids;
$this->next = $article_ids;
$this->mode = $mode;
@@ -64,9 +64,9 @@ class Categoryfinder {
* then checks the articles if they match the conditions
* @return array of page_ids (those given to seed() that match the conditions)
*/
- function run () {
+ function run() {
$this->dbr = wfGetDB( DB_SLAVE );
- while ( count ( $this->next ) > 0 ) {
+ while ( count( $this->next ) > 0 ) {
$this->scan_next_layer();
}
@@ -90,7 +90,7 @@ class Categoryfinder {
* @param $path used to check for recursion loops
* @return bool Does this match the conditions?
*/
- function check( $id , &$conds, $path = array() ) {
+ function check( $id, &$conds, $path = array() ) {
// Check for loops and stop!
if ( in_array( $id, $path ) ) {
return false;
@@ -114,13 +114,13 @@ class Categoryfinder {
# Is this a condition?
if ( isset( $conds[$pname] ) ) {
# This key is in the category list!
- if ( $this->mode == "OR" ) {
+ if ( $this->mode == 'OR' ) {
# One found, that's enough!
$conds = array();
return true;
} else {
# Assuming "AND" as default
- unset( $conds[$pname] ) ;
+ unset( $conds[$pname] );
if ( count( $conds ) == 0 ) {
# All conditions met, done
return true;
@@ -131,7 +131,7 @@ class Categoryfinder {
# Not done yet, try sub-parents
if ( !isset( $this->name2id[$pname] ) ) {
# No sub-parent
- continue ;
+ continue;
}
$done = $this->check( $this->name2id[$pname], $conds, $path );
if ( $done || count( $conds ) == 0 ) {
@@ -152,10 +152,10 @@ class Categoryfinder {
/* FROM */ 'categorylinks',
/* SELECT */ '*',
/* WHERE */ array( 'cl_from' => $this->next ),
- __METHOD__ . "-1"
+ __METHOD__ . '-1'
);
- while ( $o = $this->dbr->fetchObject( $res ) ) {
- $k = $o->cl_to ;
+ foreach ( $res as $o ) {
+ $k = $o->cl_to;
# Update parent tree
if ( !isset( $this->parents[$o->cl_from] ) ) {
@@ -164,9 +164,13 @@ class Categoryfinder {
$this->parents[$o->cl_from][$k] = $o;
# Ignore those we already have
- if ( in_array ( $k , $this->deadend ) ) continue;
+ if ( in_array( $k, $this->deadend ) ) {
+ continue;
+ }
- if ( isset ( $this->name2id[$k] ) ) continue;
+ if ( isset( $this->name2id[$k] ) ) {
+ continue;
+ }
# Hey, new category!
$layer[$k] = $k;
@@ -175,14 +179,14 @@ class Categoryfinder {
$this->next = array();
# Find the IDs of all category pages in $layer, if they exist
- if ( count ( $layer ) > 0 ) {
+ if ( count( $layer ) > 0 ) {
$res = $this->dbr->select(
/* FROM */ 'page',
/* SELECT */ array( 'page_id', 'page_title' ),
/* WHERE */ array( 'page_namespace' => NS_CATEGORY , 'page_title' => $layer ),
- __METHOD__ . "-2"
+ __METHOD__ . '-2'
);
- while ( $o = $this->dbr->fetchObject( $res ) ) {
+ foreach ( $res as $o ) {
$id = $o->page_id;
$name = $o->page_title;
$this->name2id[$name] = $id;
diff --git a/includes/Cdb.php b/includes/Cdb.php
index ab429872..60477485 100644
--- a/includes/Cdb.php
+++ b/includes/Cdb.php
@@ -1,4 +1,9 @@
<?php
+/**
+ * Native CDB file reader and writer
+ *
+ * @file
+ */
/**
* Read from a CDB file.
@@ -93,7 +98,7 @@ class CdbReader_DBA {
function __construct( $fileName ) {
$this->handle = dba_open( $fileName, 'r-', 'cdb' );
if ( !$this->handle ) {
- throw new MWException( 'Unable to open DB file "' . $fileName . '"' );
+ throw new MWException( 'Unable to open CDB file "' . $fileName . '"' );
}
}
@@ -120,7 +125,7 @@ class CdbWriter_DBA {
$this->tmpFileName = $fileName . '.tmp.' . mt_rand( 0, 0x7fffffff );
$this->handle = dba_open( $this->tmpFileName, 'n', 'cdb_make' );
if ( !$this->handle ) {
- throw new MWException( 'Unable to open DB file for write "' . $fileName . '"' );
+ throw new MWException( 'Unable to open CDB file for write "' . $fileName . '"' );
}
}
diff --git a/includes/Cdb_PHP.php b/includes/Cdb_PHP.php
index 49294f71..1485cc66 100644
--- a/includes/Cdb_PHP.php
+++ b/includes/Cdb_PHP.php
@@ -1,11 +1,12 @@
<?php
-
/**
* This is a port of D.J. Bernstein's CDB to PHP. It's based on the copy that
* appears in PHP 5.3. Changes are:
* * Error returns replaced with exceptions
* * Exception thrown if sizes or offsets are between 2GB and 4GB
* * Some variables renamed
+ *
+ * @file
*/
/**
@@ -96,7 +97,7 @@ class CdbReader_PHP extends CdbReader {
function __construct( $fileName ) {
$this->handle = fopen( $fileName, 'rb' );
if ( !$this->handle ) {
- throw new MWException( 'Unable to open DB file "' . $fileName . '"' );
+ throw new MWException( 'Unable to open CDB file "' . $fileName . '"' );
}
$this->findStart();
}
@@ -137,7 +138,7 @@ class CdbReader_PHP extends CdbReader {
$buf = fread( $this->handle, $length );
if ( $buf === false || strlen( $buf ) !== $length ) {
- throw new MWException( __METHOD__.': read from cdb file failed, file may be corrupted' );
+ throw new MWException( __METHOD__.': read from CDB file failed, file may be corrupted' );
}
return $buf;
}
@@ -223,7 +224,7 @@ class CdbWriter_PHP extends CdbWriter {
$this->tmpFileName = $fileName . '.tmp.' . mt_rand( 0, 0x7fffffff );
$this->handle = fopen( $this->tmpFileName, 'wb' );
if ( !$this->handle ) {
- throw new MWException( 'Unable to open DB file for write "' . $fileName . '"' );
+ throw new MWException( 'Unable to open CDB file for write "' . $fileName . '"' );
}
$this->hplist = array();
$this->numentries = 0;
diff --git a/includes/ChangeTags.php b/includes/ChangeTags.php
index 8dce679b..7f0fee21 100644
--- a/includes/ChangeTags.php
+++ b/includes/ChangeTags.php
@@ -119,7 +119,6 @@ class ChangeTags {
}
// Figure out which conditions can be done.
- $join_field = '';
if ( in_array( 'recentchanges', $tables ) ) {
$join_cond = 'rc_id';
} elseif( in_array( 'logging', $tables ) ) {
@@ -168,10 +167,10 @@ class ChangeTags {
return $data;
}
- $html = implode( '&nbsp;', $data );
+ $html = implode( '&#160;', $data );
$html .= "\n" . Xml::element( 'input', array( 'type' => 'submit', 'value' => wfMsg( 'tag-filter-submit' ) ) );
- $html .= "\n" . Xml::hidden( 'title', $wgTitle-> getPrefixedText() );
- $html = Xml::tags( 'form', array( 'action' => $wgTitle->getLocalURL(), 'method' => 'get' ), $html );
+ $html .= "\n" . Html::hidden( 'title', $title->getPrefixedText() );
+ $html = Xml::tags( 'form', array( 'action' => $title->getLocalURL(), 'method' => 'get' ), $html );
return $html;
}
@@ -181,16 +180,17 @@ class ChangeTags {
// Caching...
global $wgMemc;
$key = wfMemcKey( 'valid-tags' );
-
- if ( $tags = $wgMemc->get( $key ) )
+ $tags = $wgMemc->get( $key );
+ if ( $tags ) {
return $tags;
+ }
$emptyTags = array();
// Some DB stuff
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( 'valid_tag', 'vt_tag', array(), __METHOD__ );
- while( $row = $res->fetchObject() ) {
+ foreach ( $res as $row ) {
$emptyTags[] = $row->vt_tag;
}
diff --git a/includes/ChangesFeed.php b/includes/ChangesFeed.php
index bc50fe02..f07b6505 100644
--- a/includes/ChangesFeed.php
+++ b/includes/ChangesFeed.php
@@ -27,8 +27,8 @@ class ChangesFeed {
* @return ChannelFeed subclass or false on failure
*/
public function getFeedObject( $title, $description ) {
- global $wgSitename, $wgContLanguageCode, $wgFeedClasses, $wgTitle;
- $feedTitle = "$wgSitename - {$title} [$wgContLanguageCode]";
+ global $wgSitename, $wgLanguageCode, $wgFeedClasses, $wgTitle;
+ $feedTitle = "$wgSitename - {$title} [$wgLanguageCode]";
if( !isset($wgFeedClasses[$this->format] ) )
return false;
return new $wgFeedClasses[$this->format](
@@ -45,18 +45,17 @@ class ChangesFeed {
* @return null or true
*/
public function execute( $feed, $rows, $lastmod, $opts ) {
- global $messageMemc, $wgFeedCacheTimeout;
- global $wgSitename, $wgLang;
+ global $wgLang, $wgRenderHashAppend;
if ( !FeedUtils::checkFeedOutput( $this->format ) ) {
return;
}
- $timekey = wfMemcKey( $this->type, $this->format, 'timestamp' );
- $optionsHash = md5( serialize( $opts->getAllValues() ) );
+ $optionsHash = md5( serialize( $opts->getAllValues() ) ) . $wgRenderHashAppend;
+ $timekey = wfMemcKey( $this->type, $this->format, $wgLang->getCode(), $optionsHash, 'timestamp' );
$key = wfMemcKey( $this->type, $this->format, $wgLang->getCode(), $optionsHash );
- FeedUtils::checkPurge($timekey, $key);
+ FeedUtils::checkPurge( $timekey, $key );
/*
* Bumping around loading up diffs can be pretty slow, so where
@@ -102,7 +101,8 @@ class ChangesFeed {
* @return feed's content on cache hit or false on cache miss
*/
public function loadFromCache( $lastmod, $timekey, $key ) {
- global $wgFeedCacheTimeout, $messageMemc;
+ global $wgFeedCacheTimeout, $wgOut, $messageMemc;
+
$feedLastmod = $messageMemc->get( $timekey );
if( ( $wgFeedCacheTimeout > 0 ) && $feedLastmod ) {
@@ -119,6 +119,9 @@ class ChangesFeed {
if( $feedAge < $wgFeedCacheTimeout || $feedLastmodUnix > $lastmodUnix) {
wfDebug( "RC: loading feed from cache ($key; $feedLastmod; $lastmod)...\n" );
+ if ( $feedLastmodUnix < $lastmodUnix ) {
+ $wgOut->setLastModified( $feedLastmod ); // bug 21916
+ }
return $messageMemc->get( $key );
} else {
wfDebug( "RC: cached feed timestamp check failed ($feedLastmod; $lastmod)\n" );
diff --git a/includes/ChangesList.php b/includes/ChangesList.php
index 9f092991..b8bc4f55 100644
--- a/includes/ChangesList.php
+++ b/includes/ChangesList.php
@@ -1,4 +1,12 @@
<?php
+/**
+ * Classes to show various lists of changes:
+ * - watchlist
+ * - related changes
+ * - recent changes
+ *
+ * @file
+ */
/**
* @todo document
@@ -17,13 +25,9 @@ class RCCacheEntry extends RecentChange {
}
/**
- * Class to show various lists of changes:
- * - what links here
- * - related changes
- * - recent changes
+ * Base class for all changes lists
*/
class ChangesList {
- # Called by history lists and recent changes
public $skin;
protected $watchlist = false;
@@ -44,11 +48,13 @@ class ChangesList {
* @return ChangesList derivative
*/
public static function newFromUser( &$user ) {
+ global $wgRequest;
+
$sk = $user->getSkin();
$list = null;
if( wfRunHooks( 'FetchChangesList', array( &$user, &$sk, &$list ) ) ) {
- return $user->getOption( 'usenewrc' ) ?
- new EnhancedChangesList( $sk ) : new OldChangesList( $sk );
+ $new = $wgRequest->getBool( 'enhanced', $user->getOption( 'usenewrc' ) );
+ return $new ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk );
} else {
return $list;
}
@@ -85,7 +91,7 @@ class ChangesList {
* @param $bot Boolean
* @return String
*/
- protected function recentChangesFlags( $new, $minor, $patrolled, $nothing = '&nbsp;', $bot = false ) {
+ protected function recentChangesFlags( $new, $minor, $patrolled, $nothing = '&#160;', $bot = false ) {
$f = $new ? self::flag( 'newpage' ) : $nothing;
$f .= $minor ? self::flag( 'minor' ) : $nothing;
$f .= $bot ? self::flag( 'bot' ) : $nothing;
@@ -124,47 +130,6 @@ class ChangesList {
}
/**
- * Some explanatory wrapper text for the given flag, to be used in a legend
- * explaining what the flags mean. For instance, "N - new page". See
- * also flag().
- *
- * @param $key String: 'newpage', 'unpatrolled', 'minor', or 'bot'
- * @return String: Raw HTML
- */
- private static function flagLine( $key ) {
- return wfMsgExt( "recentchanges-legend-$key", array( 'escapenoentities',
- 'replaceafter' ), self::flag( $key ) );
- }
-
- /**
- * A handy legend to tell users what the little "m", "b", and so on mean.
- *
- * @return String: Raw HTML
- */
- public static function flagLegend() {
- global $wgGroupPermissions, $wgLang;
-
- $flags = array( self::flagLine( 'newpage' ),
- self::flagLine( 'minor' ) );
-
- # Don't show info on bot edits unless there's a bot group of some kind
- foreach ( $wgGroupPermissions as $rights ) {
- if ( isset( $rights['bot'] ) && $rights['bot'] ) {
- $flags[] = self::flagLine( 'bot' );
- break;
- }
- }
-
- if ( self::usePatrol() ) {
- $flags[] = self::flagLine( 'unpatrolled' );
- }
-
- return '<div class="mw-rc-label-legend">' .
- wfMsgExt( 'recentchanges-label-legend', 'parseinline',
- $wgLang->commaList( $flags ) ) . '</div>';
- }
-
- /**
* Returns text for the start of the tabular part of RC
* @return String
*/
@@ -595,14 +560,14 @@ class EnhancedChangesList extends ChangesList {
* @return String
*/
public function beginRecentChangesList() {
- global $wgStylePath, $wgStyleVersion;
+ global $wgOut;
$this->rc_cache = array();
$this->rcMoveIndex = 0;
$this->rcCacheIndex = 0;
$this->lastdate = '';
$this->rclistOpen = false;
- $script = Html::linkedScript( $wgStylePath . "/common/enhancedchanges.js?$wgStyleVersion" );
- return $script;
+ $wgOut->addModules( 'mediawiki.legacy.enhancedchanges' );
+ return '';
}
/**
* Format a line for enhanced recentchange (aka with javascript and block of lines).
@@ -628,7 +593,7 @@ class EnhancedChangesList extends ChangesList {
# Process current cache
$ret = $this->recentChangesBlock();
$this->rc_cache = array();
- $ret .= Xml::element( 'h4', null, $date );
+ $ret .= Xml::element( 'h4', null, $date ) . "\n";
$this->lastdate = $date;
}
@@ -771,7 +736,15 @@ class EnhancedChangesList extends ChangesList {
wfProfileIn( __METHOD__ );
- $r = '<table class="mw-enhanced-rc"><tr>';
+ # Add the namespace and title of the block as part of the class
+ if ( $block[0]->mAttribs['rc_log_type'] ) {
+ # Log entry
+ $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-log-' . $block[0]->mAttribs['rc_log_type'] . '-' . $block[0]->mAttribs['rc_title'] );
+ } else {
+ $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-ns' . $block[0]->mAttribs['rc_namespace'] . '-' . $block[0]->mAttribs['rc_title'] );
+ }
+ $r = Html::openElement( 'table', array( 'class' => $classes ) ) .
+ Html::openElement( 'tr' );
# Collate list of users
$userlinks = array();
@@ -841,13 +814,13 @@ class EnhancedChangesList extends ChangesList {
$tl = "<span id='mw-rc-openarrow-$jsid' class='mw-changeslist-expanded' style='visibility:hidden'><a href='#' $toggleLink title='$expandTitle'>" . $this->sideArrow() . "</a></span>";
$tl .= "<span id='mw-rc-closearrow-$jsid' class='mw-changeslist-hidden' style='display:none'><a href='#' $toggleLink title='$closeTitle'>" . $this->downArrow() . "</a></span>";
- $r .= '<td class="mw-enhanced-rc">'.$tl.'&nbsp;';
+ $r .= '<td class="mw-enhanced-rc">'.$tl.'&#160;';
# Main line
- $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, '&nbsp;', $bot );
+ $r .= $this->recentChangesFlags( $isnew, false, $unpatrolled, '&#160;', $bot );
# Timestamp
- $r .= '&nbsp;'.$block[0]->timestamp.'&nbsp;</td><td style="padding:0px;">';
+ $r .= '&#160;'.$block[0]->timestamp.'&#160;</td><td style="padding:0px;">';
# Article link
if( $namehidden ) {
@@ -951,8 +924,8 @@ class EnhancedChangesList extends ChangesList {
#$r .= '<tr><td valign="top">'.$this->spacerArrow();
$r .= '<tr><td style="vertical-align:top;font-family:monospace; padding:0px;">';
$r .= $this->spacerIndent() . $this->spacerIndent();
- $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
- $r .= '&nbsp;</td><td style="vertical-align:top; padding:0px;"><span style="font-family:monospace">';
+ $r .= $this->recentChangesFlags( $rc_new, $rc_minor, $rcObj->unpatrolled, '&#160;', $rc_bot );
+ $r .= '&#160;</td><td style="vertical-align:top; padding:0px;"><span style="font-family:monospace">';
$params = $queryParams;
@@ -1067,7 +1040,7 @@ class EnhancedChangesList extends ChangesList {
* @return String: HTML <td> tag
*/
protected function spacerIndent() {
- return '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
+ return '&#160;&#160;&#160;&#160;&#160;';
}
/**
@@ -1082,19 +1055,27 @@ class EnhancedChangesList extends ChangesList {
# Extract fields from DB into the function scope (rc_xxxx variables)
// FIXME: Would be good to replace this extract() call with something
// that explicitly initializes variables.
- $classes = array(); // TODO implement
+ // TODO implement
extract( $rcObj->mAttribs );
$query['curid'] = $rc_cur_id;
- $r = '<table class="mw-enhanced-rc"><tr>';
- $r .= '<td class="mw-enhanced-rc">' . $this->spacerArrow() . '&nbsp;';
+ if( $rc_log_type ) {
+ # Log entry
+ $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-log-' . $rc_log_type . '-' . $rcObj->mAttribs['rc_title'] );
+ } else {
+ $classes = 'mw-enhanced-rc ' . Sanitizer::escapeClass( 'mw-changeslist-ns' . $rcObj->mAttribs['rc_namespace'] . '-' . $rcObj->mAttribs['rc_title'] );
+ }
+ $r = Html::openElement( 'table', array( 'class' => $classes ) ) .
+ Html::openElement( 'tr' );
+
+ $r .= '<td class="mw-enhanced-rc">' . $this->spacerArrow() . '&#160;';
# Flag and Timestamp
if( $rc_type == RC_MOVE || $rc_type == RC_MOVE_OVER_REDIRECT ) {
- $r .= '&nbsp;&nbsp;&nbsp;&nbsp;'; // 4 flags -> 4 spaces
+ $r .= '&#160;&#160;&#160;&#160;'; // 4 flags -> 4 spaces
} else {
- $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, '&nbsp;', $rc_bot );
+ $r .= $this->recentChangesFlags( $rc_type == RC_NEW, $rc_minor, $rcObj->unpatrolled, '&#160;', $rc_bot );
}
- $r .= '&nbsp;'.$rcObj->timestamp.'&nbsp;</td><td style="padding:0px;">';
+ $r .= '&#160;'.$rcObj->timestamp.'&#160;</td><td style="padding:0px;">';
# Article or log link
if( $rc_log_type ) {
$logtitle = Title::newFromText( "Log/$rc_log_type", NS_SPECIAL );
@@ -1140,6 +1121,7 @@ class EnhancedChangesList extends ChangesList {
$this->insertComment( $r, $rcObj );
$this->insertRollback( $r, $rcObj );
# Tags
+ $classes = explode( ' ', $classes );
$this->insertTags( $r, $rcObj, $classes );
# Show how many people are watching this if enabled
$r .= $this->numberofWatchingusers($rcObj->numberofWatchingusers);
diff --git a/includes/Collation.php b/includes/Collation.php
new file mode 100644
index 00000000..f00b568f
--- /dev/null
+++ b/includes/Collation.php
@@ -0,0 +1,307 @@
+<?php
+
+abstract class Collation {
+ static $instance;
+
+ static function singleton() {
+ if ( !self::$instance ) {
+ global $wgCategoryCollation;
+ self::$instance = self::factory( $wgCategoryCollation );
+ }
+ return self::$instance;
+ }
+
+ static function factory( $collationName ) {
+ switch( $collationName ) {
+ case 'uppercase':
+ return new UppercaseCollation;
+ case 'uca-default':
+ return new IcuCollation( 'root' );
+ default:
+ throw new MWException( __METHOD__.": unknown collation type \"$collationName\"" );
+ }
+ }
+
+ /**
+ * Given a string, convert it to a (hopefully short) key that can be used
+ * for efficient sorting. A binary sort according to the sortkeys
+ * corresponds to a logical sort of the corresponding strings. Current
+ * code expects that a line feed character should sort before all others, but
+ * has no other particular expectations (and that one can be changed if
+ * necessary).
+ *
+ * @param string $string UTF-8 string
+ * @return string Binary sortkey
+ */
+ abstract function getSortKey( $string );
+
+ /**
+ * Given a string, return the logical "first letter" to be used for
+ * grouping on category pages and so on. This has to be coordinated
+ * carefully with convertToSortkey(), or else the sorted list might jump
+ * back and forth between the same "initial letters" or other pathological
+ * behavior. For instance, if you just return the first character, but "a"
+ * sorts the same as "A" based on getSortKey(), then you might get a
+ * list like
+ *
+ * == A ==
+ * * [[Aardvark]]
+ *
+ * == a ==
+ * * [[antelope]]
+ *
+ * == A ==
+ * * [[Ape]]
+ *
+ * etc., assuming for the sake of argument that $wgCapitalLinks is false.
+ *
+ * @param string $string UTF-8 string
+ * @return string UTF-8 string corresponding to the first letter of input
+ */
+ abstract function getFirstLetter( $string );
+}
+
+class UppercaseCollation extends Collation {
+ var $lang;
+ function __construct() {
+ // Get a language object so that we can use the generic UTF-8 uppercase
+ // function there
+ $this->lang = Language::factory( 'en' );
+ }
+
+ function getSortKey( $string ) {
+ return $this->lang->uc( $string );
+ }
+
+ function getFirstLetter( $string ) {
+ if ( $string[0] == "\0" ) {
+ $string = substr( $string, 1 );
+ }
+ return $this->lang->ucfirst( $this->lang->firstChar( $string ) );
+ }
+}
+
+class IcuCollation extends Collation {
+ var $primaryCollator, $mainCollator, $locale;
+ var $firstLetterData;
+
+ /**
+ * Unified CJK blocks.
+ *
+ * The same definition of a CJK block must be used for both Collation and
+ * generateCollationData.php. These blocks are omitted from the first
+ * letter data, as an optimisation measure and because the default UCA table
+ * is pretty useless for sorting Chinese text anyway. Japanese and Korean
+ * blocks are not included here, because they are smaller and more useful.
+ */
+ static $cjkBlocks = array(
+ array( 0x2E80, 0x2EFF ), // CJK Radicals Supplement
+ array( 0x2F00, 0x2FDF ), // Kangxi Radicals
+ array( 0x2FF0, 0x2FFF ), // Ideographic Description Characters
+ array( 0x3000, 0x303F ), // CJK Symbols and Punctuation
+ array( 0x31C0, 0x31EF ), // CJK Strokes
+ array( 0x3200, 0x32FF ), // Enclosed CJK Letters and Months
+ array( 0x3300, 0x33FF ), // CJK Compatibility
+ array( 0x3400, 0x4DBF ), // CJK Unified Ideographs Extension A
+ array( 0x4E00, 0x9FFF ), // CJK Unified Ideographs
+ array( 0xF900, 0xFAFF ), // CJK Compatibility Ideographs
+ array( 0xFE30, 0xFE4F ), // CJK Compatibility Forms
+ array( 0x20000, 0x2A6DF ), // CJK Unified Ideographs Extension B
+ array( 0x2A700, 0x2B73F ), // CJK Unified Ideographs Extension C
+ array( 0x2B740, 0x2B81F ), // CJK Unified Ideographs Extension D
+ array( 0x2F800, 0x2FA1F ), // CJK Compatibility Ideographs Supplement
+ );
+
+ const RECORD_LENGTH = 14;
+
+ function __construct( $locale ) {
+ if ( !extension_loaded( 'intl' ) ) {
+ throw new MWException( 'An ICU collation was requested, ' .
+ 'but the intl extension is not available.' );
+ }
+ $this->locale = $locale;
+ $this->mainCollator = Collator::create( $locale );
+ if ( !$this->mainCollator ) {
+ throw new MWException( "Invalid ICU locale specified for collation: $locale" );
+ }
+
+ $this->primaryCollator = Collator::create( $locale );
+ $this->primaryCollator->setStrength( Collator::PRIMARY );
+ }
+
+ function getSortKey( $string ) {
+ // intl extension produces non null-terminated
+ // strings. Appending '' fixes it so that it doesn't generate
+ // a warning on each access in debug php.
+ wfSuppressWarnings();
+ $key = $this->mainCollator->getSortKey( $string ) . '';
+ wfRestoreWarnings();
+ return $key;
+ }
+
+ function getPrimarySortKey( $string ) {
+ wfSuppressWarnings();
+ $key = $this->primaryCollator->getSortKey( $string ) . '';
+ wfRestoreWarnings();
+ return $key;
+ }
+
+ function getFirstLetter( $string ) {
+ $string = strval( $string );
+ if ( $string === '' ) {
+ return '';
+ }
+
+ // Check for CJK
+ $firstChar = mb_substr( $string, 0, 1, 'UTF-8' );
+ if ( ord( $firstChar ) > 0x7f
+ && self::isCjk( utf8ToCodepoint( $firstChar ) ) )
+ {
+ return $firstChar;
+ }
+
+ $sortKey = $this->getPrimarySortKey( $string );
+
+ // Do a binary search to find the correct letter to sort under
+ $min = $this->findLowerBound(
+ array( $this, 'getSortKeyByLetterIndex' ),
+ $this->getFirstLetterCount(),
+ 'strcmp',
+ $sortKey );
+
+ if ( $min === false ) {
+ // Before the first letter
+ return '';
+ }
+ return $this->getLetterByIndex( $min );
+ }
+
+ function getFirstLetterData() {
+ if ( $this->firstLetterData !== null ) {
+ return $this->firstLetterData;
+ }
+
+ $cache = wfGetCache( CACHE_ANYTHING );
+ $cacheKey = wfMemcKey( 'first-letters', $this->locale );
+ $cacheEntry = $cache->get( $cacheKey );
+
+ if ( $cacheEntry ) {
+ $this->firstLetterData = $cacheEntry;
+ return $this->firstLetterData;
+ }
+
+ // Generate data from serialized data file
+
+ $letters = wfGetPrecompiledData( "first-letters-{$this->locale}.ser" );
+ if ( $letters === false ) {
+ throw new MWException( "MediaWiki does not support ICU locale " .
+ "\"{$this->locale}\"" );
+ }
+
+ // Sort the letters.
+ //
+ // It's impossible to have the precompiled data file properly sorted,
+ // because the sort order changes depending on ICU version. If the
+ // array is not properly sorted, the binary search will return random
+ // results.
+ //
+ // We also take this opportunity to remove primary collisions.
+ $letterMap = array();
+ foreach ( $letters as $letter ) {
+ $key = $this->getPrimarySortKey( $letter );
+ if ( isset( $letterMap[$key] ) ) {
+ // Primary collision
+ // Keep whichever one sorts first in the main collator
+ if ( $this->mainCollator->compare( $letter, $letterMap[$key] ) < 0 ) {
+ $letterMap[$key] = $letter;
+ }
+ } else {
+ $letterMap[$key] = $letter;
+ }
+ }
+ ksort( $letterMap, SORT_STRING );
+ $data = array(
+ 'chars' => array_values( $letterMap ),
+ 'keys' => array_keys( $letterMap )
+ );
+
+ // Reduce memory usage before caching
+ unset( $letterMap );
+
+ // Save to cache
+ $this->firstLetterData = $data;
+ $cache->set( $cacheKey, $data, 86400 * 7 /* 1 week */ );
+ return $data;
+ }
+
+ function getLetterByIndex( $index ) {
+ if ( $this->firstLetterData === null ) {
+ $this->getFirstLetterData();
+ }
+ return $this->firstLetterData['chars'][$index];
+ }
+
+ function getSortKeyByLetterIndex( $index ) {
+ if ( $this->firstLetterData === null ) {
+ $this->getFirstLetterData();
+ }
+ return $this->firstLetterData['keys'][$index];
+ }
+
+ function getFirstLetterCount() {
+ if ( $this->firstLetterData === null ) {
+ $this->getFirstLetterData();
+ }
+ return count( $this->firstLetterData['chars'] );
+ }
+
+ /**
+ * Do a binary search, and return the index of the largest item that sorts
+ * less than or equal to the target value.
+ *
+ * @param $valueCallback A function to call to get the value with
+ * a given array index.
+ * @param $valueCount The number of items accessible via $valueCallback,
+ * indexed from 0 to $valueCount - 1
+ * @param $comparisonCallback A callback to compare two values, returning
+ * -1, 0 or 1 in the style of strcmp().
+ * @param $target The target value to find.
+ *
+ * @return The item index of the lower bound, or false if the target value
+ * sorts before all items.
+ */
+ function findLowerBound( $valueCallback, $valueCount, $comparisonCallback, $target ) {
+ $min = 0;
+ $max = $valueCount - 1;
+ do {
+ $mid = $min + ( ( $max - $min ) >> 1 );
+ $item = call_user_func( $valueCallback, $mid );
+ $comparison = call_user_func( $comparisonCallback, $target, $item );
+ if ( $comparison > 0 ) {
+ $min = $mid;
+ } elseif ( $comparison == 0 ) {
+ $min = $mid;
+ break;
+ } else {
+ $max = $mid;
+ }
+ } while ( $min < $max - 1 );
+
+ if ( $min == 0 && $max == 0 && $comparison > 0 ) {
+ // Before the first item
+ return false;
+ } else {
+ return $min;
+ }
+ }
+
+ static function isCjk( $codepoint ) {
+ foreach ( self::$cjkBlocks as $block ) {
+ if ( $codepoint >= $block[0] && $codepoint <= $block[1] ) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+
diff --git a/includes/ConfEditor.php b/includes/ConfEditor.php
index f862ebb7..b08b77df 100644
--- a/includes/ConfEditor.php
+++ b/includes/ConfEditor.php
@@ -72,7 +72,7 @@ class ConfEditor {
var $pathInfo;
/**
- * Next serial number for whitespace placeholder paths (@extra-N)
+ * Next serial number for whitespace placeholder paths (\@extra-N)
*/
var $serial;
@@ -104,7 +104,7 @@ class ConfEditor {
/**
* Edit the text. Returns the edited text.
- * @param array $ops Array of operations.
+ * @param $ops Array of operations.
*
* Operations are given as an associative array, with members:
* type: One of delete, set, append or insert (required)
@@ -176,7 +176,7 @@ class ConfEditor {
// Has it got a comma already?
if ( strpos( $lastEltPath, '@extra' ) === false && !$lastEltInfo['hasComma'] ) {
// No comma, insert one after the value region
- list( $start, $end ) = $this->findValueRegion( $lastEltPath );
+ list( , $end ) = $this->findValueRegion( $lastEltPath );
$this->replaceSourceRegion( $end - 1, $end - 1, ',' );
}
@@ -184,7 +184,7 @@ class ConfEditor {
list( $start, $end ) = $this->findDeletionRegion( $lastEltPath );
if ( $key === null ) {
- list( $indent, $arrowIndent ) = $this->getIndent( $start );
+ list( $indent, ) = $this->getIndent( $start );
$textToInsert = "$indent$value,";
} else {
list( $indent, $arrowIndent ) =
@@ -202,12 +202,12 @@ class ConfEditor {
if ( $firstEltPath === false ) {
throw new MWException( "Can't find array element of \"$path\"" );
}
- list( $start, $end ) = $this->findDeletionRegion( $firstEltPath );
+ list( $start, ) = $this->findDeletionRegion( $firstEltPath );
$info = $this->pathInfo[$firstEltPath];
// Make the text to insert
if ( $key === null ) {
- list( $indent, $arrowIndent ) = $this->getIndent( $start );
+ list( $indent, ) = $this->getIndent( $start );
$textToInsert = "$indent$value,";
} else {
list( $indent, $arrowIndent ) =
@@ -336,7 +336,7 @@ class ConfEditor {
// Split all copy operations with a source corresponding to the region
// in question.
$newEdits = array();
- foreach ( $this->edits as $i => $edit ) {
+ foreach ( $this->edits as $edit ) {
if ( $edit[0] !== 'copy' ) {
$newEdits[] = $edit;
continue;
@@ -427,7 +427,7 @@ class ConfEditor {
*/
function findValueRegion( $pathName ) {
if ( !isset( $this->pathInfo[$pathName] ) ) {
- throw new MWEXception( "Can't find path \"$pathName\"" );
+ throw new MWException( "Can't find path \"$pathName\"" );
}
$path = $this->pathInfo[$pathName];
if ( $path['valueStartByte'] === false || $path['valueEndByte'] === false ) {
@@ -438,7 +438,7 @@ class ConfEditor {
/**
* Find the path name of the last element in the array.
- * If the array is empty, this will return the @extra interstitial element.
+ * If the array is empty, this will return the \@extra interstitial element.
* If the specified path is not found or is not an array, it will return false.
*/
function findLastArrayElement( $path ) {
@@ -474,7 +474,7 @@ class ConfEditor {
/*
* Find the path name of first element in the array.
- * If the array is empty, this will return the @extra interstitial element.
+ * If the array is empty, this will return the \@extra interstitial element.
* If the specified path is not found or is not an array, it will return false.
*/
function findFirstArrayElement( $path ) {
@@ -510,7 +510,6 @@ class ConfEditor {
$indent = false;
}
if ( $indent !== false && $arrowPos !== false ) {
- $textToInsert = "$indent$key ";
$arrowIndentLength = $arrowPos - $pos - $indentLength - strlen( $key );
if ( $arrowIndentLength > 0 ) {
$arrowIndent = str_repeat( ' ', $arrowIndentLength );
@@ -537,7 +536,7 @@ class ConfEditor {
switch ( $state ) {
case 'file':
- $token = $this->expect( T_OPEN_TAG );
+ $this->expect( T_OPEN_TAG );
$token = $this->skipSpace();
if ( $token->isEnd() ) {
break 2;
@@ -836,7 +835,6 @@ class ConfEditor {
* not call except from popPath() or nextPath().
*/
function endPath() {
- $i = count( $this->pathStack ) - 1;
$key = '';
foreach ( $this->pathStack as $pathInfo ) {
if ( $key !== '' ) {
@@ -878,7 +876,7 @@ class ConfEditor {
/**
* Go to the next path on the same level. This ends the current path and
- * starts a new one. If $path is @next, the new path is set to the next
+ * starts a new one. If $path is \@next, the new path is set to the next
* numeric array element.
*/
function nextPath( $path ) {
diff --git a/includes/Credits.php b/includes/Credits.php
index 91ba3f16..e4c8be54 100644
--- a/includes/Credits.php
+++ b/includes/Credits.php
@@ -1,50 +1,51 @@
<?php
/**
- * Credits.php -- formats credits for articles
+ * Formats credits for articles
+ *
* Copyright 2004, Evan Prodromou <evan@wikitravel.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 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.
+ * 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
+ * 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
*
+ * @file
* @author <evan@wikitravel.org>
*/
class Credits {
-
/**
* This is largely cadged from PageHistory::history
* @param $article Article object
*/
public static function showPage( Article $article ) {
global $wgOut;
-
+
wfProfileIn( __METHOD__ );
-
+
$wgOut->setPageTitle( $article->mTitle->getPrefixedText() );
$wgOut->setSubtitle( wfMsg( 'creditspage' ) );
$wgOut->setArticleFlag( false );
$wgOut->setArticleRelated( true );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
-
- if( $article->mTitle->getArticleID() == 0 ) {
+
+ if ( $article->mTitle->getArticleID() == 0 ) {
$s = wfMsg( 'nocredits' );
} else {
- $s = self::getCredits($article, -1 );
+ $s = self::getCredits( $article, -1 );
}
-
+
$wgOut->addHTML( $s );
-
+
wfProfileOut( __METHOD__ );
}
@@ -59,7 +60,7 @@ class Credits {
wfProfileIn( __METHOD__ );
$s = '';
- if( isset( $cnt ) && $cnt != 0 ){
+ if ( isset( $cnt ) && $cnt != 0 ) {
$s = self::getAuthor( $article );
if ( $cnt > 1 || $cnt < 0 ) {
$s .= ' ' . self::getContributors( $article, $cnt - 1, $showIfMax );
@@ -74,13 +75,13 @@ class Credits {
* Get the last author with the last modification time
* @param $article Article object
*/
- protected static function getAuthor( Article $article ){
+ protected static function getAuthor( Article $article ) {
global $wgLang;
$user = User::newFromId( $article->getUser() );
$timestamp = $article->getTimestamp();
- if( $timestamp ){
+ if ( $timestamp ) {
$d = $wgLang->date( $article->getTimestamp(), true );
$t = $wgLang->time( $article->getTimestamp(), true );
} else {
@@ -99,62 +100,72 @@ class Credits {
*/
protected static function getContributors( Article $article, $cnt, $showIfMax ) {
global $wgLang, $wgHiddenPrefs;
-
+
$contributors = $article->getContributors();
-
+
$others_link = false;
-
+
# Hmm... too many to fit!
- if( $cnt > 0 && $contributors->count() > $cnt ){
+ if ( $cnt > 0 && $contributors->count() > $cnt ) {
$others_link = self::othersLink( $article );
- if( !$showIfMax )
- return wfMsg( 'othercontribs', $others_link );
+ if ( !$showIfMax )
+ return wfMsgExt( 'othercontribs', 'parsemag', $others_link, $contributors->count() );
}
-
+
$real_names = array();
$user_names = array();
$anon_ips = array();
-
+
# Sift for real versus user names
- foreach( $contributors as $user ) {
+ foreach ( $contributors as $user ) {
$cnt--;
- if( $user->isLoggedIn() ){
+ if ( $user->isLoggedIn() ) {
$link = self::link( $user );
- if( !in_array( 'realname', $wgHiddenPrefs ) && $user->getRealName() )
+ if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->getRealName() ) {
$real_names[] = $link;
- else
+ } else {
$user_names[] = $link;
+ }
} else {
$anon_ips[] = self::link( $user );
}
- if( $cnt == 0 ) break;
+
+ if ( $cnt == 0 ) {
+ break;
+ }
}
-
+
if ( count( $real_names ) ) {
$real = $wgLang->listToText( $real_names );
} else {
$real = false;
}
-
+
# "ThisSite user(s) A, B and C"
- if( count( $user_names ) ){
- $user = wfMsgExt( 'siteusers', array( 'parsemag' ),
- $wgLang->listToText( $user_names ), count( $user_names ) );
+ if ( count( $user_names ) ) {
+ $user = wfMsgExt(
+ 'siteusers',
+ 'parsemag',
+ $wgLang->listToText( $user_names ), count( $user_names )
+ );
} else {
$user = false;
}
- if( count( $anon_ips ) ){
- $anon = wfMsgExt( 'anonusers', array( 'parsemag' ),
- $wgLang->listToText( $anon_ips ), count( $anon_ips ) );
+ if ( count( $anon_ips ) ) {
+ $anon = wfMsgExt(
+ 'anonusers',
+ 'parsemag',
+ $wgLang->listToText( $anon_ips ), count( $anon_ips )
+ );
} else {
$anon = false;
}
-
+
# This is the big list, all mooshed together. We sift for blank strings
$fulllist = array();
- foreach( array( $real, $user, $anon, $others_link ) as $s ){
- if( $s ){
+ foreach ( array( $real, $user, $anon, $others_link ) as $s ) {
+ if ( $s ) {
array_push( $fulllist, $s );
}
}
@@ -163,7 +174,9 @@ class Credits {
$creds = $wgLang->listToText( $fulllist );
# "Based on work by ..."
- return strlen( $creds ) ? wfMsg( 'othercontribs', $creds ) : '';
+ return strlen( $creds )
+ ? wfMsgExt( 'othercontribs', 'parsemag', $creds, count( $fulllist ) )
+ : '';
}
/**
@@ -173,10 +186,11 @@ class Credits {
*/
protected static function link( User $user ) {
global $wgUser, $wgHiddenPrefs;
- if( !in_array( 'realname', $wgHiddenPrefs ) && !$user->isAnon() )
+ if ( !in_array( 'realname', $wgHiddenPrefs ) && !$user->isAnon() ) {
$real = $user->getRealName();
- else
+ } else {
$real = false;
+ }
$skin = $wgUser->getSkin();
$page = $user->isAnon() ?
@@ -188,20 +202,20 @@ class Credits {
/**
* Get a link to $user's user page
- * @param $user_name String: user name
- * @param $linkText String: optional display
+ * @param $user User object
* @return String: html
*/
protected static function userLink( User $user ) {
$link = self::link( $user );
- if( $user->isAnon() ){
+ if ( $user->isAnon() ) {
return wfMsgExt( 'anonuser', array( 'parseinline', 'replaceafter' ), $link );
} else {
global $wgHiddenPrefs;
- if( !in_array( 'realname', $wgHiddenPrefs ) && $user->getRealName() )
+ if ( !in_array( 'realname', $wgHiddenPrefs ) && $user->getRealName() ) {
return $link;
- else
- return wfMsgExt( 'siteuser', array( 'parseinline', 'replaceafter' ), $link );
+ } else {
+ return wfMsgExt( 'siteuser', 'parsemag', $link, $user->getName() );
+ }
}
}
@@ -213,6 +227,12 @@ class Credits {
protected static function othersLink( Article $article ) {
global $wgUser;
$skin = $wgUser->getSkin();
- return $skin->link( $article->getTitle(), wfMsgHtml( 'others' ), array(), array( 'action' => 'credits' ), array( 'known' ) );
+ return $skin->link(
+ $article->getTitle(),
+ wfMsgHtml( 'others' ),
+ array(),
+ array( 'action' => 'credits' ),
+ array( 'known' )
+ );
}
}
diff --git a/includes/DatabaseFunctions.php b/includes/DatabaseFunctions.php
deleted file mode 100644
index 2df56115..00000000
--- a/includes/DatabaseFunctions.php
+++ /dev/null
@@ -1,412 +0,0 @@
-<?php
-/**
- * Legacy database functions, for compatibility with pre-1.3 code
- * NOTE: this file is no longer loaded by default.
- * @file
- * @ingroup Database
- */
-
-/**
- * Usually aborts on failure
- * If errors are explicitly ignored, returns success
- * @param $sql String: SQL query
- * @param $db Mixed: database handler
- * @param $fname String: name of the php function calling
- */
-function wfQuery( $sql, $db, $fname = '' ) {
- if ( !is_numeric( $db ) ) {
- # Someone has tried to call this the old way
- throw new FatalError( wfMsgNoDB( 'wrong_wfQuery_params', $db, $sql ) );
- }
- $c = wfGetDB( $db );
- if ( $c !== false ) {
- return $c->query( $sql, $fname );
- } else {
- return false;
- }
-}
-
-/**
- *
- * @param $sql String: SQL query
- * @param $dbi
- * @param $fname String: name of the php function calling
- * @return Array: first row from the database
- */
-function wfSingleQuery( $sql, $dbi, $fname = '' ) {
- $db = wfGetDB( $dbi );
- $res = $db->query($sql, $fname );
- $row = $db->fetchRow( $res );
- $ret = $row[0];
- $db->freeResult( $res );
- return $ret;
-}
-
-/**
- * Turns on (false) or off (true) the automatic generation and sending
- * of a "we're sorry, but there has been a database error" page on
- * database errors. Default is on (false). When turned off, the
- * code should use wfLastErrno() and wfLastError() to handle the
- * situation as appropriate.
- *
- * @param $newstate
- * @param $dbi
- * @return Returns the previous state.
- */
-function wfIgnoreSQLErrors( $newstate, $dbi = DB_LAST ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->ignoreErrors( $newstate );
- } else {
- return null;
- }
-}
-
-/**#@+
- * @param $res Database result handler
- * @param $dbi
-*/
-
-/**
- * Free a database result
- * @return Bool: whether result is sucessful or not.
- */
-function wfFreeResult( $res, $dbi = DB_LAST )
-{
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- $db->freeResult( $res );
- return true;
- } else {
- return false;
- }
-}
-
-/**
- * Get an object from a database result
- * @return object|false object we requested
- */
-function wfFetchObject( $res, $dbi = DB_LAST ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->fetchObject( $res, $dbi = DB_LAST );
- } else {
- return false;
- }
-}
-
-/**
- * Get a row from a database result
- * @return object|false row we requested
- */
-function wfFetchRow( $res, $dbi = DB_LAST ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->fetchRow ( $res, $dbi = DB_LAST );
- } else {
- return false;
- }
-}
-
-/**
- * Get a number of rows from a database result
- * @return integer|false number of rows
- */
-function wfNumRows( $res, $dbi = DB_LAST ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->numRows( $res, $dbi = DB_LAST );
- } else {
- return false;
- }
-}
-
-/**
- * Get the number of fields from a database result
- * @return integer|false number of fields
- */
-function wfNumFields( $res, $dbi = DB_LAST ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->numFields( $res );
- } else {
- return false;
- }
-}
-
-/**
- * Return name of a field in a result
- * @param $res Mixed: Ressource link see Database::fieldName()
- * @param $n Integer: id of the field
- * @param $dbi Default DB_LAST
- * @return string|false name of field
- */
-function wfFieldName( $res, $n, $dbi = DB_LAST )
-{
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->fieldName( $res, $n, $dbi = DB_LAST );
- } else {
- return false;
- }
-}
-/**#@-*/
-
-/**
- * @todo document function
- * @see Database::insertId()
- */
-function wfInsertId( $dbi = DB_LAST ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->insertId();
- } else {
- return false;
- }
-}
-
-/**
- * @todo document function
- * @see Database::dataSeek()
- */
-function wfDataSeek( $res, $row, $dbi = DB_LAST ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->dataSeek( $res, $row );
- } else {
- return false;
- }
-}
-
-/**
- * Get the last error number
- * @see Database::lastErrno()
- */
-function wfLastErrno( $dbi = DB_LAST ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->lastErrno();
- } else {
- return false;
- }
-}
-
-/**
- * Get the last error
- * @see Database::lastError()
- */
-function wfLastError( $dbi = DB_LAST ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->lastError();
- } else {
- return false;
- }
-}
-
-/**
- * Get the number of affected rows
- * @see Database::affectedRows()
- */
-function wfAffectedRows( $dbi = DB_LAST ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->affectedRows();
- } else {
- return false;
- }
-}
-
-/**
- * Get the last query ran
- * @see Database::lastQuery
- */
-function wfLastDBquery( $dbi = DB_LAST ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->lastQuery();
- } else {
- return false;
- }
-}
-
-/**
- * @see Database::Set()
- * @todo document function
- * @param $table
- * @param $var
- * @param $value
- * @param $cond
- * @param $dbi Default DB_MASTER
- */
-function wfSetSQL( $table, $var, $value, $cond, $dbi = DB_MASTER )
-{
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->set( $table, $var, $value, $cond );
- } else {
- return false;
- }
-}
-
-
-/**
- * Simple select wrapper, return one field
- * @see Database::selectField()
- * @param $table
- * @param $var
- * @param $cond Default ''
- * @param $dbi Default DB_LAST
- */
-function wfGetSQL( $table, $var, $cond='', $dbi = DB_LAST )
-{
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->selectField( $table, $var, $cond );
- } else {
- return false;
- }
-}
-
-/**
- * Does a given field exist on the specified table?
- * @see Database::fieldExists()
- * @param $table
- * @param $field
- * @param $dbi Default DB_LAST
- * @return Result of Database::fieldExists() or false.
- */
-function wfFieldExists( $table, $field, $dbi = DB_LAST ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->fieldExists( $table, $field );
- } else {
- return false;
- }
-}
-
-/**
- * Does the requested index exist on the specified table?
- * @see Database::indexExists()
- * @param $table String
- * @param $index
- * @param $dbi Default DB_LAST
- * @return Result of Database::indexExists() or false.
- */
-function wfIndexExists( $table, $index, $dbi = DB_LAST ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->indexExists( $table, $index );
- } else {
- return false;
- }
-}
-
-/**
- * @see Database::insert()
- * @todo document function
- * @param $table String
- * @param $array Array
- * @param $fname String, default 'wfInsertArray'.
- * @param $dbi Default DB_MASTER
- * @return result of Database::insert() or false.
- */
-function wfInsertArray( $table, $array, $fname = 'wfInsertArray', $dbi = DB_MASTER ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->insert( $table, $array, $fname );
- } else {
- return false;
- }
-}
-
-/**
- * @see Database::getArray()
- * @todo document function
- * @param $table String
- * @param $vars
- * @param $conds
- * @param $fname String, default 'wfGetArray'.
- * @param $dbi Default DB_LAST
- * @return result of Database::getArray() or false.
- */
-function wfGetArray( $table, $vars, $conds, $fname = 'wfGetArray', $dbi = DB_LAST ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->getArray( $table, $vars, $conds, $fname );
- } else {
- return false;
- }
-}
-
-/**
- * @see Database::update()
- * @param $table String
- * @param $values
- * @param $conds
- * @param $fname String, default 'wfUpdateArray'
- * @param $dbi Default DB_MASTER
- * @return Result of Database::update()) or false;
- * @todo document function
- */
-function wfUpdateArray( $table, $values, $conds, $fname = 'wfUpdateArray', $dbi = DB_MASTER ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- $db->update( $table, $values, $conds, $fname );
- return true;
- } else {
- return false;
- }
-}
-
-/**
- * Get fully usable table name
- * @see Database::tableName()
- */
-function wfTableName( $name, $dbi = DB_LAST ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->tableName( $name );
- } else {
- return false;
- }
-}
-
-/**
- * @todo document function
- * @see Database::strencode()
- */
-function wfStrencode( $s, $dbi = DB_LAST ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->strencode( $s );
- } else {
- return false;
- }
-}
-
-/**
- * @todo document function
- * @see Database::nextSequenceValue()
- */
-function wfNextSequenceValue( $seqName, $dbi = DB_MASTER ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->nextSequenceValue( $seqName );
- } else {
- return false;
- }
-}
-
-/**
- * @todo document function
- * @see Database::useIndexClause()
- */
-function wfUseIndexClause( $index, $dbi = DB_SLAVE ) {
- $db = wfGetDB( $dbi );
- if ( $db !== false ) {
- return $db->useIndexClause( $index );
- } else {
- return false;
- }
-}
diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php
index 54a96d44..ae6fc1b7 100644
--- a/includes/DefaultSettings.php
+++ b/includes/DefaultSettings.php
@@ -1,5 +1,6 @@
<?php
/**
+ * @file
*
* NEVER EDIT THIS FILE
*
@@ -14,80 +15,78 @@
*
* Documentation is in the source and on:
* http://www.mediawiki.org/wiki/Manual:Configuration_settings
- *
*/
-# This is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
+/**
+ * @cond file_level_code
+ * This is not a valid entry point, perform no further processing unless MEDIAWIKI is defined
+ */
if( !defined( 'MEDIAWIKI' ) ) {
echo "This file is part of MediaWiki and is not a valid entry point\n";
die( 1 );
}
-/**
- * Create a site configuration object
- * Not used for much in a default install
- */
+# Create a site configuration object. Not used for much in a default install
if ( !defined( 'MW_PHP4' ) ) {
require_once( "$IP/includes/SiteConfiguration.php" );
$wgConf = new SiteConfiguration;
}
+/** @endcond */
/** MediaWiki version number */
-$wgVersion = '1.16.5';
+$wgVersion = '1.17.0';
/** Name of the site. It must be changed in LocalSettings.php */
$wgSitename = 'MediaWiki';
/**
- * Name of the project namespace. If left set to false, $wgSitename will be
- * used instead.
- */
-$wgMetaNamespace = false;
-
-/**
- * Name of the project talk namespace.
+ * URL of the server. It will be automatically built including https mode.
*
- * Normally you can ignore this and it will be something like
- * $wgMetaNamespace . "_talk". In some languages, you may want to set this
- * manually for grammatical reasons. It is currently only respected by those
- * languages where it might be relevant and where no automatic grammar converter
- * exists.
+ * Example:
+ * <code>
+ * $wgServer = http://example.com
+ * </code>
+ *
+ * This is usually detected correctly by MediaWiki. If MediaWiki detects the
+ * wrong server, it will redirect incorrectly after you save a page. In that
+ * case, set this variable to fix it.
*/
-$wgMetaNamespaceTalk = false;
-
-
-/** URL of the server. It will be automatically built including https mode */
$wgServer = '';
+/** @cond file_level_code */
if( isset( $_SERVER['SERVER_NAME'] ) ) {
- $wgServerName = $_SERVER['SERVER_NAME'];
+ $serverName = $_SERVER['SERVER_NAME'];
} elseif( isset( $_SERVER['HOSTNAME'] ) ) {
- $wgServerName = $_SERVER['HOSTNAME'];
+ $serverName = $_SERVER['HOSTNAME'];
} elseif( isset( $_SERVER['HTTP_HOST'] ) ) {
- $wgServerName = $_SERVER['HTTP_HOST'];
+ $serverName = $_SERVER['HTTP_HOST'];
} elseif( isset( $_SERVER['SERVER_ADDR'] ) ) {
- $wgServerName = $_SERVER['SERVER_ADDR'];
+ $serverName = $_SERVER['SERVER_ADDR'];
} else {
- $wgServerName = 'localhost';
+ $serverName = 'localhost';
}
-# check if server use https:
$wgProto = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http';
-$wgServer = $wgProto.'://' . $wgServerName;
+$wgServer = $wgProto.'://' . $serverName;
# If the port is a non-standard one, add it to the URL
if( isset( $_SERVER['SERVER_PORT'] )
- && !strpos( $wgServerName, ':' )
- && ( ( $wgProto == 'http' && $_SERVER['SERVER_PORT'] != 80 )
+ && !strpos( $serverName, ':' )
+ && ( ( $wgProto == 'http' && $_SERVER['SERVER_PORT'] != 80 )
|| ( $wgProto == 'https' && $_SERVER['SERVER_PORT'] != 443 ) ) ) {
$wgServer .= ":" . $_SERVER['SERVER_PORT'];
}
+/** @endcond */
+/************************************************************************//**
+ * @name Script path settings
+ * @{
+ */
/**
* The path we should point to.
- * It might be a virtual path in case with use apache mod_rewrite for example
+ * It might be a virtual path in case with use apache mod_rewrite for example.
*
* This *needs* to be set correctly.
*
@@ -117,85 +116,207 @@ $wgUsePathInfo =
( strpos( php_sapi_name(), 'apache2filter' ) === false ) &&
( strpos( php_sapi_name(), 'isapi' ) === false );
+/**
+ * The extension to append to script names by default. This can either be .php
+ * or .php5.
+ *
+ * Some hosting providers use PHP 4 for *.php files, and PHP 5 for *.php5. This
+ * variable is provided to support those providers.
+ */
+$wgScriptExtension = '.php';
-/**@{
- * Script users will request to get articles
- * ATTN: Old installations used wiki.phtml and redirect.phtml - make sure that
- * LocalSettings.php is correctly set!
+/**
+ * The URL path to index.php.
*
- * Will be set based on $wgScriptPath in Setup.php if not overridden in
- * LocalSettings.php. Generally you should not need to change this unless you
- * don't like seeing "index.php".
+ * Defaults to "{$wgScriptPath}/index{$wgScriptExtension}".
*/
-$wgScriptExtension = '.php'; ///< extension to append to script names by default
-$wgScript = false; ///< defaults to "{$wgScriptPath}/index{$wgScriptExtension}"
-$wgRedirectScript = false; ///< defaults to "{$wgScriptPath}/redirect{$wgScriptExtension}"
-/**@}*/
+$wgScript = false;
+/**
+ * The URL path to redirect.php. This is a script that is used by the Nostalgia
+ * skin.
+ *
+ * Defaults to "{$wgScriptPath}/redirect{$wgScriptExtension}".
+ */
+$wgRedirectScript = false; ///< defaults to
-/**@{
+/**
+ * The URL path to load.php.
+ *
+ * Defaults to "{$wgScriptPath}/load{$wgScriptExtension}".
+ */
+$wgLoadScript = false;
+
+/**@}*/
+
+/************************************************************************//**
+ * @name URLs and file paths
+ *
* These various web and file path variables are set to their defaults
* in Setup.php if they are not explicitly set from LocalSettings.php.
* If you do override them, be sure to set them all!
*
* These will relatively rarely need to be set manually, unless you are
* splitting style sheets or images outside the main document root.
+ *
+ * In this section, a "path" is usually a host-relative URL, i.e. a URL without
+ * the host part, that starts with a slash. In most cases a full URL is also
+ * acceptable. A "directory" is a local file path.
+ *
+ * In both paths and directories, trailing slashes should not be included.
+ *
+ * @{
*/
+
/**
- * asset paths as seen by users
+ * The URL path of the skins directory. Defaults to "{$wgScriptPath}/skins"
*/
-$wgStylePath = false; ///< defaults to "{$wgScriptPath}/skins"
-$wgExtensionAssetsPath = false; ///< defaults to "{$wgScriptPath}/extensions"
+$wgStylePath = false;
+$wgStyleSheetPath = &$wgStylePath;
/**
- * filesystem stylesheets directory
+ * The URL path of the skins directory. Should not point to an external domain.
+ * Defaults to "{$wgScriptPath}/skins".
+ */
+$wgLocalStylePath = false;
+
+/**
+ * The URL path of the extensions directory.
+ * Defaults to "{$wgScriptPath}/extensions".
+ */
+$wgExtensionAssetsPath = false;
+
+/**
+ * Filesystem stylesheets directory. Defaults to "{$IP}/skins"
+ */
+$wgStyleDirectory = false;
+
+/**
+ * The URL path for primary article page views. This path should contain $1,
+ * which is replaced by the article title.
+ *
+ * Defaults to "{$wgScript}/$1" or "{$wgScript}?title=$1", depending on
+ * $wgUsePathInfo.
+ */
+$wgArticlePath = false;
+
+/**
+ * The URL path for the images directory. Defaults to "{$wgScriptPath}/images"
+ */
+$wgUploadPath = false;
+
+/**
+ * The filesystem path of the images directory. Defaults to "{$IP}/images".
+ */
+$wgUploadDirectory = false;
+
+/**
+ * The URL path of the wiki logo. The logo size should be 135x135 pixels.
+ * Defaults to "{$wgStylePath}/common/images/wiki.png".
+ */
+$wgLogo = false;
+
+/**
+ * The URL path of the shortcut icon.
*/
-$wgStyleDirectory = false; ///< defaults to "{$IP}/skins"
-$wgStyleSheetPath = &$wgStylePath;
-$wgArticlePath = false; ///< default to "{$wgScript}/$1" or "{$wgScript}?title=$1", depending on $wgUsePathInfo
-$wgUploadPath = false; ///< defaults to "{$wgScriptPath}/images"
-$wgUploadDirectory = false; ///< defaults to "{$IP}/images"
-$wgHashedUploadDirectory = true;
-$wgLogo = false; ///< defaults to "{$wgStylePath}/common/images/wiki.png"
$wgFavicon = '/favicon.ico';
-$wgAppleTouchIcon = false; ///< This one'll actually default to off. For iPhone and iPod Touch web app bookmarks
-$wgMathPath = false; ///< defaults to "{$wgUploadPath}/math"
-$wgMathDirectory = false; ///< defaults to "{$wgUploadDirectory}/math"
-$wgTmpDirectory = false; ///< defaults to "{$wgUploadDirectory}/tmp"
-$wgUploadBaseUrl = "";
-/**@}*/
/**
- * Directory for caching data in the local filesystem. Should not be accessible
- * from the web. Set this to false to not use any local caches.
+ * The URL path of the icon for iPhone and iPod Touch web app bookmarks.
+ * Defaults to no icon.
+ */
+$wgAppleTouchIcon = false;
+
+/**
+ * The URL path of the math directory. Defaults to "{$wgUploadPath}/math".
*
- * Note: if multiple wikis share the same localisation cache directory, they
- * must all have the same set of extensions. You can set a directory just for
- * the localisation cache using $wgLocalisationCacheConf['storeDirectory'].
+ * See http://www.mediawiki.org/wiki/Manual:Enable_TeX for details about how to
+ * set up mathematical formula display.
*/
-$wgCacheDirectory = false;
+$wgMathPath = false;
/**
- * Default value for chmoding of new directories.
+ * The filesystem path of the math directory.
+ * Defaults to "{$wgUploadDirectory}/math".
+ *
+ * See http://www.mediawiki.org/wiki/Manual:Enable_TeX for details about how to
+ * set up mathematical formula display.
*/
-$wgDirectoryMode = 0777;
+$wgMathDirectory = false;
/**
- * New file storage paths; currently used only for deleted files.
- * Set it like this:
+ * The local filesystem path to a temporary directory. This is not required to
+ * be web accessible.
*
- * $wgFileStore['deleted']['directory'] = '/var/wiki/private/deleted';
+ * Defaults to "{$wgUploadDirectory}/tmp".
+ */
+$wgTmpDirectory = false;
+
+/**
+ * If set, this URL is added to the start of $wgUploadPath to form a complete
+ * upload URL.
+ */
+$wgUploadBaseUrl = "";
+
+/**
+ * To enable remote on-demand scaling, set this to the thumbnail base URL.
+ * Full thumbnail URL will be like $wgUploadStashScalerBaseUrl/e/e6/Foo.jpg/123px-Foo.jpg
+ * where 'e6' are the first two characters of the MD5 hash of the file name.
+ * If $wgUploadStashScalerBaseUrl is set to false, thumbs are rendered locally as needed.
+ */
+$wgUploadStashScalerBaseUrl = false;
+
+/**
+ * To set 'pretty' URL paths for actions other than
+ * plain page views, add to this array. For instance:
+ * 'edit' => "$wgScriptPath/edit/$1"
*
+ * There must be an appropriate script or rewrite rule
+ * in place to handle these URLs.
+ */
+$wgActionPaths = array();
+
+/**@}*/
+
+/************************************************************************//**
+ * @name Files and file uploads
+ * @{
+ */
+
+/** Uploads have to be specially set up to be secure */
+$wgEnableUploads = false;
+
+/** Allows to move images and other media files */
+$wgAllowImageMoving = true;
+
+/**
+ * These are additional characters that should be replaced with '-' in file names
+ */
+$wgIllegalFileChars = ":";
+
+/**
+ * @deprecated use $wgDeletedDirectory
*/
$wgFileStore = array();
-$wgFileStore['deleted']['directory'] = false;///< Defaults to $wgUploadDirectory/deleted
-$wgFileStore['deleted']['url'] = null; ///< Private
-$wgFileStore['deleted']['hash'] = 3; ///< 3-level subdirectory split
-$wgImgAuthDetails = false; ///< defaults to false - only set to true if you use img_auth and want the user to see details on why access failed
-$wgImgAuthPublicTest = true; ///< defaults to true - if public read is turned on, no need for img_auth, config error unless other access is used
+/**
+ * What directory to place deleted uploads in
+ */
+$wgDeletedDirectory = false; // Defaults to $wgUploadDirectory/deleted
+
+/**
+ * Set this to true if you use img_auth and want the user to see details on why access failed.
+ */
+$wgImgAuthDetails = false;
-/**@{
+/**
+ * If this is enabled, img_auth.php will not allow image access unless the wiki
+ * is private. This improves security when image uploads are hosted on a
+ * separate domain.
+ */
+$wgImgAuthPublicTest = true;
+
+/**
* File repository structures
*
* $wgLocalFileRepo is a single repository structure, and $wgForeignFileRepos is
@@ -203,59 +324,62 @@ $wgImgAuthPublicTest = true; ///< defaults to true - if public read is turned on
* array of properties configuring the repository.
*
* Properties required for all repos:
- * class The class name for the repository. May come from the core or an extension.
+ * - class The class name for the repository. May come from the core or an extension.
* The core repository classes are LocalRepo, ForeignDBRepo, FSRepo.
*
- * name A unique name for the repository.
+ * - name A unique name for the repository.
*
* For most core repos:
- * url Base public URL
- * hashLevels The number of directory levels for hash-based division of files
- * thumbScriptUrl The URL for thumb.php (optional, not recommended)
- * transformVia404 Whether to skip media file transformation on parse and rely on a 404
+ * - url Base public URL
+ * - hashLevels The number of directory levels for hash-based division of files
+ * - thumbScriptUrl The URL for thumb.php (optional, not recommended)
+ * - transformVia404 Whether to skip media file transformation on parse and rely on a 404
* handler instead.
- * initialCapital Equivalent to $wgCapitalLinks (or $wgCapitalLinkOverrides[NS_FILE],
+ * - initialCapital Equivalent to $wgCapitalLinks (or $wgCapitalLinkOverrides[NS_FILE],
* determines whether filenames implicitly start with a capital letter.
* The current implementation may give incorrect description page links
* when the local $wgCapitalLinks and initialCapital are mismatched.
- * pathDisclosureProtection
+ * - pathDisclosureProtection
* May be 'paranoid' to remove all parameters from error messages, 'none' to
* leave the paths in unchanged, or 'simple' to replace paths with
* placeholders. Default for LocalRepo is 'simple'.
- * fileMode This allows wikis to set the file mode when uploading/moving files. Default
+ * - fileMode This allows wikis to set the file mode when uploading/moving files. Default
* is 0644.
- * directory The local filesystem directory where public files are stored. Not used for
+ * - directory The local filesystem directory where public files are stored. Not used for
* some remote repos.
- * thumbDir The base thumbnail directory. Defaults to <directory>/thumb.
- * thumbUrl The base thumbnail URL. Defaults to <url>/thumb.
+ * - thumbDir The base thumbnail directory. Defaults to <directory>/thumb.
+ * - thumbUrl The base thumbnail URL. Defaults to <url>/thumb.
*
*
* These settings describe a foreign MediaWiki installation. They are optional, and will be ignored
* for local repositories:
- * descBaseUrl URL of image description pages, e.g. http://en.wikipedia.org/wiki/Image:
- * scriptDirUrl URL of the MediaWiki installation, equivalent to $wgScriptPath, e.g.
- * http://en.wikipedia.org/w
- *
- * articleUrl Equivalent to $wgArticlePath, e.g. http://en.wikipedia.org/wiki/$1
- * fetchDescription Fetch the text of the remote file description page. Equivalent to
+ * - descBaseUrl URL of image description pages, e.g. http://en.wikipedia.org/wiki/File:
+ * - scriptDirUrl URL of the MediaWiki installation, equivalent to $wgScriptPath, e.g.
+ * http://en.wikipedia.org/w
+ * - scriptExtension Script extension of the MediaWiki installation, equivalent to
+ * $wgScriptExtension, e.g. .php5 defaults to .php
+ *
+ * - articleUrl Equivalent to $wgArticlePath, e.g. http://en.wikipedia.org/wiki/$1
+ * - fetchDescription Fetch the text of the remote file description page. Equivalent to
* $wgFetchCommonsDescriptions.
*
* ForeignDBRepo:
- * dbType, dbServer, dbUser, dbPassword, dbName, dbFlags
+ * - dbType, dbServer, dbUser, dbPassword, dbName, dbFlags
* equivalent to the corresponding member of $wgDBservers
- * tablePrefix Table prefix, the foreign wiki's $wgDBprefix
- * hasSharedCache True if the wiki's shared cache is accessible via the local $wgMemc
+ * - tablePrefix Table prefix, the foreign wiki's $wgDBprefix
+ * - hasSharedCache True if the wiki's shared cache is accessible via the local $wgMemc
*
* ForeignAPIRepo:
- * apibase Use for the foreign API's URL
- * apiThumbCacheExpiry How long to locally cache thumbs for
+ * - apibase Use for the foreign API's URL
+ * - apiThumbCacheExpiry How long to locally cache thumbs for
*
* The default is to initialise these arrays from the MW<1.11 backwards compatible settings:
* $wgUploadPath, $wgThumbnailScriptPath, $wgSharedUploadDirectory, etc.
*/
$wgLocalFileRepo = false;
+
+/** @see $wgLocalFileRepo */
$wgForeignFileRepos = array();
-/**@}*/
/**
* Use Commons as a remote file repository. Essentially a wrapper, when this
@@ -265,76 +389,398 @@ $wgForeignFileRepos = array();
$wgUseInstantCommons = false;
/**
- * Allowed title characters -- regex character class
- * Don't change this unless you know what you're doing
+ * Show EXIF data, on by default if available.
+ * Requires PHP's EXIF extension: http://www.php.net/manual/en/ref.exif.php
*
- * Problematic punctuation:
- * []{}|# Are needed for link syntax, never enable these
- * <> Causes problems with HTML escaping, don't use
- * % Enabled by default, minor problems with path to query rewrite rules, see below
- * + Enabled by default, but doesn't work with path to query rewrite rules, corrupted by apache
- * ? Enabled by default, but doesn't work with path to PATH_INFO rewrites
+ * NOTE FOR WINDOWS USERS:
+ * To enable EXIF functions, add the folloing lines to the
+ * "Windows extensions" section of php.ini:
*
- * All three of these punctuation problems can be avoided by using an alias, instead of a
- * rewrite rule of either variety.
+ * extension=extensions/php_mbstring.dll
+ * extension=extensions/php_exif.dll
+ */
+$wgShowEXIF = function_exists( 'exif_read_data' );
+
+/**
+ * If you operate multiple wikis, you can define a shared upload path here.
+ * Uploads to this wiki will NOT be put there - they will be put into
+ * $wgUploadDirectory.
+ * If $wgUseSharedUploads is set, the wiki will look in the shared repository if
+ * no file of the given name is found in the local repository (for [[File:..]],
+ * [[Media:..]] links). Thumbnails will also be looked for and generated in this
+ * directory.
*
- * The problem with % is that when using a path to query rewrite rule, URLs are
- * double-unescaped: once by Apache's path conversion code, and again by PHP. So
- * %253F, for example, becomes "?". Our code does not double-escape to compensate
- * for this, indeed double escaping would break if the double-escaped title was
- * passed in the query string rather than the path. This is a minor security issue
- * because articles can be created such that they are hard to view or edit.
+ * Note that these configuration settings can now be defined on a per-
+ * repository basis for an arbitrary number of file repositories, using the
+ * $wgForeignFileRepos variable.
+ */
+$wgUseSharedUploads = false;
+/** Full path on the web server where shared uploads can be found */
+$wgSharedUploadPath = "http://commons.wikimedia.org/shared/images";
+/** Fetch commons image description pages and display them on the local wiki? */
+$wgFetchCommonsDescriptions = false;
+/** Path on the file system where shared uploads can be found. */
+$wgSharedUploadDirectory = "/var/www/wiki3/images";
+/** DB name with metadata about shared directory. Set this to false if the uploads do not come from a wiki. */
+$wgSharedUploadDBname = false;
+/** Optional table prefix used in database. */
+$wgSharedUploadDBprefix = '';
+/** Cache shared metadata in memcached. Don't do this if the commons wiki is in a different memcached domain */
+$wgCacheSharedUploads = true;
+/**
+* Allow for upload to be copied from an URL. Requires Special:Upload?source=web
+* The timeout for copy uploads is set by $wgHTTPTimeout.
+*/
+$wgAllowCopyUploads = false;
+/**
+ * Allow asynchronous copy uploads.
+ * This feature is experimental.
+ */
+$wgAllowAsyncCopyUploads = false;
+
+/**
+ * Max size for uploads, in bytes. Applies to all uploads.
+ */
+$wgMaxUploadSize = 1024*1024*100; # 100MB
+
+/**
+ * Point the upload navigation link to an external URL
+ * Useful if you want to use a shared repository by default
+ * without disabling local uploads (use $wgEnableUploads = false for that)
+ * e.g. $wgUploadNavigationUrl = 'http://commons.wikimedia.org/wiki/Special:Upload';
+ */
+$wgUploadNavigationUrl = false;
+
+/**
+ * Point the upload link for missing files to an external URL, as with
+ * $wgUploadNavigationUrl. The URL will get (?|&)wpDestFile=<filename>
+ * appended to it as appropriate.
+ */
+$wgUploadMissingFileUrl = false;
+
+/**
+ * Give a path here to use thumb.php for thumbnail generation on client request, instead of
+ * generating them on render and outputting a static URL. This is necessary if some of your
+ * apache servers don't have read/write access to the thumbnail path.
*
- * In some rare cases you may wish to remove + for compatibility with old links.
+ * Example:
+ * $wgThumbnailScriptPath = "{$wgScriptPath}/thumb{$wgScriptExtension}";
+ */
+$wgThumbnailScriptPath = false;
+$wgSharedThumbnailScriptPath = false;
+
+/**
+ * Set this to false if you do not want MediaWiki to divide your images
+ * directory into many subdirectories, for improved performance.
*
- * Theoretically 0x80-0x9F of ISO 8859-1 should be disallowed, but
- * this breaks interlanguage links
+ * It's almost always good to leave this enabled. In previous versions of
+ * MediaWiki, some users set this to false to allow images to be added to the
+ * wiki by simply copying them into $wgUploadDirectory and then running
+ * maintenance/rebuildImages.php to register them in the database. This is no
+ * longer recommended, use maintenance/importImages.php instead.
+ *
+ * Note that this variable may be ignored if $wgLocalFileRepo is set.
*/
-$wgLegalTitleChars = " %!\"$&'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+";
-$wgIllegalFileChars = ":"; // These are additional characters that should be replaced with '-' in file names
+$wgHashedUploadDirectory = true;
+/**
+ * Set the following to false especially if you have a set of files that need to
+ * be accessible by all wikis, and you do not want to use the hash (path/a/aa/)
+ * directory layout.
+ */
+$wgHashedSharedUploadDirectory = true;
+
+/**
+ * Base URL for a repository wiki. Leave this blank if uploads are just stored
+ * in a shared directory and not meant to be accessible through a separate wiki.
+ * Otherwise the image description pages on the local wiki will link to the
+ * image description page on this wiki.
+ *
+ * Please specify the namespace, as in the example below.
+ */
+$wgRepositoryBaseUrl = "http://commons.wikimedia.org/wiki/File:";
/**
- * The external URL protocols
+ * This is the list of preferred extensions for uploading files. Uploading files
+ * with extensions not in this list will trigger a warning.
+ *
+ * WARNING: If you add any OpenOffice or Microsoft Office file formats here,
+ * such as odt or doc, and untrusted users are allowed to upload files, then
+ * your wiki will be vulnerable to cross-site request forgery (CSRF).
*/
-$wgUrlProtocols = array(
- 'http://',
- 'https://',
- 'ftp://',
- 'irc://',
- 'gopher://',
- 'telnet://', // Well if we're going to support the above.. -ævar
- 'nntp://', // @bug 3808 RFC 1738
- 'worldwind://',
- 'mailto:',
- 'news:',
- 'svn://',
+$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg' );
+
+/** Files with these extensions will never be allowed as uploads. */
+$wgFileBlacklist = array(
+ # HTML may contain cookie-stealing JavaScript and web bugs
+ 'html', 'htm', 'js', 'jsb', 'mhtml', 'mht', 'xhtml', 'xht',
+ # PHP scripts may execute arbitrary code on the server
+ 'php', 'phtml', 'php3', 'php4', 'php5', 'phps',
+ # Other types that may be interpreted by some servers
+ 'shtml', 'jhtml', 'pl', 'py', 'cgi',
+ # May contain harmful executables for Windows victims
+ 'exe', 'scr', 'dll', 'msi', 'vbs', 'bat', 'com', 'pif', 'cmd', 'vxd', 'cpl' );
+
+/**
+ * Files with these mime types will never be allowed as uploads
+ * if $wgVerifyMimeType is enabled.
+ */
+$wgMimeTypeBlacklist = array(
+ # HTML may contain cookie-stealing JavaScript and web bugs
+ 'text/html', 'text/javascript', 'text/x-javascript', 'application/x-shellscript',
+ # PHP scripts may execute arbitrary code on the server
+ 'application/x-php', 'text/x-php',
+ # Other types that may be interpreted by some servers
+ 'text/x-python', 'text/x-perl', 'text/x-bash', 'text/x-sh', 'text/x-csh',
+ # Client-side hazards on Internet Explorer
+ 'text/scriptlet', 'application/x-msdownload',
+ # Windows metafile, client-side vulnerability on some systems
+ 'application/x-msmetafile',
+ # A ZIP file may be a valid Java archive containing an applet which exploits the
+ # same-origin policy to steal cookies
+ 'application/zip',
+
+ # MS Office OpenXML and other Open Package Conventions files are zip files
+ # and thus blacklisted just as other zip files. If you remove these entries
+ # from the blacklist in your local configuration, a malicious file upload
+ # will be able to compromise the wiki's user accounts, and the user
+ # accounts of any other website in the same cookie domain.
+ 'application/x-opc+zip',
+ 'application/msword',
+ 'application/vnd.ms-powerpoint',
+ 'application/vnd.msexcel',
);
-/** internal name of virus scanner. This servers as a key to the $wgAntivirusSetup array.
- * Set this to NULL to disable virus scanning. If not null, every file uploaded will be scanned for viruses.
+/**
+ * This is a flag to determine whether or not to check file extensions on upload.
+ *
+ * WARNING: setting this to false is insecure for public wikis.
*/
-$wgAntivirus= null;
+$wgCheckFileExtensions = true;
-/** Configuration for different virus scanners. This an associative array of associative arrays:
- * it contains on setup array per known scanner type. The entry is selected by $wgAntivirus, i.e.
- * valid values for $wgAntivirus are the keys defined in this array.
+/**
+ * If this is turned off, users may override the warning for files not covered
+ * by $wgFileExtensions.
+ *
+ * WARNING: setting this to false is insecure for public wikis.
+ */
+$wgStrictFileExtensions = true;
+
+/** Warn if uploaded files are larger than this (in bytes), or false to disable*/
+$wgUploadSizeWarning = false;
+
+/**
+ * list of trusted media-types and mime types.
+ * Use the MEDIATYPE_xxx constants to represent media types.
+ * This list is used by File::isSafeFile
+ *
+ * Types not listed here will have a warning about unsafe content
+ * displayed on the images description page. It would also be possible
+ * to use this for further restrictions, like disabling direct
+ * [[media:...]] links for non-trusted formats.
+ */
+$wgTrustedMediaFormats = array(
+ MEDIATYPE_BITMAP, //all bitmap formats
+ MEDIATYPE_AUDIO, //all audio formats
+ MEDIATYPE_VIDEO, //all plain video formats
+ "image/svg+xml", //svg (only needed if inline rendering of svg is not supported)
+ "application/pdf", //PDF files
+ #"application/x-shockwave-flash", //flash/shockwave movie
+);
+
+/**
+ * Plugins for media file type handling.
+ * Each entry in the array maps a MIME type to a class name
+ */
+$wgMediaHandlers = array(
+ 'image/jpeg' => 'BitmapHandler',
+ 'image/png' => 'PNGHandler',
+ 'image/gif' => 'GIFHandler',
+ 'image/tiff' => 'TiffHandler',
+ 'image/x-ms-bmp' => 'BmpHandler',
+ 'image/x-bmp' => 'BmpHandler',
+ 'image/svg+xml' => 'SvgHandler', // official
+ 'image/svg' => 'SvgHandler', // compat
+ 'image/vnd.djvu' => 'DjVuHandler', // official
+ 'image/x.djvu' => 'DjVuHandler', // compat
+ 'image/x-djvu' => 'DjVuHandler', // compat
+);
+
+/**
+ * Resizing can be done using PHP's internal image libraries or using
+ * ImageMagick or another third-party converter, e.g. GraphicMagick.
+ * These support more file formats than PHP, which only supports PNG,
+ * GIF, JPG, XBM and WBMP.
+ *
+ * Use Image Magick instead of PHP builtin functions.
+ */
+$wgUseImageMagick = false;
+/** The convert command shipped with ImageMagick */
+$wgImageMagickConvertCommand = '/usr/bin/convert';
+
+/** Sharpening parameter to ImageMagick */
+$wgSharpenParameter = '0x0.4';
+
+/** Reduction in linear dimensions below which sharpening will be enabled */
+$wgSharpenReductionThreshold = 0.85;
+
+/**
+ * Temporary directory used for ImageMagick. The directory must exist. Leave
+ * this set to false to let ImageMagick decide for itself.
+ */
+$wgImageMagickTempDir = false;
+
+/**
+ * Use another resizing converter, e.g. GraphicMagick
+ * %s will be replaced with the source path, %d with the destination
+ * %w and %h will be replaced with the width and height.
+ *
+ * Example for GraphicMagick:
+ * <code>
+ * $wgCustomConvertCommand = "gm convert %s -resize %wx%h %d"
+ * </code>
+ *
+ * Leave as false to skip this.
+ */
+$wgCustomConvertCommand = false;
+
+/**
+ * Scalable Vector Graphics (SVG) may be uploaded as images.
+ * Since SVG support is not yet standard in browsers, it is
+ * necessary to rasterize SVGs to PNG as a fallback format.
+ *
+ * An external program is required to perform this conversion.
+ */
+$wgSVGConverters = array(
+ 'ImageMagick' => '$path/convert -background white -thumbnail $widthx$height\! $input PNG:$output',
+ 'sodipodi' => '$path/sodipodi -z -w $width -f $input -e $output',
+ 'inkscape' => '$path/inkscape -z -w $width -f $input -e $output',
+ 'batik' => 'java -Djava.awt.headless=true -jar $path/batik-rasterizer.jar -w $width -d $output $input',
+ 'rsvg' => '$path/rsvg -w$width -h$height $input $output',
+ 'imgserv' => '$path/imgserv-wrapper -i svg -o png -w$width $input $output',
+ );
+/** Pick a converter defined in $wgSVGConverters */
+$wgSVGConverter = 'ImageMagick';
+/** If not in the executable PATH, specify the SVG converter path. */
+$wgSVGConverterPath = '';
+/** Don't scale a SVG larger than this */
+$wgSVGMaxSize = 2048;
+/** Don't read SVG metadata beyond this point.
+ * Default is 1024*256 bytes */
+$wgSVGMetadataCutoff = 262144;
+
+/**
+ * MediaWiki will reject HTMLesque tags in uploaded files due to idiotic browsers which can't
+ * perform basic stuff like MIME detection and which are vulnerable to further idiots uploading
+ * crap files as images. When this directive is on, <title> will be allowed in files with
+ * an "image/svg+xml" MIME type. You should leave this disabled if your web server is misconfigured
+ * and doesn't send appropriate MIME types for SVG images.
+ */
+$wgAllowTitlesInSVG = false;
+
+/**
+ * Don't thumbnail an image if it will use too much working memory.
+ * Default is 50 MB if decompressed to RGBA form, which corresponds to
+ * 12.5 million pixels or 3500x3500
+ */
+$wgMaxImageArea = 1.25e7;
+/**
+ * Force thumbnailing of animated GIFs above this size to a single
+ * frame instead of an animated thumbnail. As of MW 1.17 this limit
+ * is checked against the total size of all frames in the animation.
+ * It probably makes sense to keep this equal to $wgMaxImageArea.
+ */
+$wgMaxAnimatedGifArea = 1.25e7;
+/**
+ * Browsers don't support TIFF inline generally...
+ * For inline display, we need to convert to PNG or JPEG.
+ * Note scaling should work with ImageMagick, but may not with GD scaling.
*
- * The configuration array for each scanner contains the following keys: "command", "codemap", "messagepattern";
+ * Example:
+ * <code>
+ * // PNG is lossless, but inefficient for photos
+ * $wgTiffThumbnailType = array( 'png', 'image/png' );
+ * // JPEG is good for photos, but has no transparency support. Bad for diagrams.
+ * $wgTiffThumbnailType = array( 'jpg', 'image/jpeg' );
+ * </code>
+ */
+ $wgTiffThumbnailType = false;
+
+/**
+ * If rendered thumbnail files are older than this timestamp, they
+ * will be rerendered on demand as if the file didn't already exist.
+ * Update if there is some need to force thumbs and SVG rasterizations
+ * to rerender, such as fixes to rendering bugs.
+ */
+$wgThumbnailEpoch = '20030516000000';
+
+/**
+ * If set, inline scaled images will still produce <img> tags ready for
+ * output instead of showing an error message.
*
- * "command" is the full command to call the virus scanner - %f will be replaced with the name of the
- * file to scan. If not present, the filename will be appended to the command. Note that this must be
- * overwritten if the scanner is not in the system path; in that case, plase set
- * $wgAntivirusSetup[$wgAntivirus]['command'] to the desired command with full path.
+ * This may be useful if errors are transitory, especially if the site
+ * is configured to automatically render thumbnails on request.
*
- * "codemap" is a mapping of exit code to return codes of the detectVirus function in SpecialUpload.
- * An exit code mapped to AV_SCAN_FAILED causes the function to consider the scan to be failed. This will pass
- * the file if $wgAntivirusRequired is not set.
- * An exit code mapped to AV_SCAN_ABORTED causes the function to consider the file to have an usupported format,
- * which is probably imune to virusses. This causes the file to pass.
- * An exit code mapped to AV_NO_VIRUS will cause the file to pass, meaning no virus was found.
- * All other codes (like AV_VIRUS_FOUND) will cause the function to report a virus.
- * You may use "*" as a key in the array to catch all exit codes not mapped otherwise.
+ * On the other hand, it may obscure error conditions from debugging.
+ * Enable the debug log or the 'thumbnail' log group to make sure errors
+ * are logged to a file for review.
+ */
+$wgIgnoreImageErrors = false;
+
+/**
+ * Allow thumbnail rendering on page view. If this is false, a valid
+ * thumbnail URL is still output, but no file will be created at
+ * the target location. This may save some time if you have a
+ * thumb.php or 404 handler set up which is faster than the regular
+ * webserver(s).
+ */
+$wgGenerateThumbnailOnParse = true;
+
+/**
+* Show thumbnails for old images on the image description page
+*/
+$wgShowArchiveThumbnails = true;
+
+/** Obsolete, always true, kept for compatibility with extensions */
+$wgUseImageResize = true;
+
+
+/**
+ * Internal name of virus scanner. This servers as a key to the
+ * $wgAntivirusSetup array. Set this to NULL to disable virus scanning. If not
+ * null, every file uploaded will be scanned for viruses.
+ */
+$wgAntivirus= null;
+
+/**
+ * Configuration for different virus scanners. This an associative array of
+ * associative arrays. It contains one setup array per known scanner type.
+ * The entry is selected by $wgAntivirus, i.e.
+ * valid values for $wgAntivirus are the keys defined in this array.
+ *
+ * The configuration array for each scanner contains the following keys:
+ * "command", "codemap", "messagepattern":
+ *
+ * "command" is the full command to call the virus scanner - %f will be
+ * replaced with the name of the file to scan. If not present, the filename
+ * will be appended to the command. Note that this must be overwritten if the
+ * scanner is not in the system path; in that case, plase set
+ * $wgAntivirusSetup[$wgAntivirus]['command'] to the desired command with full
+ * path.
+ *
+ * "codemap" is a mapping of exit code to return codes of the detectVirus
+ * function in SpecialUpload.
+ * - An exit code mapped to AV_SCAN_FAILED causes the function to consider
+ * the scan to be failed. This will pass the file if $wgAntivirusRequired
+ * is not set.
+ * - An exit code mapped to AV_SCAN_ABORTED causes the function to consider
+ * the file to have an usupported format, which is probably imune to
+ * virusses. This causes the file to pass.
+ * - An exit code mapped to AV_NO_VIRUS will cause the file to pass, meaning
+ * no virus was found.
+ * - All other codes (like AV_VIRUS_FOUND) will cause the function to report
+ * a virus.
+ * - You may use "*" as a key in the array to catch all exit codes not mapped otherwise.
*
* "messagepattern" is a perl regular expression to extract the meaningful part of the scanners
* output. The relevant part should be matched as group one (\1).
@@ -373,13 +819,13 @@ $wgAntivirusSetup = array(
/** Determines if a failed virus scan (AV_SCAN_FAILED) will cause the file to be rejected. */
-$wgAntivirusRequired= true;
+$wgAntivirusRequired = true;
/** Determines if the mime type of uploaded files should be checked */
-$wgVerifyMimeType= true;
+$wgVerifyMimeType = true;
/** Sets the mime type definition file to use by MimeMagic.php. */
-$wgMimeTypeFile= "includes/mime.types";
+$wgMimeTypeFile = "includes/mime.types";
#$wgMimeTypeFile= "/etc/mime.types";
#$wgMimeTypeFile= null; #use built-in defaults only.
@@ -387,25 +833,30 @@ $wgMimeTypeFile= "includes/mime.types";
$wgMimeInfoFile= "includes/mime.info";
#$wgMimeInfoFile= null; #use built-in defaults only.
-/** Switch for loading the FileInfo extension by PECL at runtime.
+/**
+ * Switch for loading the FileInfo extension by PECL at runtime.
* This should be used only if fileinfo is installed as a shared object
- * or a dynamic libary
+ * or a dynamic library.
*/
-$wgLoadFileinfoExtension= false;
+$wgLoadFileinfoExtension = false;
/** Sets an external mime detector program. The command must print only
* the mime type to standard output.
* The name of the file to process will be appended to the command given here.
* If not set or NULL, mime_content_type will be used if available.
+ * Example:
+ * <code>
+ * #$wgMimeDetectorCommand = "file -bi"; # use external mime detector (Linux)
+ * </code>
*/
-$wgMimeDetectorCommand= null; # use internal mime_content_type function, available since php 4.3.0
-#$wgMimeDetectorCommand= "file -bi"; #use external mime detector (Linux)
+$wgMimeDetectorCommand = null;
-/** Switch for trivial mime detection. Used by thumb.php to disable all fance
+/**
+ * Switch for trivial mime detection. Used by thumb.php to disable all fancy
* things, because only a few types of images are needed and file extensions
* can be trusted.
*/
-$wgTrivialMimeDetection= false;
+$wgTrivialMimeDetection = false;
/**
* Additional XML types we can allow via mime-detection.
@@ -420,117 +871,136 @@ $wgXMLMimeTypes = array(
);
/**
- * To set 'pretty' URL paths for actions other than
- * plain page views, add to this array. For instance:
- * 'edit' => "$wgScriptPath/edit/$1"
- *
- * There must be an appropriate script or rewrite rule
- * in place to handle these URLs.
+ * Limit images on image description pages to a user-selectable limit. In order
+ * to reduce disk usage, limits can only be selected from a list.
+ * The user preference is saved as an array offset in the database, by default
+ * the offset is set with $wgDefaultUserOptions['imagesize']. Make sure you
+ * change it if you alter the array (see bug 8858).
+ * This is the list of settings the user can choose from:
*/
-$wgActionPaths = array();
+$wgImageLimits = array (
+ array(320,240),
+ array(640,480),
+ array(800,600),
+ array(1024,768),
+ array(1280,1024),
+ array(10000,10000) );
/**
- * If you operate multiple wikis, you can define a shared upload path here.
- * Uploads to this wiki will NOT be put there - they will be put into
- * $wgUploadDirectory.
- * If $wgUseSharedUploads is set, the wiki will look in the shared repository if
- * no file of the given name is found in the local repository (for [[Image:..]],
- * [[Media:..]] links). Thumbnails will also be looked for and generated in this
- * directory.
- *
- * Note that these configuration settings can now be defined on a per-
- * repository basis for an arbitrary number of file repositories, using the
- * $wgForeignFileRepos variable.
+ * Adjust thumbnails on image pages according to a user setting. In order to
+ * reduce disk usage, the values can only be selected from a list. This is the
+ * list of settings the user can choose from:
*/
-$wgUseSharedUploads = false;
-/** Full path on the web server where shared uploads can be found */
-$wgSharedUploadPath = "http://commons.wikimedia.org/shared/images";
-/** Fetch commons image description pages and display them on the local wiki? */
-$wgFetchCommonsDescriptions = false;
-/** Path on the file system where shared uploads can be found. */
-$wgSharedUploadDirectory = "/var/www/wiki3/images";
-/** DB name with metadata about shared directory. Set this to false if the uploads do not come from a wiki. */
-$wgSharedUploadDBname = false;
-/** Optional table prefix used in database. */
-$wgSharedUploadDBprefix = '';
-/** Cache shared metadata in memcached. Don't do this if the commons wiki is in a different memcached domain */
-$wgCacheSharedUploads = true;
+$wgThumbLimits = array(
+ 120,
+ 150,
+ 180,
+ 200,
+ 250,
+ 300
+);
+
/**
-* Allow for upload to be copied from an URL. Requires Special:Upload?source=web
-* The timeout for copy uploads is set by $wgHTTPTimeout.
-*/
-$wgAllowCopyUploads = false;
+ * Default parameters for the <gallery> tag
+ */
+$wgGalleryOptions = array (
+ 'imagesPerRow' => 0, // Default number of images per-row in the gallery. 0 -> Adapt to screensize
+ 'imageWidth' => 120, // Width of the cells containing images in galleries (in "px")
+ 'imageHeight' => 120, // Height of the cells containing images in galleries (in "px")
+ 'captionLength' => 20, // Length of caption to truncate (in characters)
+ 'showBytes' => true, // Show the filesize in bytes in categories
+);
/**
- * Max size for uploads, in bytes. Currently only works for uploads from URL
- * via CURL (see $wgAllowCopyUploads). The only way to impose limits on
- * normal uploads is currently to edit php.ini.
+ * Adjust width of upright images when parameter 'upright' is used
+ * This allows a nicer look for upright images without the need to fix the width
+ * by hardcoded px in wiki sourcecode.
*/
-$wgMaxUploadSize = 1024*1024*100; # 100MB
+$wgThumbUpright = 0.75;
/**
- * Point the upload navigation link to an external URL
- * Useful if you want to use a shared repository by default
- * without disabling local uploads (use $wgEnableUploads = false for that)
- * e.g. $wgUploadNavigationUrl = 'http://commons.wikimedia.org/wiki/Special:Upload';
- *
- * This also affects images inline images that do not exist. In that case the URL will get
- * (?|&)wpDestFile=<filename> appended to it as appropriate.
+ * Default value for chmoding of new directories.
*/
-$wgUploadNavigationUrl = false;
+$wgDirectoryMode = 0777;
/**
- * Give a path here to use thumb.php for thumbnail generation on client request, instead of
- * generating them on render and outputting a static URL. This is necessary if some of your
- * apache servers don't have read/write access to the thumbnail path.
- *
- * Example:
- * $wgThumbnailScriptPath = "{$wgScriptPath}/thumb{$wgScriptExtension}";
+ * DJVU settings
+ * Path of the djvudump executable
+ * Enable this and $wgDjvuRenderer to enable djvu rendering
*/
-$wgThumbnailScriptPath = false;
-$wgSharedThumbnailScriptPath = false;
+# $wgDjvuDump = 'djvudump';
+$wgDjvuDump = null;
/**
- * Set the following to false especially if you have a set of files that need to
- * be accessible by all wikis, and you do not want to use the hash (path/a/aa/)
- * directory layout.
+ * Path of the ddjvu DJVU renderer
+ * Enable this and $wgDjvuDump to enable djvu rendering
*/
-$wgHashedSharedUploadDirectory = true;
+# $wgDjvuRenderer = 'ddjvu';
+$wgDjvuRenderer = null;
/**
- * Base URL for a repository wiki. Leave this blank if uploads are just stored
- * in a shared directory and not meant to be accessible through a separate wiki.
- * Otherwise the image description pages on the local wiki will link to the
- * image description page on this wiki.
+ * Path of the djvutxt DJVU text extraction utility
+ * Enable this and $wgDjvuDump to enable text layer extraction from djvu files
+ */
+# $wgDjvuTxt = 'djvutxt';
+$wgDjvuTxt = null;
+
+/**
+ * Path of the djvutoxml executable
+ * This works like djvudump except much, much slower as of version 3.5.
*
- * Please specify the namespace, as in the example below.
+ * For now I recommend you use djvudump instead. The djvuxml output is
+ * probably more stable, so we'll switch back to it as soon as they fix
+ * the efficiency problem.
+ * http://sourceforge.net/tracker/index.php?func=detail&aid=1704049&group_id=32953&atid=406583
*/
-$wgRepositoryBaseUrl = "http://commons.wikimedia.org/wiki/Image:";
+# $wgDjvuToXML = 'djvutoxml';
+$wgDjvuToXML = null;
-#
-# Email settings
-#
/**
- * Site admin email address
- * Default to wikiadmin@SERVER_NAME
+ * Shell command for the DJVU post processor
+ * Default: pnmtopng, since ddjvu generates ppm output
+ * Set this to false to output the ppm file directly.
+ */
+$wgDjvuPostProcessor = 'pnmtojpeg';
+/**
+ * File extension for the DJVU post processor output
+ */
+$wgDjvuOutputExtension = 'jpg';
+
+/** @} */ # end of file uploads }
+
+/************************************************************************//**
+ * @name Email settings
+ * @{
+ */
+
+/**
+ * Site admin email address.
*/
-$wgEmergencyContact = 'wikiadmin@' . $wgServerName;
+$wgEmergencyContact = 'wikiadmin@' . $serverName;
/**
- * Password reminder email address
- * The address we should use as sender when a user is requesting his password
- * Default to apache@SERVER_NAME
+ * Password reminder email address.
+ *
+ * The address we should use as sender when a user is requesting his password.
*/
-$wgPasswordSender = 'MediaWiki Mail <apache@' . $wgServerName . '>';
+$wgPasswordSender = 'apache@' . $serverName;
+
+unset( $serverName ); # Don't leak local variables to global scope
/**
- * dummy address which should be accepted during mail send action
- * It might be necessay to adapt the address or to set it equal
- * to the $wgEmergencyContact address
+ * Password reminder name
*/
-#$wgNoReplyAddress = $wgEmergencyContact;
-$wgNoReplyAddress = 'reply@not.possible';
+$wgPasswordSenderName = 'MediaWiki Mail';
+
+/**
+ * Dummy address which should be accepted during mail send action.
+ * It might be necessary to adapt the address or to set it equal
+ * to the $wgEmergencyContact address.
+ */
+$wgNoReplyAddress = 'reply@not.possible';
/**
* Set to true to enable the e-mail basic features:
@@ -581,18 +1051,97 @@ $wgNewPasswordExpiry = 3600 * 24 * 7;
*/
$wgSMTP = false;
+/**
+ * Additional email parameters, will be passed as the last argument to mail() call.
+ */
+$wgAdditionalMailParams = null;
+
+/**
+ * True: from page editor if s/he opted-in. False: Enotif mails appear to come
+ * from $wgEmergencyContact
+ */
+$wgEnotifFromEditor = false;
+
+// TODO move UPO to preferences probably ?
+# If set to true, users get a corresponding option in their preferences and can choose to enable or disable at their discretion
+# If set to false, the corresponding input form on the user preference page is suppressed
+# It call this to be a "user-preferences-option (UPO)"
+
+/**
+ * Require email authentication before sending mail to an email addres. This is
+ * highly recommended. It prevents MediaWiki from being used as an open spam
+ * relay.
+ */
+$wgEmailAuthentication = true;
+
+/**
+ * Allow users to enable email notification ("enotif") on watchlist changes.
+ */
+$wgEnotifWatchlist = false;
+
+/**
+ * Allow users to enable email notification ("enotif") when someone edits their
+ * user talk page.
+ */
+$wgEnotifUserTalk = false;
+
+/**
+ * Set the Reply-to address in notifications to the editor's address, if user
+ * allowed this in the preferences.
+ */
+$wgEnotifRevealEditorAddress = false;
+
+/**
+ * Send notification mails on minor edits to watchlist pages. This is enabled
+ * by default. Does not affect user talk notifications.
+ */
+$wgEnotifMinorEdits = true;
+
+/**
+ * Send a generic mail instead of a personalised mail for each user. This
+ * always uses UTC as the time zone, and doesn't include the username.
+ *
+ * For pages with many users watching, this can significantly reduce mail load.
+ * Has no effect when using sendmail rather than SMTP.
+ */
+$wgEnotifImpersonal = false;
+
+/**
+ * Maximum number of users to mail at once when using impersonal mail. Should
+ * match the limit on your mail server.
+ */
+$wgEnotifMaxRecips = 500;
+
+/**
+ * Send mails via the job queue. This can be useful to reduce the time it
+ * takes to save a page that a lot of people are watching.
+ */
+$wgEnotifUseJobQ = false;
+
+/**
+ * Use real name instead of username in e-mail "from" field.
+ */
+$wgEnotifUseRealName = false;
+
+/**
+ * Array of usernames who will be sent a notification email for every change
+ * which occurs on a wiki.
+ */
+$wgUsersNotifiedOnAllChanges = array();
+
-/**@{
- * Database settings
+/** @} */ # end of email settings
+
+/************************************************************************//**
+ * @name Database settings
+ * @{
*/
-/** database host name or ip address */
+/** Database host name or IP address */
$wgDBserver = 'localhost';
-/** database port number (for PostgreSQL) */
+/** Database port number (for PostgreSQL) */
$wgDBport = 5432;
-/** name of the database */
+/** Name of the database */
$wgDBname = 'my_wiki';
-/** */
-$wgDBconnection = '';
/** Database username */
$wgDBuser = 'wikiuser';
/** Database user's password */
@@ -600,11 +1149,13 @@ $wgDBpassword = '';
/** Database type */
$wgDBtype = 'mysql';
-/** Separate username and password for maintenance tasks. Leave as null to use the default */
+/** Separate username for maintenance tasks. Leave as null to use the default. */
$wgDBadminuser = null;
+/** Separate password for maintenance tasks. Leave as null to use the default. */
$wgDBadminpassword = null;
-/** Search type
+/**
+ * Search type.
* Leave as null to select the default search engine for the
* selected database type (eg SearchMySQL), or set to a class
* name to override to a custom search engine.
@@ -616,6 +1167,14 @@ $wgDBprefix = '';
/** MySQL table options to use during installation or update */
$wgDBTableOptions = 'ENGINE=InnoDB';
+/**
+ * SQL Mode - default is turning off all modes, including strict, if set.
+ * null can be used to skip the setting for performance reasons and assume
+ * DBA has done his best job.
+ * String override can be used for some additional fun :-)
+ */
+$wgSQLMode = '';
+
/** Mediawiki schema */
$wgDBmwschema = 'mediawiki';
/** Tsearch2 schema */
@@ -624,12 +1183,6 @@ $wgDBts2schema = 'public';
/** To override default SQLite data directory ($docroot/../data) */
$wgSQLiteDataDir = '';
-/** Default directory mode for SQLite data directory on creation.
- * Note that this is different from the default directory mode used
- * elsewhere.
- */
-$wgSQLiteDataDirMode = 0700;
-
/**
* Make all database connections secretly go to localhost. Fool the load balancer
* thinking there is an arbitrarily large cluster of servers to connect to.
@@ -637,17 +1190,11 @@ $wgSQLiteDataDirMode = 0700;
*/
$wgAllDBsAreLocalhost = false;
-/**@}*/
-
-
-/** Live high performance sites should disable this - some checks acquire giant mysql locks */
-$wgCheckDBSchema = true;
-
-
/**
* Shared database for multiple wikis. Commonly used for storing a user table
* for single sign-on. The server for this database must be the same as for the
* main database.
+ *
* For backwards compatibility the shared prefix is set to the same as the local
* prefix, and the user table is listed in the default list of shared tables.
* The user_properties table is also added so that users will continue to have their
@@ -657,33 +1204,39 @@ $wgCheckDBSchema = true;
* datbase. However it is advised to limit what tables you do share as many of
* MediaWiki's tables may have side effects if you try to share them.
* EXPERIMENTAL
+ *
+ * $wgSharedPrefix is the table prefix for the shared database. It defaults to
+ * $wgDBprefix.
*/
$wgSharedDB = null;
-$wgSharedPrefix = false; # Defaults to $wgDBprefix
+
+/** @see $wgSharedDB */
+$wgSharedPrefix = false;
+/** @see $wgSharedDB */
$wgSharedTables = array( 'user', 'user_properties' );
/**
* Database load balancer
* This is a two-dimensional array, an array of server info structures
* Fields are:
- * host: Host name
- * dbname: Default database name
- * user: DB user
- * password: DB password
- * type: "mysql" or "postgres"
- * load: ratio of DB_SLAVE load, must be >=0, the sum of all loads must be >0
- * groupLoads: array of load ratios, the key is the query group name. A query may belong
- * to several groups, the most specific group defined here is used.
- *
- * flags: bit field
- * DBO_DEFAULT -- turns on DBO_TRX only if !$wgCommandLineMode (recommended)
- * DBO_DEBUG -- equivalent of $wgDebugDumpSql
- * DBO_TRX -- wrap entire request in a transaction
- * DBO_IGNORE -- ignore errors (not useful in LocalSettings.php)
- * DBO_NOBUFFER -- turn off buffering (not useful in LocalSettings.php)
- *
- * max lag: (optional) Maximum replication lag before a slave will taken out of rotation
- * max threads: (optional) Maximum number of running threads
+ * - host: Host name
+ * - dbname: Default database name
+ * - user: DB user
+ * - password: DB password
+ * - type: "mysql" or "postgres"
+ * - load: ratio of DB_SLAVE load, must be >=0, the sum of all loads must be >0
+ * - groupLoads: array of load ratios, the key is the query group name. A query may belong
+ * to several groups, the most specific group defined here is used.
+ *
+ * - flags: bit field
+ * - DBO_DEFAULT -- turns on DBO_TRX only if !$wgCommandLineMode (recommended)
+ * - DBO_DEBUG -- equivalent of $wgDebugDumpSql
+ * - DBO_TRX -- wrap entire request in a transaction
+ * - DBO_IGNORE -- ignore errors (not useful in LocalSettings.php)
+ * - DBO_NOBUFFER -- turn off buffering (not useful in LocalSettings.php)
+ *
+ * - max lag: (optional) Maximum replication lag before a slave will taken out of rotation
+ * - max threads: (optional) Maximum number of running threads
*
* These and any other user-defined properties will be assigned to the mLBInfo member
* variable of the Database object.
@@ -697,7 +1250,9 @@ $wgSharedTables = array( 'user', 'user_properties' );
* accidental misconfiguration or MediaWiki bugs, set read_only=1 on all your
* slaves in my.cnf. You can set read_only mode at runtime using:
*
+ * <code>
* SET @@read_only=1;
+ * </code>
*
* Since the effect of writing to a slave is so damaging and difficult to clean
* up, we at Wikimedia set read_only=1 in my.cnf on all our DB servers, even
@@ -763,38 +1318,218 @@ $wgDBmysql5 = false;
*/
$wgLocalDatabases = array();
-/** @{
- * Object cache settings
- * See Defines.php for types
+/**
+ * If lag is higher than $wgSlaveLagWarning, show a warning in some special
+ * pages (like watchlist). If the lag is higher than $wgSlaveLagCritical,
+ * show a more obvious warning.
+ */
+$wgSlaveLagWarning = 10;
+/** @see $wgSlaveLagWarning */
+$wgSlaveLagCritical = 30;
+
+/**
+ * Use old names for change_tags indices.
+ */
+$wgOldChangeTagsIndex = false;
+
+/**@}*/ # End of DB settings }
+
+
+/************************************************************************//**
+ * @name Text storage
+ * @{
+ */
+
+/**
+ * We can also compress text stored in the 'text' table. If this is set on, new
+ * revisions will be compressed on page save if zlib support is available. Any
+ * compressed revisions will be decompressed on load regardless of this setting
+ * *but will not be readable at all* if zlib support is not available.
+ */
+$wgCompressRevisions = false;
+
+/**
+ * External stores allow including content
+ * from non database sources following URL links
+ *
+ * Short names of ExternalStore classes may be specified in an array here:
+ * $wgExternalStores = array("http","file","custom")...
+ *
+ * CAUTION: Access to database might lead to code execution
+ */
+$wgExternalStores = false;
+
+/**
+ * An array of external mysql servers, e.g.
+ * $wgExternalServers = array( 'cluster1' => array( 'srv28', 'srv29', 'srv30' ) );
+ * Used by LBFactory_Simple, may be ignored if $wgLBFactoryConf is set to another class.
+ */
+$wgExternalServers = array();
+
+/**
+ * The place to put new revisions, false to put them in the local text table.
+ * Part of a URL, e.g. DB://cluster1
+ *
+ * Can be an array instead of a single string, to enable data distribution. Keys
+ * must be consecutive integers, starting at zero. Example:
+ *
+ * $wgDefaultExternalStore = array( 'DB://cluster1', 'DB://cluster2' );
+ *
+ */
+$wgDefaultExternalStore = false;
+
+/**
+ * Revision text may be cached in $wgMemc to reduce load on external storage
+ * servers and object extraction overhead for frequently-loaded revisions.
+ *
+ * Set to 0 to disable, or number of seconds before cache expiry.
+ */
+$wgRevisionCacheExpiry = 0;
+
+/** @} */ # end text storage }
+
+/************************************************************************//**
+ * @name Performance hacks and limits
+ * @{
+ */
+/** Disable database-intensive features */
+$wgMiserMode = false;
+/** Disable all query pages if miser mode is on, not just some */
+$wgDisableQueryPages = false;
+/** Number of rows to cache in 'querycache' table when miser mode is on */
+$wgQueryCacheLimit = 1000;
+/** Number of links to a page required before it is deemed "wanted" */
+$wgWantedPagesThreshold = 1;
+/** Enable slow parser functions */
+$wgAllowSlowParserFunctions = false;
+
+/**
+ * Do DELETE/INSERT for link updates instead of incremental
+ */
+$wgUseDumbLinkUpdate = false;
+
+/**
+ * Anti-lock flags - bitfield
+ * - ALF_PRELOAD_LINKS:
+ * Preload links during link update for save
+ * - ALF_PRELOAD_EXISTENCE:
+ * Preload cur_id during replaceLinkHolders
+ * - ALF_NO_LINK_LOCK:
+ * Don't use locking reads when updating the link table. This is
+ * necessary for wikis with a high edit rate for performance
+ * reasons, but may cause link table inconsistency
+ * - ALF_NO_BLOCK_LOCK:
+ * As for ALF_LINK_LOCK, this flag is a necessity for high-traffic
+ * wikis.
+ */
+$wgAntiLockFlags = 0;
+
+/**
+ * Maximum article size in kilobytes
+ */
+$wgMaxArticleSize = 2048;
+
+/**
+ * The minimum amount of memory that MediaWiki "needs"; MediaWiki will try to
+ * raise PHP's memory limit if it's below this amount.
+ */
+$wgMemoryLimit = "50M";
+
+/** @} */ # end performance hacks }
+
+/************************************************************************//**
+ * @name Cache settings
+ * @{
+ */
+
+/**
+ * Directory for caching data in the local filesystem. Should not be accessible
+ * from the web. Set this to false to not use any local caches.
+ *
+ * Note: if multiple wikis share the same localisation cache directory, they
+ * must all have the same set of extensions. You can set a directory just for
+ * the localisation cache using $wgLocalisationCacheConf['storeDirectory'].
+ */
+$wgCacheDirectory = false;
+
+/**
+ * Main cache type. This should be a cache with fast access, but it may have
+ * limited space. By default, it is disabled, since the database is not fast
+ * enough to make it worthwhile.
+ *
+ * The options are:
+ *
+ * - CACHE_ANYTHING: Use anything, as long as it works
+ * - CACHE_NONE: Do not cache
+ * - CACHE_DB: Store cache objects in the DB
+ * - CACHE_MEMCACHED: MemCached, must specify servers in $wgMemCachedServers
+ * - CACHE_ACCEL: eAccelerator, APC, XCache or WinCache
+ * - CACHE_DBA: Use PHP's DBA extension to store in a DBM-style
+ * database. This is slow, and is not recommended for
+ * anything other than debugging.
+ *
+ * @see $wgMessageCacheType, $wgParserCacheType
*/
$wgMainCacheType = CACHE_NONE;
+
+/**
+ * The cache type for storing the contents of the MediaWiki namespace. This
+ * cache is used for a small amount of data which is expensive to regenerate.
+ *
+ * For available types see $wgMainCacheType.
+ */
$wgMessageCacheType = CACHE_ANYTHING;
+
+/**
+ * The cache type for storing article HTML. This is used to store data which
+ * is expensive to regenerate, and benefits from having plenty of storage space.
+ *
+ * For available types see $wgMainCacheType.
+ */
$wgParserCacheType = CACHE_ANYTHING;
-/**@}*/
+/**
+ * The expiry time for the parser cache, in seconds. The default is 86.4k
+ * seconds, otherwise known as a day.
+ */
$wgParserCacheExpireTime = 86400;
-// Select which DBA handler <http://www.php.net/manual/en/dba.requirements.php> to use as CACHE_DBA backend
+/**
+ * Select which DBA handler <http://www.php.net/manual/en/dba.requirements.php> to use as CACHE_DBA backend
+ */
$wgDBAhandler = 'db3';
+/**
+ * Store sessions in MemCached. This can be useful to improve performance, or to
+ * avoid the locking behaviour of PHP's default session handler, which tends to
+ * prevent multiple requests for the same user from acting concurrently.
+ */
$wgSessionsInMemcached = false;
-/** This is used for setting php's session.save_handler. In practice, you will
+/**
+ * This is used for setting php's session.save_handler. In practice, you will
* almost never need to change this ever. Other options might be 'user' or
* 'session_mysql.' Setting to null skips setting this entirely (which might be
- * useful if you're doing cross-application sessions, see bug 11381) */
+ * useful if you're doing cross-application sessions, see bug 11381)
+ */
$wgSessionHandler = 'files';
-/**@{
- * Memcached-specific settings
- * See docs/memcached.txt
- */
-$wgUseMemCached = false;
-$wgMemCachedDebug = false; ///< Will be set to false in Setup.php, if the server isn't working
+/** If enabled, will send MemCached debugging information to $wgDebugLogFile */
+$wgMemCachedDebug = false;
+
+/** The list of MemCached servers and port numbers */
$wgMemCachedServers = array( '127.0.0.1:11000' );
+
+/**
+ * Use persistent connections to MemCached, which are shared across multiple
+ * requests.
+ */
$wgMemCachedPersistent = false;
-$wgMemCachedTimeout = 100000; //Data timeout in microseconds
-/**@}*/
+
+/**
+ * Read/write timeout for MemCached server communication, in microseconds.
+ */
+$wgMemCachedTimeout = 100000;
/**
* Set this to true to make a local copy of the message cache, for use in
@@ -837,17 +1572,222 @@ $wgLocalisationCacheConf = array(
'manualRecache' => false,
);
-# Language settings
-#
+/** Allow client-side caching of pages */
+$wgCachePages = true;
+
+/**
+ * Set this to current time to invalidate all prior cached pages. Affects both
+ * client- and server-side caching.
+ * You can get the current date on your server by using the command:
+ * date +%Y%m%d%H%M%S
+ */
+$wgCacheEpoch = '20030516000000';
+
+/**
+ * Bump this number when changing the global style sheets and JavaScript.
+ * It should be appended in the query string of static CSS and JS includes,
+ * to ensure that client-side caches do not keep obsolete copies of global
+ * styles.
+ */
+$wgStyleVersion = '301';
+
+/**
+ * This will cache static pages for non-logged-in users to reduce
+ * database traffic on public sites.
+ * Must set $wgShowIPinHeader = false
+ */
+$wgUseFileCache = false;
+
+/**
+ * Directory where the cached page will be saved.
+ * Defaults to "$wgCacheDirectory/html".
+ */
+$wgFileCacheDirectory = false;
+
+/**
+ * Depth of the subdirectory hierarchy to be created under
+ * $wgFileCacheDirectory. The subdirectories will be named based on
+ * the MD5 hash of the title. A value of 0 means all cache files will
+ * be put directly into the main file cache directory.
+ */
+$wgFileCacheDepth = 2;
+
+/**
+ * Keep parsed pages in a cache (objectcache table or memcached)
+ * to speed up output of the same page viewed by another user with the
+ * same options.
+ *
+ * This can provide a significant speedup for medium to large pages,
+ * so you probably want to keep it on. Extensions that conflict with the
+ * parser cache should disable the cache on a per-page basis instead.
+ */
+$wgEnableParserCache = true;
+
+/**
+ * Append a configured value to the parser cache and the sitenotice key so
+ * that they can be kept separate for some class of activity.
+ */
+$wgRenderHashAppend = '';
+
+/**
+ * If on, the sidebar navigation links are cached for users with the
+ * current language set. This can save a touch of load on a busy site
+ * by shaving off extra message lookups.
+ *
+ * However it is also fragile: changing the site configuration, or
+ * having a variable $wgArticlePath, can produce broken links that
+ * don't update as expected.
+ */
+$wgEnableSidebarCache = false;
+
+/**
+ * Expiry time for the sidebar cache, in seconds
+ */
+$wgSidebarCacheExpiry = 86400;
+
+/**
+ * When using the file cache, we can store the cached HTML gzipped to save disk
+ * space. Pages will then also be served compressed to clients that support it.
+ * THIS IS NOT COMPATIBLE with ob_gzhandler which is now enabled if supported in
+ * the default LocalSettings.php! If you enable this, remove that setting first.
+ *
+ * Requires zlib support enabled in PHP.
+ */
+$wgUseGzip = false;
+
+/**
+ * Whether MediaWiki should send an ETag header. Seems to cause
+ * broken behavior with Squid 2.6, see bug 7098.
+ */
+$wgUseETag = false;
+
+/** Clock skew or the one-second resolution of time() can occasionally cause cache
+ * problems when the user requests two pages within a short period of time. This
+ * variable adds a given number of seconds to vulnerable timestamps, thereby giving
+ * a grace period.
+ */
+$wgClockSkewFudge = 5;
+
+/**
+ * Invalidate various caches when LocalSettings.php changes. This is equivalent
+ * to setting $wgCacheEpoch to the modification time of LocalSettings.php, as
+ * was previously done in the default LocalSettings.php file.
+ *
+ * On high-traffic wikis, this should be set to false, to avoid the need to
+ * check the file modification time, and to avoid the performance impact of
+ * unnecessary cache invalidations.
+ */
+$wgInvalidateCacheOnLocalSettingsChange = true;
+
+/** @} */ # end of cache settings
+
+/************************************************************************//**
+ * @name HTTP proxy (Squid) settings
+ *
+ * Many of these settings apply to any HTTP proxy used in front of MediaWiki,
+ * although they are referred to as Squid settings for historical reasons.
+ *
+ * Achieving a high hit ratio with an HTTP proxy requires special
+ * configuration. See http://www.mediawiki.org/wiki/Manual:Squid_caching for
+ * more details.
+ *
+ * @{
+ */
+
+/**
+ * Enable/disable Squid.
+ * See http://www.mediawiki.org/wiki/Manual:Squid_caching
+ */
+$wgUseSquid = false;
+
+/** If you run Squid3 with ESI support, enable this (default:false): */
+$wgUseESI = false;
+
+/** Send X-Vary-Options header for better caching (requires patched Squid) */
+$wgUseXVO = false;
+
+/**
+ * Internal server name as known to Squid, if different. Example:
+ * <code>
+ * $wgInternalServer = 'http://yourinternal.tld:8000';
+ * </code>
+ */
+$wgInternalServer = $wgServer;
+
+/**
+ * Cache timeout for the squid, will be sent as s-maxage (without ESI) or
+ * Surrogate-Control (with ESI). Without ESI, you should strip out s-maxage in
+ * the Squid config. 18000 seconds = 5 hours, more cache hits with 2678400 = 31
+ * days
+ */
+$wgSquidMaxage = 18000;
+
+/**
+ * Default maximum age for raw CSS/JS accesses
+ */
+$wgForcedRawSMaxage = 300;
+
+/**
+ * List of proxy servers to purge on changes; default port is 80. Use IP addresses.
+ *
+ * When MediaWiki is running behind a proxy, it will trust X-Forwarded-For
+ * headers sent/modified from these proxies when obtaining the remote IP address
+ *
+ * For a list of trusted servers which *aren't* purged, see $wgSquidServersNoPurge.
+ */
+$wgSquidServers = array();
+
+/**
+ * As above, except these servers aren't purged on page changes; use to set a
+ * list of trusted proxies, etc.
+ */
+$wgSquidServersNoPurge = array();
+
+/** Maximum number of titles to purge in any one client operation */
+$wgMaxSquidPurgeTitles = 400;
+
+/**
+ * HTCP multicast address. Set this to a multicast IP address to enable HTCP.
+ *
+ * Note that MediaWiki uses the old non-RFC compliant HTCP format, which was
+ * present in the earliest Squid implementations of the protocol.
+ */
+$wgHTCPMulticastAddress = false;
+
+/**
+ * HTCP multicast port.
+ * @see $wgHTCPMulticastAddress
+ */
+$wgHTCPPort = 4827;
+
+/**
+ * HTCP multicast TTL.
+ * @see $wgHTCPMulticastAddress
+ */
+$wgHTCPMulticastTTL = 1;
+
+/** Should forwarded Private IPs be accepted? */
+$wgUsePrivateIPs = false;
+
+/** @} */ # end of HTTP proxy settings
+
+/************************************************************************//**
+ * @name Language, regional and character encoding settings
+ * @{
+ */
+
/** Site language code, should be one of ./languages/Language(.*).php */
$wgLanguageCode = 'en';
/**
* Some languages need different word forms, usually for different cases.
- * Used in Language::convertGrammar().
+ * Used in Language::convertGrammar(). Example:
+ *
+ * <code>
+ * $wgGrammarForms['en']['genitive']['car'] = 'car\'s';
+ * </code>
*/
$wgGrammarForms = array();
-#$wgGrammarForms['en']['genitive']['car'] = 'car\'s';
/** Treat language links as magic connectors, not inline links */
$wgInterwikiMagic = true;
@@ -863,28 +1803,48 @@ $wgExtraLanguageNames = array();
* These codes are leftoffs from renames, or other legacy things.
* Also, qqq is a dummy "language" for documenting messages.
*/
-$wgDummyLanguageCodes = array( 'qqq', 'als', 'be-x-old', 'dk', 'fiu-vro', 'iu', 'nb', 'simple', 'tp' );
+$wgDummyLanguageCodes = array(
+ 'als',
+ 'bat-smg',
+ 'be-x-old',
+ 'dk',
+ 'fiu-vro',
+ 'iu',
+ 'nb',
+ 'qqq',
+ 'simple',
+ 'tp',
+);
-/** We speak UTF-8 all the time now, unless some oddities happen */
+/** @deprecated Since MediaWiki 1.5, this must always be set to UTF-8. */
$wgInputEncoding = 'UTF-8';
+/** @deprecated Since MediaWiki 1.5, this must always be set to UTF-8. */
$wgOutputEncoding = 'UTF-8';
+
+/**
+ * Character set for use in the article edit box. Language-specific encodings
+ * may be defined.
+ *
+ * This historic feature is one of the first that was added by former MediaWiki
+ * team leader Brion Vibber, and is used to support the Esperanto x-system.
+ */
$wgEditEncoding = '';
/**
- * Set this to true to replace Arabic presentation forms with their standard
+ * Set this to true to replace Arabic presentation forms with their standard
* forms in the U+0600-U+06FF block. This only works if $wgLanguageCode is
* set to "ar".
*
- * Note that pages with titles containing presentation forms will become
+ * Note that pages with titles containing presentation forms will become
* inaccessible, run maintenance/cleanupTitles.php to fix this.
*/
$wgFixArabicUnicode = true;
/**
* Set this to true to replace ZWJ-based chillu sequences in Malayalam text
- * with their Unicode 5.1 equivalents. This only works if $wgLanguageCode is
- * set to "ml". Note that some clients (even new clients as of 2010) do not
- * support these characters.
+ * with their Unicode 5.1 equivalents. This only works if $wgLanguageCode is
+ * set to "ml". Note that some clients (even new clients as of 2010) do not
+ * support these characters.
*
* If you enable this on an existing wiki, run maintenance/cleanupTitles.php to
* fix any ZWJ sequences in existing page titles.
@@ -892,25 +1852,71 @@ $wgFixArabicUnicode = true;
$wgFixMalayalamUnicode = true;
/**
- * Locale for LC_CTYPE, to work around http://bugs.php.net/bug.php?id=45132
- * For Unix-like operating systems, set this to to a locale that has a UTF-8
- * character set. Only the character set is relevant.
+ * Set this to always convert certain Unicode sequences to modern ones
+ * regardless of the content language. This has a small performance
+ * impact.
+ *
+ * See $wgFixArabicUnicode and $wgFixMalayalamUnicode for conversion
+ * details.
+ *
+ * @since 1.17
*/
-$wgShellLocale = 'en_US.utf8';
+$wgAllUnicodeFixes = false;
/**
- * Set this to eg 'ISO-8859-1' to perform character set
- * conversion when loading old revisions not marked with
- * "utf-8" flag. Use this when converting wiki to UTF-8
- * without the burdensome mass conversion of old text data.
+ * Set this to eg 'ISO-8859-1' to perform character set conversion when
+ * loading old revisions not marked with "utf-8" flag. Use this when
+ * converting a wiki from MediaWiki 1.4 or earlier to UTF-8 without the
+ * burdensome mass conversion of old text data.
*
- * NOTE! This DOES NOT touch any fields other than old_text.
- * Titles, comments, user names, etc still must be converted
- * en masse in the database before continuing as a UTF-8 wiki.
+ * NOTE! This DOES NOT touch any fields other than old_text.Titles, comments,
+ * user names, etc still must be converted en masse in the database before
+ * continuing as a UTF-8 wiki.
*/
$wgLegacyEncoding = false;
/**
+ * Browser Blacklist for unicode non compliant browsers. Contains a list of
+ * regexps : "/regexp/" matching problematic browsers. These browsers will
+ * be served encoded unicode in the edit box instead of real unicode.
+ */
+$wgBrowserBlackList = array(
+ /**
+ * Netscape 2-4 detection
+ * The minor version may contain strings such as "Gold" or "SGoldC-SGI"
+ * Lots of non-netscape user agents have "compatible", so it's useful to check for that
+ * with a negative assertion. The [UIN] identifier specifies the level of security
+ * in a Netscape/Mozilla browser, checking for it rules out a number of fakers.
+ * The language string is unreliable, it is missing on NS4 Mac.
+ *
+ * Reference: http://www.psychedelix.com/agents/index.shtml
+ */
+ '/^Mozilla\/2\.[^ ]+ [^(]*?\((?!compatible).*; [UIN]/',
+ '/^Mozilla\/3\.[^ ]+ [^(]*?\((?!compatible).*; [UIN]/',
+ '/^Mozilla\/4\.[^ ]+ [^(]*?\((?!compatible).*; [UIN]/',
+
+ /**
+ * MSIE on Mac OS 9 is teh sux0r, converts þ to <thorn>, ð to <eth>, Þ to <THORN> and Ð to <ETH>
+ *
+ * Known useragents:
+ * - Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC)
+ * - Mozilla/4.0 (compatible; MSIE 5.15; Mac_PowerPC)
+ * - Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC)
+ * - [...]
+ *
+ * @link http://en.wikipedia.org/w/index.php?title=User%3A%C6var_Arnfj%F6r%F0_Bjarmason%2Ftestme&diff=12356041&oldid=12355864
+ * @link http://en.wikipedia.org/wiki/Template%3AOS9
+ */
+ '/^Mozilla\/4\.0 \(compatible; MSIE \d+\.\d+; Mac_PowerPC\)/',
+
+ /**
+ * Google wireless transcoder, seems to eat a lot of chars alive
+ * http://it.wikipedia.org/w/index.php?title=Luciano_Ligabue&diff=prev&oldid=8857361
+ */
+ '/^Mozilla\/4\.0 \(compatible; MSIE 6.0; Windows NT 5.0; Google Wireless Transcoder;\)/'
+);
+
+/**
* If set to true, the MediaWiki 1.4 to 1.5 schema conversion will
* create stub reference rows in the text table instead of copying
* the full text of all current entries from 'cur' to 'text'.
@@ -927,17 +1933,173 @@ $wgLegacyEncoding = false;
*/
$wgLegacySchemaConversion = false;
+/**
+ * Enable to allow rewriting dates in page text.
+ * DOES NOT FORMAT CORRECTLY FOR MOST LANGUAGES.
+ */
+$wgUseDynamicDates = false;
+/**
+ * Enable dates like 'May 12' instead of '12 May', this only takes effect if
+ * the interface is set to English.
+ */
+$wgAmericanDates = false;
+/**
+ * For Hindi and Arabic use local numerals instead of Western style (0-9)
+ * numerals in interface.
+ */
+$wgTranslateNumerals = true;
+
+/**
+ * Translation using MediaWiki: namespace.
+ * Interface messages will be loaded from the database.
+ */
+$wgUseDatabaseMessages = true;
+
+/**
+ * Expiry time for the message cache key
+ */
+$wgMsgCacheExpiry = 86400;
+
+/**
+ * Maximum entry size in the message cache, in bytes
+ */
+$wgMaxMsgCacheEntrySize = 10000;
+
+/** Whether to enable language variant conversion. */
+$wgDisableLangConversion = false;
+
+/** Whether to enable language variant conversion for links. */
+$wgDisableTitleConversion = false;
+
+/** Whether to enable cononical language links in meta data. */
+$wgCanonicalLanguageLinks = true;
+
+/** Default variant code, if false, the default will be the language code */
+$wgDefaultLanguageVariant = false;
+
+/**
+ * Disabled variants array of language variant conversion. Example:
+ * <code>
+ * $wgDisabledVariants[] = 'zh-mo';
+ * $wgDisabledVariants[] = 'zh-my';
+ * </code>
+ *
+ * or:
+ *
+ * <code>
+ * $wgDisabledVariants = array('zh-mo', 'zh-my');
+ * </code>
+ */
+$wgDisabledVariants = array();
+
+/**
+ * Like $wgArticlePath, but on multi-variant wikis, this provides a
+ * path format that describes which parts of the URL contain the
+ * language variant. For Example:
+ *
+ * $wgLanguageCode = 'sr';
+ * $wgVariantArticlePath = '/$2/$1';
+ * $wgArticlePath = '/wiki/$1';
+ *
+ * A link to /wiki/ would be redirected to /sr/Главна_страна
+ *
+ * It is important that $wgArticlePath not overlap with possible values
+ * of $wgVariantArticlePath.
+ */
+$wgVariantArticlePath = false;
+
+/**
+ * Show a bar of language selection links in the user login and user
+ * registration forms; edit the "loginlanguagelinks" message to
+ * customise these.
+ */
+$wgLoginLanguageSelector = false;
+
+/**
+ * When translating messages with wfMsg(), it is not always clear what should
+ * be considered UI messages and what should be content messages.
+ *
+ * For example, for the English Wikipedia, there should be only one 'mainpage',
+ * so when getting the link for 'mainpage', we should treat it as site content
+ * and call wfMsgForContent(), but for rendering the text of the link, we call
+ * wfMsg(). The code behaves this way by default. However, sites like the
+ * Wikimedia Commons do offer different versions of 'mainpage' and the like for
+ * different languages. This array provides a way to override the default
+ * behavior. For example, to allow language-specific main page and community
+ * portal, set
+ *
+ * $wgForceUIMsgAsContentMsg = array( 'mainpage', 'portal-url' );
+ */
+$wgForceUIMsgAsContentMsg = array();
+
+/**
+ * Fake out the timezone that the server thinks it's in. This will be used for
+ * date display and not for what's stored in the DB. Leave to null to retain
+ * your server's OS-based timezone value.
+ *
+ * This variable is currently used only for signature formatting and for local
+ * time/date parser variables ({{LOCALTIME}} etc.)
+ *
+ * Timezones can be translated by editing MediaWiki messages of type
+ * timezone-nameinlowercase like timezone-utc.
+ *
+ * Examples:
+ * <code>
+ * $wgLocaltimezone = 'GMT';
+ * $wgLocaltimezone = 'PST8PDT';
+ * $wgLocaltimezone = 'Europe/Sweden';
+ * $wgLocaltimezone = 'CET';
+ * </code>
+ */
+$wgLocaltimezone = null;
+
+/**
+ * Set an offset from UTC in minutes to use for the default timezone setting
+ * for anonymous users and new user accounts.
+ *
+ * This setting is used for most date/time displays in the software, and is
+ * overrideable in user preferences. It is *not* used for signature timestamps.
+ *
+ * You can set it to match the configured server timezone like this:
+ * $wgLocalTZoffset = date("Z") / 60;
+ *
+ * If your server is not configured for the timezone you want, you can set
+ * this in conjunction with the signature timezone and override the PHP default
+ * timezone like so:
+ * $wgLocaltimezone="Europe/Berlin";
+ * date_default_timezone_set( $wgLocaltimezone );
+ * $wgLocalTZoffset = date("Z") / 60;
+ *
+ * Leave at NULL to show times in universal time (UTC/GMT).
+ */
+$wgLocalTZoffset = null;
+
+/** @} */ # End of language/charset settings
+
+/*************************************************************************//**
+ * @name Output format and skin settings
+ * @{
+ */
+
+/** The default Content-Type header. */
$wgMimeType = 'text/html';
+
+/** The content type used in script tags. */
$wgJsMimeType = 'text/javascript';
+
+/** The HTML document type. */
$wgDocType = '-//W3C//DTD XHTML 1.0 Transitional//EN';
+
+/** The URL of the document type declaration. */
$wgDTD = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd';
+
+/** The default xmlns attribute. */
$wgXhtmlDefaultNamespace = 'http://www.w3.org/1999/xhtml';
/**
- * Should we output an HTML5 doctype? This mode is still experimental, but
- * all indications are that it should be usable, so it's enabled by default.
- * If all goes well, it will be removed and become always true before the 1.16
- * release.
+ * Should we output an HTML5 doctype? If false, use XHTML 1.0 Transitional
+ * instead, and disable HTML5 features. This may eventually be removed and set
+ * to always true.
*/
$wgHtml5 = true;
@@ -986,106 +2148,421 @@ $wgWellFormedXml = true;
*/
$wgXhtmlNamespaces = array();
-/** Enable to allow rewriting dates in page text.
- * DOES NOT FORMAT CORRECTLY FOR MOST LANGUAGES */
-$wgUseDynamicDates = false;
-/** Enable dates like 'May 12' instead of '12 May', this only takes effect if
- * the interface is set to English
+/**
+ * Show IP address, for non-logged in users. It's necessary to switch this off
+ * for some forms of caching.
*/
-$wgAmericanDates = false;
+$wgShowIPinHeader = true;
+
/**
- * For Hindi and Arabic use local numerals instead of Western style (0-9)
- * numerals in interface.
+ * Site notice shown at the top of each page
+ *
+ * MediaWiki:Sitenotice page, which will override this. You can also
+ * provide a separate message for logged-out users using the
+ * MediaWiki:Anonnotice page.
*/
-$wgTranslateNumerals = true;
+$wgSiteNotice = '';
/**
- * Translation using MediaWiki: namespace.
- * Interface messages will be loaded from the database.
+ * A subtitle to add to the tagline, for skins that have it/
*/
-$wgUseDatabaseMessages = true;
+$wgExtraSubtitle = '';
/**
- * Expiry time for the message cache key
+ * If this is set, a "donate" link will appear in the sidebar. Set it to a URL.
*/
-$wgMsgCacheExpiry = 86400;
+$wgSiteSupportPage = '';
/**
- * Maximum entry size in the message cache, in bytes
+ * Validate the overall output using tidy and refuse
+ * to display the page if it's not valid.
*/
-$wgMaxMsgCacheEntrySize = 10000;
+$wgValidateAllHtml = false;
/**
- * If true, serialized versions of the messages arrays will be
- * read from the 'serialized' subdirectory if they are present.
- * Set to false to always use the Messages files, regardless of
- * whether they are up to date or not.
+ * Default skin, for new users and anonymous visitors. Registered users may
+ * change this to any one of the other available skins in their preferences.
+ * This has to be completely lowercase; see the "skins" directory for the list
+ * of available skins.
*/
-$wgEnableSerializedMessages = true;
+$wgDefaultSkin = 'vector';
+
+/**
+* Should we allow the user's to select their own skin that will override the default?
+* @deprecated in 1.16, use $wgHiddenPrefs[] = 'skin' to disable it
+*/
+$wgAllowUserSkin = true;
/**
- * Set to false if you are thorough system admin who always remembers to keep
- * serialized files up to date to save few mtime calls.
+ * Specify the name of a skin that should not be presented in the list of
+ * available skins. Use for blacklisting a skin which you do not want to
+ * remove from the .../skins/ directory
*/
-$wgCheckSerialized = true;
+$wgSkipSkin = '';
+/** Array for more like $wgSkipSkin. */
+$wgSkipSkins = array();
-/** Whether to enable language variant conversion. */
-$wgDisableLangConversion = false;
+/**
+ * Optionally, we can specify a stylesheet to use for media="handheld".
+ * This is recognized by some, but not all, handheld/mobile/PDA browsers.
+ * If left empty, compliant handheld browsers won't pick up the skin
+ * stylesheet, which is specified for 'screen' media.
+ *
+ * Can be a complete URL, base-relative path, or $wgStylePath-relative path.
+ * Try 'chick/main.css' to apply the Chick styles to the MonoBook HTML.
+ *
+ * Will also be switched in when 'handheld=yes' is added to the URL, like
+ * the 'printable=yes' mode for print media.
+ */
+$wgHandheldStyle = false;
-/** Whether to enable language variant conversion for links. */
-$wgDisableTitleConversion = false;
+/**
+ * If set, 'screen' and 'handheld' media specifiers for stylesheets are
+ * transformed such that they apply to the iPhone/iPod Touch Mobile Safari,
+ * which doesn't recognize 'handheld' but does support media queries on its
+ * screen size.
+ *
+ * Consider only using this if you have a *really good* handheld stylesheet,
+ * as iPhone users won't have any way to disable it and use the "grown-up"
+ * styles instead.
+ */
+$wgHandheldForIPhone = false;
-/** Default variant code, if false, the default will be the language code */
-$wgDefaultLanguageVariant = false;
+/**
+ * Allow user Javascript page?
+ * This enables a lot of neat customizations, but may
+ * increase security risk to users and server load.
+ */
+$wgAllowUserJs = false;
-/** Disabled variants array of language variant conversion.
- * example:
- * $wgDisabledVariants[] = 'zh-mo';
- * $wgDisabledVariants[] = 'zh-my';
+/**
+ * Allow user Cascading Style Sheets (CSS)?
+ * This enables a lot of neat customizations, but may
+ * increase security risk to users and server load.
+ */
+$wgAllowUserCss = false;
+
+/**
+ * Allow user-preferences implemented in CSS?
+ * This allows users to customise the site appearance to a greater
+ * degree; disabling it will improve page load times.
+ */
+$wgAllowUserCssPrefs = true;
+
+/** Use the site's Javascript page? */
+$wgUseSiteJs = true;
+
+/** Use the site's Cascading Style Sheets (CSS)? */
+$wgUseSiteCss = true;
+
+/**
+ * Set to false to disable application of access keys and tooltips,
+ * eg to avoid keyboard conflicts with system keys or as a low-level
+ * optimization.
+ */
+$wgEnableTooltipsAndAccesskeys = true;
+
+/**
+ * Break out of framesets. This can be used to prevent clickjacking attacks,
+ * or to prevent external sites from framing your site with ads.
+ */
+$wgBreakFrames = false;
+
+/**
+ * The X-Frame-Options header to send on pages sensitive to clickjacking
+ * attacks, such as edit pages. This prevents those pages from being displayed
+ * in a frame or iframe. The options are:
*
- * or:
- * $wgDisabledVariants = array('zh-mo', 'zh-my');
+ * - 'DENY': Do not allow framing. This is recommended for most wikis.
+ *
+ * - 'SAMEORIGIN': Allow framing by pages on the same domain. This can be used
+ * to allow framing within a trusted domain. This is insecure if there
+ * is a page on the same domain which allows framing of arbitrary URLs.
+ *
+ * - false: Allow all framing. This opens up the wiki to XSS attacks and thus
+ * full compromise of local user accounts. Private wikis behind a
+ * corporate firewall are especially vulnerable. This is not
+ * recommended.
+ *
+ * For extra safety, set $wgBreakFrames = true, to prevent framing on all pages,
+ * not just edit pages.
*/
-$wgDisabledVariants = array();
+$wgEditPageFrameOptions = 'DENY';
/**
- * Like $wgArticlePath, but on multi-variant wikis, this provides a
- * path format that describes which parts of the URL contain the
- * language variant. For Example:
+ * Disable output compression (enabled by default if zlib is available)
+ */
+$wgDisableOutputCompression = false;
+
+/**
+ * Should we allow a broader set of characters in id attributes, per HTML5? If
+ * not, use only HTML 4-compatible IDs. This option is for testing -- when the
+ * functionality is ready, it will be on by default with no option.
*
- * $wgLanguageCode = 'sr';
- * $wgVariantArticlePath = '/$2/$1';
- * $wgArticlePath = '/wiki/$1';
+ * Currently this appears to work fine in all browsers, but it's disabled by
+ * default because it normalizes id's a bit too aggressively, breaking preexisting
+ * content (particularly Cite). See bug 27733, bug 27694, bug 27474.
+ */
+$wgExperimentalHtmlIds = false;
+
+/**
+ * Abstract list of footer icons for skins in place of old copyrightico and poweredbyico code
+ * You can add new icons to the built in copyright or poweredby, or you can create
+ * a new block. Though note that you may need to add some custom css to get good styling
+ * of new blocks in monobook. vector and modern should work without any special css.
+ *
+ * $wgFooterIcons itself is a key/value array.
+ * The key is the name of a block that the icons will be wrapped in. The final id varies
+ * by skin; Monobook and Vector will turn poweredby into f-poweredbyico while Modern
+ * turns it into mw_poweredby.
+ * The value is either key/value array of icons or a string.
+ * In the key/value array the key may or may not be used by the skin but it can
+ * be used to find the icon and unset it or change the icon if needed.
+ * This is useful for disabling icons that are set by extensions.
+ * The value should be either a string or an array. If it is a string it will be output
+ * directly as html, however some skins may choose to ignore it. An array is the preferred format
+ * for the icon, the following keys are used:
+ * src: An absolute url to the image to use for the icon, this is recommended
+ * but not required, however some skins will ignore icons without an image
+ * url: The url to use in the <a> arround the text or icon, if not set an <a> will not be outputted
+ * alt: This is the text form of the icon, it will be displayed without an image in
+ * skins like Modern or if src is not set, and will otherwise be used as
+ * the alt="" for the image. This key is required.
+ * width and height: If the icon specified by src is not of the standard size
+ * you can specify the size of image to use with these keys.
+ * Otherwise they will default to the standard 88x31.
+ */
+$wgFooterIcons = array(
+ "copyright" => array(
+ "copyright" => array(), // placeholder for the built in copyright icon
+ ),
+ "poweredby" => array(
+ "mediawiki" => array(
+ "src" => null, // Defaults to "$wgStylePath/common/images/poweredby_mediawiki_88x31.png"
+ "url" => "http://www.mediawiki.org/",
+ "alt" => "Powered by MediaWiki",
+ )
+ ),
+);
+
+/**
+ * Search form behavior for Vector skin only
+ * true = use an icon search button
+ * false = use Go & Search buttons
+ */
+$wgVectorUseSimpleSearch = false;
+
+/**
+ * Watch and unwatch as an icon rather than a link for Vector skin only
+ * true = use an icon watch/unwatch button
+ * false = use watch/unwatch text link
+ */
+$wgVectorUseIconWatch = false;
+
+/**
+ * Show the name of the current variant as a label in the variants drop-down menu
+ */
+$wgVectorShowVariantName = false;
+
+/**
+ * Display user edit counts in various prominent places.
+ */
+$wgEdititis = false;
+
+/**
+ * Experimental better directionality support.
+ */
+$wgBetterDirectionality = false;
+
+
+/** @} */ # End of output format settings }
+
+/*************************************************************************//**
+ * @name Resource loader settings
+ * @{
+ */
+
+/**
+ * Client-side resource modules. Extensions should add their module definitions
+ * here.
*
- * A link to /wiki/ would be redirected to /sr/Главна_страна
+ * Example:
+ * $wgResourceModules['ext.myExtension'] = array(
+ * 'scripts' => 'myExtension.js',
+ * 'styles' => 'myExtension.css',
+ * 'dependencies' => array( 'jquery.cookie', 'jquery.tabIndex' ),
+ * 'localBasePath' => dirname( __FILE__ ),
+ * 'remoteExtPath' => 'MyExtension',
+ * );
+ */
+$wgResourceModules = array();
+
+/**
+ * Maximum time in seconds to cache resources served by the resource loader
+ */
+$wgResourceLoaderMaxage = array(
+ 'versioned' => array(
+ // Squid/Varnish but also any other public proxy cache between the client and MediaWiki
+ 'server' => 30 * 24 * 60 * 60, // 30 days
+ // On the client side (e.g. in the browser cache).
+ 'client' => 30 * 24 * 60 * 60, // 30 days
+ ),
+ 'unversioned' => array(
+ 'server' => 5 * 60, // 5 minutes
+ 'client' => 5 * 60, // 5 minutes
+ ),
+);
+
+/**
+ * Whether to embed private modules inline with HTML output or to bypass
+ * caching and check the user parameter against $wgUser to prevent
+ * unauthorized access to private modules.
+ */
+$wgResourceLoaderInlinePrivateModules = true;
+
+/**
+ * The default debug mode (on/off) for of ResourceLoader requests. This will still
+ * be overridden when the debug URL parameter is used.
+ */
+$wgResourceLoaderDebug = false;
+
+/**
+ * Enable embedding of certain resources using Edge Side Includes. This will
+ * improve performance but only works if there is something in front of the
+ * web server (e..g a Squid or Varnish server) configured to process the ESI.
+ */
+$wgResourceLoaderUseESI = false;
+
+/**
+ * Put each statement on its own line when minifying JavaScript. This makes
+ * debugging in non-debug mode a bit easier.
+ */
+$wgResourceLoaderMinifierStatementsOnOwnLine = false;
+
+/**
+ * Maximum line length when minifying JavaScript. This is not a hard maximum:
+ * the minifier will try not to produce lines longer than this, but may be
+ * forced to do so in certain cases.
+ */
+$wgResourceLoaderMinifierMaxLineLength = 1000;
+
+/**
+ * Whether to include the mediawiki.legacy JS library (old wikibits.js), and its
+ * dependencies
+ */
+$wgIncludeLegacyJavaScript = true;
+
+/**
+ * If set to a positive number, ResourceLoader will not generate URLs whose
+ * query string is more than this many characters long, and will instead use
+ * multiple requests with shorter query strings. This degrades performance,
+ * but may be needed if your web server has a low (less than, say 1024)
+ * query string length limit or a low value for suhosin.get.max_value_length
+ * that you can't increase.
*
- * It is important that $wgArticlePath not overlap with possible values
- * of $wgVariantArticlePath.
+ * If set to a negative number, ResourceLoader will assume there is no query
+ * string length limit.
+ */
+$wgResourceLoaderMaxQueryLength = -1;
+
+/** @} */ # End of resource loader settings }
+
+
+/*************************************************************************//**
+ * @name Page title and interwiki link settings
+ * @{
*/
-$wgVariantArticlePath = false;///< defaults to false
/**
- * Show a bar of language selection links in the user login and user
- * registration forms; edit the "loginlanguagelinks" message to
- * customise these
+ * Name of the project namespace. If left set to false, $wgSitename will be
+ * used instead.
*/
-$wgLoginLanguageSelector = false;
+$wgMetaNamespace = false;
+
+/**
+ * Name of the project talk namespace.
+ *
+ * Normally you can ignore this and it will be something like
+ * $wgMetaNamespace . "_talk". In some languages, you may want to set this
+ * manually for grammatical reasons.
+ */
+$wgMetaNamespaceTalk = false;
+
+/**
+ * Additional namespaces. If the namespaces defined in Language.php and
+ * Namespace.php are insufficient, you can create new ones here, for example,
+ * to import Help files in other languages. You can also override the namespace
+ * names of existing namespaces. Extensions developers should use
+ * $wgCanonicalNamespaceNames.
+ *
+ * PLEASE NOTE: Once you delete a namespace, the pages in that namespace will
+ * no longer be accessible. If you rename it, then you can access them through
+ * the new namespace name.
+ *
+ * Custom namespaces should start at 100 to avoid conflicting with standard
+ * namespaces, and should always follow the even/odd main/talk pattern.
+ */
+#$wgExtraNamespaces =
+# array(100 => "Hilfe",
+# 101 => "Hilfe_Diskussion",
+# 102 => "Aide",
+# 103 => "Discussion_Aide"
+# );
+$wgExtraNamespaces = array();
/**
- * Whether to use zhdaemon to perform Chinese text processing
- * zhdaemon is under developement, so normally you don't want to
- * use it unless for testing
+ * Namespace aliases
+ * These are alternate names for the primary localised namespace names, which
+ * are defined by $wgExtraNamespaces and the language file. If a page is
+ * requested with such a prefix, the request will be redirected to the primary
+ * name.
+ *
+ * Set this to a map from namespace names to IDs.
+ * Example:
+ * $wgNamespaceAliases = array(
+ * 'Wikipedian' => NS_USER,
+ * 'Help' => 100,
+ * );
*/
-$wgUseZhdaemon = false;
-$wgZhdaemonHost="localhost";
-$wgZhdaemonPort=2004;
+$wgNamespaceAliases = array();
+/**
+ * Allowed title characters -- regex character class
+ * Don't change this unless you know what you're doing
+ *
+ * Problematic punctuation:
+ * - []{}|# Are needed for link syntax, never enable these
+ * - <> Causes problems with HTML escaping, don't use
+ * - % Enabled by default, minor problems with path to query rewrite rules, see below
+ * - + Enabled by default, but doesn't work with path to query rewrite rules, corrupted by apache
+ * - ? Enabled by default, but doesn't work with path to PATH_INFO rewrites
+ *
+ * All three of these punctuation problems can be avoided by using an alias, instead of a
+ * rewrite rule of either variety.
+ *
+ * The problem with % is that when using a path to query rewrite rule, URLs are
+ * double-unescaped: once by Apache's path conversion code, and again by PHP. So
+ * %253F, for example, becomes "?". Our code does not double-escape to compensate
+ * for this, indeed double escaping would break if the double-escaped title was
+ * passed in the query string rather than the path. This is a minor security issue
+ * because articles can be created such that they are hard to view or edit.
+ *
+ * In some rare cases you may wish to remove + for compatibility with old links.
+ *
+ * Theoretically 0x80-0x9F of ISO 8859-1 should be disallowed, but
+ * this breaks interlanguage links
+ */
+$wgLegalTitleChars = " %!\"$&'()*,\\-.\\/0-9:;=?@A-Z\\\\^_`a-z~\\x80-\\xFF+";
-# Miscellaneous configuration settings
-#
+/**
+ * The interwiki prefix of the current wiki, or false if it doesn't have one.
+ */
+$wgLocalInterwiki = false;
-$wgLocalInterwiki = 'w';
-$wgInterwikiExpiry = 10800; # Expiry time for cache of interwiki table
+/**
+ * Expiry time for cache of interwiki table
+ */
+$wgInterwikiExpiry = 10800;
/** Interwiki caching settings.
$wgInterwikiCache specifies path to constant database file
@@ -1121,15 +2598,110 @@ $wgInterwikiFallbackSite = 'wiki';
*/
$wgRedirectSources = false;
+/**
+ * Set this to false to avoid forcing the first letter of links to capitals.
+ * WARNING: may break links! This makes links COMPLETELY case-sensitive. Links
+ * appearing with a capital at the beginning of a sentence will *not* go to the
+ * same place as links in the middle of a sentence using a lowercase initial.
+ */
+$wgCapitalLinks = true;
-$wgShowIPinHeader = true; # For non-logged in users
-$wgMaxSigChars = 255; # Maximum number of Unicode characters in signature
-$wgMaxArticleSize = 2048; # Maximum article size in kilobytes
-# Maximum number of bytes in username. You want to run the maintenance
-# script ./maintenancecheckUsernames.php once you have changed this value
-$wgMaxNameChars = 255;
+/**
+ * @since 1.16 - This can now be set per-namespace. Some special namespaces (such
+ * as Special, see MWNamespace::$alwaysCapitalizedNamespaces for the full list) must be
+ * true by default (and setting them has no effect), due to various things that
+ * require them to be so. Also, since Talk namespaces need to directly mirror their
+ * associated content namespaces, the values for those are ignored in favor of the
+ * subject namespace's setting. Setting for NS_MEDIA is taken automatically from
+ * NS_FILE.
+ * EX: $wgCapitalLinkOverrides[ NS_FILE ] = false;
+ */
+$wgCapitalLinkOverrides = array();
+
+/** Which namespaces should support subpages?
+ * See Language.php for a list of namespaces.
+ */
+$wgNamespacesWithSubpages = array(
+ NS_TALK => true,
+ NS_USER => true,
+ NS_USER_TALK => true,
+ NS_PROJECT_TALK => true,
+ NS_FILE_TALK => true,
+ NS_MEDIAWIKI => true,
+ NS_MEDIAWIKI_TALK => true,
+ NS_TEMPLATE_TALK => true,
+ NS_HELP_TALK => true,
+ NS_CATEGORY_TALK => true
+);
+
+/**
+ * Array of namespaces which can be deemed to contain valid "content", as far
+ * as the site statistics are concerned. Useful if additional namespaces also
+ * contain "content" which should be considered when generating a count of the
+ * number of articles in the wiki.
+ */
+$wgContentNamespaces = array( NS_MAIN );
+
+/**
+ * Max number of redirects to follow when resolving redirects.
+ * 1 means only the first redirect is followed (default behavior).
+ * 0 or less means no redirects are followed.
+ */
+$wgMaxRedirects = 1;
+
+/**
+ * Array of invalid page redirect targets.
+ * Attempting to create a redirect to any of the pages in this array
+ * will make the redirect fail.
+ * Userlogout is hard-coded, so it does not need to be listed here.
+ * (bug 10569) Disallow Mypage and Mytalk as well.
+ *
+ * As of now, this only checks special pages. Redirects to pages in
+ * other namespaces cannot be invalidated by this variable.
+ */
+$wgInvalidRedirectTargets = array( 'Filepath', 'Mypage', 'Mytalk' );
+
+/** @} */ # End of title and interwiki settings }
+
+/************************************************************************//**
+ * @name Parser settings
+ * These settings configure the transformation from wikitext to HTML.
+ * @{
+ */
+
+/**
+ * Parser configuration. Associative array with the following members:
+ *
+ * class The class name
+ *
+ * preprocessorClass The preprocessor class. Two classes are currently available:
+ * Preprocessor_Hash, which uses plain PHP arrays for tempoarary
+ * storage, and Preprocessor_DOM, which uses the DOM module for
+ * temporary storage. Preprocessor_DOM generally uses less memory;
+ * the speed of the two is roughly the same.
+ *
+ * If this parameter is not given, it uses Preprocessor_DOM if the
+ * DOM module is available, otherwise it uses Preprocessor_Hash.
+ *
+ * The entire associative array will be passed through to the constructor as
+ * the first parameter. Note that only Setup.php can use this variable --
+ * the configuration will change at runtime via $wgParser member functions, so
+ * the contents of this variable will be out-of-date. The variable can only be
+ * changed during LocalSettings.php, in particular, it can't be changed during
+ * an extension setup function.
+ */
+$wgParserConf = array(
+ 'class' => 'Parser',
+ #'preprocessorClass' => 'Preprocessor_Hash',
+);
+
+/** Maximum indent level of toc. */
+$wgMaxTocLevel = 999;
-$wgMaxPPNodeCount = 1000000; # A complexity limit on template expansion
+/**
+ * A complexity limit on template expansion
+ */
+$wgMaxPPNodeCount = 1000000;
/**
* Maximum recursion depth for templates within templates.
@@ -1138,207 +2710,460 @@ $wgMaxPPNodeCount = 1000000; # A complexity limit on template expansion
* stop the parser before it hits the xdebug limit.
*/
$wgMaxTemplateDepth = 40;
+
+/** @see $wgMaxTemplateDepth */
$wgMaxPPExpandDepth = 40;
+/** The external URL protocols */
+$wgUrlProtocols = array(
+ 'http://',
+ 'https://',
+ 'ftp://',
+ 'irc://',
+ 'gopher://',
+ 'telnet://', // Well if we're going to support the above.. -ævar
+ 'nntp://', // @bug 3808 RFC 1738
+ 'worldwind://',
+ 'mailto:',
+ 'news:',
+ 'svn://',
+ 'git://',
+ 'mms://',
+);
+
/**
* If true, removes (substitutes) templates in "~~~~" signatures.
*/
$wgCleanSignatures = true;
-$wgExtraSubtitle = '';
-$wgSiteSupportPage = ''; # A page where you users can receive donations
+/** Whether to allow inline image pointing to other websites */
+$wgAllowExternalImages = false;
/**
- * Set this to a string to put the wiki into read-only mode. The text will be
- * used as an explanation to users.
+ * If the above is false, you can specify an exception here. Image URLs
+ * that start with this string are then rendered, while all others are not.
+ * You can use this to set up a trusted, simple repository of images.
+ * You may also specify an array of strings to allow multiple sites
*
- * This prevents most write operations via the web interface. Cache updates may
- * still be possible. To prevent database writes completely, use the read_only
- * option in MySQL.
+ * Examples:
+ * <code>
+ * $wgAllowExternalImagesFrom = 'http://127.0.0.1/';
+ * $wgAllowExternalImagesFrom = array( 'http://127.0.0.1/', 'http://example.com' );
+ * </code>
*/
-$wgReadOnly = null;
+$wgAllowExternalImagesFrom = '';
-/***
- * If this lock file exists (size > 0), the wiki will be forced into read-only mode.
- * Its contents will be shown to users as part of the read-only warning
- * message.
+/** If $wgAllowExternalImages is false, you can allow an on-wiki
+ * whitelist of regular expression fragments to match the image URL
+ * against. If the image matches one of the regular expression fragments,
+ * The image will be displayed.
+ *
+ * Set this to true to enable the on-wiki whitelist (MediaWiki:External image whitelist)
+ * Or false to disable it
*/
-$wgReadOnlyFile = false; ///< defaults to "{$wgUploadDirectory}/lock_yBgMBwiR";
+$wgEnableImageWhitelist = true;
/**
- * Filename for debug logging. See http://www.mediawiki.org/wiki/How_to_debug
- * The debug log file should be not be publicly accessible if it is used, as it
- * may contain private data.
+ * A different approach to the above: simply allow the <img> tag to be used.
+ * This allows you to specify alt text and other attributes, copy-paste HTML to
+ * your wiki more easily, etc. However, allowing external images in any manner
+ * will allow anyone with editing rights to snoop on your visitors' IP
+ * addresses and so forth, if they wanted to, by inserting links to images on
+ * sites they control.
*/
-$wgDebugLogFile = '';
+$wgAllowImageTag = false;
/**
- * Prefix for debug log lines
+ * $wgUseTidy: use tidy to make sure HTML output is sane.
+ * Tidy is a free tool that fixes broken HTML.
+ * See http://www.w3.org/People/Raggett/tidy/
+ *
+ * - $wgTidyBin should be set to the path of the binary and
+ * - $wgTidyConf to the path of the configuration file.
+ * - $wgTidyOpts can include any number of parameters.
+ * - $wgTidyInternal controls the use of the PECL extension to use an in-
+ * process tidy library instead of spawning a separate program.
+ * Normally you shouldn't need to override the setting except for
+ * debugging. To install, use 'pear install tidy' and add a line
+ * 'extension=tidy.so' to php.ini.
*/
-$wgDebugLogPrefix = '';
+$wgUseTidy = false;
+/** @see $wgUseTidy */
+$wgAlwaysUseTidy = false;
+/** @see $wgUseTidy */
+$wgTidyBin = 'tidy';
+/** @see $wgUseTidy */
+$wgTidyConf = $IP.'/includes/tidy.conf';
+/** @see $wgUseTidy */
+$wgTidyOpts = '';
+/** @see $wgUseTidy */
+$wgTidyInternal = extension_loaded( 'tidy' );
/**
- * If true, instead of redirecting, show a page with a link to the redirect
- * destination. This allows for the inspection of PHP error messages, and easy
- * resubmission of form data. For developer use only.
+ * Put tidy warnings in HTML comments
+ * Only works for internal tidy.
*/
-$wgDebugRedirects = false;
+$wgDebugTidy = false;
+
+/** Allow raw, unchecked HTML in <html>...</html> sections.
+ * THIS IS VERY DANGEROUS on a publically editable site, so USE wgGroupPermissions
+ * TO RESTRICT EDITING to only those that you trust
+ */
+$wgRawHtml = false;
/**
- * If true, log debugging data from action=raw.
- * This is normally false to avoid overlapping debug entries due to gen=css and
- * gen=js requests.
+ * Set a default target for external links, e.g. _blank to pop up a new window
*/
-$wgDebugRawPage = false;
+$wgExternalLinkTarget = false;
/**
- * Send debug data to an HTML comment in the output.
+ * If true, external URL links in wiki text will be given the
+ * rel="nofollow" attribute as a hint to search engines that
+ * they should not be followed for ranking purposes as they
+ * are user-supplied and thus subject to spamming.
+ */
+$wgNoFollowLinks = true;
+
+/**
+ * Namespaces in which $wgNoFollowLinks doesn't apply.
+ * See Language.php for a list of namespaces.
+ */
+$wgNoFollowNsExceptions = array();
+
+/**
+ * If this is set to an array of domains, external links to these domain names
+ * (or any subdomains) will not be set to rel="nofollow" regardless of the
+ * value of $wgNoFollowLinks. For instance:
*
- * This may occasionally be useful when supporting a non-technical end-user. It's
- * more secure than exposing the debug log file to the web, since the output only
- * contains private data for the current user. But it's not ideal for development
- * use since data is lost on fatal errors and redirects.
+ * $wgNoFollowDomainExceptions = array( 'en.wikipedia.org', 'wiktionary.org' );
+ *
+ * This would add rel="nofollow" to links to de.wikipedia.org, but not
+ * en.wikipedia.org, wiktionary.org, en.wiktionary.org, us.en.wikipedia.org,
+ * etc.
*/
-$wgDebugComments = false;
+$wgNoFollowDomainExceptions = array();
/**
- * Write SQL queries to the debug log
+ * Allow DISPLAYTITLE to change title display
*/
-$wgDebugDumpSql = false;
+$wgAllowDisplayTitle = true;
/**
- * Set to an array of log group keys to filenames.
- * If set, wfDebugLog() output for that group will go to that file instead
- * of the regular $wgDebugLogFile. Useful for enabling selective logging
- * in production.
+ * For consistency, restrict DISPLAYTITLE to titles that normalize to the same
+ * canonical DB key.
*/
-$wgDebugLogGroups = array();
+$wgRestrictDisplayTitle = true;
/**
- * Display debug data at the bottom of the main content area.
- *
- * Useful for developers and technical users trying to working on a closed wiki.
+ * Maximum number of calls per parse to expensive parser functions such as
+ * PAGESINCATEGORY.
*/
-$wgShowDebug = false;
+$wgExpensiveParserFunctionLimit = 100;
/**
- * Prefix debug messages with relative timestamp. Very-poor man's profiler.
+ * Preprocessor caching threshold
*/
-$wgDebugTimestamps = false;
+$wgPreprocessorCacheThreshold = 1000;
/**
- * Print HTTP headers for every request in the debug information.
+ * Enable interwiki transcluding. Only when iw_trans=1.
*/
-$wgDebugPrintHttpHeaders = true;
+$wgEnableScaryTranscluding = false;
/**
- * Show the contents of $wgHooks in Special:Version
+ * Expiry time for interwiki transclusion
+ */
+$wgTranscludeCacheExpiry = 3600;
+
+/** @} */ # end of parser settings }
+
+/************************************************************************//**
+ * @name Statistics
+ * @{
*/
-$wgSpecialVersionShowHooks = false;
/**
- * Whether to show "we're sorry, but there has been a database error" pages.
- * Displaying errors aids in debugging, but may display information useful
- * to an attacker.
+ * Under which condition should a page in the main namespace be counted
+ * as a valid article? If $wgUseCommaCount is set to true, it will be
+ * counted if it contains at least one comma. If it is set to false
+ * (default), it will only be counted if it contains at least one [[wiki
+ * link]]. See http://www.mediawiki.org/wiki/Manual:Article_count
+ *
+ * Retroactively changing this variable will not affect
+ * the existing count (cf. maintenance/recount.sql).
*/
-$wgShowSQLErrors = false;
+$wgUseCommaCount = false;
/**
- * If true, some error messages will be colorized when running scripts on the
- * command line; this can aid picking important things out when debugging.
- * Ignored when running on Windows or when output is redirected to a file.
+ * wgHitcounterUpdateFreq sets how often page counters should be updated, higher
+ * values are easier on the database. A value of 1 causes the counters to be
+ * updated on every hit, any higher value n cause them to update *on average*
+ * every n hits. Should be set to either 1 or something largish, eg 1000, for
+ * maximum efficiency.
*/
-$wgColorErrors = true;
+$wgHitcounterUpdateFreq = 1;
/**
- * If set to true, uncaught exceptions will print a complete stack trace
- * to output. This should only be used for debugging, as it may reveal
- * private information in function parameters due to PHP's backtrace
- * formatting.
+ * How many days user must be idle before he is considered inactive. Will affect
+ * the number shown on Special:Statistics and Special:ActiveUsers special page.
+ * You might want to leave this as the default value, to provide comparable
+ * numbers between different wikis.
*/
-$wgShowExceptionDetails = false;
+$wgActiveUserDays = 30;
+
+/** @} */ # End of statistics }
+
+/************************************************************************//**
+ * @name User accounts, authentication
+ * @{
+ */
+
+/** For compatibility with old installations set to false */
+$wgPasswordSalt = true;
/**
- * If true, show a backtrace for database errors
+ * Specifies the minimal length of a user password. If set to 0, empty pass-
+ * words are allowed.
*/
-$wgShowDBErrorBacktrace = false;
+$wgMinimalPasswordLength = 1;
/**
- * Expose backend server host names through the API and various HTML comments
+ * Enabes or disables JavaScript-based suggestions of password strength
*/
-$wgShowHostnames = false;
+$wgLivePasswordStrengthChecks = false;
/**
- * If set to true MediaWiki will throw notices for some possible error
- * conditions and for deprecated functions.
+ * Maximum number of Unicode characters in signature
*/
-$wgDevelopmentWarnings = false;
+$wgMaxSigChars = 255;
/**
- * Use experimental, DMOZ-like category browser
+ * Maximum number of bytes in username. You want to run the maintenance
+ * script ./maintenance/checkUsernames.php once you have changed this value.
*/
-$wgUseCategoryBrowser = false;
+$wgMaxNameChars = 255;
/**
- * Keep parsed pages in a cache (objectcache table or memcached)
- * to speed up output of the same page viewed by another user with the
- * same options.
+ * Array of usernames which may not be registered or logged in from
+ * Maintenance scripts can still use these
+ */
+$wgReservedUsernames = array(
+ 'MediaWiki default', // Default 'Main Page' and MediaWiki: message pages
+ 'Conversion script', // Used for the old Wikipedia software upgrade
+ 'Maintenance script', // Maintenance scripts which perform editing, image import script
+ 'Template namespace initialisation script', // Used in 1.2->1.3 upgrade
+ 'msg:double-redirect-fixer', // Automatic double redirect fix
+ 'msg:usermessage-editor', // Default user for leaving user messages
+ 'msg:proxyblocker', // For Special:Blockme
+);
+
+/**
+ * Settings added to this array will override the default globals for the user
+ * preferences used by anonymous visitors and newly created accounts.
+ * For instance, to disable section editing links:
+ * $wgDefaultUserOptions ['editsection'] = 0;
*
- * This can provide a significant speedup for medium to large pages,
- * so you probably want to keep it on. Extensions that conflict with the
- * parser cache should disable the cache on a per-page basis instead.
*/
-$wgEnableParserCache = true;
+$wgDefaultUserOptions = array(
+ 'ccmeonemails' => 0,
+ 'cols' => 80,
+ 'contextchars' => 50,
+ 'contextlines' => 5,
+ 'date' => 'default',
+ 'diffonly' => 0,
+ 'disablemail' => 0,
+ 'disablesuggest' => 0,
+ 'editfont' => 'default',
+ 'editondblclick' => 0,
+ 'editsection' => 1,
+ 'editsectiononrightclick' => 0,
+ 'enotifminoredits' => 0,
+ 'enotifrevealaddr' => 0,
+ 'enotifusertalkpages' => 1,
+ 'enotifwatchlistpages' => 0,
+ 'extendwatchlist' => 0,
+ 'externaldiff' => 0,
+ 'externaleditor' => 0,
+ 'fancysig' => 0,
+ 'forceeditsummary' => 0,
+ 'gender' => 'unknown',
+ 'hideminor' => 0,
+ 'hidepatrolled' => 0,
+ 'highlightbroken' => 1,
+ 'imagesize' => 2,
+ 'justify' => 0,
+ 'math' => 1,
+ 'minordefault' => 0,
+ 'newpageshidepatrolled' => 0,
+ 'nocache' => 0,
+ 'noconvertlink' => 0,
+ 'norollbackdiff' => 0,
+ 'numberheadings' => 0,
+ 'previewonfirst' => 0,
+ 'previewontop' => 1,
+ 'quickbar' => 1,
+ 'rcdays' => 7,
+ 'rclimit' => 50,
+ 'rememberpassword' => 0,
+ 'rows' => 25,
+ 'searchlimit' => 20,
+ 'showhiddencats' => 0,
+ 'showjumplinks' => 1,
+ 'shownumberswatching' => 1,
+ 'showtoc' => 1,
+ 'showtoolbar' => 1,
+ 'skin' => false,
+ 'stubthreshold' => 0,
+ 'thumbsize' => 2,
+ 'underline' => 2,
+ 'uselivepreview' => 0,
+ 'usenewrc' => 0,
+ 'watchcreations' => 0,
+ 'watchdefault' => 0,
+ 'watchdeletion' => 0,
+ 'watchlistdays' => 3.0,
+ 'watchlisthideanons' => 0,
+ 'watchlisthidebots' => 0,
+ 'watchlisthideliu' => 0,
+ 'watchlisthideminor' => 0,
+ 'watchlisthideown' => 0,
+ 'watchlisthidepatrolled' => 0,
+ 'watchmoves' => 0,
+ 'wllimit' => 250,
+);
/**
- * Append a configured value to the parser cache and the sitenotice key so
- * that they can be kept separate for some class of activity.
+ * Whether or not to allow and use real name fields.
+ * @deprecated in 1.16, use $wgHiddenPrefs[] = 'realname' below to disable real
+ * names
*/
-$wgRenderHashAppend = '';
+$wgAllowRealName = true;
+
+/** An array of preferences to not show for the user */
+$wgHiddenPrefs = array();
/**
- * If on, the sidebar navigation links are cached for users with the
- * current language set. This can save a touch of load on a busy site
- * by shaving off extra message lookups.
+ * Characters to prevent during new account creations.
+ * This is used in a regular expression character class during
+ * registration (regex metacharacters like / are escaped).
+ */
+$wgInvalidUsernameCharacters = '@';
+
+/**
+ * Character used as a delimiter when testing for interwiki userrights
+ * (In Special:UserRights, it is possible to modify users on different
+ * databases if the delimiter is used, e.g. Someuser@enwiki).
*
- * However it is also fragile: changing the site configuration, or
- * having a variable $wgArticlePath, can produce broken links that
- * don't update as expected.
+ * It is recommended that you have this delimiter in
+ * $wgInvalidUsernameCharacters above, or you will not be able to
+ * modify the user rights of those users via Special:UserRights
*/
-$wgEnableSidebarCache = false;
+$wgUserrightsInterwikiDelimiter = '@';
/**
- * Expiry time for the sidebar cache, in seconds
+ * Use some particular type of external authentication. The specific
+ * authentication module you use will normally require some extra settings to
+ * be specified.
+ *
+ * null indicates no external authentication is to be used. Otherwise,
+ * $wgExternalAuthType must be the name of a non-abstract class that extends
+ * ExternalUser.
+ *
+ * Core authentication modules can be found in includes/extauth/.
*/
-$wgSidebarCacheExpiry = 86400;
+$wgExternalAuthType = null;
/**
- * Under which condition should a page in the main namespace be counted
- * as a valid article? If $wgUseCommaCount is set to true, it will be
- * counted if it contains at least one comma. If it is set to false
- * (default), it will only be counted if it contains at least one [[wiki
- * link]]. See http://www.mediawiki.org/wiki/Manual:Article_count
+ * Configuration for the external authentication. This may include arbitrary
+ * keys that depend on the authentication mechanism. For instance,
+ * authentication against another web app might require that the database login
+ * info be provided. Check the file where your auth mechanism is defined for
+ * info on what to put here.
+ */
+$wgExternalAuthConf = array();
+
+/**
+ * When should we automatically create local accounts when external accounts
+ * already exist, if using ExternalAuth? Can have three values: 'never',
+ * 'login', 'view'. 'view' requires the external database to support cookies,
+ * and implies 'login'.
*
- * Retroactively changing this variable will not affect
- * the existing count (cf. maintenance/recount.sql).
+ * TODO: Implement 'view' (currently behaves like 'login').
*/
-$wgUseCommaCount = false;
+$wgAutocreatePolicy = 'login';
/**
- * wgHitcounterUpdateFreq sets how often page counters should be updated, higher
- * values are easier on the database. A value of 1 causes the counters to be
- * updated on every hit, any higher value n cause them to update *on average*
- * every n hits. Should be set to either 1 or something largish, eg 1000, for
- * maximum efficiency.
+ * Policies for how each preference is allowed to be changed, in the presence
+ * of external authentication. The keys are preference keys, e.g., 'password'
+ * or 'emailaddress' (see Preferences.php et al.). The value can be one of the
+ * following:
+ *
+ * - local: Allow changes to this pref through the wiki interface but only
+ * apply them locally (default).
+ * - semiglobal: Allow changes through the wiki interface and try to apply them
+ * to the foreign database, but continue on anyway if that fails.
+ * - global: Allow changes through the wiki interface, but only let them go
+ * through if they successfully update the foreign database.
+ * - message: Allow no local changes for linked accounts; replace the change
+ * form with a message provided by the auth plugin, telling the user how to
+ * change the setting externally (maybe providing a link, etc.). If the auth
+ * plugin provides no message for this preference, hide it entirely.
+ *
+ * Accounts that are not linked to an external account are never affected by
+ * this setting. You may want to look at $wgHiddenPrefs instead.
+ * $wgHiddenPrefs supersedes this option.
+ *
+ * TODO: Implement message, global.
*/
-$wgHitcounterUpdateFreq = 1;
+$wgAllowPrefChange = array();
-# Basic user rights and block settings
-$wgSysopUserBans = true; # Allow sysops to ban logged-in users
-$wgSysopRangeBans = true; # Allow sysops to ban IP ranges
-$wgAutoblockExpiry = 86400; # Number of seconds before autoblock entries expire
-$wgBlockAllowsUTEdit = false; # Default setting for option on block form to allow self talkpage editing whilst blocked
-$wgSysopEmailBans = true; # Allow sysops to ban users from accessing Emailuser
+/**
+ * This is to let user authenticate using https when they come from http.
+ * Based on an idea by George Herbert on wikitech-l:
+ * http://lists.wikimedia.org/pipermail/wikitech-l/2010-October/050065.html
+ * @since 1.17
+ */
+$wgSecureLogin = false;
+
+/** @} */ # end user accounts }
+
+/************************************************************************//**
+ * @name User rights, access control and monitoring
+ * @{
+ */
+
+/**
+ * Allow sysops to ban logged-in users
+ * @deprecated since 1.17, will be made permanently true in 1.18
+ */
+$wgSysopUserBans = true;
+
+/**
+ * Allow sysops to ban IP ranges
+ * @deprecated since 1.17; set $wgBlockCIDRLimit to array( 'IPv4' => 32, 'IPv6 => 128 ) instead.
+ */
+$wgSysopRangeBans = true;
+
+/**
+ * Number of seconds before autoblock entries expire. Default 86400 = 1 day.
+ */
+$wgAutoblockExpiry = 86400;
+
+/**
+ * Set this to true to allow blocked users to edit their own user talk page.
+ */
+$wgBlockAllowsUTEdit = false;
+
+/** Allow sysops to ban users from accessing Emailuser */
+$wgSysopEmailBans = true;
+
+/**
+ * Limits on the possible sizes of range blocks.
+ *
+ * CIDR notation is hard to understand, it's easy to mistakenly assume that a
+ * /1 is a small range and a /31 is a large range. Setting this to half the
+ * number of bits avoids such errors.
+ */
$wgBlockCIDRLimit = array(
'IPv4' => 16, # Blocks larger than a /16 (64k addresses) will not be allowed
'IPv6' => 64, # 2^64 = ~1.8x10^19 addresses
@@ -1351,24 +3176,31 @@ $wgBlockCIDRLimit = array(
* logging the user out will again allow reading and editing, just as for
* anonymous visitors.
*/
-$wgBlockDisablesLogin = false; #
-
-# Pages anonymous user may see as an array, e.g.:
-# array ( "Main Page", "Wikipedia:Help");
-# Special:Userlogin and Special:Resetpass are always whitelisted.
-# NOTE: This will only work if $wgGroupPermissions['*']['read']
-# is false -- see below. Otherwise, ALL pages are accessible,
-# regardless of this setting.
-# Also note that this will only protect _pages in the wiki_.
-# Uploaded files will remain readable. Make your upload
-# directory name unguessable, or use .htaccess to protect it.
+$wgBlockDisablesLogin = false;
+
+/**
+ * Pages anonymous user may see as an array, e.g.
+ *
+ * <code>
+ * $wgWhitelistRead = array ( "Main Page", "Wikipedia:Help");
+ * </code>
+ *
+ * Special:Userlogin and Special:Resetpass are always whitelisted.
+ *
+ * NOTE: This will only work if $wgGroupPermissions['*']['read'] is false --
+ * see below. Otherwise, ALL pages are accessible, regardless of this setting.
+ *
+ * Also note that this will only protect _pages in the wiki_. Uploaded files
+ * will remain readable. You can use img_auth.php to protect uploaded files,
+ * see http://www.mediawiki.org/wiki/Manual:Image_Authorization
+ */
$wgWhitelistRead = false;
/**
* Should editors be required to have a validated e-mail
* address before being allowed to edit?
*/
-$wgEmailConfirmToEdit=false;
+$wgEmailConfirmToEdit = false;
/**
* Permission keys given to users in each group.
@@ -1389,6 +3221,7 @@ $wgEmailConfirmToEdit=false;
*/
$wgGroupPermissions = array();
+/** @cond file_level_code */
// Implicit group for all visitors
$wgGroupPermissions['*']['createaccount'] = true;
$wgGroupPermissions['*']['read'] = true;
@@ -1463,8 +3296,9 @@ $wgGroupPermissions['sysop']['markbotedits'] = true;
$wgGroupPermissions['sysop']['apihighlimits'] = true;
$wgGroupPermissions['sysop']['browsearchive'] = true;
$wgGroupPermissions['sysop']['noratelimit'] = true;
-$wgGroupPermissions['sysop']['versiondetail'] = true;
$wgGroupPermissions['sysop']['movefile'] = true;
+$wgGroupPermissions['sysop']['unblockself'] = true;
+$wgGroupPermissions['sysop']['suppressredirect'] = true;
#$wgGroupPermissions['sysop']['mergehistory'] = true;
// Permission to change users' group assignments
@@ -1491,6 +3325,8 @@ $wgGroupPermissions['bureaucrat']['noratelimit'] = true;
*/
# $wgGroupPermissions['developer']['siteadmin'] = true;
+/** @endcond */
+
/**
* Permission keys revoked from users in each group.
* This acts the same way as wgGroupPermissions above, except that
@@ -1525,14 +3361,18 @@ $wgImplicitGroups = array( '*', 'user', 'autoconfirmed' );
*
*/
$wgGroupsAddToSelf = array();
+
+/** @see $wgGroupsAddToSelf */
$wgGroupsRemoveFromSelf = array();
/**
* Set of available actions that can be restricted via action=protect
* You probably shouldn't change this.
* Translated through restriction-* messages.
+ * Title::getRestrictionTypes() will remove restrictions that are not
+ * applicable to a specific title (create and upload)
*/
-$wgRestrictionTypes = array( 'edit', 'move' );
+$wgRestrictionTypes = array( 'create', 'edit', 'move', 'upload' );
/**
* Rights which can be required for each protection level (via action=protect)
@@ -1541,8 +3381,8 @@ $wgRestrictionTypes = array( 'edit', 'move' );
* permission by manipulating this array. The ordering of elements
* dictates the order on the protection form's lists.
*
- * '' will be ignored (i.e. unprotected)
- * 'sysop' is quietly rewritten to 'protect' for backwards compatibility
+ * - '' will be ignored (i.e. unprotected)
+ * - 'sysop' is quietly rewritten to 'protect' for backwards compatibility
*/
$wgRestrictionLevels = array( '', 'autoconfirmed', 'sysop' );
@@ -1564,24 +3404,32 @@ $wgNamespaceProtection = array();
$wgNonincludableNamespaces = array();
/**
- * Number of seconds an account is required to age before
- * it's given the implicit 'autoconfirm' group membership.
- * This can be used to limit privileges of new accounts.
+ * Number of seconds an account is required to age before it's given the
+ * implicit 'autoconfirm' group membership. This can be used to limit
+ * privileges of new accounts.
*
- * Accounts created by earlier versions of the software
- * may not have a recorded creation date, and will always
- * be considered to pass the age test.
+ * Accounts created by earlier versions of the software may not have a
+ * recorded creation date, and will always be considered to pass the age test.
*
* When left at 0, all registered accounts will pass.
+ *
+ * Example:
+ * <code>
+ * $wgAutoConfirmAge = 600; // ten minutes
+ * $wgAutoConfirmAge = 3600*24; // one day
+ * </code>
*/
$wgAutoConfirmAge = 0;
-//$wgAutoConfirmAge = 600; // ten minutes
-//$wgAutoConfirmAge = 3600*24; // one day
-# Number of edits an account requires before it is autoconfirmed
-# Passing both this AND the time requirement is needed
+/**
+ * Number of edits an account requires before it is autoconfirmed.
+ * Passing both this AND the time requirement is needed. Example:
+ *
+ * <code>
+ * $wgAutoConfirmCount = 50;
+ * </code>
+ */
$wgAutoConfirmCount = 0;
-//$wgAutoConfirmCount = 50;
/**
* Automatically add a usergroup to any user who matches certain conditions.
@@ -1610,9 +3458,10 @@ $wgAutopromote = array(
);
/**
- * These settings can be used to give finer control over who can assign which
- * groups at Special:Userrights. Example configuration:
+ * $wgAddGroups and $wgRemoveGroups can be used to give finer control over who
+ * can assign which groups at Special:Userrights. Example configuration:
*
+ * @code
* // Bureaucrat can add any group
* $wgAddGroups['bureaucrat'] = true;
* // Bureaucrats can only remove bots and sysops
@@ -1621,8 +3470,10 @@ $wgAutopromote = array(
* $wgAddGroups['sysop'] = array( 'bot' );
* // Sysops can disable other sysops in an emergency, and disable bots
* $wgRemoveGroups['sysop'] = array( 'sysop', 'bot' );
+ * @endcode
*/
$wgAddGroups = array();
+/** @see $wgAddGroups */
$wgRemoveGroups = array();
/**
@@ -1637,219 +3488,178 @@ $wgAvailableRights = array();
*/
$wgDeleteRevisionsLimit = 0;
-# Proxy scanner settings
-#
+/** Number of accounts each IP address may create, 0 to disable.
+ * Requires memcached */
+$wgAccountCreationThrottle = 0;
/**
- * If you enable this, every editor's IP address will be scanned for open HTTP
- * proxies.
+ * Edits matching these regular expressions in body text
+ * will be recognised as spam and rejected automatically.
*
- * Don't enable this. Many sysops will report "hostile TCP port scans" to your
- * ISP and ask for your server to be shut down.
+ * There's no administrator override on-wiki, so be careful what you set. :)
+ * May be an array of regexes or a single string for backwards compatibility.
*
- * You have been warned.
+ * See http://en.wikipedia.org/wiki/Regular_expression
+ * Note that each regex needs a beginning/end delimiter, eg: # or /
*/
-$wgBlockOpenProxies = false;
-/** Port we want to scan for a proxy */
-$wgProxyPorts = array( 80, 81, 1080, 3128, 6588, 8000, 8080, 8888, 65506 );
-/** Script used to scan */
-$wgProxyScriptPath = "$IP/includes/proxy_check.php";
-/** */
-$wgProxyMemcExpiry = 86400;
-/** This should always be customised in LocalSettings.php */
-$wgSecretKey = false;
-/** big list of banned IP addresses, in the keys not the values */
-$wgProxyList = array();
-/** deprecated */
-$wgProxyKey = false;
-
-/** Number of accounts each IP address may create, 0 to disable.
- * Requires memcached */
-$wgAccountCreationThrottle = 0;
-
-# Client-side caching:
+$wgSpamRegex = array();
-/** Allow client-side caching of pages */
-$wgCachePages = true;
+/** Same as the above except for edit summaries */
+$wgSummarySpamRegex = array();
/**
- * Set this to current time to invalidate all prior cached pages. Affects both
- * client- and server-side caching.
- * You can get the current date on your server by using the command:
- * date +%Y%m%d%H%M%S
+ * Similarly you can get a function to do the job. The function will be given
+ * the following args:
+ * - a Title object for the article the edit is made on
+ * - the text submitted in the textarea (wpTextbox1)
+ * - the section number.
+ * The return should be boolean indicating whether the edit matched some evilness:
+ * - true : block it
+ * - false : let it through
+ *
+ * @deprecated Use hooks. See SpamBlacklist extension.
*/
-$wgCacheEpoch = '20030516000000';
+$wgFilterCallback = false;
/**
- * Bump this number when changing the global style sheets and JavaScript.
- * It should be appended in the query string of static CSS and JS includes,
- * to ensure that client-side caches do not keep obsolete copies of global
- * styles.
+ * Whether to use DNS blacklists in $wgDnsBlacklistUrls to check for open proxies
+ * @since 1.16
*/
-$wgStyleVersion = '270';
-
-
-# Server-side caching:
+$wgEnableDnsBlacklist = false;
/**
- * This will cache static pages for non-logged-in users to reduce
- * database traffic on public sites.
- * Must set $wgShowIPinHeader = false
+ * @deprecated Use $wgEnableDnsBlacklist instead, only kept for backward
+ * compatibility
*/
-$wgUseFileCache = false;
-
-/** Directory where the cached page will be saved */
-$wgFileCacheDirectory = false; ///< defaults to "$wgCacheDirectory/html";
+$wgEnableSorbs = false;
/**
- * When using the file cache, we can store the cached HTML gzipped to save disk
- * space. Pages will then also be served compressed to clients that support it.
- * THIS IS NOT COMPATIBLE with ob_gzhandler which is now enabled if supported in
- * the default LocalSettings.php! If you enable this, remove that setting first.
- *
- * Requires zlib support enabled in PHP.
+ * List of DNS blacklists to use, if $wgEnableDnsBlacklist is true
+ * @since 1.16
*/
-$wgUseGzip = false;
-
-/** Whether MediaWiki should send an ETag header */
-$wgUseETag = false;
-
-# Email notification settings
-#
-
-/** For email notification on page changes */
-$wgPasswordSender = $wgEmergencyContact;
-
-# true: from page editor if s/he opted-in
-# false: Enotif mails appear to come from $wgEmergencyContact
-$wgEnotifFromEditor = false;
-
-// TODO move UPO to preferences probably ?
-# If set to true, users get a corresponding option in their preferences and can choose to enable or disable at their discretion
-# If set to false, the corresponding input form on the user preference page is suppressed
-# It call this to be a "user-preferences-option (UPO)"
-$wgEmailAuthentication = true; # UPO (if this is set to false, texts referring to authentication are suppressed)
-$wgEnotifWatchlist = false; # UPO
-$wgEnotifUserTalk = false; # UPO
-$wgEnotifRevealEditorAddress = false; # UPO; reply-to address may be filled with page editor's address (if user allowed this in the preferences)
-$wgEnotifMinorEdits = true; # UPO; false: "minor edits" on pages do not trigger notification mails.
-# # Attention: _every_ change on a user_talk page trigger a notification mail (if the user is not yet notified)
-
-# Send a generic mail instead of a personalised mail for each user. This
-# always uses UTC as the time zone, and doesn't include the username.
-#
-# For pages with many users watching, this can significantly reduce mail load.
-# Has no effect when using sendmail rather than SMTP;
-
-$wgEnotifImpersonal = false;
-
-# Maximum number of users to mail at once when using impersonal mail. Should
-# match the limit on your mail server.
-$wgEnotifMaxRecips = 500;
-
-# Send mails via the job queue.
-$wgEnotifUseJobQ = false;
-
-# Use real name instead of username in e-mail "from" field
-$wgEnotifUseRealName = false;
+$wgDnsBlacklistUrls = array( 'http.dnsbl.sorbs.net.' );
/**
- * Array of usernames who will be sent a notification email for every change which occurs on a wiki
+ * @deprecated Use $wgDnsBlacklistUrls instead, only kept for backward
+ * compatibility
*/
-$wgUsersNotifiedOnAllChanges = array();
-
-/** Show watching users in recent changes, watchlist and page history views */
-$wgRCShowWatchingUsers = false; # UPO
-/** Show watching users in Page views */
-$wgPageShowWatchingUsers = false;
-/** Show the amount of changed characters in recent changes */
-$wgRCShowChangedSize = true;
+$wgSorbsUrl = array();
/**
- * If the difference between the character counts of the text
- * before and after the edit is below that value, the value will be
- * highlighted on the RC page.
+ * Proxy whitelist, list of addresses that are assumed to be non-proxy despite
+ * what the other methods might say.
*/
-$wgRCChangedSizeThreshold = 500;
+$wgProxyWhitelist = array();
/**
- * Show "Updated (since my last visit)" marker in RC view, watchlist and history
- * view for watched pages with new changes */
-$wgShowUpdatedMarker = true;
+ * Simple rate limiter options to brake edit floods. Maximum number actions
+ * allowed in the given number of seconds; after that the violating client re-
+ * ceives HTTP 500 error pages until the period elapses.
+ *
+ * array( 4, 60 ) for a maximum of 4 hits in 60 seconds.
+ *
+ * This option set is experimental and likely to change. Requires memcached.
+ */
+$wgRateLimits = array(
+ 'edit' => array(
+ 'anon' => null, // for any and all anonymous edits (aggregate)
+ 'user' => null, // for each logged-in user
+ 'newbie' => null, // for each recent (autoconfirmed) account; overrides 'user'
+ 'ip' => null, // for each anon and recent account
+ 'subnet' => null, // ... with final octet removed
+ ),
+ 'move' => array(
+ 'user' => null,
+ 'newbie' => null,
+ 'ip' => null,
+ 'subnet' => null,
+ ),
+ 'mailpassword' => array(
+ 'anon' => null,
+ ),
+ 'emailuser' => array(
+ 'user' => null,
+ ),
+ );
/**
- * Default cookie expiration time. Setting to 0 makes all cookies session-only.
+ * Set to a filename to log rate limiter hits.
*/
-$wgCookieExpiration = 30*86400;
+$wgRateLimitLog = null;
-/** Clock skew or the one-second resolution of time() can occasionally cause cache
- * problems when the user requests two pages within a short period of time. This
- * variable adds a given number of seconds to vulnerable timestamps, thereby giving
- * a grace period.
+/**
+ * Array of groups which should never trigger the rate limiter
+ *
+ * @deprecated as of 1.13.0, the preferred method is using
+ * $wgGroupPermissions[]['noratelimit']. However, this will still
+ * work if desired.
+ *
+ * $wgRateLimitsExcludedGroups = array( 'sysop', 'bureaucrat' );
*/
-$wgClockSkewFudge = 5;
-
-# Squid-related settings
-#
-
-/** Enable/disable Squid */
-$wgUseSquid = false;
-
-/** If you run Squid3 with ESI support, enable this (default:false): */
-$wgUseESI = false;
-
-/** Send X-Vary-Options header for better caching (requires patched Squid) */
-$wgUseXVO = false;
-
-/** Internal server name as known to Squid, if different */
-# $wgInternalServer = 'http://yourinternal.tld:8000';
-$wgInternalServer = $wgServer;
+$wgRateLimitsExcludedGroups = array();
/**
- * Cache timeout for the squid, will be sent as s-maxage (without ESI) or
- * Surrogate-Control (with ESI). Without ESI, you should strip out s-maxage in
- * the Squid config. 18000 seconds = 5 hours, more cache hits with 2678400 = 31
- * days
+ * Array of IPs which should be excluded from rate limits.
+ * This may be useful for whitelisting NAT gateways for conferences, etc.
*/
-$wgSquidMaxage = 18000;
+$wgRateLimitsExcludedIPs = array();
/**
- * Default maximum age for raw CSS/JS accesses
+ * Log IP addresses in the recentchanges table; can be accessed only by
+ * extensions (e.g. CheckUser) or a DB admin
*/
-$wgForcedRawSMaxage = 300;
+$wgPutIPinRC = true;
/**
- * List of proxy servers to purge on changes; default port is 80. Use IP addresses.
- *
- * When MediaWiki is running behind a proxy, it will trust X-Forwarded-For
- * headers sent/modified from these proxies when obtaining the remote IP address
- *
- * For a list of trusted servers which *aren't* purged, see $wgSquidServersNoPurge.
+ * Limit password attempts to X attempts per Y seconds per IP per account.
+ * Requires memcached.
+ */
+$wgPasswordAttemptThrottle = array( 'count' => 5, 'seconds' => 300 );
+
+/** @} */ # end of user rights settings
+
+/************************************************************************//**
+ * @name Proxy scanner settings
+ * @{
*/
-$wgSquidServers = array();
/**
- * As above, except these servers aren't purged on page changes; use to set a
- * list of trusted proxies, etc.
+ * If you enable this, every editor's IP address will be scanned for open HTTP
+ * proxies.
+ *
+ * Don't enable this. Many sysops will report "hostile TCP port scans" to your
+ * ISP and ask for your server to be shut down.
+ *
+ * You have been warned.
*/
-$wgSquidServersNoPurge = array();
+$wgBlockOpenProxies = false;
+/** Port we want to scan for a proxy */
+$wgProxyPorts = array( 80, 81, 1080, 3128, 6588, 8000, 8080, 8888, 65506 );
+/** Script used to scan */
+$wgProxyScriptPath = "$IP/includes/proxy_check.php";
+/** */
+$wgProxyMemcExpiry = 86400;
+/** This should always be customised in LocalSettings.php */
+$wgSecretKey = false;
+/** big list of banned IP addresses, in the keys not the values */
+$wgProxyList = array();
+/** deprecated */
+$wgProxyKey = false;
-/** Maximum number of titles to purge in any one client operation */
-$wgMaxSquidPurgeTitles = 400;
+/** @} */ # end of proxy scanner settings
-/** HTCP multicast purging */
-$wgHTCPPort = 4827;
-$wgHTCPMulticastTTL = 1;
-# $wgHTCPMulticastAddress = "224.0.0.85";
-$wgHTCPMulticastAddress = false;
+/************************************************************************//**
+ * @name Cookie settings
+ * @{
+ */
-/** Should forwarded Private IPs be accepted? */
-$wgUsePrivateIPs = false;
+/**
+ * Default cookie expiration time. Setting to 0 makes all cookies session-only.
+ */
+$wgCookieExpiration = 30*86400;
-# Cookie settings:
-#
/**
- * Set to set an explicit domain on the login cookies eg, "justthis.domain. org"
+ * Set to set an explicit domain on the login cookies eg, "justthis.domain.org"
* or ".any.subdomain.net"
*/
$wgCookieDomain = '';
@@ -1889,65 +3699,12 @@ $wgCacheVaryCookies = array();
/** Override to customise the session name */
$wgSessionName = false;
-/** Whether to allow inline image pointing to other websites */
-$wgAllowExternalImages = false;
-
-/** If the above is false, you can specify an exception here. Image URLs
- * that start with this string are then rendered, while all others are not.
- * You can use this to set up a trusted, simple repository of images.
- * You may also specify an array of strings to allow multiple sites
- *
- * Examples:
- * $wgAllowExternalImagesFrom = 'http://127.0.0.1/';
- * $wgAllowExternalImagesFrom = array( 'http://127.0.0.1/', 'http://example.com' );
- */
-$wgAllowExternalImagesFrom = '';
+/** @} */ # end of cookie settings }
-/** If $wgAllowExternalImages is false, you can allow an on-wiki
- * whitelist of regular expression fragments to match the image URL
- * against. If the image matches one of the regular expression fragments,
- * The image will be displayed.
- *
- * Set this to true to enable the on-wiki whitelist (MediaWiki:External image whitelist)
- * Or false to disable it
+/************************************************************************//**
+ * @name LaTeX (mathematical formulas)
+ * @{
*/
-$wgEnableImageWhitelist = true;
-
-/** Allows to move images and other media files */
-$wgAllowImageMoving = true;
-
-/** Disable database-intensive features */
-$wgMiserMode = false;
-/** Disable all query pages if miser mode is on, not just some */
-$wgDisableQueryPages = false;
-/** Number of rows to cache in 'querycache' table when miser mode is on */
-$wgQueryCacheLimit = 1000;
-/** Number of links to a page required before it is deemed "wanted" */
-$wgWantedPagesThreshold = 1;
-/** Enable slow parser functions */
-$wgAllowSlowParserFunctions = false;
-
-/**
- * Maps jobs to their handling classes; extensions
- * can add to this to provide custom jobs
- */
-$wgJobClasses = array(
- 'refreshLinks' => 'RefreshLinksJob',
- 'refreshLinks2' => 'RefreshLinksJob2',
- 'htmlCacheUpdate' => 'HTMLCacheUpdateJob',
- 'html_cache_update' => 'HTMLCacheUpdateJob', // backwards-compatible
- 'sendMail' => 'EmaillingJob',
- 'enotifNotify' => 'EnotifNotifyJob',
- 'fixDoubleRedirect' => 'DoubleRedirectJob',
-);
-
-/**
- * Additional functions to be performed with updateSpecialPages.
- * Expensive Querypages are already updated.
- */
-$wgSpecialPageCacheUpdates = array(
- 'Statistics' => array('SiteStatsUpdate','cacheUpdate')
-);
/**
* To use inline TeX, you need to compile 'texvc' (in the 'math' subdirectory of
@@ -1957,7 +3714,7 @@ $wgSpecialPageCacheUpdates = array(
*/
$wgUseTeX = false;
/** Location of the texvc binary */
-$wgTexvc = './math/texvc';
+$wgTexvc = $IP . '/math/texvc';
/**
* Texvc background color
* use LaTeX color format as used in \special function
@@ -1979,31 +3736,157 @@ $wgTexvcBackgroundColor = 'transparent';
*/
$wgMathCheckFiles = true;
-#
-# Profiling / debugging
-#
-# You have to create a 'profiling' table in your database before using
-# profiling see maintenance/archives/patch-profiling.sql .
-#
-# To enable profiling, edit StartProfiler.php
+/* @} */ # end LaTeX }
+
+/************************************************************************//**
+ * @name Profiling, testing and debugging
+ *
+ * To enable profiling, edit StartProfiler.php
+ *
+ * @{
+ */
+
+/**
+ * Filename for debug logging. See http://www.mediawiki.org/wiki/How_to_debug
+ * The debug log file should be not be publicly accessible if it is used, as it
+ * may contain private data.
+ */
+$wgDebugLogFile = '';
+
+/**
+ * Prefix for debug log lines
+ */
+$wgDebugLogPrefix = '';
+
+/**
+ * If true, instead of redirecting, show a page with a link to the redirect
+ * destination. This allows for the inspection of PHP error messages, and easy
+ * resubmission of form data. For developer use only.
+ */
+$wgDebugRedirects = false;
+
+/**
+ * If true, log debugging data from action=raw.
+ * This is normally false to avoid overlapping debug entries due to gen=css and
+ * gen=js requests.
+ */
+$wgDebugRawPage = false;
+
+/**
+ * Send debug data to an HTML comment in the output.
+ *
+ * This may occasionally be useful when supporting a non-technical end-user. It's
+ * more secure than exposing the debug log file to the web, since the output only
+ * contains private data for the current user. But it's not ideal for development
+ * use since data is lost on fatal errors and redirects.
+ */
+$wgDebugComments = false;
+
+/**
+ * Write SQL queries to the debug log
+ */
+$wgDebugDumpSql = false;
+
+/**
+ * Set to an array of log group keys to filenames.
+ * If set, wfDebugLog() output for that group will go to that file instead
+ * of the regular $wgDebugLogFile. Useful for enabling selective logging
+ * in production.
+ */
+$wgDebugLogGroups = array();
+
+/**
+ * Display debug data at the bottom of the main content area.
+ *
+ * Useful for developers and technical users trying to working on a closed wiki.
+ */
+$wgShowDebug = false;
+
+/**
+ * Prefix debug messages with relative timestamp. Very-poor man's profiler.
+ */
+$wgDebugTimestamps = false;
+
+/**
+ * Print HTTP headers for every request in the debug information.
+ */
+$wgDebugPrintHttpHeaders = true;
+
+/**
+ * Show the contents of $wgHooks in Special:Version
+ */
+$wgSpecialVersionShowHooks = false;
+
+/**
+ * Whether to show "we're sorry, but there has been a database error" pages.
+ * Displaying errors aids in debugging, but may display information useful
+ * to an attacker.
+ */
+$wgShowSQLErrors = false;
+
+/**
+ * If set to true, uncaught exceptions will print a complete stack trace
+ * to output. This should only be used for debugging, as it may reveal
+ * private information in function parameters due to PHP's backtrace
+ * formatting.
+ */
+$wgShowExceptionDetails = false;
+
+/**
+ * If true, show a backtrace for database errors
+ */
+$wgShowDBErrorBacktrace = false;
+
+/**
+ * Expose backend server host names through the API and various HTML comments
+ */
+$wgShowHostnames = false;
+
+/**
+ * If set to true MediaWiki will throw notices for some possible error
+ * conditions and for deprecated functions.
+ */
+$wgDevelopmentWarnings = false;
/** Only record profiling info for pages that took longer than this */
$wgProfileLimit = 0.0;
+
/** Don't put non-profiling info into log file */
$wgProfileOnly = false;
-/** Log sums from profiling into "profiling" table in db. */
+
+/**
+ * Log sums from profiling into "profiling" table in db.
+ *
+ * You have to create a 'profiling' table in your database before using
+ * this feature, see maintenance/archives/patch-profiling.sql
+ *
+ * To enable profiling, edit StartProfiler.php
+ */
$wgProfileToDatabase = false;
+
/** If true, print a raw call tree instead of per-function report */
$wgProfileCallTree = false;
+
/** Should application server host be put into profiling table */
$wgProfilePerHost = false;
-/** Settings for UDP profiler */
+/**
+ * Host for UDP profiler.
+ *
+ * The host should be running a daemon which can be obtained from MediaWiki
+ * Subversion at: http://svn.wikimedia.org/svnroot/mediawiki/trunk/udpprofile
+ */
$wgUDPProfilerHost = '127.0.0.1';
+
+/**
+ * Port for UDP profiler.
+ * @see $wgUDPProfilerHost
+ */
$wgUDPProfilerPort = '3811';
/** Detects non-matching wfProfileIn/wfProfileOut calls */
$wgDebugProfiling = false;
+
/** Output debug message on every wfProfileIn/wfProfileOut */
$wgDebugFunctionEntry = 0;
@@ -2020,9 +3903,52 @@ $wgStatsMethod = 'cache';
*/
$wgDisableCounters = false;
-$wgDisableTextSearch = false;
-$wgDisableSearchContext = false;
+/**
+ * Support blog-style "trackbacks" for articles. See
+ * http://www.sixapart.com/pronet/docs/trackback_spec for details.
+ */
+$wgUseTrackbacks = false;
+
+/**
+ * Parser test suite files to be run by parserTests.php when no specific
+ * filename is passed to it.
+ *
+ * Extensions may add their own tests to this array, or site-local tests
+ * may be added via LocalSettings.php
+ *
+ * Use full paths.
+ */
+$wgParserTestFiles = array(
+ "$IP/maintenance/tests/parser/parserTests.txt",
+ "$IP/maintenance/tests/parser/ExtraParserTests.txt"
+);
+
+/**
+ * If configured, specifies target CodeReview installation to send test
+ * result data from 'parserTests.php --upload'
+ *
+ * Something like this:
+ * $wgParserTestRemote = array(
+ * 'api-url' => 'http://www.mediawiki.org/w/api.php',
+ * 'repo' => 'MediaWiki',
+ * 'suite' => 'ParserTests',
+ * 'path' => '/trunk/phase3', // not used client-side; for reference
+ * 'secret' => 'qmoicj3mc4mcklmqw', // Shared secret used in HMAC validation
+ * );
+ */
+$wgParserTestRemote = false;
+
+/** @} */ # end of profiling, testing and debugging }
+/************************************************************************//**
+ * @name Search
+ * @{
+ */
+
+/**
+ * Set this to true to disable the full text search feature.
+ */
+$wgDisableTextSearch = false;
/**
* Set to true to have nicer highligted text in search results,
@@ -2033,6 +3959,8 @@ $wgAdvancedSearchHighlighting = false;
/**
* Regexp to match word boundaries, defaults for non-CJK languages
* should be empty for CJK since the words are not separate
+ *
+ * @todo FIXME: checks for lower than required PHP version (5.1.x).
*/
$wgSearchHighlightBoundaries = version_compare("5.1", PHP_VERSION, "<")? '[\p{Z}\p{P}\p{C}]'
: '[ ,.;:!?~!@#$%\^&*\(\)+=\-\\|\[\]"\'<>\n\r\/{}]'; // PHP 5.0 workaround
@@ -2092,149 +4020,15 @@ $wgMWSuggestTemplate = false;
* table. If you ever re-enable, be sure to rebuild the search table.
*/
$wgDisableSearchUpdate = false;
-/** Uploads have to be specially set up to be secure */
-$wgEnableUploads = false;
-/**
- * Show EXIF data, on by default if available.
- * Requires PHP's EXIF extension: http://www.php.net/manual/en/ref.exif.php
- *
- * NOTE FOR WINDOWS USERS:
- * To enable EXIF functions, add the folloing lines to the
- * "Windows extensions" section of php.ini:
- *
- * extension=extensions/php_mbstring.dll
- * extension=extensions/php_exif.dll
- */
-$wgShowEXIF = function_exists( 'exif_read_data' );
-
-/**
- * Set to true to enable the upload _link_ while local uploads are disabled.
- * Assumes that the special page link will be bounced to another server where
- * uploads do work.
- */
-$wgRemoteUploads = false;
-
-/**
- * Disable links to talk pages of anonymous users (IPs) in listings on special
- * pages like page history, Special:Recentchanges, etc.
- */
-$wgDisableAnonTalk = false;
-/**
- * Do DELETE/INSERT for link updates instead of incremental
- */
-$wgUseDumbLinkUpdate = false;
-
-/**
- * Anti-lock flags - bitfield
- * ALF_PRELOAD_LINKS
- * Preload links during link update for save
- * ALF_PRELOAD_EXISTENCE
- * Preload cur_id during replaceLinkHolders
- * ALF_NO_LINK_LOCK
- * Don't use locking reads when updating the link table. This is
- * necessary for wikis with a high edit rate for performance
- * reasons, but may cause link table inconsistency
- * ALF_NO_BLOCK_LOCK
- * As for ALF_LINK_LOCK, this flag is a necessity for high-traffic
- * wikis.
- */
-$wgAntiLockFlags = 0;
-
-/**
- * Path to the GNU diff3 utility. If the file doesn't exist, edit conflicts will
- * fall back to the old behaviour (no merging).
- */
-$wgDiff3 = '/usr/bin/diff3';
/**
- * Path to the GNU diff utility.
- */
-$wgDiff = '/usr/bin/diff';
-
-/**
- * We can also compress text stored in the 'text' table. If this is set on, new
- * revisions will be compressed on page save if zlib support is available. Any
- * compressed revisions will be decompressed on load regardless of this setting
- * *but will not be readable at all* if zlib support is not available.
- */
-$wgCompressRevisions = false;
-
-/**
- * This is the list of preferred extensions for uploading files. Uploading files
- * with extensions not in this list will trigger a warning.
- */
-$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg' );
-
-/** Files with these extensions will never be allowed as uploads. */
-$wgFileBlacklist = array(
- # HTML may contain cookie-stealing JavaScript and web bugs
- 'html', 'htm', 'js', 'jsb', 'mhtml', 'mht', 'xhtml', 'xht',
- # PHP scripts may execute arbitrary code on the server
- 'php', 'phtml', 'php3', 'php4', 'php5', 'phps',
- # Other types that may be interpreted by some servers
- 'shtml', 'jhtml', 'pl', 'py', 'cgi',
- # May contain harmful executables for Windows victims
- 'exe', 'scr', 'dll', 'msi', 'vbs', 'bat', 'com', 'pif', 'cmd', 'vxd', 'cpl' );
-
-/** Files with these mime types will never be allowed as uploads
- * if $wgVerifyMimeType is enabled.
- */
-$wgMimeTypeBlacklist= array(
- # HTML may contain cookie-stealing JavaScript and web bugs
- 'text/html', 'text/javascript', 'text/x-javascript', 'application/x-shellscript',
- # PHP scripts may execute arbitrary code on the server
- 'application/x-php', 'text/x-php',
- # Other types that may be interpreted by some servers
- 'text/x-python', 'text/x-perl', 'text/x-bash', 'text/x-sh', 'text/x-csh',
- # Client-side hazards on Internet Explorer
- 'text/scriptlet', 'application/x-msdownload',
- # Windows metafile, client-side vulnerability on some systems
- 'application/x-msmetafile',
- # A ZIP file may be a valid Java archive containing an applet which exploits the
- # same-origin policy to steal cookies
- 'application/zip',
-);
-
-/** This is a flag to determine whether or not to check file extensions on upload. */
-$wgCheckFileExtensions = true;
-
-/**
- * If this is turned off, users may override the warning for files not covered
- * by $wgFileExtensions.
- */
-$wgStrictFileExtensions = true;
-
-/** Warn if uploaded files are larger than this (in bytes), or false to disable*/
-$wgUploadSizeWarning = false;
-
-/** For compatibility with old installations set to false */
-$wgPasswordSalt = true;
-
-/** Which namespaces should support subpages?
- * See Language.php for a list of namespaces.
- */
-$wgNamespacesWithSubpages = array(
- NS_TALK => true,
- NS_USER => true,
- NS_USER_TALK => true,
- NS_PROJECT_TALK => true,
- NS_FILE_TALK => true,
- NS_MEDIAWIKI => true,
- NS_MEDIAWIKI_TALK => true,
- NS_TEMPLATE_TALK => true,
- NS_HELP_TALK => true,
- NS_CATEGORY_TALK => true
-);
-
-/**
- * Which namespaces have special treatment where they should be preview-on-open
- * Internaly only Category: pages apply, but using this extensions (e.g. Semantic MediaWiki)
- * can specify namespaces of pages they have special treatment for
+ * List of namespaces which are searched by default. Example:
+ *
+ * <code>
+ * $wgNamespacesToBeSearchedDefault[NS_MAIN] = true;
+ * $wgNamespacesToBeSearchedDefault[NS_PROJECT] = true;
+ * </code>
*/
-$wgPreviewOnOpenNamespaces = array(
- NS_CATEGORY => true
-);
-
$wgNamespacesToBeSearchedDefault = array(
NS_MAIN => true,
);
@@ -2258,158 +4052,104 @@ $wgNamespacesToBeSearchedHelp = array(
$wgSearchEverythingOnlyLoggedIn = false;
/**
- * Site notice shown at the top of each page
- *
- * MediaWiki:Sitenotice page, which will override this. You can also
- * provide a separate message for logged-out users using the
- * MediaWiki:Anonnotice page.
- */
-$wgSiteNotice = '';
-
-#
-# Images settings
-#
-
-/**
- * Plugins for media file type handling.
- * Each entry in the array maps a MIME type to a class name
+ * Disable the internal MySQL-based search, to allow it to be
+ * implemented by an extension instead.
*/
-$wgMediaHandlers = array(
- 'image/jpeg' => 'BitmapHandler',
- 'image/png' => 'BitmapHandler',
- 'image/gif' => 'GIFHandler',
- 'image/tiff' => 'TiffHandler',
- 'image/x-ms-bmp' => 'BmpHandler',
- 'image/x-bmp' => 'BmpHandler',
- 'image/svg+xml' => 'SvgHandler', // official
- 'image/svg' => 'SvgHandler', // compat
- 'image/vnd.djvu' => 'DjVuHandler', // official
- 'image/x.djvu' => 'DjVuHandler', // compat
- 'image/x-djvu' => 'DjVuHandler', // compat
-);
-
+$wgDisableInternalSearch = false;
/**
- * Resizing can be done using PHP's internal image libraries or using
- * ImageMagick or another third-party converter, e.g. GraphicMagick.
- * These support more file formats than PHP, which only supports PNG,
- * GIF, JPG, XBM and WBMP.
+ * Set this to a URL to forward search requests to some external location.
+ * If the URL includes '$1', this will be replaced with the URL-encoded
+ * search term.
*
- * Use Image Magick instead of PHP builtin functions.
+ * For example, to forward to Google you'd have something like:
+ * $wgSearchForwardUrl = 'http://www.google.com/search?q=$1' .
+ * '&domains=http://example.com' .
+ * '&sitesearch=http://example.com' .
+ * '&ie=utf-8&oe=utf-8';
*/
-$wgUseImageMagick = false;
-/** The convert command shipped with ImageMagick */
-$wgImageMagickConvertCommand = '/usr/bin/convert';
-
-/** Sharpening parameter to ImageMagick */
-$wgSharpenParameter = '0x0.4';
-
-/** Reduction in linear dimensions below which sharpening will be enabled */
-$wgSharpenReductionThreshold = 0.85;
+$wgSearchForwardUrl = null;
/**
- * Temporary directory used for ImageMagick. The directory must exist. Leave
- * this set to false to let ImageMagick decide for itself.
+ * Search form behavior
+ * true = use Go & Search buttons
+ * false = use Go button & Advanced search link
*/
-$wgImageMagickTempDir = false;
+$wgUseTwoButtonsSearchForm = true;
/**
- * Use another resizing converter, e.g. GraphicMagick
- * %s will be replaced with the source path, %d with the destination
- * %w and %h will be replaced with the width and height
- *
- * An example is provided for GraphicMagick
- * Leave as false to skip this
+ * Array of namespaces to generate a Google sitemap for when the
+ * maintenance/generateSitemap.php script is run, or false if one is to be ge-
+ * nerated for all namespaces.
*/
-#$wgCustomConvertCommand = "gm convert %s -resize %wx%h %d"
-$wgCustomConvertCommand = false;
+$wgSitemapNamespaces = false;
-# Scalable Vector Graphics (SVG) may be uploaded as images.
-# Since SVG support is not yet standard in browsers, it is
-# necessary to rasterize SVGs to PNG as a fallback format.
-#
-# An external program is required to perform this conversion:
-$wgSVGConverters = array(
- 'ImageMagick' => '$path/convert -background white -thumbnail $widthx$height\! $input PNG:$output',
- 'sodipodi' => '$path/sodipodi -z -w $width -f $input -e $output',
- 'inkscape' => '$path/inkscape -z -w $width -f $input -e $output',
- 'batik' => 'java -Djava.awt.headless=true -jar $path/batik-rasterizer.jar -w $width -d $output $input',
- 'rsvg' => '$path/rsvg -w$width -h$height $input $output',
- 'imgserv' => '$path/imgserv-wrapper -i svg -o png -w$width $input $output',
- );
-/** Pick one of the above */
-$wgSVGConverter = 'ImageMagick';
-/** If not in the executable PATH, specify */
-$wgSVGConverterPath = '';
-/** Don't scale a SVG larger than this */
-$wgSVGMaxSize = 2048;
-/**
- * Don't thumbnail an image if it will use too much working memory
- * Default is 50 MB if decompressed to RGBA form, which corresponds to
- * 12.5 million pixels or 3500x3500
+/** @} */ # end of search settings
+
+/************************************************************************//**
+ * @name Edit user interface
+ * @{
*/
-$wgMaxImageArea = 1.25e7;
+
/**
- * Force thumbnailing of animated GIFs above this size to a single
- * frame instead of an animated thumbnail. ImageMagick seems to
- * get real unhappy and doesn't play well with resource limits. :P
- * Defaulting to 1 megapixel (1000x1000)
+ * Path to the GNU diff3 utility. If the file doesn't exist, edit conflicts will
+ * fall back to the old behaviour (no merging).
*/
-$wgMaxAnimatedGifArea = 1.0e6;
+$wgDiff3 = '/usr/bin/diff3';
+
/**
- * Browsers don't support TIFF inline generally...
- * For inline display, we need to convert to PNG or JPEG.
- * Note scaling should work with ImageMagick, but may not with GD scaling.
- * // PNG is lossless, but inefficient for photos
- * $wgTiffThumbnailType = array( 'png', 'image/png' );
- * // JPEG is good for photos, but has no transparency support. Bad for diagrams.
- * $wgTiffThumbnailType = array( 'jpg', 'image/jpeg' );
+ * Path to the GNU diff utility.
*/
- $wgTiffThumbnailType = false;
+$wgDiff = '/usr/bin/diff';
/**
- * If rendered thumbnail files are older than this timestamp, they
- * will be rerendered on demand as if the file didn't already exist.
- * Update if there is some need to force thumbs and SVG rasterizations
- * to rerender, such as fixes to rendering bugs.
+ * Which namespaces have special treatment where they should be preview-on-open
+ * Internaly only Category: pages apply, but using this extensions (e.g. Semantic MediaWiki)
+ * can specify namespaces of pages they have special treatment for
*/
-$wgThumbnailEpoch = '20030516000000';
+$wgPreviewOnOpenNamespaces = array(
+ NS_CATEGORY => true
+);
/**
- * If set, inline scaled images will still produce <img> tags ready for
- * output instead of showing an error message.
- *
- * This may be useful if errors are transitory, especially if the site
- * is configured to automatically render thumbnails on request.
- *
- * On the other hand, it may obscure error conditions from debugging.
- * Enable the debug log or the 'thumbnail' log group to make sure errors
- * are logged to a file for review.
+ * Activate external editor interface for files and pages
+ * See http://www.mediawiki.org/wiki/Manual:External_editors
*/
-$wgIgnoreImageErrors = false;
+$wgUseExternalEditor = true;
+
+/** Go button goes straight to the edit screen if the article doesn't exist. */
+$wgGoToEdit = false;
/**
- * Allow thumbnail rendering on page view. If this is false, a valid
- * thumbnail URL is still output, but no file will be created at
- * the target location. This may save some time if you have a
- * thumb.php or 404 handler set up which is faster than the regular
- * webserver(s).
+ * Enable the UniversalEditButton for browsers that support it
+ * (currently only Firefox with an extension)
+ * See http://universaleditbutton.org for more background information
*/
-$wgGenerateThumbnailOnParse = true;
+$wgUniversalEditButton = true;
/**
-* Show thumbnails for old images on the image description page
-*/
-$wgShowArchiveThumbnails = true;
+ * If user doesn't specify any edit summary when making a an edit, MediaWiki
+ * will try to automatically create one. This feature can be disabled by set-
+ * ting this variable false.
+ */
+$wgUseAutomaticEditSummaries = true;
-/** Obsolete, always true, kept for compatibility with extensions */
-$wgUseImageResize = true;
+/** @} */ # end edit UI }
+/************************************************************************//**
+ * @name Maintenance
+ * See also $wgSiteNotice
+ * @{
+ */
-/** Set $wgCommandLineMode if it's not set already, to avoid notices */
+/**
+ * @cond file_level_code
+ * Set $wgCommandLineMode if it's not set already, to avoid notices
+ */
if( !isset( $wgCommandLineMode ) ) {
$wgCommandLineMode = false;
}
+/** @endcond */
/** For colorized maintenance script output, is your terminal background dark ? */
$wgCommandLineDarkBg = false;
@@ -2421,12 +4161,42 @@ $wgCommandLineDarkBg = false;
*/
$wgMaintenanceScripts = array();
-#
-# Recent changes settings
-#
+/**
+ * Set this to a string to put the wiki into read-only mode. The text will be
+ * used as an explanation to users.
+ *
+ * This prevents most write operations via the web interface. Cache updates may
+ * still be possible. To prevent database writes completely, use the read_only
+ * option in MySQL.
+ */
+$wgReadOnly = null;
-/** Log IP addresses in the recentchanges table; can be accessed only by extensions (e.g. CheckUser) or a DB admin */
-$wgPutIPinRC = true;
+/**
+ * If this lock file exists (size > 0), the wiki will be forced into read-only mode.
+ * Its contents will be shown to users as part of the read-only warning
+ * message.
+ *
+ * Defaults to "{$wgUploadDirectory}/lock_yBgMBwiR".
+ */
+$wgReadOnlyFile = false;
+
+/**
+ * When you run the web-based upgrade utility, it will tell you what to set
+ * this to in order to authorize the upgrade process. It will subsequently be
+ * used as a password, to authorize further upgrades.
+ *
+ * For security, do not set this to a guessable string. Use the value supplied
+ * by the install/upgrade process. To cause the upgrader to generate a new key,
+ * delete the old key from LocalSettings.php.
+ */
+$wgUpgradeKey = false;
+
+/** @} */ # End of maintenance }
+
+/************************************************************************//**
+ * @name Recent changes, new pages, watchlist and history
+ * @{
+ */
/**
* Recentchanges items are periodically purged; entries older than this many
@@ -2436,14 +4206,17 @@ $wgPutIPinRC = true;
$wgRCMaxAge = 13 * 7 * 24 * 3600;
/**
- * Filter $wgRCLinkDays by $wgRCMaxAge to avoid showing links for numbers higher than what will be stored.
- * Note that this is disabled by default because we sometimes do have RC data which is beyond the limit
- * for some reason, and some users may use the high numbers to display that data which is still there.
+ * Filter $wgRCLinkDays by $wgRCMaxAge to avoid showing links for numbers
+ * higher than what will be stored. Note that this is disabled by default
+ * because we sometimes do have RC data which is beyond the limit for some
+ * reason, and some users may use the high numbers to display that data which
+ * is still there.
*/
$wgRCFilterByAge = false;
/**
- * List of Days and Limits options to list in the Special:Recentchanges and Special:Recentchangeslinked pages.
+ * List of Days and Limits options to list in the Special:Recentchanges and
+ * Special:Recentchangeslinked pages.
*/
$wgRCLinkLimits = array( 50, 100, 250, 500 );
$wgRCLinkDays = array( 1, 3, 7, 14, 30 );
@@ -2486,9 +4259,88 @@ $wgRC2UDPOmitBots = false;
*/
$wgEnableNewpagesUserFilter = true;
-#
-# Copyright and credits settings
-#
+/** Use RC Patrolling to check for vandalism */
+$wgUseRCPatrol = true;
+
+/** Use new page patrolling to check new pages on Special:Newpages */
+$wgUseNPPatrol = true;
+
+/** Provide syndication feeds (RSS, Atom) for, e.g., Recentchanges, Newpages */
+$wgFeed = true;
+
+/** Set maximum number of results to return in syndication feeds (RSS, Atom) for
+ * eg Recentchanges, Newpages. */
+$wgFeedLimit = 50;
+
+/** _Minimum_ timeout for cached Recentchanges feed, in seconds.
+ * A cached version will continue to be served out even if changes
+ * are made, until this many seconds runs out since the last render.
+ *
+ * If set to 0, feed caching is disabled. Use this for debugging only;
+ * feed generation can be pretty slow with diffs.
+ */
+$wgFeedCacheTimeout = 60;
+
+/** When generating Recentchanges RSS/Atom feed, diffs will not be generated for
+ * pages larger than this size. */
+$wgFeedDiffCutoff = 32768;
+
+/** Override the site's default RSS/ATOM feed for recentchanges that appears on
+ * every page. Some sites might have a different feed they'd like to promote
+ * instead of the RC feed (maybe like a "Recent New Articles" or "Breaking news" one).
+ * Ex: $wgSiteFeed['format'] = "http://example.com/somefeed.xml"; Format can be one
+ * of either 'rss' or 'atom'.
+ */
+$wgOverrideSiteFeed = array();
+
+/**
+ * Which feed types should we provide by default? This can include 'rss',
+ * 'atom', neither, or both.
+ */
+$wgAdvertisedFeedTypes = array( 'atom' );
+
+/** Show watching users in recent changes, watchlist and page history views */
+$wgRCShowWatchingUsers = false; # UPO
+/** Show watching users in Page views */
+$wgPageShowWatchingUsers = false;
+/** Show the amount of changed characters in recent changes */
+$wgRCShowChangedSize = true;
+
+/**
+ * If the difference between the character counts of the text
+ * before and after the edit is below that value, the value will be
+ * highlighted on the RC page.
+ */
+$wgRCChangedSizeThreshold = 500;
+
+/**
+ * Show "Updated (since my last visit)" marker in RC view, watchlist and history
+ * view for watched pages with new changes */
+$wgShowUpdatedMarker = true;
+
+/**
+ * Disable links to talk pages of anonymous users (IPs) in listings on special
+ * pages like page history, Special:Recentchanges, etc.
+ */
+$wgDisableAnonTalk = false;
+
+/**
+ * Enable filtering of categories in Recentchanges
+ */
+$wgAllowCategorizedRecentChanges = false;
+
+/**
+ * Allow filtering by change tag in recentchanges, history, etc
+ * Has no effect if no tags are defined in valid_tag.
+ */
+$wgUseTagFilter = true;
+
+/** @} */ # end RC/watchlist }
+
+/************************************************************************//**
+ * @name Copyright and credits settings
+ * @{
+ */
/** RDF metadata toggles */
$wgEnableDublinCoreRdf = false;
@@ -2507,7 +4359,10 @@ $wgRightsIcon = null;
*/
$wgLicenseTerms = false;
-/** Set this to some HTML to override the rights icon with an arbitrary logo */
+/**
+ * Set this to some HTML to override the rights icon with an arbitrary logo
+ * @deprecated Use $wgFooterIcons['copyright']['copyright']
+ */
$wgCopyrightIcon = null;
/** Set this to true if you want detailed copyright information forms on Upload. */
@@ -2530,27 +4385,12 @@ $wgMaxCredits = 0;
* Otherwise, link to a separate credits page. */
$wgShowCreditsIfMax = true;
+/** @} */ # end of copyright and credits settings }
-
-/**
- * Set this to false to avoid forcing the first letter of links to capitals.
- * WARNING: may break links! This makes links COMPLETELY case-sensitive. Links
- * appearing with a capital at the beginning of a sentence will *not* go to the
- * same place as links in the middle of a sentence using a lowercase initial.
- */
-$wgCapitalLinks = true;
-
-/**
- * @since 1.16 - This can now be set per-namespace. Some special namespaces (such
- * as Special, see MWNamespace::$alwaysCapitalizedNamespaces for the full list) must be
- * true by default (and setting them has no effect), due to various things that
- * require them to be so. Also, since Talk namespaces need to directly mirror their
- * associated content namespaces, the values for those are ignored in favor of the
- * subject namespace's setting. Setting for NS_MEDIA is taken automatically from
- * NS_FILE.
- * EX: $wgCapitalLinkOverrides[ NS_FILE ] = false;
+/************************************************************************//**
+ * @name Import / Export
+ * @{
*/
-$wgCapitalLinkOverrides = array();
/**
* List of interwiki prefixes for wikis we'll accept as sources for
@@ -2608,199 +4448,11 @@ $wgExportMaxLinkDepth = 0;
*/
$wgExportFromNamespaces = false;
-/**
- * Edits matching these regular expressions in body text
- * will be recognised as spam and rejected automatically.
- *
- * There's no administrator override on-wiki, so be careful what you set. :)
- * May be an array of regexes or a single string for backwards compatibility.
- *
- * See http://en.wikipedia.org/wiki/Regular_expression
- * Note that each regex needs a beginning/end delimiter, eg: # or /
- */
-$wgSpamRegex = array();
-
-/** Same as the above except for edit summaries */
-$wgSummarySpamRegex = array();
-
-/** Similarly you can get a function to do the job. The function will be given
- * the following args:
- * - a Title object for the article the edit is made on
- * - the text submitted in the textarea (wpTextbox1)
- * - the section number.
- * The return should be boolean indicating whether the edit matched some evilness:
- * - true : block it
- * - false : let it through
- *
- * For a complete example, have a look at the SpamBlacklist extension.
- */
-$wgFilterCallback = false;
-
-/** Go button goes straight to the edit screen if the article doesn't exist. */
-$wgGoToEdit = false;
-
-/** Allow raw, unchecked HTML in <html>...</html> sections.
- * THIS IS VERY DANGEROUS on a publically editable site, so USE wgGroupPermissions
- * TO RESTRICT EDITING to only those that you trust
- */
-$wgRawHtml = false;
-
-/**
- * $wgUseTidy: use tidy to make sure HTML output is sane.
- * Tidy is a free tool that fixes broken HTML.
- * See http://www.w3.org/People/Raggett/tidy/
- * $wgTidyBin should be set to the path of the binary and
- * $wgTidyConf to the path of the configuration file.
- * $wgTidyOpts can include any number of parameters.
- *
- * $wgTidyInternal controls the use of the PECL extension to use an in-
- * process tidy library instead of spawning a separate program.
- * Normally you shouldn't need to override the setting except for
- * debugging. To install, use 'pear install tidy' and add a line
- * 'extension=tidy.so' to php.ini.
- */
-$wgUseTidy = false;
-$wgAlwaysUseTidy = false;
-$wgTidyBin = 'tidy';
-$wgTidyConf = $IP.'/includes/tidy.conf';
-$wgTidyOpts = '';
-$wgTidyInternal = extension_loaded( 'tidy' );
-
-/**
- * Put tidy warnings in HTML comments
- * Only works for internal tidy.
- */
-$wgDebugTidy = false;
-
-/**
- * Validate the overall output using tidy and refuse
- * to display the page if it's not valid.
- */
-$wgValidateAllHtml = false;
-
-/** See list of skins and their symbolic names in languages/Language.php */
-$wgDefaultSkin = 'monobook';
-
-/**
-* Should we allow the user's to select their own skin that will override the default?
-* @deprecated in 1.16, use $wgHiddenPrefs[] = 'skin' to disable it
-*/
-$wgAllowUserSkin = true;
-
-/**
- * Optionally, we can specify a stylesheet to use for media="handheld".
- * This is recognized by some, but not all, handheld/mobile/PDA browsers.
- * If left empty, compliant handheld browsers won't pick up the skin
- * stylesheet, which is specified for 'screen' media.
- *
- * Can be a complete URL, base-relative path, or $wgStylePath-relative path.
- * Try 'chick/main.css' to apply the Chick styles to the MonoBook HTML.
- *
- * Will also be switched in when 'handheld=yes' is added to the URL, like
- * the 'printable=yes' mode for print media.
- */
-$wgHandheldStyle = false;
-
-/**
- * If set, 'screen' and 'handheld' media specifiers for stylesheets are
- * transformed such that they apply to the iPhone/iPod Touch Mobile Safari,
- * which doesn't recognize 'handheld' but does support media queries on its
- * screen size.
- *
- * Consider only using this if you have a *really good* handheld stylesheet,
- * as iPhone users won't have any way to disable it and use the "grown-up"
- * styles instead.
- */
-$wgHandheldForIPhone = false;
-
-/**
- * Settings added to this array will override the default globals for the user
- * preferences used by anonymous visitors and newly created accounts.
- * For instance, to disable section editing links:
- * $wgDefaultUserOptions ['editsection'] = 0;
- *
- */
-$wgDefaultUserOptions = array(
- 'quickbar' => 1,
- 'underline' => 2,
- 'cols' => 80,
- 'rows' => 25,
- 'searchlimit' => 20,
- 'contextlines' => 5,
- 'contextchars' => 50,
- 'disablesuggest' => 0,
- 'skin' => false,
- 'math' => 1,
- 'usenewrc' => 0,
- 'rcdays' => 7,
- 'rclimit' => 50,
- 'wllimit' => 250,
- 'hideminor' => 0,
- 'hidepatrolled' => 0,
- 'newpageshidepatrolled' => 0,
- 'highlightbroken' => 1,
- 'stubthreshold' => 0,
- 'previewontop' => 1,
- 'previewonfirst' => 0,
- 'editsection' => 1,
- 'editsectiononrightclick' => 0,
- 'editondblclick' => 0,
- 'editwidth' => 0,
- 'showtoc' => 1,
- 'showtoolbar' => 1,
- 'minordefault' => 0,
- 'date' => 'default',
- 'imagesize' => 2,
- 'thumbsize' => 2,
- 'rememberpassword' => 0,
- 'nocache' => 0,
- 'diffonly' => 0,
- 'showhiddencats' => 0,
- 'norollbackdiff' => 0,
- 'enotifwatchlistpages' => 0,
- 'enotifusertalkpages' => 1,
- 'enotifminoredits' => 0,
- 'enotifrevealaddr' => 0,
- 'shownumberswatching' => 1,
- 'fancysig' => 0,
- 'externaleditor' => 0,
- 'externaldiff' => 0,
- 'forceeditsummary' => 0,
- 'showjumplinks' => 1,
- 'justify' => 0,
- 'numberheadings' => 0,
- 'uselivepreview' => 0,
- 'watchlistdays' => 3.0,
- 'extendwatchlist' => 0,
- 'watchlisthideminor' => 0,
- 'watchlisthidebots' => 0,
- 'watchlisthideown' => 0,
- 'watchlisthideanons' => 0,
- 'watchlisthideliu' => 0,
- 'watchlisthidepatrolled' => 0,
- 'watchcreations' => 0,
- 'watchdefault' => 0,
- 'watchmoves' => 0,
- 'watchdeletion' => 0,
- 'noconvertlink' => 0,
- 'gender' => 'unknown',
- 'ccmeonemails' => 0,
- 'disablemail' => 0,
- 'editfont' => 'default',
-);
-
-/**
- * Whether or not to allow and use real name fields.
- * @deprecated in 1.16, use $wgHiddenPrefs[] = 'realname' below to disable real
- * names
- */
-$wgAllowRealName = true;
-
-/** An array of preferences to not show for the user */
-$wgHiddenPrefs = array();
+/** @} */ # end of import/export }
-/*****************************************************************************
- * Extensions
+/*************************************************************************//**
+ * @name Extensions
+ * @{
*/
/**
@@ -2892,157 +4544,78 @@ $wgAutoloadClasses = array();
* 'descriptionmsg' => array( 'exampleextension-desc', param1, param2, ... ),
*/
$wgExtensionCredits = array();
-/*
- * end extensions
- ******************************************************************************/
/**
- * Allow user Javascript page?
- * This enables a lot of neat customizations, but may
- * increase security risk to users and server load.
+ * Authentication plugin.
*/
-$wgAllowUserJs = false;
+$wgAuth = null;
/**
- * Allow user Cascading Style Sheets (CSS)?
- * This enables a lot of neat customizations, but may
- * increase security risk to users and server load.
+ * Global list of hooks.
+ * Add a hook by doing:
+ * $wgHooks['event_name'][] = $function;
+ * or:
+ * $wgHooks['event_name'][] = array($function, $data);
+ * or:
+ * $wgHooks['event_name'][] = array($object, 'method');
*/
-$wgAllowUserCss = false;
-
-/** Use the site's Javascript page? */
-$wgUseSiteJs = true;
-
-/** Use the site's Cascading Style Sheets (CSS)? */
-$wgUseSiteCss = true;
+$wgHooks = array();
/**
- * Filter for Special:Randompage. Part of a WHERE clause
- * @deprecated as of 1.16, use the SpecialRandomGetRandomTitle hook
-*/
-
-$wgExtraRandompageSQL = false;
-
-/** Allow the "info" action, very inefficient at the moment */
-$wgAllowPageInfo = false;
-
-/** Maximum indent level of toc. */
-$wgMaxTocLevel = 999;
-
-/** Name of the external diff engine to use */
-$wgExternalDiffEngine = false;
-
-/** Use RC Patrolling to check for vandalism */
-$wgUseRCPatrol = true;
-
-/** Use new page patrolling to check new pages on Special:Newpages */
-$wgUseNPPatrol = true;
-
-/** Provide syndication feeds (RSS, Atom) for, e.g., Recentchanges, Newpages */
-$wgFeed = true;
-
-/** Set maximum number of results to return in syndication feeds (RSS, Atom) for
- * eg Recentchanges, Newpages. */
-$wgFeedLimit = 50;
-
-/** _Minimum_ timeout for cached Recentchanges feed, in seconds.
- * A cached version will continue to be served out even if changes
- * are made, until this many seconds runs out since the last render.
- *
- * If set to 0, feed caching is disabled. Use this for debugging only;
- * feed generation can be pretty slow with diffs.
- */
-$wgFeedCacheTimeout = 60;
-
-/** When generating Recentchanges RSS/Atom feed, diffs will not be generated for
- * pages larger than this size. */
-$wgFeedDiffCutoff = 32768;
-
-/** Override the site's default RSS/ATOM feed for recentchanges that appears on
- * every page. Some sites might have a different feed they'd like to promote
- * instead of the RC feed (maybe like a "Recent New Articles" or "Breaking news" one).
- * Ex: $wgSiteFeed['format'] = "http://example.com/somefeed.xml"; Format can be one
- * of either 'rss' or 'atom'.
+ * Maps jobs to their handling classes; extensions
+ * can add to this to provide custom jobs
*/
-$wgOverrideSiteFeed = array();
+$wgJobClasses = array(
+ 'refreshLinks' => 'RefreshLinksJob',
+ 'refreshLinks2' => 'RefreshLinksJob2',
+ 'htmlCacheUpdate' => 'HTMLCacheUpdateJob',
+ 'html_cache_update' => 'HTMLCacheUpdateJob', // backwards-compatible
+ 'sendMail' => 'EmaillingJob',
+ 'enotifNotify' => 'EnotifNotifyJob',
+ 'fixDoubleRedirect' => 'DoubleRedirectJob',
+ 'uploadFromUrl' => 'UploadFromUrlJob',
+);
/**
- * Which feed types should we provide by default? This can include 'rss',
- * 'atom', neither, or both.
+ * Additional functions to be performed with updateSpecialPages.
+ * Expensive Querypages are already updated.
*/
-$wgAdvertisedFeedTypes = array( 'atom' );
+$wgSpecialPageCacheUpdates = array(
+ 'Statistics' => array('SiteStatsUpdate','cacheUpdate')
+);
/**
- * Additional namespaces. If the namespaces defined in Language.php and
- * Namespace.php are insufficient, you can create new ones here, for example,
- * to import Help files in other languages.
- * PLEASE NOTE: Once you delete a namespace, the pages in that namespace will
- * no longer be accessible. If you rename it, then you can access them through
- * the new namespace name.
- *
- * Custom namespaces should start at 100 to avoid conflicting with standard
- * namespaces, and should always follow the even/odd main/talk pattern.
+ * Hooks that are used for outputting exceptions. Format is:
+ * $wgExceptionHooks[] = $funcname
+ * or:
+ * $wgExceptionHooks[] = array( $class, $funcname )
+ * Hooks should return strings or false
*/
-#$wgExtraNamespaces =
-# array(100 => "Hilfe",
-# 101 => "Hilfe_Diskussion",
-# 102 => "Aide",
-# 103 => "Discussion_Aide"
-# );
-$wgExtraNamespaces = null;
+$wgExceptionHooks = array();
-/**
- * Namespace aliases
- * These are alternate names for the primary localised namespace names, which
- * are defined by $wgExtraNamespaces and the language file. If a page is
- * requested with such a prefix, the request will be redirected to the primary
- * name.
- *
- * Set this to a map from namespace names to IDs.
- * Example:
- * $wgNamespaceAliases = array(
- * 'Wikipedian' => NS_USER,
- * 'Help' => 100,
- * );
- */
-$wgNamespaceAliases = array();
/**
- * Limit images on image description pages to a user-selectable limit. In order
- * to reduce disk usage, limits can only be selected from a list.
- * The user preference is saved as an array offset in the database, by default
- * the offset is set with $wgDefaultUserOptions['imagesize']. Make sure you
- * change it if you alter the array (see bug 8858).
- * This is the list of settings the user can choose from:
+ * Page property link table invalidation lists. When a page property
+ * changes, this may require other link tables to be updated (eg
+ * adding __HIDDENCAT__ means the hiddencat tracking category will
+ * have been added, so the categorylinks table needs to be rebuilt).
+ * This array can be added to by extensions.
*/
-$wgImageLimits = array (
- array(320,240),
- array(640,480),
- array(800,600),
- array(1024,768),
- array(1280,1024),
- array(10000,10000) );
+$wgPagePropLinkInvalidations = array(
+ 'hiddencat' => 'categorylinks',
+);
-/**
- * Adjust thumbnails on image pages according to a user setting. In order to
- * reduce disk usage, the values can only be selected from a list. This is the
- * list of settings the user can choose from:
+/** @} */ # End extensions }
+
+/*************************************************************************//**
+ * @name Categories
+ * @{
*/
-$wgThumbLimits = array(
- 120,
- 150,
- 180,
- 200,
- 250,
- 300
-);
/**
- * Adjust width of upright images when parameter 'upright' is used
- * This allows a nicer look for upright images without the need to fix the width
- * by hardcoded px in wiki sourcecode.
+ * Use experimental, DMOZ-like category browser
*/
-$wgThumbUpright = 0.75;
+$wgUseCategoryBrowser = false;
/**
* On category pages, show thumbnail gallery for images belonging to that
@@ -3056,123 +4629,33 @@ $wgCategoryMagicGallery = true;
$wgCategoryPagingLimit = 200;
/**
- * Should the default category sortkey be the prefixed title?
- * Run maintenance/refreshLinks.php after changing this.
- */
-$wgCategoryPrefixedDefaultSortkey = true;
-
-/**
- * Browser Blacklist for unicode non compliant browsers
- * Contains a list of regexps : "/regexp/" matching problematic browsers
- */
-$wgBrowserBlackList = array(
- /**
- * Netscape 2-4 detection
- * The minor version may contain strings such as "Gold" or "SGoldC-SGI"
- * Lots of non-netscape user agents have "compatible", so it's useful to check for that
- * with a negative assertion. The [UIN] identifier specifies the level of security
- * in a Netscape/Mozilla browser, checking for it rules out a number of fakers.
- * The language string is unreliable, it is missing on NS4 Mac.
- *
- * Reference: http://www.psychedelix.com/agents/index.shtml
- */
- '/^Mozilla\/2\.[^ ]+ [^(]*?\((?!compatible).*; [UIN]/',
- '/^Mozilla\/3\.[^ ]+ [^(]*?\((?!compatible).*; [UIN]/',
- '/^Mozilla\/4\.[^ ]+ [^(]*?\((?!compatible).*; [UIN]/',
-
- /**
- * MSIE on Mac OS 9 is teh sux0r, converts þ to <thorn>, ð to <eth>, Þ to <THORN> and Ð to <ETH>
- *
- * Known useragents:
- * - Mozilla/4.0 (compatible; MSIE 5.0; Mac_PowerPC)
- * - Mozilla/4.0 (compatible; MSIE 5.15; Mac_PowerPC)
- * - Mozilla/4.0 (compatible; MSIE 5.23; Mac_PowerPC)
- * - [...]
- *
- * @link http://en.wikipedia.org/w/index.php?title=User%3A%C6var_Arnfj%F6r%F0_Bjarmason%2Ftestme&diff=12356041&oldid=12355864
- * @link http://en.wikipedia.org/wiki/Template%3AOS9
- */
- '/^Mozilla\/4\.0 \(compatible; MSIE \d+\.\d+; Mac_PowerPC\)/',
-
- /**
- * Google wireless transcoder, seems to eat a lot of chars alive
- * http://it.wikipedia.org/w/index.php?title=Luciano_Ligabue&diff=prev&oldid=8857361
- */
- '/^Mozilla\/4\.0 \(compatible; MSIE 6.0; Windows NT 5.0; Google Wireless Transcoder;\)/'
-);
-
-/**
- * Fake out the timezone that the server thinks it's in. This will be used for
- * date display and not for what's stored in the DB. Leave to null to retain
- * your server's OS-based timezone value.
+ * Specify how category names should be sorted, when listed on a category page.
+ * A sorting scheme is also known as a collation.
*
- * This variable is currently used only for signature formatting and for local
- * time/date parser variables ({{LOCALTIME}} etc.)
+ * Available values are:
*
- * Timezones can be translated by editing MediaWiki messages of type
- * timezone-nameinlowercase like timezone-utc.
- */
-# $wgLocaltimezone = 'GMT';
-# $wgLocaltimezone = 'PST8PDT';
-# $wgLocaltimezone = 'Europe/Sweden';
-# $wgLocaltimezone = 'CET';
-$wgLocaltimezone = null;
-
-/**
- * Set an offset from UTC in minutes to use for the default timezone setting
- * for anonymous users and new user accounts.
- *
- * This setting is used for most date/time displays in the software, and is
- * overrideable in user preferences. It is *not* used for signature timestamps.
+ * - uppercase: Converts the category name to upper case, and sorts by that.
*
- * You can set it to match the configured server timezone like this:
- * $wgLocalTZoffset = date("Z") / 60;
+ * - uca-default: Provides access to the Unicode Collation Algorithm with
+ * the default element table. This is a compromise collation which sorts
+ * all languages in a mediocre way. However, it is better than "uppercase".
*
- * If your server is not configured for the timezone you want, you can set
- * this in conjunction with the signature timezone and override the PHP default
- * timezone like so:
- * $wgLocaltimezone="Europe/Berlin";
- * date_default_timezone_set( $wgLocaltimezone );
- * $wgLocalTZoffset = date("Z") / 60;
- *
- * Leave at NULL to show times in universal time (UTC/GMT).
- */
-$wgLocalTZoffset = null;
-
-
-/**
- * When translating messages with wfMsg(), it is not always clear what should
- * be considered UI messages and what should be content messages.
- *
- * For example, for the English Wikipedia, there should be only one 'mainpage',
- * so when getting the link for 'mainpage', we should treat it as site content
- * and call wfMsgForContent(), but for rendering the text of the link, we call
- * wfMsg(). The code behaves this way by default. However, sites like the
- * Wikimedia Commons do offer different versions of 'mainpage' and the like for
- * different languages. This array provides a way to override the default
- * behavior. For example, to allow language-specific main page and community
- * portal, set
+ * To use the uca-default collation, you must have PHP's intl extension
+ * installed. See http://php.net/manual/en/intl.setup.php . The details of the
+ * resulting collation will depend on the version of ICU installed on the
+ * server.
*
- * $wgForceUIMsgAsContentMsg = array( 'mainpage', 'portal-url' );
+ * After you change this, you must run maintenance/updateCollation.php to fix
+ * the sort keys in the database.
*/
-$wgForceUIMsgAsContentMsg = array();
+$wgCategoryCollation = 'uppercase';
+/** @} */ # End categories }
-/**
- * Authentication plugin.
+/*************************************************************************//**
+ * @name Logging
+ * @{
*/
-$wgAuth = null;
-
-/**
- * Global list of hooks.
- * Add a hook by doing:
- * $wgHooks['event_name'][] = $function;
- * or:
- * $wgHooks['event_name'][] = array($function, $data);
- * or:
- * $wgHooks['event_name'][] = array($object, 'method');
- */
-$wgHooks = array();
/**
* The logging system has two levels: an event type, which describes the
@@ -3283,6 +4766,7 @@ $wgLogActions = array(
'protect/unprotect' => 'unprotectedarticle',
'protect/move_prot' => 'movedarticleprotection',
'rights/rights' => 'rightslogentry',
+ 'rights/disable' => 'disableaccount-logentry',
'delete/delete' => 'deletedarticle',
'delete/restore' => 'undeletedarticle',
'delete/revision' => 'revdelete-logentry',
@@ -3299,13 +4783,15 @@ $wgLogActions = array(
'suppress/file' => 'revdelete-logentry',
'suppress/event' => 'logdelete-logentry',
'suppress/delete' => 'suppressedarticle',
- 'suppress/block' => 'blocklogentry',
+ 'suppress/block' => 'blocklogentry',
'suppress/reblock' => 'reblock-logentry',
+ 'patrol/patrol' => 'patrol-log-line',
);
/**
* The same as above, but here values are names of functions,
- * not messages
+ * not messages.
+ * @see LogPage::actionText
*/
$wgLogActionsHandlers = array();
@@ -3315,6 +4801,29 @@ $wgLogActionsHandlers = array();
$wgNewUserLog = true;
/**
+ * Log the automatic creations of new users accounts?
+ */
+$wgLogAutocreatedAccounts = false;
+
+/** @} */ # end logging }
+
+/*************************************************************************//**
+ * @name Special pages (general and miscellaneous)
+ * @{
+ */
+
+/**
+ * Allow special page inclusions such as {{Special:Allpages}}
+ */
+$wgAllowSpecialInclusion = true;
+
+/**
+ * Set this to an array of special page names to prevent
+ * maintenance/updateSpecialPages.php from updating those pages.
+ */
+$wgDisableQueryPageUpdate = false;
+
+/**
* List of special pages, followed by what subtitle they should go under
* at Special:SpecialPages
*/
@@ -3396,6 +4905,7 @@ $wgSpecialPageGroups = array(
'Search' => 'redirects',
'LinkSearch' => 'redirects',
+ 'ComparePages' => 'pagetools',
'Movepage' => 'pagetools',
'MergeHistory' => 'pagetools',
'Revisiondelete' => 'pagetools',
@@ -3416,56 +4926,35 @@ $wgSpecialPageGroups = array(
'Booksources' => 'other',
);
-/**
- * Disable the internal MySQL-based search, to allow it to be
- * implemented by an extension instead.
- */
-$wgDisableInternalSearch = false;
+/** Whether or not to sort special pages in Special:Specialpages */
-/**
- * Set this to a URL to forward search requests to some external location.
- * If the URL includes '$1', this will be replaced with the URL-encoded
- * search term.
- *
- * For example, to forward to Google you'd have something like:
- * $wgSearchForwardUrl = 'http://www.google.com/search?q=$1' .
- * '&domains=http://example.com' .
- * '&sitesearch=http://example.com' .
- * '&ie=utf-8&oe=utf-8';
- */
-$wgSearchForwardUrl = null;
+$wgSortSpecialPages = true;
/**
- * Set a default target for external links, e.g. _blank to pop up a new window
+ * Filter for Special:Randompage. Part of a WHERE clause
+ * @deprecated as of 1.16, use the SpecialRandomGetRandomTitle hook
*/
-$wgExternalLinkTarget = false;
+$wgExtraRandompageSQL = false;
/**
- * If true, external URL links in wiki text will be given the
- * rel="nofollow" attribute as a hint to search engines that
- * they should not be followed for ranking purposes as they
- * are user-supplied and thus subject to spamming.
+ * On Special:Unusedimages, consider images "used", if they are put
+ * into a category. Default (false) is not to count those as used.
*/
-$wgNoFollowLinks = true;
+$wgCountCategorizedImagesAsUsed = false;
/**
- * Namespaces in which $wgNoFollowLinks doesn't apply.
- * See Language.php for a list of namespaces.
+ * Maximum number of links to a redirect page listed on
+ * Special:Whatlinkshere/RedirectDestination
*/
-$wgNoFollowNsExceptions = array();
+$wgMaxRedirectLinksRetrieved = 500;
-/**
- * If this is set to an array of domains, external links to these domain names
- * (or any subdomains) will not be set to rel="nofollow" regardless of the
- * value of $wgNoFollowLinks. For instance:
- *
- * $wgNoFollowDomainExceptions = array( 'en.wikipedia.org', 'wiktionary.org' );
- *
- * This would add rel="nofollow" to links to de.wikipedia.org, but not
- * en.wikipedia.org, wiktionary.org, en.wiktionary.org, us.en.wikipedia.org,
- * etc.
+/** @} */ # end special pages }
+
+/*************************************************************************//**
+ * @name Robot (search engine crawler) policy
+ * See also $wgNoFollowLinks.
+ * @{
*/
-$wgNoFollowDomainExceptions = array();
/**
* Default robot policy. The default policy is to encourage indexing and fol-
@@ -3516,251 +5005,76 @@ $wgArticleRobotPolicies = array();
*/
$wgExemptFromUserRobotsControl = null;
-/**
- * Specifies the minimal length of a user password. If set to 0, empty pass-
- * words are allowed.
- */
-$wgMinimalPasswordLength = 1;
-
-/**
- * Activate external editor interface for files and pages
- * See http://www.mediawiki.org/wiki/Manual:External_editors
- */
-$wgUseExternalEditor = true;
-
-/** Whether or not to sort special pages in Special:Specialpages */
-
-$wgSortSpecialPages = true;
-
-/**
- * Specify the name of a skin that should not be presented in the list of a-
- * vailable skins. Use for blacklisting a skin which you do not want to remove
- * from the .../skins/ directory
- */
-$wgSkipSkin = '';
-$wgSkipSkins = array(); # More of the same
-
-/**
- * Array of disabled article actions, e.g. view, edit, dublincore, delete, etc.
- */
-$wgDisabledActions = array();
-
-/**
- * Disable redirects to special pages and interwiki redirects, which use a 302
- * and have no "redirected from" link.
- */
-$wgDisableHardRedirects = false;
-
-/**
- * Set to false to disable application of access keys and tooltips,
- * eg to avoid keyboard conflicts with system keys or as a low-level
- * optimization.
- */
-$wgEnableTooltipsAndAccesskeys = true;
-
-/**
- * Whether to use DNS blacklists in $wgDnsBlacklistUrls to check for open proxies
- * @since 1.16
- */
-$wgEnableDnsBlacklist = false;
-
-/**
- * @deprecated Use $wgEnableDnsBlacklist instead, only kept for backward
- * compatibility
- */
-$wgEnableSorbs = false;
-
-/**
- * List of DNS blacklists to use, if $wgEnableDnsBlacklist is true
- * @since 1.16
- */
-$wgDnsBlacklistUrls = array( 'http.dnsbl.sorbs.net.' );
-
-/**
- * @deprecated Use $wgDnsBlacklistUrls instead, only kept for backward
- * compatibility
- */
-$wgSorbsUrl = array();
-
-/**
- * Proxy whitelist, list of addresses that are assumed to be non-proxy despite
- * what the other methods might say.
- */
-$wgProxyWhitelist = array();
-
-/**
- * Simple rate limiter options to brake edit floods. Maximum number actions
- * allowed in the given number of seconds; after that the violating client re-
- * ceives HTTP 500 error pages until the period elapses.
- *
- * array( 4, 60 ) for a maximum of 4 hits in 60 seconds.
- *
- * This option set is experimental and likely to change. Requires memcached.
- */
-$wgRateLimits = array(
- 'edit' => array(
- 'anon' => null, // for any and all anonymous edits (aggregate)
- 'user' => null, // for each logged-in user
- 'newbie' => null, // for each recent (autoconfirmed) account; overrides 'user'
- 'ip' => null, // for each anon and recent account
- 'subnet' => null, // ... with final octet removed
- ),
- 'move' => array(
- 'user' => null,
- 'newbie' => null,
- 'ip' => null,
- 'subnet' => null,
- ),
- 'mailpassword' => array(
- 'anon' => null,
- ),
- 'emailuser' => array(
- 'user' => null,
- ),
- );
-
-/**
- * Set to a filename to log rate limiter hits.
- */
-$wgRateLimitLog = null;
-
-/**
- * Array of groups which should never trigger the rate limiter
- *
- * @deprecated as of 1.13.0, the preferred method is using
- * $wgGroupPermissions[]['noratelimit']. However, this will still
- * work if desired.
- *
- * $wgRateLimitsExcludedGroups = array( 'sysop', 'bureaucrat' );
- */
-$wgRateLimitsExcludedGroups = array();
-
-/**
- * Array of IPs which should be excluded from rate limits.
- * This may be useful for whitelisting NAT gateways for conferences, etc.
- */
-$wgRateLimitsExcludedIPs = array();
+/** @} */ # End robot policy }
-/**
- * On Special:Unusedimages, consider images "used", if they are put
- * into a category. Default (false) is not to count those as used.
+/************************************************************************//**
+ * @name AJAX and API
+ * Note: The AJAX entry point which this section refers to is gradually being
+ * replaced by the API entry point, api.php. They are essentially equivalent.
+ * Both of them are used for dynamic client-side features, via XHR.
+ * @{
*/
-$wgCountCategorizedImagesAsUsed = false;
-
-/**
- * External stores allow including content
- * from non database sources following URL links
- *
- * Short names of ExternalStore classes may be specified in an array here:
- * $wgExternalStores = array("http","file","custom")...
- *
- * CAUTION: Access to database might lead to code execution
- */
-$wgExternalStores = false;
-
-/**
- * An array of external mysql servers, e.g.
- * $wgExternalServers = array( 'cluster1' => array( 'srv28', 'srv29', 'srv30' ) );
- * Used by LBFactory_Simple, may be ignored if $wgLBFactoryConf is set to another class.
- */
-$wgExternalServers = array();
-
-/**
- * The place to put new revisions, false to put them in the local text table.
- * Part of a URL, e.g. DB://cluster1
- *
- * Can be an array instead of a single string, to enable data distribution. Keys
- * must be consecutive integers, starting at zero. Example:
- *
- * $wgDefaultExternalStore = array( 'DB://cluster1', 'DB://cluster2' );
- *
- */
-$wgDefaultExternalStore = false;
-
-/**
- * Revision text may be cached in $wgMemc to reduce load on external storage
- * servers and object extraction overhead for frequently-loaded revisions.
- *
- * Set to 0 to disable, or number of seconds before cache expiry.
- */
-$wgRevisionCacheExpiry = 0;
/**
- * list of trusted media-types and mime types.
- * Use the MEDIATYPE_xxx constants to represent media types.
- * This list is used by Image::isSafeFile
+ * Enable the MediaWiki API for convenient access to
+ * machine-readable data via api.php
*
- * Types not listed here will have a warning about unsafe content
- * displayed on the images description page. It would also be possible
- * to use this for further restrictions, like disabling direct
- * [[media:...]] links for non-trusted formats.
- */
-$wgTrustedMediaFormats= array(
- MEDIATYPE_BITMAP, //all bitmap formats
- MEDIATYPE_AUDIO, //all audio formats
- MEDIATYPE_VIDEO, //all plain video formats
- "image/svg+xml", //svg (only needed if inline rendering of svg is not supported)
- "application/pdf", //PDF files
- #"application/x-shockwave-flash", //flash/shockwave movie
-);
-
-/**
- * Allow special page inclusions such as {{Special:Allpages}}
- */
-$wgAllowSpecialInclusion = true;
-
-/**
- * Timeout for HTTP requests done internally
+ * See http://www.mediawiki.org/wiki/API
*/
-$wgHTTPTimeout = 25;
+$wgEnableAPI = true;
/**
- * Timeout for Asynchronous (background) HTTP requests
+ * Allow the API to be used to perform write operations
+ * (page edits, rollback, etc.) when an authorised user
+ * accesses it
*/
-$wgAsyncHTTPTimeout = 25;
+$wgEnableWriteAPI = true;
/**
- * Proxy to use for CURL requests.
+ * API module extensions
+ * Associative array mapping module name to class name.
+ * Extension modules may override the core modules.
*/
-$wgHTTPProxy = false;
+$wgAPIModules = array();
+$wgAPIMetaModules = array();
+$wgAPIPropModules = array();
+$wgAPIListModules = array();
/**
- * Enable interwiki transcluding. Only when iw_trans=1.
- */
-$wgEnableScaryTranscluding = false;
-/**
- * Expiry time for interwiki transclusion
+ * Maximum amount of rows to scan in a DB query in the API
+ * The default value is generally fine
*/
-$wgTranscludeCacheExpiry = 3600;
+$wgAPIMaxDBRows = 5000;
/**
- * Support blog-style "trackbacks" for articles. See
- * http://www.sixapart.com/pronet/docs/trackback_spec for details.
+ * The maximum size (in bytes) of an API result.
+ * Don't set this lower than $wgMaxArticleSize*1024
*/
-$wgUseTrackbacks = false;
+$wgAPIMaxResultSize = 8388608;
/**
- * Enable filtering of categories in Recentchanges
+ * The maximum number of uncached diffs that can be retrieved in one API
+ * request. Set this to 0 to disable API diffs altogether
*/
-$wgAllowCategorizedRecentChanges = false ;
+$wgAPIMaxUncachedDiffs = 1;
/**
- * Number of jobs to perform per request. May be less than one in which case
- * jobs are performed probabalistically. If this is zero, jobs will not be done
- * during ordinary apache requests. In this case, maintenance/runJobs.php should
- * be run periodically.
+ * Log file or URL (TCP or UDP) to log API requests to, or false to disable
+ * API request logging
*/
-$wgJobRunRate = 1;
+$wgAPIRequestLog = false;
/**
- * Number of rows to update per job
+ * Cache the API help text for up to an hour. Disable this during API
+ * debugging and development
*/
-$wgUpdateRowsPerJob = 500;
+$wgAPICacheHelp = true;
/**
- * Number of rows to update per query
+ * Set the timeout for the API help text cache. Ignored if $wgAPICacheHelp
+ * is false.
*/
-$wgUpdateRowsPerQuery = 100;
+$wgAPICacheHelpTimeout = 60*60;
/**
* Enable AJAX framework
@@ -3771,7 +5085,7 @@ $wgUseAjax = true;
* List of Ajax-callable functions.
* Extensions acting as Ajax callbacks must register here
*/
-$wgAjaxExportList = array( 'wfAjaxGetThumbnailUrl', 'wfAjaxGetFileUrl' );
+$wgAjaxExportList = array( 'wfAjaxGetFileUrl' );
/**
* Enable watching/unwatching pages using AJAX.
@@ -3791,43 +5105,40 @@ $wgAjaxUploadDestCheck = true;
$wgAjaxLicensePreview = true;
/**
- * Allow DISPLAYTITLE to change title display
+ * Settings for incoming cross-site AJAX requests:
+ * Newer browsers support cross-site AJAX when the target resource allows requests
+ * from the origin domain by the Access-Control-Allow-Origin header.
+ * This is currently only used by the API (requests to api.php)
+ * $wgCrossSiteAJAXdomains can be set using a wildcard syntax:
+ *
+ * '*' matches any number of characters
+ * '?' matches any 1 character
+ *
+ * Example:
+ $wgCrossSiteAJAXdomains = array(
+ 'www.mediawiki.org',
+ '*.wikipedia.org',
+ '*.wikimedia.org',
+ '*.wiktionary.org',
+ );
+ *
*/
-$wgAllowDisplayTitle = true;
+$wgCrossSiteAJAXdomains = array();
/**
- * for consistency, restrict DISPLAYTITLE to titles that normalize to the same canonical DB key
+ * Domains that should not be allowed to make AJAX requests,
+ * even if they match one of the domains allowed by $wgCrossSiteAJAXdomains
+ * Uses the same syntax as $wgCrossSiteAJAXdomains
*/
-$wgRestrictDisplayTitle = true;
-/**
- * Array of usernames which may not be registered or logged in from
- * Maintenance scripts can still use these
- */
-$wgReservedUsernames = array(
- 'MediaWiki default', // Default 'Main Page' and MediaWiki: message pages
- 'Conversion script', // Used for the old Wikipedia software upgrade
- 'Maintenance script', // Maintenance scripts which perform editing, image import script
- 'Template namespace initialisation script', // Used in 1.2->1.3 upgrade
- 'msg:double-redirect-fixer', // Automatic double redirect fix
-);
+$wgCrossSiteAJAXdomainExceptions = array();
-/**
- * MediaWiki will reject HTMLesque tags in uploaded files due to idiotic browsers which can't
- * perform basic stuff like MIME detection and which are vulnerable to further idiots uploading
- * crap files as images. When this directive is on, <title> will be allowed in files with
- * an "image/svg+xml" MIME type. You should leave this disabled if your web server is misconfigured
- * and doesn't send appropriate MIME types for SVG images.
- */
-$wgAllowTitlesInSVG = false;
+/** @} */ # End AJAX and API }
-/**
- * Array of namespaces which can be deemed to contain valid "content", as far
- * as the site statistics are concerned. Useful if additional namespaces also
- * contain "content" which should be considered when generating a count of the
- * number of articles in the wiki.
+/************************************************************************//**
+ * @name Shell and process control
+ * @{
*/
-$wgContentNamespaces = array( NS_MAIN );
/**
* Maximum amount of virtual memory available to shell processes under linux, in KB.
@@ -3851,211 +5162,85 @@ $wgMaxShellTime = 180;
$wgPhpCli = '/usr/bin/php';
/**
- * DJVU settings
- * Path of the djvudump executable
- * Enable this and $wgDjvuRenderer to enable djvu rendering
- */
-# $wgDjvuDump = 'djvudump';
-$wgDjvuDump = null;
-
-/**
- * Path of the ddjvu DJVU renderer
- * Enable this and $wgDjvuDump to enable djvu rendering
- */
-# $wgDjvuRenderer = 'ddjvu';
-$wgDjvuRenderer = null;
-
-/**
- * Path of the djvutxt DJVU text extraction utility
- * Enable this and $wgDjvuDump to enable text layer extraction from djvu files
- */
-# $wgDjvuTxt = 'djvutxt';
-$wgDjvuTxt = null;
-
-/**
- * Path of the djvutoxml executable
- * This works like djvudump except much, much slower as of version 3.5.
- *
- * For now I recommend you use djvudump instead. The djvuxml output is
- * probably more stable, so we'll switch back to it as soon as they fix
- * the efficiency problem.
- * http://sourceforge.net/tracker/index.php?func=detail&aid=1704049&group_id=32953&atid=406583
- */
-# $wgDjvuToXML = 'djvutoxml';
-$wgDjvuToXML = null;
-
-
-/**
- * Shell command for the DJVU post processor
- * Default: pnmtopng, since ddjvu generates ppm output
- * Set this to false to output the ppm file directly.
- */
-$wgDjvuPostProcessor = 'pnmtojpeg';
-/**
- * File extension for the DJVU post processor output
- */
-$wgDjvuOutputExtension = 'jpg';
-
-/**
- * Enable the MediaWiki API for convenient access to
- * machine-readable data via api.php
- *
- * See http://www.mediawiki.org/wiki/API
+ * Locale for LC_CTYPE, to work around http://bugs.php.net/bug.php?id=45132
+ * For Unix-like operating systems, set this to to a locale that has a UTF-8
+ * character set. Only the character set is relevant.
*/
-$wgEnableAPI = true;
+$wgShellLocale = 'en_US.utf8';
-/**
- * Allow the API to be used to perform write operations
- * (page edits, rollback, etc.) when an authorised user
- * accesses it
- */
-$wgEnableWriteAPI = true;
+/** @} */ # End shell }
-/**
- * API module extensions
- * Associative array mapping module name to class name.
- * Extension modules may override the core modules.
+/************************************************************************//**
+ * @name HTTP client
+ * @{
*/
-$wgAPIModules = array();
-$wgAPIMetaModules = array();
-$wgAPIPropModules = array();
-$wgAPIListModules = array();
/**
- * Maximum amount of rows to scan in a DB query in the API
- * The default value is generally fine
+ * Timeout for HTTP requests done internally
*/
-$wgAPIMaxDBRows = 5000;
+$wgHTTPTimeout = 25;
/**
- * The maximum size (in bytes) of an API result.
- * Don't set this lower than $wgMaxArticleSize*1024
+ * Timeout for Asynchronous (background) HTTP requests
*/
-$wgAPIMaxResultSize = 8388608;
+$wgAsyncHTTPTimeout = 25;
/**
- * The maximum number of uncached diffs that can be retrieved in one API
- * request. Set this to 0 to disable API diffs altogether
+ * Proxy to use for CURL requests.
*/
-$wgAPIMaxUncachedDiffs = 1;
+$wgHTTPProxy = false;
-/**
- * Log file or URL (TCP or UDP) to log API requests to, or false to disable
- * API request logging
- */
-$wgAPIRequestLog = false;
+/** @} */ # End HTTP client }
-/**
- * Cache the API help text for up to an hour. Disable this during API
- * debugging and development
+/************************************************************************//**
+ * @name Job queue
+ * See also $wgEnotifUseJobQ.
+ * @{
*/
-$wgAPICacheHelp = true;
/**
- * Set the timeout for the API help text cache. Ignored if $wgAPICacheHelp
- * is false.
+ * Number of jobs to perform per request. May be less than one in which case
+ * jobs are performed probabalistically. If this is zero, jobs will not be done
+ * during ordinary apache requests. In this case, maintenance/runJobs.php should
+ * be run periodically.
*/
-$wgAPICacheHelpTimeout = 60*60;
+$wgJobRunRate = 1;
/**
- * Parser test suite files to be run by parserTests.php when no specific
- * filename is passed to it.
- *
- * Extensions may add their own tests to this array, or site-local tests
- * may be added via LocalSettings.php
- *
- * Use full paths.
+ * Number of rows to update per job
*/
-$wgParserTestFiles = array(
- "$IP/maintenance/parserTests.txt",
-);
+$wgUpdateRowsPerJob = 500;
/**
- * If configured, specifies target CodeReview installation to send test
- * result data from 'parserTests.php --upload'
- *
- * Something like this:
- * $wgParserTestRemote = array(
- * 'api-url' => 'http://www.mediawiki.org/w/api.php',
- * 'repo' => 'MediaWiki',
- * 'suite' => 'ParserTests',
- * 'path' => '/trunk/phase3', // not used client-side; for reference
- * 'secret' => 'qmoicj3mc4mcklmqw', // Shared secret used in HMAC validation
- * );
+ * Number of rows to update per query
*/
-$wgParserTestRemote = false;
+$wgUpdateRowsPerQuery = 100;
-/**
- * Break out of framesets. This can be used to prevent clickjacking attacks,
- * or to prevent external sites from framing your site with ads.
- */
-$wgBreakFrames = false;
+/** @} */ # End job queue }
-/**
- * The X-Frame-Options header to send on pages sensitive to clickjacking
- * attacks, such as edit pages. This prevents those pages from being displayed
- * in a frame or iframe. The options are:
- *
- * - 'DENY': Do not allow framing. This is recommended for most wikis.
- *
- * - 'SAMEORIGIN': Allow framing by pages on the same domain. This can be used
- * to allow framing within a trusted domain. This is insecure if there
- * is a page on the same domain which allows framing of arbitrary URLs.
- *
- * - false: Allow all framing. This opens up the wiki to XSS attacks and thus
- * full compromise of local user accounts. Private wikis behind a
- * corporate firewall are especially vulnerable. This is not
- * recommended.
- *
- * For extra safety, set $wgBreakFrames = true, to prevent framing on all pages,
- * not just edit pages.
+/************************************************************************//**
+ * @name Miscellaneous
+ * @{
*/
-$wgEditPageFrameOptions = 'DENY';
-/**
- * Set this to an array of special page names to prevent
- * maintenance/updateSpecialPages.php from updating those pages.
- */
-$wgDisableQueryPageUpdate = false;
+/** Allow the "info" action, very inefficient at the moment */
+$wgAllowPageInfo = false;
-/**
- * Disable output compression (enabled by default if zlib is available)
- */
-$wgDisableOutputCompression = false;
+/** Name of the external diff engine to use */
+$wgExternalDiffEngine = false;
/**
- * If lag is higher than $wgSlaveLagWarning, show a warning in some special
- * pages (like watchlist). If the lag is higher than $wgSlaveLagCritical,
- * show a more obvious warning.
+ * Array of disabled article actions, e.g. view, edit, dublincore, delete, etc.
*/
-$wgSlaveLagWarning = 10;
-$wgSlaveLagCritical = 30;
+$wgDisabledActions = array();
/**
- * Parser configuration. Associative array with the following members:
- *
- * class The class name
- *
- * preprocessorClass The preprocessor class. Two classes are currently available:
- * Preprocessor_Hash, which uses plain PHP arrays for tempoarary
- * storage, and Preprocessor_DOM, which uses the DOM module for
- * temporary storage. Preprocessor_DOM generally uses less memory;
- * the speed of the two is roughly the same.
- *
- * If this parameter is not given, it uses Preprocessor_DOM if the
- * DOM module is available, otherwise it uses Preprocessor_Hash.
- *
- * The entire associative array will be passed through to the constructor as
- * the first parameter. Note that only Setup.php can use this variable --
- * the configuration will change at runtime via $wgParser member functions, so
- * the contents of this variable will be out-of-date. The variable can only be
- * changed during LocalSettings.php, in particular, it can't be changed during
- * an extension setup function.
+ * Disable redirects to special pages and interwiki redirects, which use a 302
+ * and have no "redirected from" link. Note this is only for articles with #Redirect
+ * in them. URL's containing a local interwiki prefix (or a non-canonical special
+ * page name) are still hard redirected regardless of this setting.
*/
-$wgParserConf = array(
- 'class' => 'Parser',
- #'preprocessorClass' => 'Preprocessor_Hash',
-);
+$wgDisableHardRedirects = false;
/**
* LinkHolderArray batch size
@@ -4070,38 +5255,6 @@ $wgLinkHolderBatchSize = 1000;
$wgRegisterInternalExternals = false;
/**
- * Hooks that are used for outputting exceptions. Format is:
- * $wgExceptionHooks[] = $funcname
- * or:
- * $wgExceptionHooks[] = array( $class, $funcname )
- * Hooks should return strings or false
- */
-$wgExceptionHooks = array();
-
-/**
- * Page property link table invalidation lists. When a page property
- * changes, this may require other link tables to be updated (eg
- * adding __HIDDENCAT__ means the hiddencat tracking category will
- * have been added, so the categorylinks table needs to be rebuilt).
- * This array can be added to by extensions.
- */
-$wgPagePropLinkInvalidations = array(
- 'hiddencat' => 'categorylinks',
-);
-
-/**
- * Maximum number of links to a redirect page listed on
- * Special:Whatlinkshere/RedirectDestination
- */
-$wgMaxRedirectLinksRetrieved = 500;
-
-/**
- * Maximum number of calls per parse to expensive parser functions such as
- * PAGESINCATEGORY.
- */
-$wgExpensiveParserFunctionLimit = 100;
-
-/**
* Maximum number of pages to move at once when moving subpages with a page.
*/
$wgMaximumMovedPages = 100;
@@ -4113,133 +5266,12 @@ $wgMaximumMovedPages = 100;
$wgFixDoubleRedirects = false;
/**
- * Max number of redirects to follow when resolving redirects.
- * 1 means only the first redirect is followed (default behavior).
- * 0 or less means no redirects are followed.
- */
-$wgMaxRedirects = 1;
-
-/**
- * Array of invalid page redirect targets.
- * Attempting to create a redirect to any of the pages in this array
- * will make the redirect fail.
- * Userlogout is hard-coded, so it does not need to be listed here.
- * (bug 10569) Disallow Mypage and Mytalk as well.
- *
- * As of now, this only checks special pages. Redirects to pages in
- * other namespaces cannot be invalidated by this variable.
- */
-$wgInvalidRedirectTargets = array( 'Filepath', 'Mypage', 'Mytalk' );
-
-/**
- * Array of namespaces to generate a sitemap for when the
- * maintenance/generateSitemap.php script is run, or false if one is to be ge-
- * nerated for all namespaces.
- */
-$wgSitemapNamespaces = false;
-
-
-/**
- * If user doesn't specify any edit summary when making a an edit, MediaWiki
- * will try to automatically create one. This feature can be disabled by set-
- * ting this variable false.
- */
-$wgUseAutomaticEditSummaries = true;
-
-/**
- * Limit password attempts to X attempts per Y seconds per IP per account.
- * Requires memcached.
- */
-$wgPasswordAttemptThrottle = array( 'count' => 5, 'seconds' => 300 );
-
-/**
- * Display user edit counts in various prominent places.
- */
-$wgEdititis = false;
-
-/**
- * Enable the UniversalEditButton for browsers that support it
- * (currently only Firefox with an extension)
- * See http://universaleditbutton.org for more background information
- */
-$wgUniversalEditButton = true;
-
-/**
- * Should we allow a broader set of characters in id attributes, per HTML5? If
- * not, use only HTML 4-compatible IDs. This option is for testing -- when the
- * functionality is ready, it will be on by default with no option.
- *
- * Currently this appears to work fine in Chrome 4 and 5, Firefox 3.5 and 3.6, IE6
- * and 8, and Opera 10.50, but it fails in Opera 10.10: Unicode IDs don't seem
- * to work as anchors. So not quite ready for general use yet.
- */
-$wgExperimentalHtmlIds = false;
-
-/**
- * Search form behavior
- * true = use Go & Search buttons
- * false = use Go button & Advanced search link
- */
-$wgUseTwoButtonsSearchForm = true;
-
-/**
- * Search form behavior for Vector skin only
- * true = use an icon search button
- * false = use Go & Search buttons
- */
-$wgVectorUseSimpleSearch = false;
-
-/**
- * Watch and unwatch as an icon rather than a link for Vector skin only
- * true = use an icon watch/unwatch button
- * false = use watch/unwatch text link
- */
-$wgVectorUseIconWatch = false;
-
-/**
- * Add extra stylesheets for Vector - This is only being used so that we can play around with different options while
- * keeping our CSS code in the SVN and not having to change the main Vector styles. This will probably go away later on.
- * null = add no extra styles
- * array = list of style paths relative to skins/vector/
- */
-$wgVectorExtraStyles = null;
-
-/**
- * Preprocessor caching threshold
- */
-$wgPreprocessorCacheThreshold = 1000;
-
-/**
- * Allow filtering by change tag in recentchanges, history, etc
- * Has no effect if no tags are defined in valid_tag.
- */
-$wgUseTagFilter = true;
-
-/**
* Allow redirection to another page when a user logs in.
* To enable, set to a string like 'Main Page'
*/
$wgRedirectOnLogin = null;
/**
- * Characters to prevent during new account creations.
- * This is used in a regular expression character class during
- * registration (regex metacharacters like / are escaped).
- */
-$wgInvalidUsernameCharacters = '@';
-
-/**
- * Character used as a delimiter when testing for interwiki userrights
- * (In Special:UserRights, it is possible to modify users on different
- * databases if the delimiter is used, e.g. Someuser@enwiki).
- *
- * It is recommended that you have this delimiter in
- * $wgInvalidUsernameCharacters above, or you will not be able to
- * modify the user rights of those users via Special:UserRights
- */
-$wgUserrightsInterwikiDelimiter = '@';
-
-/**
* Configuration for processing pool control, for use in high-traffic wikis.
* An implementation is provided in the PoolCounter extension.
*
@@ -4248,112 +5280,30 @@ $wgUserrightsInterwikiDelimiter = '@';
* The remaining elements are passed through to the class as constructor
* parameters. Example:
*
- * $wgPoolCounterConf = array( 'Article::view' => array(
+ * $wgPoolCounterConf = array( 'ArticleView' => array(
* 'class' => 'PoolCounter_Client',
+ * 'timeout' => 15, // wait timeout in seconds
+ * 'workers' => 5, // maximum number of active threads in each pool
+ * 'maxqueue' => 50, // maximum number of total threads in each pool
* ... any extension-specific options...
* );
*/
$wgPoolCounterConf = null;
/**
- * Use some particular type of external authentication. The specific
- * authentication module you use will normally require some extra settings to
- * be specified.
- *
- * null indicates no external authentication is to be used. Otherwise,
- * $wgExternalAuthType must be the name of a non-abstract class that extends
- * ExternalUser.
- *
- * Core authentication modules can be found in includes/extauth/.
- */
-$wgExternalAuthType = null;
-
-/**
- * Configuration for the external authentication. This may include arbitrary
- * keys that depend on the authentication mechanism. For instance,
- * authentication against another web app might require that the database login
- * info be provided. Check the file where your auth mechanism is defined for
- * info on what to put here.
- */
-$wgExternalAuthConfig = array();
-
-/**
- * When should we automatically create local accounts when external accounts
- * already exist, if using ExternalAuth? Can have three values: 'never',
- * 'login', 'view'. 'view' requires the external database to support cookies,
- * and implies 'login'.
- *
- * TODO: Implement 'view' (currently behaves like 'login').
- */
-$wgAutocreatePolicy = 'login';
-
-/**
- * Policies for how each preference is allowed to be changed, in the presence
- * of external authentication. The keys are preference keys, e.g., 'password'
- * or 'emailaddress' (see Preferences.php et al.). The value can be one of the
- * following:
- *
- * - local: Allow changes to this pref through the wiki interface but only
- * apply them locally (default).
- * - semiglobal: Allow changes through the wiki interface and try to apply them
- * to the foreign database, but continue on anyway if that fails.
- * - global: Allow changes through the wiki interface, but only let them go
- * through if they successfully update the foreign database.
- * - message: Allow no local changes for linked accounts; replace the change
- * form with a message provided by the auth plugin, telling the user how to
- * change the setting externally (maybe providing a link, etc.). If the auth
- * plugin provides no message for this preference, hide it entirely.
- *
- * Accounts that are not linked to an external account are never affected by
- * this setting. You may want to look at $wgHiddenPrefs instead.
- * $wgHiddenPrefs supersedes this option.
- *
- * TODO: Implement message, global.
- */
-$wgAllowPrefChange = array();
-
-
-/**
- * Settings for incoming cross-site AJAX requests:
- * Newer browsers support cross-site AJAX when the target resource allows requests
- * from the origin domain by the Access-Control-Allow-Origin header.
- * This is currently only used by the API (requests to api.php)
- * $wgCrossSiteAJAXdomains can be set using a wildcard syntax:
- *
- * '*' matches any number of characters
- * '?' matches any 1 character
- *
- * Example:
- $wgCrossSiteAJAXdomains = array(
- 'www.mediawiki.org',
- '*.wikipedia.org',
- '*.wikimedia.org',
- '*.wiktionary.org',
- );
- *
- */
-$wgCrossSiteAJAXdomains = array();
-
-/**
- * Domains that should not be allowed to make AJAX requests,
- * even if they match one of the domains allowed by $wgCrossSiteAJAXdomains
- * Uses the same syntax as $wgCrossSiteAJAXdomains
- */
-
-$wgCrossSiteAJAXdomainExceptions = array();
-
-/**
- * The minimum amount of memory that MediaWiki "needs"; MediaWiki will try to raise PHP's memory limit if it's below this amount.
- */
-$wgMemoryLimit = "50M";
-
-/**
* To disable file delete/restore temporarily
*/
$wgUploadMaintenance = false;
/**
- * Use old names for change_tags indices.
+ * Allows running of selenium tests via maintenance/tests/RunSeleniumTests.php
*/
-$wgOldChangeTagsIndex = false;
+$wgEnableSelenium = false;
+$wgSeleniumTestConfigs = array();
+$wgSeleniumConfigFile = null;
+/**
+ * For really cool vim folding this needs to be at the end:
+ * vim: foldmarker=@{,@} foldmethod=marker
+ * @}
+ */
diff --git a/includes/Defines.php b/includes/Defines.php
index 7be569af..64197d9c 100644
--- a/includes/Defines.php
+++ b/includes/Defines.php
@@ -9,7 +9,7 @@
*/
define( 'MW_SPECIALPAGE_VERSION', 2 );
-/**#@+
+/**@{
* Database related constants
*/
define( 'DBO_DEBUG', 1 );
@@ -19,27 +19,31 @@ define( 'DBO_TRX', 8 );
define( 'DBO_DEFAULT', 16 );
define( 'DBO_PERSISTENT', 32 );
define( 'DBO_SYSDBA', 64 ); //for oracle maintenance
-/**#@-*/
+define( 'DBO_DDLMODE', 128 ); // when using schema files: mostly for Oracle
+/**@}*/
-# Valid database indexes
-# Operation-based indexes
+/**@{
+ * Valid database indexes
+ * Operation-based indexes
+ */
define( 'DB_SLAVE', -1 ); # Read from the slave (or only server)
define( 'DB_MASTER', -2 ); # Write to master (or only server)
define( 'DB_LAST', -3 ); # Whatever database was used last
+/**@}*/
# Obsolete aliases
define( 'DB_READ', -1 );
define( 'DB_WRITE', -2 );
-/**#@+
+/**@{
* Virtual namespaces; don't appear in the page database
*/
-define('NS_MEDIA', -2);
-define('NS_SPECIAL', -1);
-/**#@-*/
+define( 'NS_MEDIA', -2 );
+define( 'NS_SPECIAL', -1 );
+/**@}*/
-/**#@+
+/**@{
* Real namespaces
*
* Number 100 and beyond are reserved for custom namespaces;
@@ -47,22 +51,23 @@ define('NS_SPECIAL', -1);
* DO NOT Change integer values as they are most probably hardcoded everywhere
* see bug #696 which talked about that.
*/
-define('NS_MAIN', 0);
-define('NS_TALK', 1);
-define('NS_USER', 2);
-define('NS_USER_TALK', 3);
-define('NS_PROJECT', 4);
-define('NS_PROJECT_TALK', 5);
-define('NS_FILE', 6);
-define('NS_FILE_TALK', 7);
-define('NS_MEDIAWIKI', 8);
-define('NS_MEDIAWIKI_TALK', 9);
-define('NS_TEMPLATE', 10);
-define('NS_TEMPLATE_TALK', 11);
-define('NS_HELP', 12);
-define('NS_HELP_TALK', 13);
-define('NS_CATEGORY', 14);
-define('NS_CATEGORY_TALK', 15);
+define( 'NS_MAIN', 0 );
+define( 'NS_TALK', 1 );
+define( 'NS_USER', 2 );
+define( 'NS_USER_TALK', 3 );
+define( 'NS_PROJECT', 4 );
+define( 'NS_PROJECT_TALK', 5 );
+define( 'NS_FILE', 6 );
+define( 'NS_FILE_TALK', 7 );
+define( 'NS_MEDIAWIKI', 8 );
+define( 'NS_MEDIAWIKI_TALK', 9 );
+define( 'NS_TEMPLATE', 10 );
+define( 'NS_TEMPLATE_TALK', 11 );
+define( 'NS_HELP', 12 );
+define( 'NS_HELP_TALK', 13 );
+define( 'NS_CATEGORY', 14 );
+define( 'NS_CATEGORY_TALK', 15 );
+
/**
* NS_IMAGE and NS_IMAGE_TALK are the pre-v1.14 names for NS_FILE and
* NS_FILE_TALK respectively, and are kept for compatibility.
@@ -71,9 +76,9 @@ define('NS_CATEGORY_TALK', 15);
* versions, either stick to the old names or define the new constants
* yourself, if they're not defined already.
*/
-define('NS_IMAGE', NS_FILE);
-define('NS_IMAGE_TALK', NS_FILE_TALK);
-/**#@-*/
+define( 'NS_IMAGE', NS_FILE );
+define( 'NS_IMAGE_TALK', NS_FILE_TALK );
+/**@}*/
/**
* Available feeds objects
@@ -85,7 +90,7 @@ $wgFeedClasses = array(
'atom' => 'AtomFeed',
);
-/**#@+
+/**@{
* Maths constants
*/
define( 'MW_MATH_PNG', 0 );
@@ -94,9 +99,9 @@ define( 'MW_MATH_HTML', 2 );
define( 'MW_MATH_SOURCE', 3 );
define( 'MW_MATH_MODERN', 4 );
define( 'MW_MATH_MATHML', 5 );
-/**#@-*/
+/**@}*/
-/**#@+
+/**@{
* Cache type
*/
define( 'CACHE_ANYTHING', -1 ); // Use anything, as long as it works
@@ -105,11 +110,9 @@ define( 'CACHE_DB', 1 ); // Store cache objects in the DB
define( 'CACHE_MEMCACHED', 2 ); // MemCached, must specify servers in $wgMemCacheServers
define( 'CACHE_ACCEL', 3 ); // eAccelerator
define( 'CACHE_DBA', 4 ); // Use PHP's DBA extension to store in a DBM-style database
-/**#@-*/
-
-
+/**@}*/
-/**#@+
+/**@{
* Media types.
* This defines constants for the value returned by Image::getMediaType()
*/
@@ -123,18 +126,18 @@ define( 'MEDIATYPE_OFFICE', 'OFFICE' ); // Office Documents, Spreadshee
define( 'MEDIATYPE_TEXT', 'TEXT' ); // Plain text (possibly containing program code or scripts)
define( 'MEDIATYPE_EXECUTABLE', 'EXECUTABLE' ); // binary executable
define( 'MEDIATYPE_ARCHIVE', 'ARCHIVE' ); // archive file (zip, tar, etc)
-/**#@-*/
+/**@}*/
-/**#@+
+/**@{
* Antivirus result codes, for use in $wgAntivirusSetup.
*/
define( 'AV_NO_VIRUS', 0 ); #scan ok, no virus found
define( 'AV_VIRUS_FOUND', 1 ); #virus found!
define( 'AV_SCAN_ABORTED', -1 ); #scan aborted, the file is probably imune
define( 'AV_SCAN_FAILED', false ); #scan failed (scanner not found or error in scanner)
-/**#@-*/
+/**@}*/
-/**#@+
+/**@{
* Anti-lock flags
* See DefaultSettings.php for a description
*/
@@ -142,9 +145,9 @@ define( 'ALF_PRELOAD_LINKS', 1 );
define( 'ALF_PRELOAD_EXISTENCE', 2 );
define( 'ALF_NO_LINK_LOCK', 4 );
define( 'ALF_NO_BLOCK_LOCK', 8 );
-/**#@-*/
+/**@}*/
-/**#@+
+/**@{
* Date format selectors; used in user preference storage and by
* Language::date() and co.
*/
@@ -158,9 +161,9 @@ define( 'MW_DATE_MDY', 'mdy' );
define( 'MW_DATE_DMY', 'dmy' );
define( 'MW_DATE_YMD', 'ymd' );
define( 'MW_DATE_ISO', 'ISO 8601' );
-/**#@-*/
+/**@}*/
-/**#@+
+/**@{
* RecentChange type identifiers
* This may be obsolete; log items are now used for moves?
*/
@@ -169,9 +172,9 @@ define( 'RC_NEW', 1);
define( 'RC_MOVE', 2);
define( 'RC_LOG', 3);
define( 'RC_MOVE_OVER_REDIRECT', 4);
-/**#@-*/
+/**@}*/
-/**#@+
+/**@{
* Article edit flags
*/
define( 'EDIT_NEW', 1 );
@@ -181,9 +184,9 @@ define( 'EDIT_SUPPRESS_RC', 8 );
define( 'EDIT_FORCE_BOT', 16 );
define( 'EDIT_DEFER_UPDATES', 32 );
define( 'EDIT_AUTOSUMMARY', 64 );
-/**#@-*/
+/**@}*/
-/**
+/**@{
* Flags for Database::makeList()
* These are also available as Database class constants
*/
@@ -192,36 +195,57 @@ define( 'LIST_AND', 1 );
define( 'LIST_SET', 2 );
define( 'LIST_NAMES', 3);
define( 'LIST_OR', 4);
+define( 'LIST_SET_PREPARED', 8); // List of (?, ?, ?) for DatabaseIbm_db2
+/**@}*/
/**
* Unicode and normalisation related
*/
require_once dirname(__FILE__).'/normal/UtfNormalDefines.php';
-# Hook support constants
+/**@{
+ * Hook support constants
+ */
define( 'MW_SUPPORTS_EDITFILTERMERGED', 1 );
define( 'MW_SUPPORTS_PARSERFIRSTCALLINIT', 1 );
define( 'MW_SUPPORTS_LOCALISATIONCACHE', 1 );
+/**@}*/
+
+/** Support for $wgResourceModules */
+define( 'MW_SUPPORTS_RESOURCE_MODULES', 1 );
-# Allowed values for Parser::$mOutputType
-# Parameter to Parser::startExternalParse().
+/**@{
+ * Allowed values for Parser::$mOutputType
+ * Parameter to Parser::startExternalParse().
+ */
define( 'OT_HTML', 1 );
define( 'OT_WIKI', 2 );
define( 'OT_PREPROCESS', 3 );
define( 'OT_MSG' , 3 ); // b/c alias for OT_PREPROCESS
+define( 'OT_PLAIN', 4 );
+/**@}*/
-# Flags for Parser::setFunctionHook
+/**@{
+ * Flags for Parser::setFunctionHook
+ */
define( 'SFH_NO_HASH', 1 );
define( 'SFH_OBJECT_ARGS', 2 );
+/**@}*/
-# Flags for Parser::setLinkHook
+/**
+ * Flags for Parser::setLinkHook
+ */
define( 'SLH_PATTERN', 1 );
-# Flags for Parser::replaceLinkHolders
+/**
+ * Flags for Parser::replaceLinkHolders
+ */
define( 'RLH_FOR_UPDATE', 1 );
-# Autopromote conditions (must be here and not in Autopromote.php, so that
-# they're loaded for DefaultSettings.php before AutoLoader.php)
+/**@{
+ * Autopromote conditions (must be here and not in Autopromote.php, so that
+ * they're loaded for DefaultSettings.php before AutoLoader.php)
+ */
define( 'APCOND_EDITCOUNT', 1 );
define( 'APCOND_AGE', 2 );
define( 'APCOND_EMAILCONFIRMED', 3 );
@@ -230,3 +254,4 @@ define( 'APCOND_ISIP', 5 );
define( 'APCOND_IPINRANGE', 6 );
define( 'APCOND_AGE_FROM_EDIT', 7 );
define( 'APCOND_BLOCKED', 8 );
+/**@}*/
diff --git a/includes/DjVuImage.php b/includes/DjVuImage.php
index 75df0fd5..cccb070a 100644
--- a/includes/DjVuImage.php
+++ b/includes/DjVuImage.php
@@ -1,8 +1,8 @@
<?php
-
/**
+ * DjVu image handler
*
- * Copyright (C) 2006 Brion Vibber <brion@pobox.com>
+ * Copyright © 2006 Brion Vibber <brion@pobox.com>
* http://www.mediawiki.org/
*
* This program is free software; you can redistribute it and/or modify
@@ -20,6 +20,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
+ * @file
*/
/**
@@ -225,6 +226,8 @@ class DjVuImage {
*/
function retrieveMetaData() {
global $wgDjvuToXML, $wgDjvuDump, $wgDjvuTxt;
+ wfProfileIn( __METHOD__ );
+
if ( isset( $wgDjvuDump ) ) {
# djvudump is faster as of version 3.5
# http://sourceforge.net/tracker/index.php?func=detail&aid=1704049&group_id=32953&atid=406583
@@ -247,28 +250,38 @@ class DjVuImage {
wfProfileIn( 'djvutxt' );
$cmd = wfEscapeShellArg( $wgDjvuTxt ) . ' --detail=page ' . wfEscapeShellArg( $this->mFilename ) ;
wfDebug( __METHOD__.": $cmd\n" );
+ $retval = '';
$txt = wfShellExec( $cmd, $retval );
wfProfileOut( 'djvutxt' );
if( $retval == 0) {
- # Get rid of invalid UTF-8, strip control characters
- if( is_callable( 'iconv' ) ) {
- wfSuppressWarnings();
- $txt = iconv( "UTF-8","UTF-8//IGNORE", $txt );
- wfRestoreWarnings();
- } else {
- $txt = UtfNormal::cleanUp( $txt );
- }
+ # Strip some control characters
$txt = preg_replace( "/[\013\035\037]/", "", $txt );
- $txt = htmlspecialchars($txt);
- $txt = preg_replace( "/\((page\s[\d-]*\s[\d-]*\s[\d-]*\s[\d-]*\s*\&quot;([^<]*?)\&quot;\s*|)\)/s", "<PAGE value=\"$2\" />", $txt );
+ $reg = <<<EOR
+ /\(page\s[\d-]*\s[\d-]*\s[\d-]*\s[\d-]*\s*"
+ ((?> # Text to match is composed of atoms of either:
+ \\\\. # - any escaped character
+ | # - any character different from " and \
+ [^"\\\\]+
+ )*?)
+ "\s*\)
+ | # Or page can be empty ; in this case, djvutxt dumps ()
+ \(\s*()\)/sx
+EOR;
+ $txt = preg_replace_callback( $reg, array( $this, 'pageTextCallback' ), $txt );
$txt = "<DjVuTxt>\n<HEAD></HEAD>\n<BODY>\n" . $txt . "</BODY>\n</DjVuTxt>\n";
$xml = preg_replace( "/<DjVuXML>/", "<mw-djvu><DjVuXML>", $xml );
$xml = $xml . $txt. '</mw-djvu>' ;
}
}
+ wfProfileOut( __METHOD__ );
return $xml;
}
+ function pageTextCallback( $matches ) {
+ # Get rid of invalid UTF-8, strip control characters
+ return '<PAGE value="' . htmlspecialchars( UtfNormal::cleanUp( $matches[1] ) ) . '" />';
+ }
+
/**
* Hack to temporarily work around djvutoxml bug
*/
diff --git a/includes/EditPage.php b/includes/EditPage.php
index b4cbf0de..3e85ad10 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -96,7 +96,7 @@ class EditPage {
* @todo document
* @param $article
*/
- function EditPage( $article ) {
+ function __construct( $article ) {
$this->mArticle =& $article;
$this->mTitle = $article->getTitle();
$this->action = 'submit';
@@ -129,21 +129,19 @@ class EditPage {
wfProfileIn( __METHOD__ );
# Get variables from query string :P
$section = $wgRequest->getVal( 'section' );
-
- $preload = $wgRequest->getVal( 'preload',
+
+ $preload = $wgRequest->getVal( 'preload',
// Custom preload text for new sections
$section === 'new' ? 'MediaWiki:addsection-preload' : '' );
$undoafter = $wgRequest->getVal( 'undoafter' );
$undo = $wgRequest->getVal( 'undo' );
- $text = '';
// For message page not locally set, use the i18n message.
// For other non-existent articles, use preload text if any.
if ( !$this->mTitle->exists() ) {
if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {