From 38c7f444e1c13327e203ce4e2890826782b39876 Mon Sep 17 00:00:00 2001 From: jeroendedauw Date: Mon, 27 Aug 2012 21:03:15 +0200 Subject: [PATCH] Use __DIR__ instead of dirname( __FILE__ ) We can now do this since we finally switched to PHP 5.3 for MW 1.20 and get rid of the silly dirname(__FILE__) stuff :) Change-Id: Id9b2c9cd2e678197aa81c78adced5d1d31ff57b1 --- RELEASE-NOTES-1.20 | 1 + api.php | 2 +- docs/magicword.txt | 4 +- img_auth.php | 2 +- includes/CryptRand.php | 4 +- includes/DefaultSettings.php | 2 +- includes/SpecialPage.php | 2 +- includes/WebStart.php | 2 +- includes/installer/Installer.php | 4 +- includes/installer/WebInstaller.php | 2 +- includes/installer/WebInstallerOutput.php | 2 +- includes/installer/WebInstallerPage.php | 2 +- includes/json/FormatJson.php | 2 +- index.php | 2 +- languages/Language.php | 2 +- languages/classes/LanguageGan.php | 6 +- languages/classes/LanguageIu.php | 2 +- languages/classes/LanguageKk.php | 4 +- languages/classes/LanguageKu.php | 4 +- languages/classes/LanguageShi.php | 2 +- languages/classes/LanguageSr.php | 6 +- languages/classes/LanguageTg.php | 2 +- languages/classes/LanguageUz.php | 2 +- languages/classes/LanguageZh.php | 6 +- load.php | 2 +- maintenance/Maintenance.php | 10 ++-- maintenance/archives/upgradeLogging.php | 2 +- maintenance/attachLatest.php | 2 +- maintenance/backupTextPass.inc | 2 +- maintenance/benchmarks/Benchmarker.php | 2 +- maintenance/benchmarks/bench_HTTP_HTTPS.php | 2 +- .../benchmarks/bench_delete_truncate.php | 2 +- maintenance/benchmarks/bench_if_switch.php | 2 +- .../benchmarks/bench_strtr_str_replace.php | 2 +- .../benchmarks/bench_utf8_title_check.php | 60 +++++++++---------- maintenance/benchmarks/bench_wfIsWindows.php | 2 +- maintenance/benchmarks/benchmarkHooks.php | 2 +- maintenance/benchmarks/benchmarkPurge.php | 2 +- maintenance/cdb.php | 2 +- maintenance/changePassword.php | 2 +- maintenance/checkAutoLoader.php | 2 +- maintenance/checkBadRedirects.php | 2 +- maintenance/checkImages.php | 2 +- maintenance/checkSyntax.php | 2 +- maintenance/checkUsernames.php | 2 +- maintenance/cleanupAncientTables.php | 2 +- maintenance/cleanupCaps.php | 2 +- maintenance/cleanupImages.php | 2 +- maintenance/cleanupPreferences.php | 2 +- maintenance/cleanupRemovedModules.php | 2 +- maintenance/cleanupSpam.php | 2 +- maintenance/cleanupTable.inc | 2 +- maintenance/cleanupTitles.php | 2 +- maintenance/cleanupUploadStash.php | 2 +- maintenance/cleanupWatchlist.php | 2 +- maintenance/clear_interwiki_cache.php | 2 +- maintenance/clear_stats.php | 2 +- maintenance/commandLine.inc | 2 +- maintenance/compareParsers.php | 2 +- maintenance/convertLinks.php | 2 +- maintenance/convertUserOptions.php | 2 +- maintenance/copyFileBackend.php | 2 +- maintenance/createAndPromote.php | 2 +- maintenance/deleteArchivedFiles.php | 4 +- maintenance/deleteArchivedRevisions.php | 4 +- maintenance/deleteBatch.php | 2 +- maintenance/deleteDefaultMessages.php | 2 +- maintenance/deleteImageMemcached.php | 2 +- maintenance/deleteOldRevisions.php | 2 +- maintenance/deleteOrphanedRevisions.php | 2 +- maintenance/deleteRevision.php | 2 +- maintenance/deleteSelfExternals.php | 2 +- maintenance/dumpBackup.php | 4 +- maintenance/dumpIterator.php | 2 +- maintenance/dumpLinks.php | 2 +- maintenance/dumpSisterSites.php | 2 +- maintenance/dumpTextPass.php | 4 +- maintenance/dumpUploads.php | 2 +- maintenance/edit.php | 2 +- maintenance/eval.php | 2 +- maintenance/fetchText.php | 2 +- maintenance/fileOpPerfTest.php | 2 +- maintenance/findHooks.php | 2 +- maintenance/fixDoubleRedirects.php | 2 +- maintenance/fixExtLinksProtocolRelative.php | 2 +- maintenance/fixSlaveDesync.php | 2 +- maintenance/fixTimestamps.php | 2 +- maintenance/fixUserRegistration.php | 2 +- maintenance/formatInstallDoc.php | 2 +- maintenance/fuzz-tester.php | 2 +- maintenance/generateSitemap.php | 2 +- maintenance/getLagTimes.php | 2 +- maintenance/getSlaveServer.php | 2 +- maintenance/getText.php | 2 +- maintenance/hiphop/make | 6 +- maintenance/hiphop/run-server | 6 +- maintenance/importDump.php | 2 +- maintenance/importImages.php | 4 +- maintenance/importSiteScripts.php | 2 +- maintenance/importTextFile.php | 2 +- maintenance/initEditCount.php | 2 +- maintenance/initStats.php | 2 +- maintenance/install.php | 2 +- maintenance/jsparse.php | 2 +- maintenance/lag.php | 2 +- maintenance/language/alltrans.php | 2 +- maintenance/language/checkDupeMessages.php | 4 +- maintenance/language/checkExtensions.php | 2 +- maintenance/language/checkLanguage.php | 2 +- maintenance/language/countMessages.php | 2 +- maintenance/language/date-formats.php | 2 +- maintenance/language/digit2html.php | 2 +- maintenance/language/dumpMessages.php | 2 +- .../language/generateCollationData.php | 2 +- .../language/generateNormalizerData.php | 4 +- maintenance/language/langmemusage.php | 4 +- maintenance/language/rebuildLanguage.php | 2 +- maintenance/language/transstat.php | 4 +- maintenance/language/validate.php | 2 +- maintenance/language/writeMessagesArray.inc | 2 +- maintenance/mcc.php | 2 +- maintenance/mctest.php | 2 +- maintenance/mergeMessageFileList.php | 4 +- maintenance/migrateUserGroup.php | 2 +- maintenance/minify.php | 2 +- maintenance/moveBatch.php | 2 +- maintenance/mwdocgen.php | 2 +- maintenance/namespaceDupes.php | 2 +- maintenance/nextJobDB.php | 2 +- maintenance/nukeNS.php | 2 +- maintenance/nukePage.php | 2 +- maintenance/oracle/alterSharedConstraints.php | 2 +- maintenance/orphans.php | 2 +- maintenance/patchSql.php | 2 +- maintenance/populateCategory.php | 2 +- maintenance/populateImageSha1.php | 2 +- maintenance/populateLogSearch.php | 2 +- maintenance/populateLogUsertext.php | 2 +- maintenance/populateParentId.php | 2 +- maintenance/populateRevisionLength.php | 2 +- maintenance/populateRevisionSha1.php | 2 +- maintenance/preprocessDump.php | 2 +- maintenance/preprocessorFuzzTest.php | 2 +- maintenance/protect.php | 2 +- maintenance/pruneFileCache.php | 2 +- maintenance/purgeDeletedFiles.php | 2 +- maintenance/purgeList.php | 2 +- maintenance/purgeOldText.php | 2 +- maintenance/purgeParserCache.php | 2 +- maintenance/purgeStaleMemcachedText.php | 2 +- maintenance/reassignEdits.php | 2 +- maintenance/rebuildFileCache.php | 2 +- maintenance/rebuildImages.php | 2 +- maintenance/rebuildLocalisationCache.php | 2 +- maintenance/rebuildall.php | 2 +- maintenance/rebuildmessages.php | 2 +- maintenance/rebuildrecentchanges.php | 2 +- maintenance/rebuildtextindex.php | 2 +- maintenance/refreshImageCount.php | 2 +- maintenance/refreshImageMetadata.php | 2 +- maintenance/refreshLinks.php | 2 +- maintenance/removeUnusedAccounts.php | 2 +- maintenance/renameDbPrefix.php | 2 +- maintenance/renderDump.php | 2 +- maintenance/resetUserTokens.php | 2 +- maintenance/rollbackEdits.php | 2 +- maintenance/runBatchedQuery.php | 2 +- maintenance/runJobs.php | 2 +- maintenance/showJobs.php | 2 +- maintenance/showStats.php | 2 +- maintenance/sql.php | 2 +- maintenance/sqlite.php | 2 +- maintenance/stats.php | 2 +- maintenance/storage/checkStorage.php | 2 +- maintenance/storage/compressOld.php | 2 +- maintenance/storage/dumpRev.php | 2 +- maintenance/storage/fixBug20757.php | 2 +- maintenance/storage/moveToExternal.php | 4 +- maintenance/storage/orphanStats.php | 2 +- maintenance/storage/recompressTracked.php | 2 +- maintenance/storage/resolveStubs.php | 2 +- maintenance/storage/storageTypeStats.php | 2 +- maintenance/storage/testCompression.php | 2 +- maintenance/storage/trackBlobs.php | 4 +- maintenance/syncFileBackend.php | 2 +- maintenance/undelete.php | 2 +- maintenance/update.php | 2 +- maintenance/updateArticleCount.php | 2 +- maintenance/updateCollation.php | 2 +- maintenance/updateDoubleWidthSearch.php | 2 +- maintenance/updateRestrictions.php | 2 +- maintenance/updateSearchIndex.php | 2 +- maintenance/updateSpecialPages.php | 2 +- maintenance/upgrade1_5.php | 2 +- maintenance/userOptions.inc | 2 +- maintenance/waitForSlave.php | 2 +- mw-config/index.php | 4 +- profileinfo.php | 2 +- redirect.php | 2 +- tests/RunSeleniumTests.php | 8 +-- tests/TestsAutoLoader.php | 2 +- .../jasmine/spec_makers/makeJqueryMsgSpec.php | 2 +- tests/parserTests.php | 2 +- tests/phpunit/MediaWikiPHPUnitCommand.php | 2 +- tests/phpunit/bootstrap.php | 2 +- .../includes/TemplateCategoriesTest.php | 2 +- .../includes/ZipDirectoryReaderTest.php | 2 +- .../includes/api/RandomImageGenerator.php | 2 +- .../includes/api/generateRandomImages.php | 4 +- tests/phpunit/includes/db/TestORMRowTest.php | 2 +- .../media/BitmapMetadataHandlerTest.php | 2 +- .../includes/media/ExifRotationTest.php | 2 +- tests/phpunit/includes/media/ExifTest.php | 2 +- .../includes/media/FormatMetadataTest.php | 2 +- .../media/GIFMetadataExtractorTest.php | 2 +- tests/phpunit/includes/media/GIFTest.php | 2 +- .../media/JpegMetadataExtractorTest.php | 2 +- tests/phpunit/includes/media/JpegTest.php | 2 +- .../media/PNGMetadataExtractorTest.php | 2 +- tests/phpunit/includes/media/PNGTest.php | 2 +- .../media/SVGMetadataExtractorTest.php | 4 +- tests/phpunit/includes/media/TiffTest.php | 2 +- tests/phpunit/includes/media/XMPTest.php | 8 +-- .../includes/parser/MediaWikiParserTest.php | 2 +- .../includes/parser/PreprocessorTest.php | 4 +- .../includes/upload/UploadStashTest.php | 2 +- tests/phpunit/languages/LanguageSrTest.php | 2 +- tests/phpunit/languages/LanguageUzTest.php | 2 +- .../maintenance/backupPrefetchTest.php | 2 +- .../maintenance/backupTextPassTest.php | 2 +- tests/phpunit/maintenance/fetchTextTest.php | 2 +- .../maintenance/getSlaveServerTest.php | 2 +- tests/phpunit/phpunit.php | 2 +- .../phpunit/suites/UploadFromUrlTestSuite.php | 2 +- ...iaWikiDifferentDatabaseAccountTestCase.php | 2 +- ...ediaWikiDifferntDatabasePrefixTestCase.php | 2 +- ...ikiErrorsConnectToDatabasePageTestCase.php | 2 +- .../MediaWikiErrorsNamepageTestCase.php | 2 +- .../MediaWikiHelpFieldHintTestCase.php | 2 +- .../MediaWikiInstallationCommonFunction.php | 2 +- .../installer/MediaWikiInstallerTestSuite.php | 26 ++++---- .../suites/MediawikiCoreSmokeTestCase.php | 2 +- .../suites/MyContributionsTestCase.php | 2 +- tests/selenium/suites/MyWatchListTestCase.php | 2 +- thumb.php | 2 +- thumb_handler.php | 2 +- 246 files changed, 328 insertions(+), 327 deletions(-) diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index 92f050e68e..e06dc7d437 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -293,6 +293,7 @@ changes to languages because of Bugzilla reports. * Deprecated mw.user.anonymous in favour of mw.user.isAnon. * Deprecated DatabaseBase functions newFromParams(), newFromType(), set(), quote_ident(), and escapeLike() were removed. +* Use of __DIR__ instead of dirname( __FILE__ ). == Compatibility == diff --git a/api.php b/api.php index 9e1f5dd334..ad420ff55a 100644 --- a/api.php +++ b/api.php @@ -43,7 +43,7 @@ if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5. if ( isset( $_SERVER['MW_COMPILED'] ) ) { require ( 'core/includes/WebStart.php' ); } else { - require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); + require ( __DIR__ . '/includes/WebStart.php' ); } wfProfileIn( 'api.php' ); diff --git a/docs/magicword.txt b/docs/magicword.txt index ceae026295..1d9bf7d466 100644 --- a/docs/magicword.txt +++ b/docs/magicword.txt @@ -40,7 +40,7 @@ $magicWords['es'] = array( ); ---- -$wgExtensionMessagesFiles['ExtensionNameMagic'] = dirname( __FILE__ ) . '/ExtensionName.i18n.magic.php'; +$wgExtensionMessagesFiles['ExtensionNameMagic'] = __DIR__ . '/ExtensionName.i18n.magic.php'; $wgHooks['MagicWordwgVariableIDs'][] = 'wfAddCustomMagicWordID'; $wgHooks['ParserGetVariableValueSwitch'][] = 'wfGetCustomMagicWordValue'; @@ -74,7 +74,7 @@ $magicWords['es'] = array( ); ---- -$wgExtensionMessagesFiles['ExtensionNameMagic'] = dirname( __FILE__ ) . '/ExtensionName.i18n.magic.php'; +$wgExtensionMessagesFiles['ExtensionNameMagic'] = __DIR__ . '/ExtensionName.i18n.magic.php'; $wgHooks['ParserFirstCallInit'][] = 'wfRegisterCustomMagicWord'; function wfRegisterCustomMagicWord( &$parser ){ diff --git a/img_auth.php b/img_auth.php index 74602f26aa..b3a34955de 100644 --- a/img_auth.php +++ b/img_auth.php @@ -43,7 +43,7 @@ define( 'MW_NO_OUTPUT_COMPRESSION', 1 ); if ( isset( $_SERVER['MW_COMPILED'] ) ) { require ( 'core/includes/WebStart.php' ); } else { - require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); + require ( __DIR__ . '/includes/WebStart.php' ); } wfProfileIn( 'img_auth.php' ); diff --git a/includes/CryptRand.php b/includes/CryptRand.php index bb80eeb3a5..858eebf205 100644 --- a/includes/CryptRand.php +++ b/includes/CryptRand.php @@ -83,8 +83,8 @@ class MWCryptRand { $files[] = __FILE__; // We must also have a parent folder, and with the usual file structure, a grandparent - $files[] = dirname( __FILE__ ); - $files[] = dirname( dirname( __FILE__ ) ); + $files[] = __DIR__; + $files[] = dirname( __DIR__ ); // The config file is likely the most often edited file we know should be around // so include its stat info into the state. diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 3ea35d53fc..c58746b5ec 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2760,7 +2760,7 @@ $wgShowRollbackEditCount = 10; * 'scripts' => 'myExtension.js', * 'styles' => 'myExtension.css', * 'dependencies' => array( 'jquery.cookie', 'jquery.tabIndex' ), - * 'localBasePath' => dirname( __FILE__ ), + * 'localBasePath' => __DIR__, * 'remoteExtPath' => 'MyExtension', * ); * @endcode diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index e2932e1254..2e5e02b0fc 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -351,7 +351,7 @@ class SpecialPage { $this->mFunction = $function; } if ( $file === 'default' ) { - $this->mFile = dirname( __FILE__ ) . "/specials/Special$name.php"; + $this->mFile = __DIR__ . "/specials/Special$name.php"; } else { $this->mFile = $file; } diff --git a/includes/WebStart.php b/includes/WebStart.php index 17f8216bab..01c5eea846 100644 --- a/includes/WebStart.php +++ b/includes/WebStart.php @@ -81,7 +81,7 @@ define( 'MEDIAWIKI', true ); # Full path to working directory. # Makes it possible to for example to have effective exclude path in apc. # Also doesn't break installations using symlinked includes, like -# dirname( __FILE__ ) would do. +# __DIR__ would do. $IP = getenv( 'MW_INSTALL_PATH' ); if ( $IP === false ) { $IP = realpath( '.' ); diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index caf7b69647..ac5dbd747c 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -339,7 +339,7 @@ abstract class Installer { // Load the installer's i18n file. $wgExtensionMessagesFiles['MediawikiInstaller'] = - dirname( __FILE__ ) . '/Installer.i18n.php'; + __DIR__ . '/Installer.i18n.php'; // Having a user with id = 0 safeguards us from DB access via User::loadOptions(). $wgUser = User::newFromId( 0 ); @@ -935,7 +935,7 @@ abstract class Installer { */ protected function envCheckPath() { global $IP; - $IP = dirname( dirname( dirname( __FILE__ ) ) ); + $IP = dirname( dirname( __DIR__ ) ); $this->setVar( 'IP', $IP ); $this->showMessage( 'config-using-uri', $this->getVar( 'wgServer' ), $this->getVar( 'wgScriptPath' ) ); diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index e1c5c29961..0d5ea576a6 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -362,7 +362,7 @@ class WebInstaller extends Installer { $url = $m[1]; } return md5( serialize( array( - 'local path' => dirname( dirname( __FILE__ ) ), + 'local path' => dirname( __DIR__ ), 'url' => $url, 'version' => $GLOBALS['wgVersion'] ) ) ); diff --git a/includes/installer/WebInstallerOutput.php b/includes/installer/WebInstallerOutput.php index 9a516a65b7..e440c6bdb7 100644 --- a/includes/installer/WebInstallerOutput.php +++ b/includes/installer/WebInstallerOutput.php @@ -108,7 +108,7 @@ class WebInstallerOutput { * @return String */ public function getCSS( $dir ) { - $skinDir = dirname( dirname( dirname( __FILE__ ) ) ) . '/skins'; + $skinDir = dirname( dirname( __DIR__ ) ) . '/skins'; // All these files will be concatenated in sequence and loaded // as one file. diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index a7ec2dffc6..a193afb714 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -1269,7 +1269,7 @@ abstract class WebInstaller_Document extends WebInstallerPage { } public function getFileContents() { - $file = dirname( __FILE__ ) . '/../../' . $this->getFileName(); + $file = __DIR__ . '/../../' . $this->getFileName(); if( ! file_exists( $file ) ) { return wfMessage( 'config-nofile', $file )->plain(); } diff --git a/includes/json/FormatJson.php b/includes/json/FormatJson.php index aa60fbdcc0..f67700c94f 100644 --- a/includes/json/FormatJson.php +++ b/includes/json/FormatJson.php @@ -20,7 +20,7 @@ * @file */ -require_once dirname( __FILE__ ) . '/Services_JSON.php'; +require_once __DIR__ . '/Services_JSON.php'; /** * JSON formatter wrapper class diff --git a/index.php b/index.php index 201087847a..2ee17f81a4 100644 --- a/index.php +++ b/index.php @@ -51,7 +51,7 @@ if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5. if ( isset( $_SERVER['MW_COMPILED'] ) ) { require ( 'phase3/includes/WebStart.php' ); } else { - require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); + require ( __DIR__ . '/includes/WebStart.php' ); } $mediaWiki = new MediaWiki(); diff --git a/languages/Language.php b/languages/Language.php index 69a72eb068..1edca80469 100644 --- a/languages/Language.php +++ b/languages/Language.php @@ -32,7 +32,7 @@ if ( !defined( 'MEDIAWIKI' ) ) { # Read language names global $wgLanguageNames; -require_once( dirname( __FILE__ ) . '/Names.php' ); +require_once( __DIR__ . '/Names.php' ); if ( function_exists( 'mb_strtoupper' ) ) { mb_internal_encoding( 'UTF-8' ); diff --git a/languages/classes/LanguageGan.php b/languages/classes/LanguageGan.php index 4fd41cf978..14fe92824d 100644 --- a/languages/classes/LanguageGan.php +++ b/languages/classes/LanguageGan.php @@ -21,8 +21,8 @@ * @ingroup Language */ -require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' ); -require_once( dirname( __FILE__ ) . '/LanguageZh.php' ); +require_once( __DIR__ . '/../LanguageConverter.php' ); +require_once( __DIR__ . '/LanguageZh.php' ); /** * @ingroup Language @@ -58,7 +58,7 @@ class GanConverter extends LanguageConverter { } function loadDefaultTables() { - require( dirname( __FILE__ ) . "/../../includes/ZhConversion.php" ); + require( __DIR__ . "/../../includes/ZhConversion.php" ); $this->mTables = array( 'gan-hans' => new ReplacementArray( $zh2Hans ), 'gan-hant' => new ReplacementArray( $zh2Hant ), diff --git a/languages/classes/LanguageIu.php b/languages/classes/LanguageIu.php index 090d626fae..9bac5d73ff 100644 --- a/languages/classes/LanguageIu.php +++ b/languages/classes/LanguageIu.php @@ -21,7 +21,7 @@ * @ingroup Language */ -require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' ); +require_once( __DIR__ . '/../LanguageConverter.php' ); /** * Conversion script between Latin and Syllabics for Inuktitut. diff --git a/languages/classes/LanguageKk.php b/languages/classes/LanguageKk.php index 7eb0b6c009..5cf1afd0ca 100644 --- a/languages/classes/LanguageKk.php +++ b/languages/classes/LanguageKk.php @@ -21,8 +21,8 @@ * @ingroup Language */ -require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' ); -require_once( dirname( __FILE__ ) . '/LanguageKk_cyrl.php' ); +require_once( __DIR__ . '/../LanguageConverter.php' ); +require_once( __DIR__ . '/LanguageKk_cyrl.php' ); define( 'KK_C_UC', 'АӘБВГҒДЕЁЖЗИЙКҚЛМНҢОӨПРСТУҰҮФХҺЦЧШЩЪЫІЬЭЮЯ' ); # Kazakh Cyrillic uppercase define( 'KK_C_LC', 'аәбвгғдеёжзийкқлмнңоөпрстуұүфхһцчшщъыіьэюя' ); # Kazakh Cyrillic lowercase diff --git a/languages/classes/LanguageKu.php b/languages/classes/LanguageKu.php index 18c856442d..02ec648282 100644 --- a/languages/classes/LanguageKu.php +++ b/languages/classes/LanguageKu.php @@ -21,8 +21,8 @@ * @ingroup Language */ -require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' ); -require_once( dirname( __FILE__ ) . '/LanguageKu_ku.php' ); +require_once( __DIR__ . '/../LanguageConverter.php' ); +require_once( __DIR__ . '/LanguageKu_ku.php' ); /** * Kurdish converter routines diff --git a/languages/classes/LanguageShi.php b/languages/classes/LanguageShi.php index ab34440a5e..27c5d64f15 100644 --- a/languages/classes/LanguageShi.php +++ b/languages/classes/LanguageShi.php @@ -21,7 +21,7 @@ * @ingroup Language */ -require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' ); +require_once( __DIR__ . '/../LanguageConverter.php' ); /** * Conversion script between Latin and Tifinagh for Tachelhit. diff --git a/languages/classes/LanguageSr.php b/languages/classes/LanguageSr.php index 26d68531f7..4b799f2838 100644 --- a/languages/classes/LanguageSr.php +++ b/languages/classes/LanguageSr.php @@ -21,9 +21,9 @@ * @ingroup Language */ -require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' ); -require_once( dirname( __FILE__ ) . '/LanguageSr_ec.php' ); -require_once( dirname( __FILE__ ) . '/LanguageSr_el.php' ); +require_once( __DIR__ . '/../LanguageConverter.php' ); +require_once( __DIR__ . '/LanguageSr_ec.php' ); +require_once( __DIR__ . '/LanguageSr_el.php' ); /** * There are two levels of conversion for Serbian: the script level diff --git a/languages/classes/LanguageTg.php b/languages/classes/LanguageTg.php index 90d57617c3..3ec14763c3 100644 --- a/languages/classes/LanguageTg.php +++ b/languages/classes/LanguageTg.php @@ -21,7 +21,7 @@ * @ingroup Language */ -require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' ); +require_once( __DIR__ . '/../LanguageConverter.php' ); /** * Converts Tajiki to latin orthography diff --git a/languages/classes/LanguageUz.php b/languages/classes/LanguageUz.php index e0f45cd63b..bd69e3077f 100644 --- a/languages/classes/LanguageUz.php +++ b/languages/classes/LanguageUz.php @@ -21,7 +21,7 @@ * @ingroup Language */ -require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' ); +require_once( __DIR__ . '/../LanguageConverter.php' ); /** * @ingroup Language diff --git a/languages/classes/LanguageZh.php b/languages/classes/LanguageZh.php index 96eea7c23e..63f90fd9c0 100644 --- a/languages/classes/LanguageZh.php +++ b/languages/classes/LanguageZh.php @@ -21,8 +21,8 @@ * @ingroup Language */ -require_once( dirname( __FILE__ ) . '/../LanguageConverter.php' ); -require_once( dirname( __FILE__ ) . '/LanguageZh_hans.php' ); +require_once( __DIR__ . '/../LanguageConverter.php' ); +require_once( __DIR__ . '/LanguageZh_hans.php' ); /** * @ingroup Language @@ -64,7 +64,7 @@ class ZhConverter extends LanguageConverter { } function loadDefaultTables() { - require( dirname( __FILE__ ) . "/../../includes/ZhConversion.php" ); + require( __DIR__ . "/../../includes/ZhConversion.php" ); $this->mTables = array( 'zh-hans' => new ReplacementArray( $zh2Hans ), 'zh-hant' => new ReplacementArray( $zh2Hant ), diff --git a/load.php b/load.php index 4c7208006f..6ffc14587e 100644 --- a/load.php +++ b/load.php @@ -31,7 +31,7 @@ if ( !function_exists( 'version_compare' ) || version_compare( phpversion(), '5. if ( isset( $_SERVER['MW_COMPILED'] ) ) { require ( 'phase3/includes/WebStart.php' ); } else { - require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); + require ( __DIR__ . '/includes/WebStart.php' ); } wfProfileIn( 'load.php' ); diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index cec1270962..af549d793b 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -123,7 +123,7 @@ abstract class Maintenance { global $IP; $IP = strval( getenv( 'MW_INSTALL_PATH' ) ) !== '' ? getenv( 'MW_INSTALL_PATH' ) - : realpath( dirname( __FILE__ ) . '/..' ); + : realpath( __DIR__ . '/..' ); $this->addDefaultParams(); register_shutdown_function( array( $this, 'outputChanneled' ), false ); @@ -988,7 +988,7 @@ abstract class Maintenance { * @return string */ protected function getDir() { - return dirname( __FILE__ ); + return __DIR__; } /** @@ -1009,9 +1009,9 @@ abstract class Maintenance { protected static function getCoreScripts() { if ( !self::$mCoreScripts ) { $paths = array( - dirname( __FILE__ ), - dirname( __FILE__ ) . '/language', - dirname( __FILE__ ) . '/storage', + __DIR__, + __DIR__ . '/language', + __DIR__ . '/storage', ); self::$mCoreScripts = array(); foreach ( $paths as $p ) { diff --git a/maintenance/archives/upgradeLogging.php b/maintenance/archives/upgradeLogging.php index 1765bd9f10..d406ea8d98 100644 --- a/maintenance/archives/upgradeLogging.php +++ b/maintenance/archives/upgradeLogging.php @@ -21,7 +21,7 @@ * @ingroup MaintenanceArchive */ -require( dirname( __FILE__ ) . '/../commandLine.inc' ); +require( __DIR__ . '/../commandLine.inc' ); class UpdateLogging { diff --git a/maintenance/attachLatest.php b/maintenance/attachLatest.php index 78cae8cfb3..475cafc971 100644 --- a/maintenance/attachLatest.php +++ b/maintenance/attachLatest.php @@ -24,7 +24,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to correct wrong values in the `page_latest` field diff --git a/maintenance/backupTextPass.inc b/maintenance/backupTextPass.inc index 3ca30258a7..84aac57f12 100644 --- a/maintenance/backupTextPass.inc +++ b/maintenance/backupTextPass.inc @@ -24,7 +24,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/backup.inc' ); +require_once( __DIR__ . '/backup.inc' ); /** * @ingroup Maintenance diff --git a/maintenance/benchmarks/Benchmarker.php b/maintenance/benchmarks/Benchmarker.php index 0056c3c7da..822f1a6a8b 100644 --- a/maintenance/benchmarks/Benchmarker.php +++ b/maintenance/benchmarks/Benchmarker.php @@ -27,7 +27,7 @@ * @ingroup Benchmark */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); abstract class Benchmarker extends Maintenance { private $results; diff --git a/maintenance/benchmarks/bench_HTTP_HTTPS.php b/maintenance/benchmarks/bench_HTTP_HTTPS.php index cf62aadbd0..fb836c1790 100644 --- a/maintenance/benchmarks/bench_HTTP_HTTPS.php +++ b/maintenance/benchmarks/bench_HTTP_HTTPS.php @@ -22,7 +22,7 @@ * @author Platonides */ -require_once( dirname( __FILE__ ) . '/Benchmarker.php' ); +require_once( __DIR__ . '/Benchmarker.php' ); class bench_HTTP_HTTPS extends Benchmarker { public function __construct() { diff --git a/maintenance/benchmarks/bench_delete_truncate.php b/maintenance/benchmarks/bench_delete_truncate.php index 7138552048..6e448647cd 100644 --- a/maintenance/benchmarks/bench_delete_truncate.php +++ b/maintenance/benchmarks/bench_delete_truncate.php @@ -4,7 +4,7 @@ * @ingroup Benchmark */ -require_once( dirname( __FILE__ ) . '/Benchmarker.php' ); +require_once( __DIR__ . '/Benchmarker.php' ); class BenchmarkDeleteTruncate extends Benchmarker { diff --git a/maintenance/benchmarks/bench_if_switch.php b/maintenance/benchmarks/bench_if_switch.php index dafce0508c..4a3abd4a71 100644 --- a/maintenance/benchmarks/bench_if_switch.php +++ b/maintenance/benchmarks/bench_if_switch.php @@ -22,7 +22,7 @@ * @author Platonides */ -require_once( dirname( __FILE__ ) . '/Benchmarker.php' ); +require_once( __DIR__ . '/Benchmarker.php' ); class bench_if_switch extends Benchmarker { public function __construct() { diff --git a/maintenance/benchmarks/bench_strtr_str_replace.php b/maintenance/benchmarks/bench_strtr_str_replace.php index 73ace2bd0b..cce7879b1c 100644 --- a/maintenance/benchmarks/bench_strtr_str_replace.php +++ b/maintenance/benchmarks/bench_strtr_str_replace.php @@ -4,7 +4,7 @@ * @ingroup Benchmark */ -require_once( dirname( __FILE__ ) . '/Benchmarker.php' ); +require_once( __DIR__ . '/Benchmarker.php' ); function bfNormalizeTitleStrTr( $str ) { return strtr( $str, '_', ' ' ); diff --git a/maintenance/benchmarks/bench_utf8_title_check.php b/maintenance/benchmarks/bench_utf8_title_check.php index 2e4b90292d..d71f5f5ba5 100644 --- a/maintenance/benchmarks/bench_utf8_title_check.php +++ b/maintenance/benchmarks/bench_utf8_title_check.php @@ -1,22 +1,22 @@ checkTitleEncoding() and compares its execution time * against that of mb_check_encoding, if available. - */ + */ class bench_utf8_title_check extends Benchmarker { private $canRun; private $data; - public function __construct() { + public function __construct() { parent::__construct(); $this->data = array ( @@ -43,14 +43,14 @@ class bench_utf8_title_check extends Benchmarker { $this->canRun = function_exists ( 'mb_check_encoding' ); - if ( $this->canRun ) { + if ( $this->canRun ) { $this->mDescription = "Benchmark for using a regexp vs. mb_check_encoding to check for UTF-8 encoding."; mb_internal_encoding( 'UTF-8' ); } else { $this->mDescription = "CANNOT RUN benchmark using mb_check_encoding: function not available."; - } - } - + } + } + public function execute() { if ( !$this->canRun ) { return; @@ -69,22 +69,22 @@ class bench_utf8_title_check extends Benchmarker { 'function' => array( $this, 'use_regexp_once_only' ), 'args' => array( rawurldecode ( $val ) ) ); - $benchmarks[] = array( - 'function' => array( $this, 'use_mb_check_encoding' ), - 'args' => array( rawurldecode ( $val ) ) + $benchmarks[] = array( + 'function' => array( $this, 'use_mb_check_encoding' ), + 'args' => array( rawurldecode ( $val ) ) ); - } + } $this->bench( $benchmarks ); - print $this->getFormattedResults(); - } + print $this->getFormattedResults(); + } private $isutf8; - + function use_regexp( $s ) { $this->isutf8 = preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' . - '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s ); - } - + '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s ); + } + function use_regexp_non_capturing( $s ) { // Same as above with a non-capturing subgroup. $this->isutf8 = preg_match( '/^(?:[\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' . @@ -97,11 +97,11 @@ class bench_utf8_title_check extends Benchmarker { '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s ); } - function use_mb_check_encoding( $s ) { - $this->isutf8 = mb_check_encoding( $s, 'UTF-8' ); - } - -} - -$maintClass = 'bench_utf8_title_check'; -require_once( RUN_MAINTENANCE_IF_MAIN ); + function use_mb_check_encoding( $s ) { + $this->isutf8 = mb_check_encoding( $s, 'UTF-8' ); + } + +} + +$maintClass = 'bench_utf8_title_check'; +require_once( RUN_MAINTENANCE_IF_MAIN ); diff --git a/maintenance/benchmarks/bench_wfIsWindows.php b/maintenance/benchmarks/bench_wfIsWindows.php index 4caebc5edd..cd07fbd642 100644 --- a/maintenance/benchmarks/bench_wfIsWindows.php +++ b/maintenance/benchmarks/bench_wfIsWindows.php @@ -22,7 +22,7 @@ * @author Platonides */ -require_once( dirname( __FILE__ ) . '/Benchmarker.php' ); +require_once( __DIR__ . '/Benchmarker.php' ); class bench_wfIsWindows extends Benchmarker { public function __construct() { diff --git a/maintenance/benchmarks/benchmarkHooks.php b/maintenance/benchmarks/benchmarkHooks.php index 4ec2616859..508ea80aa4 100644 --- a/maintenance/benchmarks/benchmarkHooks.php +++ b/maintenance/benchmarks/benchmarkHooks.php @@ -19,7 +19,7 @@ * @ingroup Benchmark */ -require_once( dirname( __FILE__ ) . '/Benchmarker.php' ); +require_once( __DIR__ . '/Benchmarker.php' ); class BenchmarkHooks extends Benchmarker { diff --git a/maintenance/benchmarks/benchmarkPurge.php b/maintenance/benchmarks/benchmarkPurge.php index e9d2ec7a03..4d36d2629a 100644 --- a/maintenance/benchmarks/benchmarkPurge.php +++ b/maintenance/benchmarks/benchmarkPurge.php @@ -21,7 +21,7 @@ * @ingroup Benchmark */ -require_once( dirname( __FILE__ ) . '/Benchmarker.php' ); +require_once( __DIR__ . '/Benchmarker.php' ); class BenchmarkPurge extends Benchmarker { diff --git a/maintenance/cdb.php b/maintenance/cdb.php index 270f7a60f3..c06c2cd0e0 100644 --- a/maintenance/cdb.php +++ b/maintenance/cdb.php @@ -23,7 +23,7 @@ */ /** */ -require_once( dirname( __FILE__ ) . '/commandLine.inc' ); +require_once( __DIR__ . '/commandLine.inc' ); function cdbShowHelp( $command ) { $commandList = array( diff --git a/maintenance/changePassword.php b/maintenance/changePassword.php index e4063f9c9c..f276fc1637 100644 --- a/maintenance/changePassword.php +++ b/maintenance/changePassword.php @@ -24,7 +24,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to change the password of a given user. diff --git a/maintenance/checkAutoLoader.php b/maintenance/checkAutoLoader.php index ea6c09f2bb..8d0e442bdf 100644 --- a/maintenance/checkAutoLoader.php +++ b/maintenance/checkAutoLoader.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to check classes definitions in the autoloader. diff --git a/maintenance/checkBadRedirects.php b/maintenance/checkBadRedirects.php index f8b8955c3a..670b93de2b 100644 --- a/maintenance/checkBadRedirects.php +++ b/maintenance/checkBadRedirects.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to check that pages marked as being redirects really are. diff --git a/maintenance/checkImages.php b/maintenance/checkImages.php index d7463ece28..c05d91517d 100644 --- a/maintenance/checkImages.php +++ b/maintenance/checkImages.php @@ -20,7 +20,7 @@ * @file * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to check images to see if they exist, are readable, etc. diff --git a/maintenance/checkSyntax.php b/maintenance/checkSyntax.php index 3019b8427a..0a22f58c32 100644 --- a/maintenance/checkSyntax.php +++ b/maintenance/checkSyntax.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to check syntax of all PHP files in MediaWiki. diff --git a/maintenance/checkUsernames.php b/maintenance/checkUsernames.php index 6a9294a307..dd5e0022cb 100644 --- a/maintenance/checkUsernames.php +++ b/maintenance/checkUsernames.php @@ -22,7 +22,7 @@ */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to check that database usernames are actually valid. diff --git a/maintenance/cleanupAncientTables.php b/maintenance/cleanupAncientTables.php index d449d6c591..dbc2e0d3d4 100644 --- a/maintenance/cleanupAncientTables.php +++ b/maintenance/cleanupAncientTables.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to cleans up old database tables, dropping old indexes diff --git a/maintenance/cleanupCaps.php b/maintenance/cleanupCaps.php index b61f6ff4ef..ec2aa957d8 100644 --- a/maintenance/cleanupCaps.php +++ b/maintenance/cleanupCaps.php @@ -29,7 +29,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/cleanupTable.inc' ); +require_once( __DIR__ . '/cleanupTable.inc' ); /** * Maintenance script to clean up broken page links when somebody turns on $wgCapitalLinks. diff --git a/maintenance/cleanupImages.php b/maintenance/cleanupImages.php index 2beed7203d..4e7b937dbf 100644 --- a/maintenance/cleanupImages.php +++ b/maintenance/cleanupImages.php @@ -29,7 +29,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/cleanupTable.inc' ); +require_once( __DIR__ . '/cleanupTable.inc' ); /** * Maintenance script to clean up broken, unparseable upload filenames. diff --git a/maintenance/cleanupPreferences.php b/maintenance/cleanupPreferences.php index 706f87fb92..f37af775da 100755 --- a/maintenance/cleanupPreferences.php +++ b/maintenance/cleanupPreferences.php @@ -23,7 +23,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that removes hidden preferences from the database. diff --git a/maintenance/cleanupRemovedModules.php b/maintenance/cleanupRemovedModules.php index b339bfcdcf..2085da94d1 100644 --- a/maintenance/cleanupRemovedModules.php +++ b/maintenance/cleanupRemovedModules.php @@ -22,7 +22,7 @@ * @author Roan Kattouw */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to remove cache entries for removed ResourceLoader modules diff --git a/maintenance/cleanupSpam.php b/maintenance/cleanupSpam.php index 2051c89a4c..e20bcd87d6 100644 --- a/maintenance/cleanupSpam.php +++ b/maintenance/cleanupSpam.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to cleanup all spam from a given hostname. diff --git a/maintenance/cleanupTable.inc b/maintenance/cleanupTable.inc index 898bdf497e..85911ba7c8 100644 --- a/maintenance/cleanupTable.inc +++ b/maintenance/cleanupTable.inc @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Generic class to cleanup a database table. Already subclasses Maintenance. diff --git a/maintenance/cleanupTitles.php b/maintenance/cleanupTitles.php index a2dc3a3c60..ad2577aa9d 100644 --- a/maintenance/cleanupTitles.php +++ b/maintenance/cleanupTitles.php @@ -29,7 +29,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/cleanupTable.inc' ); +require_once( __DIR__ . '/cleanupTable.inc' ); /** * Maintenance script to clean up broken, unparseable titles. diff --git a/maintenance/cleanupUploadStash.php b/maintenance/cleanupUploadStash.php index 32377b6972..cc329461b9 100644 --- a/maintenance/cleanupUploadStash.php +++ b/maintenance/cleanupUploadStash.php @@ -25,7 +25,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to remove old or broken uploads from temporary uploaded diff --git a/maintenance/cleanupWatchlist.php b/maintenance/cleanupWatchlist.php index 840337c1f5..fbab6a3c4f 100644 --- a/maintenance/cleanupWatchlist.php +++ b/maintenance/cleanupWatchlist.php @@ -29,7 +29,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/cleanupTable.inc' ); +require_once( __DIR__ . '/cleanupTable.inc' ); /** * Maintenance script to remove broken, unparseable titles in the watchlist table. diff --git a/maintenance/clear_interwiki_cache.php b/maintenance/clear_interwiki_cache.php index 638a475c64..88769df2da 100644 --- a/maintenance/clear_interwiki_cache.php +++ b/maintenance/clear_interwiki_cache.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to clear the cache of interwiki prefixes for all local wikis. diff --git a/maintenance/clear_stats.php b/maintenance/clear_stats.php index 2ed5a67ce2..4581d53276 100644 --- a/maintenance/clear_stats.php +++ b/maintenance/clear_stats.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to remove all statistics tracking from the cache. diff --git a/maintenance/commandLine.inc b/maintenance/commandLine.inc index c7adbfbc9e..86a558d0e1 100644 --- a/maintenance/commandLine.inc +++ b/maintenance/commandLine.inc @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); global $optionsWithArgs; if ( !isset( $optionsWithArgs ) ) { diff --git a/maintenance/compareParsers.php b/maintenance/compareParsers.php index 9d7f5c7793..a3337173c2 100644 --- a/maintenance/compareParsers.php +++ b/maintenance/compareParsers.php @@ -28,7 +28,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/dumpIterator.php' ); +require_once( __DIR__ . '/dumpIterator.php' ); /** * Maintenance script to take page text out of an XML dump file and render diff --git a/maintenance/convertLinks.php b/maintenance/convertLinks.php index 275d8fad19..5f7b02e423 100644 --- a/maintenance/convertLinks.php +++ b/maintenance/convertLinks.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to convert from the old links schema (string->ID) diff --git a/maintenance/convertUserOptions.php b/maintenance/convertUserOptions.php index e666b65a13..7c9ca2696f 100644 --- a/maintenance/convertUserOptions.php +++ b/maintenance/convertUserOptions.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to convert user options to the new `user_properties` table. diff --git a/maintenance/copyFileBackend.php b/maintenance/copyFileBackend.php index 2363d40ae3..aebdee175f 100644 --- a/maintenance/copyFileBackend.php +++ b/maintenance/copyFileBackend.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Copy all files in one container of one backend to another. diff --git a/maintenance/createAndPromote.php b/maintenance/createAndPromote.php index 3f328f9987..ad5333fcc7 100644 --- a/maintenance/createAndPromote.php +++ b/maintenance/createAndPromote.php @@ -22,7 +22,7 @@ * @author Rob Church */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to create an account and grant it administrator rights. diff --git a/maintenance/deleteArchivedFiles.php b/maintenance/deleteArchivedFiles.php index 8709ee88bc..85ffc23b78 100644 --- a/maintenance/deleteArchivedFiles.php +++ b/maintenance/deleteArchivedFiles.php @@ -24,8 +24,8 @@ * @author Aaron Schulz */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); -require_once( dirname( __FILE__ ) . '/deleteArchivedFiles.inc' ); +require_once( __DIR__ . '/Maintenance.php' ); +require_once( __DIR__ . '/deleteArchivedFiles.inc' ); /** * Maintenance script to delete archived (non-current) files from the database. diff --git a/maintenance/deleteArchivedRevisions.php b/maintenance/deleteArchivedRevisions.php index 353661a5c7..4b658bbb80 100644 --- a/maintenance/deleteArchivedRevisions.php +++ b/maintenance/deleteArchivedRevisions.php @@ -24,8 +24,8 @@ * @author Aaron Schulz */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); -require_once( dirname( __FILE__ ) . '/deleteArchivedRevisions.inc' ); +require_once( __DIR__ . '/Maintenance.php' ); +require_once( __DIR__ . '/deleteArchivedRevisions.inc' ); /** * Maintenance script to delete archived (deleted from public) revisions diff --git a/maintenance/deleteBatch.php b/maintenance/deleteBatch.php index 6860a5afa4..936a52b857 100644 --- a/maintenance/deleteBatch.php +++ b/maintenance/deleteBatch.php @@ -28,7 +28,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to delete a batch of pages. diff --git a/maintenance/deleteDefaultMessages.php b/maintenance/deleteDefaultMessages.php index 540d225e67..4ab6d1d9c2 100644 --- a/maintenance/deleteDefaultMessages.php +++ b/maintenance/deleteDefaultMessages.php @@ -22,7 +22,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that deletes all pages in the MediaWiki namespace diff --git a/maintenance/deleteImageMemcached.php b/maintenance/deleteImageMemcached.php index 2029b57106..3c8c5fdd88 100644 --- a/maintenance/deleteImageMemcached.php +++ b/maintenance/deleteImageMemcached.php @@ -24,7 +24,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that deletes image information from the object cache. diff --git a/maintenance/deleteOldRevisions.php b/maintenance/deleteOldRevisions.php index 45a6b343c1..6a3e211b00 100644 --- a/maintenance/deleteOldRevisions.php +++ b/maintenance/deleteOldRevisions.php @@ -22,7 +22,7 @@ * @author Rob Church */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that deletes old (non-current) revisions from the database. diff --git a/maintenance/deleteOrphanedRevisions.php b/maintenance/deleteOrphanedRevisions.php index 13b9c91bf9..5dc7567fc7 100644 --- a/maintenance/deleteOrphanedRevisions.php +++ b/maintenance/deleteOrphanedRevisions.php @@ -24,7 +24,7 @@ * @todo More efficient cleanup of text records */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that deletes revisions which refer to a nonexisting page. diff --git a/maintenance/deleteRevision.php b/maintenance/deleteRevision.php index fe3b5151a8..ad6470d9d2 100644 --- a/maintenance/deleteRevision.php +++ b/maintenance/deleteRevision.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that deletes one or more revisions by moving them diff --git a/maintenance/deleteSelfExternals.php b/maintenance/deleteSelfExternals.php index 162dcb4f73..da220d6416 100644 --- a/maintenance/deleteSelfExternals.php +++ b/maintenance/deleteSelfExternals.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that deletes self-references to $wgServer diff --git a/maintenance/dumpBackup.php b/maintenance/dumpBackup.php index 463846872b..c9546c60d9 100644 --- a/maintenance/dumpBackup.php +++ b/maintenance/dumpBackup.php @@ -29,8 +29,8 @@ $originalDir = getcwd(); $optionsWithArgs = array( 'pagelist', 'start', 'end', 'revstart', 'revend'); -require_once( dirname( __FILE__ ) . '/commandLine.inc' ); -require_once( dirname( __FILE__ ) . '/backup.inc' ); +require_once( __DIR__ . '/commandLine.inc' ); +require_once( __DIR__ . '/backup.inc' ); $dumper = new BackupDumper( $argv ); diff --git a/maintenance/dumpIterator.php b/maintenance/dumpIterator.php index 4c04d860b6..485218ca88 100644 --- a/maintenance/dumpIterator.php +++ b/maintenance/dumpIterator.php @@ -26,7 +26,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Base class for interating over a dump. diff --git a/maintenance/dumpLinks.php b/maintenance/dumpLinks.php index ad440e70f2..153fdd79ef 100644 --- a/maintenance/dumpLinks.php +++ b/maintenance/dumpLinks.php @@ -30,7 +30,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that generates a plaintext link dump. diff --git a/maintenance/dumpSisterSites.php b/maintenance/dumpSisterSites.php index 5dbb5e2360..e05e154ed4 100644 --- a/maintenance/dumpSisterSites.php +++ b/maintenance/dumpSisterSites.php @@ -25,7 +25,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that generates a page name dump for SisterSites usage. diff --git a/maintenance/dumpTextPass.php b/maintenance/dumpTextPass.php index 41a7a68743..72d7d97cbb 100644 --- a/maintenance/dumpTextPass.php +++ b/maintenance/dumpTextPass.php @@ -26,8 +26,8 @@ $originalDir = getcwd(); -require_once( dirname( __FILE__ ) . '/commandLine.inc' ); -require_once( dirname( __FILE__ ) . '/backupTextPass.inc' ); +require_once( __DIR__ . '/commandLine.inc' ); +require_once( __DIR__ . '/backupTextPass.inc' ); $dumper = new TextPassDumper( $argv ); diff --git a/maintenance/dumpUploads.php b/maintenance/dumpUploads.php index b16b0c2929..0d0dfcf378 100644 --- a/maintenance/dumpUploads.php +++ b/maintenance/dumpUploads.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to dump a the list of files uploaded, diff --git a/maintenance/edit.php b/maintenance/edit.php index 13b3c49181..59df5e8863 100644 --- a/maintenance/edit.php +++ b/maintenance/edit.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to make a page edit. diff --git a/maintenance/eval.php b/maintenance/eval.php index 3bd164fdaf..5aefe1c970 100644 --- a/maintenance/eval.php +++ b/maintenance/eval.php @@ -34,7 +34,7 @@ $optionsWithArgs = array( 'd' ); /** */ -require_once( dirname( __FILE__ ) . "/commandLine.inc" ); +require_once( __DIR__ . "/commandLine.inc" ); if ( isset( $options['d'] ) ) { $d = $options['d']; diff --git a/maintenance/fetchText.php b/maintenance/fetchText.php index 28330814c3..a705bccad0 100644 --- a/maintenance/fetchText.php +++ b/maintenance/fetchText.php @@ -22,7 +22,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script used to fetch page text in a subprocess. diff --git a/maintenance/fileOpPerfTest.php b/maintenance/fileOpPerfTest.php index 0f73e880ac..501bcfc389 100644 --- a/maintenance/fileOpPerfTest.php +++ b/maintenance/fileOpPerfTest.php @@ -25,7 +25,7 @@ $initialTime = microtime( true ); $wgProfiler = array( 'class' => 'ProfilerSimpleText' ); error_reporting( E_ALL ); -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to test fileop performance. diff --git a/maintenance/findHooks.php b/maintenance/findHooks.php index e4fa5deee1..e273c545f4 100644 --- a/maintenance/findHooks.php +++ b/maintenance/findHooks.php @@ -34,7 +34,7 @@ * @author Antoine Musso */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that compares documented and actually present mismatches. diff --git a/maintenance/fixDoubleRedirects.php b/maintenance/fixDoubleRedirects.php index e52c6c34bf..6f017eca48 100644 --- a/maintenance/fixDoubleRedirects.php +++ b/maintenance/fixDoubleRedirects.php @@ -25,7 +25,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that fixes double redirects. diff --git a/maintenance/fixExtLinksProtocolRelative.php b/maintenance/fixExtLinksProtocolRelative.php index d247862f5f..2403ec68b4 100644 --- a/maintenance/fixExtLinksProtocolRelative.php +++ b/maintenance/fixExtLinksProtocolRelative.php @@ -23,7 +23,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that fixes any entriy for protocol-relative URLs diff --git a/maintenance/fixSlaveDesync.php b/maintenance/fixSlaveDesync.php index 126eed2524..8bf556f087 100644 --- a/maintenance/fixSlaveDesync.php +++ b/maintenance/fixSlaveDesync.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that fixes erroneous page_latest values diff --git a/maintenance/fixTimestamps.php b/maintenance/fixTimestamps.php index 3a952512de..84d08d3930 100644 --- a/maintenance/fixTimestamps.php +++ b/maintenance/fixTimestamps.php @@ -25,7 +25,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that fixes timestamp corruption caused by one or diff --git a/maintenance/fixUserRegistration.php b/maintenance/fixUserRegistration.php index 4eca3967d3..91d42a5d99 100644 --- a/maintenance/fixUserRegistration.php +++ b/maintenance/fixUserRegistration.php @@ -22,7 +22,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that fixes the user_registration field. diff --git a/maintenance/formatInstallDoc.php b/maintenance/formatInstallDoc.php index 474caabc8d..600ca9768e 100644 --- a/maintenance/formatInstallDoc.php +++ b/maintenance/formatInstallDoc.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) .'/Maintenance.php' ); +require_once( __DIR__ .'/Maintenance.php' ); /** * Maintenance script that formats RELEASE-NOTE file to wiki text or HTML markup. diff --git a/maintenance/fuzz-tester.php b/maintenance/fuzz-tester.php index 8f3b8e5b9d..1c96a57161 100644 --- a/maintenance/fuzz-tester.php +++ b/maintenance/fuzz-tester.php @@ -181,7 +181,7 @@ TODO: // ///////////////////////// COMMAND LINE HELP //////////////////////////////////// // This is a command line script, load MediaWiki env (gives command line options); -require_once( dirname( __FILE__ ) . '/commandLine.inc' ); +require_once( __DIR__ . '/commandLine.inc' ); // if the user asked for an explanation of command line options. if ( isset( $options["help"] ) ) { diff --git a/maintenance/generateSitemap.php b/maintenance/generateSitemap.php index a81e3d9e91..f3a5d875e8 100644 --- a/maintenance/generateSitemap.php +++ b/maintenance/generateSitemap.php @@ -26,7 +26,7 @@ * @see http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that generates a sitemap for the site. diff --git a/maintenance/getLagTimes.php b/maintenance/getLagTimes.php index c47c61e4be..72b1d48a2d 100644 --- a/maintenance/getLagTimes.php +++ b/maintenance/getLagTimes.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that displays replication lag times. diff --git a/maintenance/getSlaveServer.php b/maintenance/getSlaveServer.php index 0270052845..ec9ed20a0f 100644 --- a/maintenance/getSlaveServer.php +++ b/maintenance/getSlaveServer.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that reports the hostname of a slave server. diff --git a/maintenance/getText.php b/maintenance/getText.php index 34558b66f9..3e2f854010 100644 --- a/maintenance/getText.php +++ b/maintenance/getText.php @@ -23,7 +23,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that outputs page text to stdout. diff --git a/maintenance/hiphop/make b/maintenance/hiphop/make index 2bb9951f19..2fa70dcbc6 100755 --- a/maintenance/hiphop/make +++ b/maintenance/hiphop/make @@ -2,7 +2,7 @@ */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to re-initialise or update the site statistics table diff --git a/maintenance/install.php b/maintenance/install.php index 6339773aa2..762bb94fa6 100644 --- a/maintenance/install.php +++ b/maintenance/install.php @@ -30,7 +30,7 @@ if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), ' define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' ); define( 'MEDIAWIKI_INSTALL', true ); -require_once( dirname( dirname( __FILE__ ) )."/maintenance/Maintenance.php" ); +require_once( dirname( __DIR__ )."/maintenance/Maintenance.php" ); /** * Maintenance script to install and configure MediaWiki diff --git a/maintenance/jsparse.php b/maintenance/jsparse.php index c0a4dbaa32..ceafc3909a 100644 --- a/maintenance/jsparse.php +++ b/maintenance/jsparse.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to do test JavaScript validity parses using jsmin+'s parser diff --git a/maintenance/lag.php b/maintenance/lag.php index 19c549a547..3ad0864fb9 100644 --- a/maintenance/lag.php +++ b/maintenance/lag.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to show database lag. diff --git a/maintenance/language/alltrans.php b/maintenance/language/alltrans.php index f872e6a61a..b537f9b70c 100644 --- a/maintenance/language/alltrans.php +++ b/maintenance/language/alltrans.php @@ -20,7 +20,7 @@ * @ingroup MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); class AllTrans extends Maintenance { public function __construct() { diff --git a/maintenance/language/checkDupeMessages.php b/maintenance/language/checkDupeMessages.php index ea5b1870b9..1888c4cd76 100644 --- a/maintenance/language/checkDupeMessages.php +++ b/maintenance/language/checkDupeMessages.php @@ -21,8 +21,8 @@ * @ingroup MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../commandLine.inc' ); -$messagesDir = dirname( __FILE__ ) . '/../../languages/messages/'; +require_once( __DIR__ . '/../commandLine.inc' ); +$messagesDir = __DIR__ . '/../../languages/messages/'; $runTest = false; $run = false; $runMode = 'text'; diff --git a/maintenance/language/checkExtensions.php b/maintenance/language/checkExtensions.php index a58a8f5c32..ebc62b6027 100644 --- a/maintenance/language/checkExtensions.php +++ b/maintenance/language/checkExtensions.php @@ -21,7 +21,7 @@ * @ingroup MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../commandLine.inc' ); +require_once( __DIR__ . '/../commandLine.inc' ); require_once( 'languages.inc' ); require_once( 'checkLanguage.inc' ); diff --git a/maintenance/language/checkLanguage.php b/maintenance/language/checkLanguage.php index 69f610848c..99ba4e98d8 100644 --- a/maintenance/language/checkLanguage.php +++ b/maintenance/language/checkLanguage.php @@ -21,7 +21,7 @@ * @ingroup MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../commandLine.inc' ); +require_once( __DIR__ . '/../commandLine.inc' ); require_once( 'checkLanguage.inc' ); require_once( 'languages.inc' ); diff --git a/maintenance/language/countMessages.php b/maintenance/language/countMessages.php index f949ddc288..d37d22e961 100644 --- a/maintenance/language/countMessages.php +++ b/maintenance/language/countMessages.php @@ -20,7 +20,7 @@ * @ingroup MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); class CountMessages extends Maintenance { public function __construct() { diff --git a/maintenance/language/date-formats.php b/maintenance/language/date-formats.php index 04f5e8baf5..505cb57b91 100644 --- a/maintenance/language/date-formats.php +++ b/maintenance/language/date-formats.php @@ -20,7 +20,7 @@ * @ingroup MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); class DateFormats extends Maintenance { diff --git a/maintenance/language/digit2html.php b/maintenance/language/digit2html.php index a80ac01435..7e729b4c7d 100644 --- a/maintenance/language/digit2html.php +++ b/maintenance/language/digit2html.php @@ -18,7 +18,7 @@ * @ingroup MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); class Digit2Html extends Maintenance { diff --git a/maintenance/language/dumpMessages.php b/maintenance/language/dumpMessages.php index b7ca88d24b..9292ce3051 100644 --- a/maintenance/language/dumpMessages.php +++ b/maintenance/language/dumpMessages.php @@ -22,7 +22,7 @@ * @todo Make this more useful, right now just dumps $wgContentLang */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); class DumpMessages extends Maintenance { public function __construct() { diff --git a/maintenance/language/generateCollationData.php b/maintenance/language/generateCollationData.php index 4cb90ffe6a..c4a8e54320 100644 --- a/maintenance/language/generateCollationData.php +++ b/maintenance/language/generateCollationData.php @@ -21,7 +21,7 @@ * @file */ -require_once( dirname( __FILE__ ) .'/../Maintenance.php' ); +require_once( __DIR__ .'/../Maintenance.php' ); /** * Generate first letter data files for Collation.php diff --git a/maintenance/language/generateNormalizerData.php b/maintenance/language/generateNormalizerData.php index 3dfda92045..f3cc568221 100644 --- a/maintenance/language/generateNormalizerData.php +++ b/maintenance/language/generateNormalizerData.php @@ -21,9 +21,9 @@ * @ingroup MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); -require_once( dirname( __FILE__ ) . '/../../includes/normal/UtfNormalUtil.php' ); +require_once( __DIR__ . '/../../includes/normal/UtfNormalUtil.php' ); /** * Generates normalizer data files for Arabic and Malayalam. diff --git a/maintenance/language/langmemusage.php b/maintenance/language/langmemusage.php index 28fe120e31..2323638e26 100644 --- a/maintenance/language/langmemusage.php +++ b/maintenance/language/langmemusage.php @@ -22,8 +22,8 @@ */ /** This is a command line script */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); -require_once( dirname( __FILE__ ) . '/languages.inc' ); +require_once( __DIR__ . '/../Maintenance.php' ); +require_once( __DIR__ . '/languages.inc' ); class LangMemUsage extends Maintenance { diff --git a/maintenance/language/rebuildLanguage.php b/maintenance/language/rebuildLanguage.php index ed2dae7260..ad839054f7 100644 --- a/maintenance/language/rebuildLanguage.php +++ b/maintenance/language/rebuildLanguage.php @@ -22,7 +22,7 @@ * @defgroup MaintenanceLanguage MaintenanceLanguage */ -require_once( dirname( __FILE__ ) . '/../commandLine.inc' ); +require_once( __DIR__ . '/../commandLine.inc' ); require_once( 'languages.inc' ); require_once( 'writeMessagesArray.inc' ); diff --git a/maintenance/language/transstat.php b/maintenance/language/transstat.php index a2988417fa..ba503224d0 100644 --- a/maintenance/language/transstat.php +++ b/maintenance/language/transstat.php @@ -28,9 +28,9 @@ */ $optionsWithArgs = array( 'output' ); -require_once( dirname( __FILE__ ) . '/../commandLine.inc' ); +require_once( __DIR__ . '/../commandLine.inc' ); require_once( 'languages.inc' ); -require_once( dirname( __FILE__ ) . '/StatOutputs.php' ); +require_once( __DIR__ . '/StatOutputs.php' ); if ( isset( $options['help'] ) ) { diff --git a/maintenance/language/validate.php b/maintenance/language/validate.php index 1e97c37dae..751e744ddf 100644 --- a/maintenance/language/validate.php +++ b/maintenance/language/validate.php @@ -30,7 +30,7 @@ array_shift( $argv ); define( 'MEDIAWIKI', 1 ); define( 'NOT_REALLY_MEDIAWIKI', 1 ); -$IP = dirname( __FILE__ ) . '/../..'; +$IP = __DIR__ . '/../..'; require_once( "$IP/includes/Defines.php" ); require_once( "$IP/languages/Language.php" ); diff --git a/maintenance/language/writeMessagesArray.inc b/maintenance/language/writeMessagesArray.inc index cd368476dd..b2e04c7f83 100644 --- a/maintenance/language/writeMessagesArray.inc +++ b/maintenance/language/writeMessagesArray.inc @@ -105,7 +105,7 @@ $messages = array( */ public static function writeMessagesArray( $messages, $ignoredComments = false, $prefix = false, $removeUnknown = false ) { # Load messages - $dir = $prefix ? $prefix : dirname( __FILE__ ); + $dir = $prefix ? $prefix : __DIR__; require( $dir . '/messages.inc' ); self::$messageStructure = $wgMessageStructure; diff --git a/maintenance/mcc.php b/maintenance/mcc.php index 024452788f..e07e62db26 100644 --- a/maintenance/mcc.php +++ b/maintenance/mcc.php @@ -23,7 +23,7 @@ */ /** */ -require_once( dirname( __FILE__ ) . '/commandLine.inc' ); +require_once( __DIR__ . '/commandLine.inc' ); $mcc = new MWMemcached( array( 'persistent' => true/*, 'debug' => true*/ ) ); $mcc->set_servers( $wgMemCachedServers ); diff --git a/maintenance/mctest.php b/maintenance/mctest.php index ed8250b122..691b832b9d 100644 --- a/maintenance/mctest.php +++ b/maintenance/mctest.php @@ -22,7 +22,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that makes several 'set', 'incr' and 'get' requests diff --git a/maintenance/mergeMessageFileList.php b/maintenance/mergeMessageFileList.php index 8107016f46..cea64333c2 100644 --- a/maintenance/mergeMessageFileList.php +++ b/maintenance/mergeMessageFileList.php @@ -25,7 +25,7 @@ # Start from scratch define( 'MW_NO_EXTENSION_MESSAGES', 1 ); -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); $maintClass = 'MergeMessageFileList'; $mmfl = false; @@ -104,7 +104,7 @@ $s = $dirs = array( $IP, - dirname( dirname( __FILE__ ) ), + dirname( __DIR__ ), realpath( $IP ) ); diff --git a/maintenance/migrateUserGroup.php b/maintenance/migrateUserGroup.php index 451b598be9..497e1e0995 100644 --- a/maintenance/migrateUserGroup.php +++ b/maintenance/migrateUserGroup.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that re-assigns users from an old group to a new one. diff --git a/maintenance/minify.php b/maintenance/minify.php index b17d8fe73a..9f5a909d64 100644 --- a/maintenance/minify.php +++ b/maintenance/minify.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that minifies a file or set of files. diff --git a/maintenance/moveBatch.php b/maintenance/moveBatch.php index 78db8b97d5..7d15959c32 100644 --- a/maintenance/moveBatch.php +++ b/maintenance/moveBatch.php @@ -34,7 +34,7 @@ * e.g. immobile_namespace for namespaces which can't be moved */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to move a batch of pages. diff --git a/maintenance/mwdocgen.php b/maintenance/mwdocgen.php index a59ba1701f..583249a5aa 100644 --- a/maintenance/mwdocgen.php +++ b/maintenance/mwdocgen.php @@ -49,7 +49,7 @@ if ( php_sapi_name() != 'cli' ) { } /** Figure out the base directory for MediaWiki location */ -$mwPath = dirname( dirname( __FILE__ ) ) . DIRECTORY_SEPARATOR; +$mwPath = dirname( __DIR__ ) . DIRECTORY_SEPARATOR; /** doxygen binary script */ $doxygenBin = 'doxygen'; diff --git a/maintenance/namespaceDupes.php b/maintenance/namespaceDupes.php index e2de686cab..4197a355a5 100644 --- a/maintenance/namespaceDupes.php +++ b/maintenance/namespaceDupes.php @@ -24,7 +24,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that checks for articles to fix after diff --git a/maintenance/nextJobDB.php b/maintenance/nextJobDB.php index bee4065602..e66e981bb6 100644 --- a/maintenance/nextJobDB.php +++ b/maintenance/nextJobDB.php @@ -22,7 +22,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that picks a database that has pending jobs. diff --git a/maintenance/nukeNS.php b/maintenance/nukeNS.php index 1defe1b2f5..c471a4415a 100644 --- a/maintenance/nukeNS.php +++ b/maintenance/nukeNS.php @@ -33,7 +33,7 @@ * based on nukePage by Rob Church */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that removes pages with only one revision from the diff --git a/maintenance/nukePage.php b/maintenance/nukePage.php index 3193d4367d..89dffe0c6f 100644 --- a/maintenance/nukePage.php +++ b/maintenance/nukePage.php @@ -23,7 +23,7 @@ * @author Rob Church */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that erases a page record from the database. diff --git a/maintenance/oracle/alterSharedConstraints.php b/maintenance/oracle/alterSharedConstraints.php index aa207821c1..e222314dd3 100644 --- a/maintenance/oracle/alterSharedConstraints.php +++ b/maintenance/oracle/alterSharedConstraints.php @@ -26,7 +26,7 @@ * i.e.: GRANT REFERENCES (user_id) ON mwuser TO hubclient; */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); class AlterSharedConstraints extends Maintenance { public function __construct() { diff --git a/maintenance/orphans.php b/maintenance/orphans.php index 1ab3b9962a..78f98f5a38 100644 --- a/maintenance/orphans.php +++ b/maintenance/orphans.php @@ -28,7 +28,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that looks for 'orphan' revisions hooked to pages which diff --git a/maintenance/patchSql.php b/maintenance/patchSql.php index 0271e1a5ec..1f393556a6 100644 --- a/maintenance/patchSql.php +++ b/maintenance/patchSql.php @@ -22,7 +22,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that manually runs an SQL patch outside of the general updaters. diff --git a/maintenance/populateCategory.php b/maintenance/populateCategory.php index 037849bd3c..ae54d698a6 100644 --- a/maintenance/populateCategory.php +++ b/maintenance/populateCategory.php @@ -22,7 +22,7 @@ * @author Simetrical */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Mainteance script to populate the category table. diff --git a/maintenance/populateImageSha1.php b/maintenance/populateImageSha1.php index 0bbb5a2808..37429a342d 100644 --- a/maintenance/populateImageSha1.php +++ b/maintenance/populateImageSha1.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to populate the img_sha1 field. diff --git a/maintenance/populateLogSearch.php b/maintenance/populateLogSearch.php index 8a2366a0d8..99d8155766 100644 --- a/maintenance/populateLogSearch.php +++ b/maintenance/populateLogSearch.php @@ -22,7 +22,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that makes the required database updates for populating the diff --git a/maintenance/populateLogUsertext.php b/maintenance/populateLogUsertext.php index 3b4b2db8a1..059b6fe25c 100644 --- a/maintenance/populateLogUsertext.php +++ b/maintenance/populateLogUsertext.php @@ -24,7 +24,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that makes the required database updates for diff --git a/maintenance/populateParentId.php b/maintenance/populateParentId.php index 6a1b5c850f..e81d4ffbd9 100644 --- a/maintenance/populateParentId.php +++ b/maintenance/populateParentId.php @@ -23,7 +23,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that makes the required database updates for rev_parent_id diff --git a/maintenance/populateRevisionLength.php b/maintenance/populateRevisionLength.php index 65dd91f974..6c835f4ed2 100644 --- a/maintenance/populateRevisionLength.php +++ b/maintenance/populateRevisionLength.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that populates the rev_len field for old revisions diff --git a/maintenance/populateRevisionSha1.php b/maintenance/populateRevisionSha1.php index bb620c527a..2e14d31e8f 100644 --- a/maintenance/populateRevisionSha1.php +++ b/maintenance/populateRevisionSha1.php @@ -22,7 +22,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that fills the rev_sha1 and ar_sha1 columns of revision diff --git a/maintenance/preprocessDump.php b/maintenance/preprocessDump.php index 5c2b0d42fa..5952fd960c 100644 --- a/maintenance/preprocessDump.php +++ b/maintenance/preprocessDump.php @@ -25,7 +25,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/dumpIterator.php' ); +require_once( __DIR__ . '/dumpIterator.php' ); /** * Maintenance script that takes page text out of an XML dump file and diff --git a/maintenance/preprocessorFuzzTest.php b/maintenance/preprocessorFuzzTest.php index 9dee67e258..a53bc88c23 100644 --- a/maintenance/preprocessorFuzzTest.php +++ b/maintenance/preprocessorFuzzTest.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/commandLine.inc' ); +require_once( __DIR__ . '/commandLine.inc' ); $wgHooks['BeforeParserFetchTemplateAndtitle'][] = 'PPFuzzTester::templateHook'; diff --git a/maintenance/protect.php b/maintenance/protect.php index e60ee0818f..2f6aa1aedb 100644 --- a/maintenance/protect.php +++ b/maintenance/protect.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that protects or unprotects a page. diff --git a/maintenance/pruneFileCache.php b/maintenance/pruneFileCache.php index 782804958d..e058e3ec36 100644 --- a/maintenance/pruneFileCache.php +++ b/maintenance/pruneFileCache.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that prunes file cache for pages, objects, resources, etc. diff --git a/maintenance/purgeDeletedFiles.php b/maintenance/purgeDeletedFiles.php index e9d149b5ed..cd62716b2b 100644 --- a/maintenance/purgeDeletedFiles.php +++ b/maintenance/purgeDeletedFiles.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that scans the deletion log and purges affected files diff --git a/maintenance/purgeList.php b/maintenance/purgeList.php index 049d6e3e5f..4b3c382190 100644 --- a/maintenance/purgeList.php +++ b/maintenance/purgeList.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that sends purge requests for listed pages to squid. diff --git a/maintenance/purgeOldText.php b/maintenance/purgeOldText.php index e68047c00d..1f0b063b6b 100644 --- a/maintenance/purgeOldText.php +++ b/maintenance/purgeOldText.php @@ -22,7 +22,7 @@ * @author Rob Church */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that purges old text records from the database. diff --git a/maintenance/purgeParserCache.php b/maintenance/purgeParserCache.php index b56794bab1..1c417980eb 100644 --- a/maintenance/purgeParserCache.php +++ b/maintenance/purgeParserCache.php @@ -22,7 +22,7 @@ * @ingroup Maintenance */ -require( dirname( __FILE__ ) . '/Maintenance.php' ); +require( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to remove old objects from the parser cache. diff --git a/maintenance/purgeStaleMemcachedText.php b/maintenance/purgeStaleMemcachedText.php index ec7b08135e..225400f1f1 100644 --- a/maintenance/purgeStaleMemcachedText.php +++ b/maintenance/purgeStaleMemcachedText.php @@ -19,7 +19,7 @@ * @ingroup Maintenance Memcached */ -require_once( dirname( __FILE__ ) . '/commandLine.inc' ); +require_once( __DIR__ . '/commandLine.inc' ); function purgeStaleMemcachedText() { global $wgMemc, $wgDBname; diff --git a/maintenance/reassignEdits.php b/maintenance/reassignEdits.php index 2afd6e087f..a91abf93d3 100644 --- a/maintenance/reassignEdits.php +++ b/maintenance/reassignEdits.php @@ -23,7 +23,7 @@ * @licence GNU General Public Licence 2.0 or later */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that reassigns edits from a user or IP address diff --git a/maintenance/rebuildFileCache.php b/maintenance/rebuildFileCache.php index 4dbe267f8e..3165b97ff5 100644 --- a/maintenance/rebuildFileCache.php +++ b/maintenance/rebuildFileCache.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that builds file cache for content pages. diff --git a/maintenance/rebuildImages.php b/maintenance/rebuildImages.php index 936efd7f04..f5d06e4620 100644 --- a/maintenance/rebuildImages.php +++ b/maintenance/rebuildImages.php @@ -30,7 +30,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to update image metadata records. diff --git a/maintenance/rebuildLocalisationCache.php b/maintenance/rebuildLocalisationCache.php index c48fb7421e..83849de65b 100644 --- a/maintenance/rebuildLocalisationCache.php +++ b/maintenance/rebuildLocalisationCache.php @@ -29,7 +29,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to rebuild the localisation cache. diff --git a/maintenance/rebuildall.php b/maintenance/rebuildall.php index bc9f732f6c..882ae1b3bd 100644 --- a/maintenance/rebuildall.php +++ b/maintenance/rebuildall.php @@ -22,7 +22,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that rebuilds link tracking tables from scratch. diff --git a/maintenance/rebuildmessages.php b/maintenance/rebuildmessages.php index a22d3afbac..a70e591f9e 100644 --- a/maintenance/rebuildmessages.php +++ b/maintenance/rebuildmessages.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that purges all languages from the message cache. diff --git a/maintenance/rebuildrecentchanges.php b/maintenance/rebuildrecentchanges.php index 5caa0a8fc0..0278f72cad 100644 --- a/maintenance/rebuildrecentchanges.php +++ b/maintenance/rebuildrecentchanges.php @@ -23,7 +23,7 @@ * @todo Document */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that rebuilds recent changes from scratch. diff --git a/maintenance/rebuildtextindex.php b/maintenance/rebuildtextindex.php index a37d603451..41b245f81e 100644 --- a/maintenance/rebuildtextindex.php +++ b/maintenance/rebuildtextindex.php @@ -25,7 +25,7 @@ * @todo document */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that rebuilds search index table from scratch. diff --git a/maintenance/refreshImageCount.php b/maintenance/refreshImageCount.php index f9bdeea735..be6bd18dac 100644 --- a/maintenance/refreshImageCount.php +++ b/maintenance/refreshImageCount.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); class RefreshImageCount extends Maintenance { public function __construct() { diff --git a/maintenance/refreshImageMetadata.php b/maintenance/refreshImageMetadata.php index 6623beab23..12da7a8bc1 100644 --- a/maintenance/refreshImageMetadata.php +++ b/maintenance/refreshImageMetadata.php @@ -27,7 +27,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to refresh image metadata fields. diff --git a/maintenance/refreshLinks.php b/maintenance/refreshLinks.php index 699d88552e..3d9270b8d3 100644 --- a/maintenance/refreshLinks.php +++ b/maintenance/refreshLinks.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to refresh link tables. diff --git a/maintenance/removeUnusedAccounts.php b/maintenance/removeUnusedAccounts.php index 490602d5b4..8bc27c1837 100644 --- a/maintenance/removeUnusedAccounts.php +++ b/maintenance/removeUnusedAccounts.php @@ -23,7 +23,7 @@ * @author Rob Church */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that removes unused user accounts from the database. diff --git a/maintenance/renameDbPrefix.php b/maintenance/renameDbPrefix.php index d8e53eedd0..6f24479140 100644 --- a/maintenance/renameDbPrefix.php +++ b/maintenance/renameDbPrefix.php @@ -23,7 +23,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that changes the prefix of database tables. diff --git a/maintenance/renderDump.php b/maintenance/renderDump.php index c76a89b499..b25fb9485e 100644 --- a/maintenance/renderDump.php +++ b/maintenance/renderDump.php @@ -28,7 +28,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that takes page text out of an XML dump file diff --git a/maintenance/resetUserTokens.php b/maintenance/resetUserTokens.php index ef8f5b0ebd..d7f8c6d0bd 100644 --- a/maintenance/resetUserTokens.php +++ b/maintenance/resetUserTokens.php @@ -23,7 +23,7 @@ * @author Daniel Friesen */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to reset the user_token for all users on the wiki. diff --git a/maintenance/rollbackEdits.php b/maintenance/rollbackEdits.php index c9f607edc3..4660bcef10 100644 --- a/maintenance/rollbackEdits.php +++ b/maintenance/rollbackEdits.php @@ -22,7 +22,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to rollback all edits by a given user or IP provided diff --git a/maintenance/runBatchedQuery.php b/maintenance/runBatchedQuery.php index 6322d31de3..e1139164c5 100644 --- a/maintenance/runBatchedQuery.php +++ b/maintenance/runBatchedQuery.php @@ -23,7 +23,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script to run a database query in batches and wait for slaves. diff --git a/maintenance/runJobs.php b/maintenance/runJobs.php index af7c906cc3..e909bc06ae 100644 --- a/maintenance/runJobs.php +++ b/maintenance/runJobs.php @@ -25,7 +25,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that runs pending jobs. diff --git a/maintenance/showJobs.php b/maintenance/showJobs.php index ff7d3fc0f5..edcbdd63ee 100644 --- a/maintenance/showJobs.php +++ b/maintenance/showJobs.php @@ -24,7 +24,7 @@ * @author Antoine Musso */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); class ShowJobs extends Maintenance { public function __construct() { diff --git a/maintenance/showStats.php b/maintenance/showStats.php index b284a9acb0..f16853d7e2 100644 --- a/maintenance/showStats.php +++ b/maintenance/showStats.php @@ -28,7 +28,7 @@ * @license GNU General Public License 2.0 or later */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); class ShowStats extends Maintenance { public function __construct() { diff --git a/maintenance/sql.php b/maintenance/sql.php index c4af630786..7483dcc76f 100644 --- a/maintenance/sql.php +++ b/maintenance/sql.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); class MwSql extends Maintenance { public function __construct() { diff --git a/maintenance/sqlite.php b/maintenance/sqlite.php index 864d5ab640..7a22df598f 100644 --- a/maintenance/sqlite.php +++ b/maintenance/sqlite.php @@ -20,7 +20,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); class SqliteMaintenance extends Maintenance { public function __construct() { diff --git a/maintenance/stats.php b/maintenance/stats.php index 46926dd07b..cbea24b8ec 100644 --- a/maintenance/stats.php +++ b/maintenance/stats.php @@ -20,7 +20,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); class CacheStats extends Maintenance { diff --git a/maintenance/storage/checkStorage.php b/maintenance/storage/checkStorage.php index 29904db21f..6c669bfa07 100644 --- a/maintenance/storage/checkStorage.php +++ b/maintenance/storage/checkStorage.php @@ -22,7 +22,7 @@ */ if ( !defined( 'MEDIAWIKI' ) ) { - require_once( dirname( __FILE__ ) . '/../commandLine.inc' ); + require_once( __DIR__ . '/../commandLine.inc' ); $cs = new CheckStorage; $fix = isset( $options['fix'] ); diff --git a/maintenance/storage/compressOld.php b/maintenance/storage/compressOld.php index 5064fe7f15..4594db716c 100644 --- a/maintenance/storage/compressOld.php +++ b/maintenance/storage/compressOld.php @@ -41,7 +41,7 @@ * @ingroup Maintenance ExternalStorage */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); class CompressOld extends Maintenance { /** diff --git a/maintenance/storage/dumpRev.php b/maintenance/storage/dumpRev.php index b200d8af03..6020f22e19 100644 --- a/maintenance/storage/dumpRev.php +++ b/maintenance/storage/dumpRev.php @@ -18,7 +18,7 @@ * @ingroup Maintenance ExternalStorage */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); class DumpRev extends Maintenance { public function __construct() { diff --git a/maintenance/storage/fixBug20757.php b/maintenance/storage/fixBug20757.php index cf30b0e6b7..52ee825cea 100644 --- a/maintenance/storage/fixBug20757.php +++ b/maintenance/storage/fixBug20757.php @@ -21,7 +21,7 @@ * @ingroup Maintenance ExternalStorage */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); class FixBug20757 extends Maintenance { var $batchSize = 10000; diff --git a/maintenance/storage/moveToExternal.php b/maintenance/storage/moveToExternal.php index 64f3adaa66..2dcc25c22c 100644 --- a/maintenance/storage/moveToExternal.php +++ b/maintenance/storage/moveToExternal.php @@ -24,8 +24,8 @@ define( 'REPORTING_INTERVAL', 1 ); if ( !defined( 'MEDIAWIKI' ) ) { - require_once( dirname( __FILE__ ) . '/../commandLine.inc' ); - require_once( dirname( __FILE__ ) . '/../../includes/ExternalStoreDB.php' ); + require_once( __DIR__ . '/../commandLine.inc' ); + require_once( __DIR__ . '/../../includes/ExternalStoreDB.php' ); require_once( 'resolveStubs.php' ); $fname = 'moveToExternal'; diff --git a/maintenance/storage/orphanStats.php b/maintenance/storage/orphanStats.php index f3b521f6c3..82ee135b0d 100644 --- a/maintenance/storage/orphanStats.php +++ b/maintenance/storage/orphanStats.php @@ -20,7 +20,7 @@ * * @ingroup Maintenance ExternalStorage */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); class OrphanStats extends Maintenance { public function __construct() { diff --git a/maintenance/storage/recompressTracked.php b/maintenance/storage/recompressTracked.php index 158aa34c4f..4098077f15 100644 --- a/maintenance/storage/recompressTracked.php +++ b/maintenance/storage/recompressTracked.php @@ -23,7 +23,7 @@ */ $optionsWithArgs = RecompressTracked::getOptionsWithArgs(); -require( dirname( __FILE__ ) . '/../commandLine.inc' ); +require( __DIR__ . '/../commandLine.inc' ); if ( count( $args ) < 1 ) { echo "Usage: php recompressTracked.php [options] [... ...] diff --git a/maintenance/storage/resolveStubs.php b/maintenance/storage/resolveStubs.php index 08d0ee04f6..7e288e136a 100644 --- a/maintenance/storage/resolveStubs.php +++ b/maintenance/storage/resolveStubs.php @@ -27,7 +27,7 @@ define( 'REPORTING_INTERVAL', 100 ); if ( !defined( 'MEDIAWIKI' ) ) { $optionsWithArgs = array( 'm' ); - require_once( dirname( __FILE__ ) . '/../commandLine.inc' ); + require_once( __DIR__ . '/../commandLine.inc' ); resolveStubs(); } diff --git a/maintenance/storage/storageTypeStats.php b/maintenance/storage/storageTypeStats.php index 817659fc8a..1afecc4eb8 100644 --- a/maintenance/storage/storageTypeStats.php +++ b/maintenance/storage/storageTypeStats.php @@ -19,7 +19,7 @@ * @ingroup Maintenance ExternalStorage */ -require_once( dirname( __FILE__ ) . '/../Maintenance.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); class StorageTypeStats extends Maintenance { function execute() { diff --git a/maintenance/storage/testCompression.php b/maintenance/storage/testCompression.php index 9ae2633539..998ebe484c 100644 --- a/maintenance/storage/testCompression.php +++ b/maintenance/storage/testCompression.php @@ -21,7 +21,7 @@ */ $optionsWithArgs = array( 'start', 'limit', 'type' ); -require( dirname( __FILE__ ) . '/../commandLine.inc' ); +require( __DIR__ . '/../commandLine.inc' ); if ( !isset( $args[0] ) ) { echo "Usage: php testCompression.php [--type=] [--start=] [--limit=] \n"; diff --git a/maintenance/storage/trackBlobs.php b/maintenance/storage/trackBlobs.php index b5f800479a..214168a831 100644 --- a/maintenance/storage/trackBlobs.php +++ b/maintenance/storage/trackBlobs.php @@ -22,7 +22,7 @@ * @see wfWaitForSlaves() */ -require( dirname( __FILE__ ) . '/../commandLine.inc' ); +require( __DIR__ . '/../commandLine.inc' ); if ( count( $args ) < 1 ) { @@ -113,7 +113,7 @@ class TrackBlobs { $dbw->query( 'DROP TABLE ' . $dbw->tableName( 'blob_tracking' ) ); $dbw->query( 'DROP TABLE ' . $dbw->tableName( 'blob_orphans' ) ); } - $dbw->sourceFile( dirname( __FILE__ ) . '/blob_tracking.sql' ); + $dbw->sourceFile( __DIR__ . '/blob_tracking.sql' ); } function getTextClause() { diff --git a/maintenance/syncFileBackend.php b/maintenance/syncFileBackend.php index 2dcf757194..18d57c30ba 100644 --- a/maintenance/syncFileBackend.php +++ b/maintenance/syncFileBackend.php @@ -20,7 +20,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); class SyncFileBackend extends Maintenance { public function __construct() { diff --git a/maintenance/undelete.php b/maintenance/undelete.php index 1c3b14a567..ea8b0c4bab 100644 --- a/maintenance/undelete.php +++ b/maintenance/undelete.php @@ -21,7 +21,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); class Undelete extends Maintenance { public function __construct() { diff --git a/maintenance/update.php b/maintenance/update.php index 741ec90d5a..78e88273a3 100644 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -32,7 +32,7 @@ if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), ' } $wgUseMasterForMaintenance = true; -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); class UpdateMediaWiki extends Maintenance { diff --git a/maintenance/updateArticleCount.php b/maintenance/updateArticleCount.php index dbbfb80c3f..730a1f64e3 100644 --- a/maintenance/updateArticleCount.php +++ b/maintenance/updateArticleCount.php @@ -23,7 +23,7 @@ * @author Rob Church */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); class UpdateArticleCount extends Maintenance { diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php index 2363665b70..ec99c99e01 100644 --- a/maintenance/updateCollation.php +++ b/maintenance/updateCollation.php @@ -26,7 +26,7 @@ #$optionsWithArgs = array( 'begin', 'max-slave-lag' ); -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); class UpdateCollation extends Maintenance { const BATCH_SIZE = 50; // Number of rows to process in one batch diff --git a/maintenance/updateDoubleWidthSearch.php b/maintenance/updateDoubleWidthSearch.php index 61545f8df2..bcceab3999 100644 --- a/maintenance/updateDoubleWidthSearch.php +++ b/maintenance/updateDoubleWidthSearch.php @@ -23,7 +23,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); class UpdateDoubleWidthSearch extends Maintenance { diff --git a/maintenance/updateRestrictions.php b/maintenance/updateRestrictions.php index ffbdb2baaa..04e7f41c99 100644 --- a/maintenance/updateRestrictions.php +++ b/maintenance/updateRestrictions.php @@ -24,7 +24,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); class UpdateRestrictions extends Maintenance { public function __construct() { diff --git a/maintenance/updateSearchIndex.php b/maintenance/updateSearchIndex.php index eed3571c2b..59acc9a32d 100644 --- a/maintenance/updateSearchIndex.php +++ b/maintenance/updateSearchIndex.php @@ -28,7 +28,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); class UpdateSearchIndex extends Maintenance { diff --git a/maintenance/updateSpecialPages.php b/maintenance/updateSpecialPages.php index a1a2e2fcac..c1e497da2e 100644 --- a/maintenance/updateSpecialPages.php +++ b/maintenance/updateSpecialPages.php @@ -22,7 +22,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); class UpdateSpecialPages extends Maintenance { public function __construct() { diff --git a/maintenance/upgrade1_5.php b/maintenance/upgrade1_5.php index f0807b6df7..13faece19d 100644 --- a/maintenance/upgrade1_5.php +++ b/maintenance/upgrade1_5.php @@ -28,7 +28,7 @@ * @ingroup Maintenance */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); define( 'MW_UPGRADE_COPY', false ); define( 'MW_UPGRADE_ENCODE', true ); diff --git a/maintenance/userOptions.inc b/maintenance/userOptions.inc index 5e3574798b..2a0665793e 100644 --- a/maintenance/userOptions.inc +++ b/maintenance/userOptions.inc @@ -25,7 +25,7 @@ $options = array( 'list', 'nowarn', 'quiet', 'usage', 'dry' ); $optionsWithArgs = array( 'old', 'new' ); -require_once( dirname( __FILE__ ) . '/commandLine.inc' ); +require_once( __DIR__ . '/commandLine.inc' ); /** * @ingroup Maintenance diff --git a/maintenance/waitForSlave.php b/maintenance/waitForSlave.php index 720ca288b6..468e2395d0 100644 --- a/maintenance/waitForSlave.php +++ b/maintenance/waitForSlave.php @@ -22,7 +22,7 @@ * @see wfWaitForSlaves() */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); class WaitForSlave extends Maintenance { public function __construct() { diff --git a/mw-config/index.php b/mw-config/index.php index 3f993f0279..065d187934 100644 --- a/mw-config/index.php +++ b/mw-config/index.php @@ -8,11 +8,11 @@ define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' ); define( 'MEDIAWIKI_INSTALL', true ); -chdir( dirname( dirname( __FILE__ ) ) ); +chdir( dirname( __DIR__ ) ); if ( isset( $_SERVER['MW_COMPILED'] ) ) { require ( 'core/includes/WebStart.php' ); } else { - require( dirname( dirname( __FILE__ ) ) . '/includes/WebStart.php' ); + require( dirname( __DIR__ ) . '/includes/WebStart.php' ); } wfInstallerMain(); diff --git a/profileinfo.php b/profileinfo.php index ef038c1153..bbd5fc8aa8 100644 --- a/profileinfo.php +++ b/profileinfo.php @@ -31,7 +31,7 @@ $wgEnableProfileInfo = $wgProfileToDatabase = false; if ( isset( $_SERVER['MW_COMPILED'] ) ) { require ( 'core/includes/WebStart.php' ); } else { - require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); + require ( __DIR__ . '/includes/WebStart.php' ); } diff --git a/redirect.php b/redirect.php index fde960e015..5e6cfeed68 100644 --- a/redirect.php +++ b/redirect.php @@ -24,7 +24,7 @@ if ( isset( $_SERVER['MW_COMPILED'] ) ) { require ( 'phase3/includes/WebStart.php' ); } else { - require ( dirname( __FILE__ ) . '/includes/WebStart.php' ); + require ( __DIR__ . '/includes/WebStart.php' ); } global $wgArticlePath; diff --git a/tests/RunSeleniumTests.php b/tests/RunSeleniumTests.php index 9cadd759f6..28501eaa1b 100644 --- a/tests/RunSeleniumTests.php +++ b/tests/RunSeleniumTests.php @@ -24,12 +24,12 @@ * http://www.gnu.org/copyleft/gpl.html */ -$IP = dirname( dirname( __FILE__ ) ); +$IP = dirname( __DIR__ ); define( 'SELENIUMTEST', true ); -//require_once( dirname( __FILE__ ) . '/../maintenance/commandLine.inc' ); -require( dirname( __FILE__ ) . '/../maintenance/Maintenance.php' ); +//require_once( __DIR__ . '/../maintenance/commandLine.inc' ); +require( __DIR__ . '/../maintenance/Maintenance.php' ); require_once( 'PHPUnit/Runner/Version.php' ); if( version_compare( PHPUnit_Runner_Version::id(), '3.5.0', '>=' ) ) { @@ -43,7 +43,7 @@ if( version_compare( PHPUnit_Runner_Version::id(), '3.5.0', '>=' ) ) { require_once( 'PHPUnit/Extensions/SeleniumTestCase.php' ); include_once( 'PHPUnit/Util/Log/JUnit.php' ); -require_once( dirname( __FILE__ ) . "/selenium/SeleniumServerManager.php" ); +require_once( __DIR__ . "/selenium/SeleniumServerManager.php" ); class SeleniumTester extends Maintenance { protected $selenium; diff --git a/tests/TestsAutoLoader.php b/tests/TestsAutoLoader.php index 3125284d23..e853b13cea 100644 --- a/tests/TestsAutoLoader.php +++ b/tests/TestsAutoLoader.php @@ -1,7 +1,7 @@ zipDir = dirname( __FILE__ ) . '/../data/zip'; + $this->zipDir = __DIR__ . '/../data/zip'; } function zipCallback( $entry ) { diff --git a/tests/phpunit/includes/api/RandomImageGenerator.php b/tests/phpunit/includes/api/RandomImageGenerator.php index 86c0a828fd..8b6a3849f6 100644 --- a/tests/phpunit/includes/api/RandomImageGenerator.php +++ b/tests/phpunit/includes/api/RandomImageGenerator.php @@ -79,7 +79,7 @@ class RandomImageGenerator { foreach ( array( '/usr/share/dict/words', '/usr/dict/words', - dirname( __FILE__ ) . '/words.txt' ) + __DIR__ . '/words.txt' ) as $dictionaryFile ) { if ( is_file( $dictionaryFile ) and is_readable( $dictionaryFile ) ) { $this->dictionaryFile = $dictionaryFile; diff --git a/tests/phpunit/includes/api/generateRandomImages.php b/tests/phpunit/includes/api/generateRandomImages.php index b22eccd098..ee34562325 100644 --- a/tests/phpunit/includes/api/generateRandomImages.php +++ b/tests/phpunit/includes/api/generateRandomImages.php @@ -6,11 +6,11 @@ */ // Evaluate the include path relative to this file -$IP = dirname( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) ); +$IP = dirname( dirname( dirname( dirname( __DIR__ ) ) ) ); // Start up MediaWiki in command-line mode require_once( "$IP/maintenance/Maintenance.php" ); -require( dirname( __FILE__ ) . "/RandomImageGenerator.php" ); +require( __DIR__ . "/RandomImageGenerator.php" ); class GenerateRandomImages extends Maintenance { diff --git a/tests/phpunit/includes/db/TestORMRowTest.php b/tests/phpunit/includes/db/TestORMRowTest.php index fe5867af09..afd1cb803f 100644 --- a/tests/phpunit/includes/db/TestORMRowTest.php +++ b/tests/phpunit/includes/db/TestORMRowTest.php @@ -38,7 +38,7 @@ * @licence GNU GPL v2+ * @author Jeroen De Dauw < jeroendedauw@gmail.com > */ -require_once dirname( __FILE__ ) . "/ORMRowTest.php"; +require_once __DIR__ . "/ORMRowTest.php"; class TestORMRowTest extends ORMRowTest { diff --git a/tests/phpunit/includes/media/BitmapMetadataHandlerTest.php b/tests/phpunit/includes/media/BitmapMetadataHandlerTest.php index f4f52dd875..d6e25477bd 100644 --- a/tests/phpunit/includes/media/BitmapMetadataHandlerTest.php +++ b/tests/phpunit/includes/media/BitmapMetadataHandlerTest.php @@ -2,7 +2,7 @@ class BitmapMetadataHandlerTest extends MediaWikiTestCase { public function setUp() { - $this->filePath = dirname( __FILE__ ) . '/../../data/media/'; + $this->filePath = __DIR__ . '/../../data/media/'; } /** diff --git a/tests/phpunit/includes/media/ExifRotationTest.php b/tests/phpunit/includes/media/ExifRotationTest.php index 1e2d1bb7fe..6af52dd10d 100644 --- a/tests/phpunit/includes/media/ExifRotationTest.php +++ b/tests/phpunit/includes/media/ExifRotationTest.php @@ -8,7 +8,7 @@ class ExifRotationTest extends MediaWikiTestCase { function setUp() { parent::setUp(); $this->handler = new BitmapHandler(); - $filePath = dirname( __FILE__ ) . '/../../data/media'; + $filePath = __DIR__ . '/../../data/media'; $tmpDir = $this->getNewTempDirectory(); diff --git a/tests/phpunit/includes/media/ExifTest.php b/tests/phpunit/includes/media/ExifTest.php index fff8c0bcf3..045777d771 100644 --- a/tests/phpunit/includes/media/ExifTest.php +++ b/tests/phpunit/includes/media/ExifTest.php @@ -2,7 +2,7 @@ class ExifTest extends MediaWikiTestCase { public function setUp() { - $this->mediaPath = dirname( __FILE__ ) . '/../../data/media/'; + $this->mediaPath = __DIR__ . '/../../data/media/'; if ( !wfDl( 'exif' ) ) { $this->markTestSkipped( "This test needs the exif extension." ); diff --git a/tests/phpunit/includes/media/FormatMetadataTest.php b/tests/phpunit/includes/media/FormatMetadataTest.php index 8a632f527c..6ade67027c 100644 --- a/tests/phpunit/includes/media/FormatMetadataTest.php +++ b/tests/phpunit/includes/media/FormatMetadataTest.php @@ -4,7 +4,7 @@ class FormatMetadataTest extends MediaWikiTestCase { if ( !wfDl( 'exif' ) ) { $this->markTestSkipped( "This test needs the exif extension." ); } - $filePath = dirname( __FILE__ ) . '/../../data/media'; + $filePath = __DIR__ . '/../../data/media'; $this->backend = new FSFileBackend( array( 'name' => 'localtesting', 'lockManager' => 'nullLockManager', diff --git a/tests/phpunit/includes/media/GIFMetadataExtractorTest.php b/tests/phpunit/includes/media/GIFMetadataExtractorTest.php index 47fc368b27..650fdd5c7c 100644 --- a/tests/phpunit/includes/media/GIFMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/GIFMetadataExtractorTest.php @@ -2,7 +2,7 @@ class GIFMetadataExtractorTest extends MediaWikiTestCase { public function setUp() { - $this->mediaPath = dirname( __FILE__ ) . '/../../data/media/'; + $this->mediaPath = __DIR__ . '/../../data/media/'; } /** * Put in a file, and see if the metadata coming out is as expected. diff --git a/tests/phpunit/includes/media/GIFTest.php b/tests/phpunit/includes/media/GIFTest.php index 3665835804..5dcbeee03f 100644 --- a/tests/phpunit/includes/media/GIFTest.php +++ b/tests/phpunit/includes/media/GIFTest.php @@ -2,7 +2,7 @@ class GIFHandlerTest extends MediaWikiTestCase { public function setUp() { - $this->filePath = dirname( __FILE__ ) . '/../../data/media'; + $this->filePath = __DIR__ . '/../../data/media'; $this->backend = new FSFileBackend( array( 'name' => 'localtesting', 'lockManager' => 'nullLockManager', diff --git a/tests/phpunit/includes/media/JpegMetadataExtractorTest.php b/tests/phpunit/includes/media/JpegMetadataExtractorTest.php index f48382a431..41d811902c 100644 --- a/tests/phpunit/includes/media/JpegMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/JpegMetadataExtractorTest.php @@ -9,7 +9,7 @@ class JpegMetadataExtractorTest extends MediaWikiTestCase { public function setUp() { - $this->filePath = dirname( __FILE__ ) . '/../../data/media/'; + $this->filePath = __DIR__ . '/../../data/media/'; } /** diff --git a/tests/phpunit/includes/media/JpegTest.php b/tests/phpunit/includes/media/JpegTest.php index ddabf5b8cd..ea007f9031 100644 --- a/tests/phpunit/includes/media/JpegTest.php +++ b/tests/phpunit/includes/media/JpegTest.php @@ -2,7 +2,7 @@ class JpegTest extends MediaWikiTestCase { public function setUp() { - $this->filePath = dirname( __FILE__ ) . '/../../data/media/'; + $this->filePath = __DIR__ . '/../../data/media/'; if ( !wfDl( 'exif' ) ) { $this->markTestSkipped( "This test needs the exif extension." ); } diff --git a/tests/phpunit/includes/media/PNGMetadataExtractorTest.php b/tests/phpunit/includes/media/PNGMetadataExtractorTest.php index 9f702c504d..1b1b2ec33a 100644 --- a/tests/phpunit/includes/media/PNGMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/PNGMetadataExtractorTest.php @@ -2,7 +2,7 @@ class PNGMetadataExtractorTest extends MediaWikiTestCase { function setUp() { - $this->filePath = dirname( __FILE__ ) . '/../../data/media/'; + $this->filePath = __DIR__ . '/../../data/media/'; } /** * Tests zTXt tag (compressed textual metadata) diff --git a/tests/phpunit/includes/media/PNGTest.php b/tests/phpunit/includes/media/PNGTest.php index b6f911fd8a..fe73c9c71c 100644 --- a/tests/phpunit/includes/media/PNGTest.php +++ b/tests/phpunit/includes/media/PNGTest.php @@ -2,7 +2,7 @@ class PNGHandlerTest extends MediaWikiTestCase { public function setUp() { - $this->filePath = dirname( __FILE__ ) . '/../../data/media'; + $this->filePath = __DIR__ . '/../../data/media'; $this->backend = new FSFileBackend( array( 'name' => 'localtesting', 'lockManager' => 'nullLockManager', diff --git a/tests/phpunit/includes/media/SVGMetadataExtractorTest.php b/tests/phpunit/includes/media/SVGMetadataExtractorTest.php index 3017dbbd96..2116554eec 100644 --- a/tests/phpunit/includes/media/SVGMetadataExtractorTest.php +++ b/tests/phpunit/includes/media/SVGMetadataExtractorTest.php @@ -39,7 +39,7 @@ class SVGMetadataExtractorTest extends MediaWikiTestCase { } function providerSvgFiles() { - $base = dirname( __FILE__ ) . '/../../data/media'; + $base = __DIR__ . '/../../data/media'; return array( array( "$base/Wikimedia-logo.svg", @@ -82,7 +82,7 @@ class SVGMetadataExtractorTest extends MediaWikiTestCase { } function providerSvgFilesWithXMLMetadata() { - $base = dirname( __FILE__ ) . '/../../data/media'; + $base = __DIR__ . '/../../data/media'; $metadata = ' diff --git a/tests/phpunit/includes/media/TiffTest.php b/tests/phpunit/includes/media/TiffTest.php index d4cf503b93..4c79f66c0e 100644 --- a/tests/phpunit/includes/media/TiffTest.php +++ b/tests/phpunit/includes/media/TiffTest.php @@ -5,7 +5,7 @@ class TiffTest extends MediaWikiTestCase { global $wgShowEXIF; $this->showExif = $wgShowEXIF; $wgShowEXIF = true; - $this->filePath = dirname( __FILE__ ) . '/../../data/media/'; + $this->filePath = __DIR__ . '/../../data/media/'; $this->handler = new TiffHandler; } diff --git a/tests/phpunit/includes/media/XMPTest.php b/tests/phpunit/includes/media/XMPTest.php index 942cc3a989..8198d3b08b 100644 --- a/tests/phpunit/includes/media/XMPTest.php +++ b/tests/phpunit/includes/media/XMPTest.php @@ -26,7 +26,7 @@ class XMPTest extends MediaWikiTestCase { } public function dataXMPParse() { - $xmpPath = dirname( __FILE__ ) . '/../../data/xmp/' ; + $xmpPath = __DIR__ . '/../../data/xmp/' ; $data = array(); // $xmpFiles format: array of arrays with first arg file base name, @@ -73,7 +73,7 @@ class XMPTest extends MediaWikiTestCase { * world example file to double check the support for this is right. */ function testExtendedXMP() { - $xmpPath = dirname( __FILE__ ) . '/../../data/xmp/'; + $xmpPath = __DIR__ . '/../../data/xmp/'; $standardXMP = file_get_contents( $xmpPath . 'xmpExt.xmp' ); $extendedXMP = file_get_contents( $xmpPath . 'xmpExt2.xmp' ); @@ -103,7 +103,7 @@ class XMPTest extends MediaWikiTestCase { * and thus should only return the StandardXMP, not the ExtendedXMP. */ function testExtendedXMPWithWrongGUID() { - $xmpPath = dirname( __FILE__ ) . '/../../data/xmp/'; + $xmpPath = __DIR__ . '/../../data/xmp/'; $standardXMP = file_get_contents( $xmpPath . 'xmpExt.xmp' ); $extendedXMP = file_get_contents( $xmpPath . 'xmpExt2.xmp' ); @@ -131,7 +131,7 @@ class XMPTest extends MediaWikiTestCase { * which should cause it to ignore the ExtendedXMP packet. */ function testExtendedXMPMissingPacket() { - $xmpPath = dirname( __FILE__ ) . '/../../data/xmp/'; + $xmpPath = __DIR__ . '/../../data/xmp/'; $standardXMP = file_get_contents( $xmpPath . 'xmpExt.xmp' ); $extendedXMP = file_get_contents( $xmpPath . 'xmpExt2.xmp' ); diff --git a/tests/phpunit/includes/parser/MediaWikiParserTest.php b/tests/phpunit/includes/parser/MediaWikiParserTest.php index 816c017a95..6a6fded17a 100644 --- a/tests/phpunit/includes/parser/MediaWikiParserTest.php +++ b/tests/phpunit/includes/parser/MediaWikiParserTest.php @@ -1,5 +1,5 @@ {{foo|bar=|}"), array( "{{Foo|} Bar=", "{{Foo|} Bar="), array( "{{Foo|} Bar=}}", ""), - /* array( file_get_contents( dirname( __FILE__ ) . '/QuoteQuran.txt' ), file_get_contents( dirname( __FILE__ ) . '/QuoteQuranExpanded.txt' ) ), */ + /* array( file_get_contents( __DIR__ . '/QuoteQuran.txt' ), file_get_contents( __DIR__ . '/QuoteQuranExpanded.txt' ) ), */ ); } @@ -165,7 +165,7 @@ class PreprocessorTest extends MediaWikiTestCase { * @dataProvider provideFiles */ function testPreprocessorOutputFiles( $filename ) { - $folder = dirname( __FILE__ ) . "/../../../parser/preprocess"; + $folder = __DIR__ . "/../../../parser/preprocess"; $wikiText = file_get_contents( "$folder/$filename.txt" ); $output = $this->preprocessToXml( $wikiText ); diff --git a/tests/phpunit/includes/upload/UploadStashTest.php b/tests/phpunit/includes/upload/UploadStashTest.php index c9dbb1388e..dc1c2ac4fc 100644 --- a/tests/phpunit/includes/upload/UploadStashTest.php +++ b/tests/phpunit/includes/upload/UploadStashTest.php @@ -12,7 +12,7 @@ class UploadStashTest extends MediaWikiTestCase { parent::setUp(); // Setup a file for bug 29408 - $this->bug29408File = dirname( __FILE__ ) . '/bug29408'; + $this->bug29408File = __DIR__ . '/bug29408'; file_put_contents( $this->bug29408File, "\x00" ); self::$users = array( diff --git a/tests/phpunit/languages/LanguageSrTest.php b/tests/phpunit/languages/LanguageSrTest.php index e7d3ea1816..d44ecf8e5b 100644 --- a/tests/phpunit/languages/LanguageSrTest.php +++ b/tests/phpunit/languages/LanguageSrTest.php @@ -12,7 +12,7 @@ * @file */ -require_once dirname( dirname( __FILE__ ) ) . '/bootstrap.php'; +require_once dirname( __DIR__ ) . '/bootstrap.php'; /** Tests for MediaWiki languages/LanguageSr.php */ class LanguageSrTest extends MediaWikiTestCase { diff --git a/tests/phpunit/languages/LanguageUzTest.php b/tests/phpunit/languages/LanguageUzTest.php index 86f483d0fc..723872836f 100644 --- a/tests/phpunit/languages/LanguageUzTest.php +++ b/tests/phpunit/languages/LanguageUzTest.php @@ -12,7 +12,7 @@ * @file */ -require_once dirname( dirname( __FILE__ ) ) . '/bootstrap.php'; +require_once dirname( __DIR__ ) . '/bootstrap.php'; /** Tests for MediaWiki languages/LanguageUz.php */ class LanguageUzTest extends MediaWikiTestCase { diff --git a/tests/phpunit/maintenance/backupPrefetchTest.php b/tests/phpunit/maintenance/backupPrefetchTest.php index 965d7beeaf..8ff855744b 100644 --- a/tests/phpunit/maintenance/backupPrefetchTest.php +++ b/tests/phpunit/maintenance/backupPrefetchTest.php @@ -1,6 +1,6 @@ login(); $this->open( $this->getUrl() . '/index.php?title=Special:Upload' ); - $this->type( 'wpUploadFile', dirname( __FILE__ ) . + $this->type( 'wpUploadFile', __DIR__ . "\\..\\data\\Wikipedia-logo-v2-de.png" ); $this->check( 'wpIgnoreWarning' ); $this->click( 'wpUpload' ); diff --git a/tests/selenium/suites/MyContributionsTestCase.php b/tests/selenium/suites/MyContributionsTestCase.php index 01d87e4b7d..b8d2d48d1d 100644 --- a/tests/selenium/suites/MyContributionsTestCase.php +++ b/tests/selenium/suites/MyContributionsTestCase.php @@ -27,7 +27,7 @@ * */ -require_once dirname( dirname( __FILE__ ) ) . '/SeleniumTestConstants.php'; +require_once dirname( __DIR__ ) . '/SeleniumTestConstants.php'; class MyContributionsTestCase extends SeleniumTestCase { diff --git a/tests/selenium/suites/MyWatchListTestCase.php b/tests/selenium/suites/MyWatchListTestCase.php index d1ee3e78f8..998fab9de7 100644 --- a/tests/selenium/suites/MyWatchListTestCase.php +++ b/tests/selenium/suites/MyWatchListTestCase.php @@ -27,7 +27,7 @@ * */ -require_once dirname( dirname( __FILE__ ) ) . '/SeleniumTestConstants.php'; +require_once dirname( __DIR__ ) . '/SeleniumTestConstants.php'; class MyWatchListTestCase extends SeleniumTestCase { diff --git a/thumb.php b/thumb.php index 5fc4446248..d4c6165572 100644 --- a/thumb.php +++ b/thumb.php @@ -25,7 +25,7 @@ define( 'MW_NO_OUTPUT_COMPRESSION', 1 ); if ( isset( $_SERVER['MW_COMPILED'] ) ) { require( 'core/includes/WebStart.php' ); } else { - require( dirname( __FILE__ ) . '/includes/WebStart.php' ); + require( __DIR__ . '/includes/WebStart.php' ); } // Don't use fancy mime detection, just check the file extension for jpg/gif/png diff --git a/thumb_handler.php b/thumb_handler.php index abc71dd6a9..69bdddd8ca 100644 --- a/thumb_handler.php +++ b/thumb_handler.php @@ -26,4 +26,4 @@ define( 'THUMB_HANDLER', true ); # Execute thumb.php, having set THUMB_HANDLER so that # it knows to extract params from a thumbnail file URL. -require( dirname( __FILE__ ) . '/thumb.php' ); +require( __DIR__ . '/thumb.php' ); -- 2.20.1