From 692cf27013e8f0e5c0f452978211269d15fb284f Mon Sep 17 00:00:00 2001 From: Ori Livneh Date: Sat, 14 Oct 2017 16:57:38 -0400 Subject: [PATCH] Add lowercase variants to the autoloader for legacy history blob classes Blobs in the text table created by MediaWiki <1.5 running on PHP 4 had class names coerced to lowercase. In order to succcessfully resolve these class names, the autoloader creates a copy of the autoload class array with lowercased keys, which is pretty inefficient. So instead, make sure the auto-generated autoload map contains lowercase variants for these specific classes. Bug: T166759 Change-Id: I6d751ef516e936e04c056d70a1ecd17960a39ceb --- autoload.php | 3 +++ includes/HistoryBlob.php | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/autoload.php b/autoload.php index a489b8bf0e..83f25193ed 100644 --- a/autoload.php +++ b/autoload.php @@ -1706,5 +1706,8 @@ $wgAutoloadLocalClasses = [ 'ZhConverter' => __DIR__ . '/languages/classes/LanguageZh.php', 'ZipDirectoryReader' => __DIR__ . '/includes/utils/ZipDirectoryReader.php', 'ZipDirectoryReaderError' => __DIR__ . '/includes/utils/ZipDirectoryReaderError.php', + 'concatenatedgziphistoryblob' => __DIR__ . '/includes/HistoryBlob.php', + 'historyblobcurstub' => __DIR__ . '/includes/HistoryBlob.php', + 'historyblobstub' => __DIR__ . '/includes/HistoryBlob.php', 'profile_point' => __DIR__ . '/profileinfo.php', ]; diff --git a/includes/HistoryBlob.php b/includes/HistoryBlob.php index 51bd7a9e94..14d22ec404 100644 --- a/includes/HistoryBlob.php +++ b/includes/HistoryBlob.php @@ -699,3 +699,16 @@ class DiffHistoryBlob implements HistoryBlob { } } + +// @codingStandardsIgnoreStart +if ( false ) { + // Blobs generated by MediaWiki < 1.5 on PHP 4 were serialized with the + // class name coerced to lowercase. We can improve efficiency by adding + // autoload entries for the lowercase variants of these classes (T166759). + // The code below is never executed, but it is picked up by the AutoloadGenerator + // parser, which scans for class_alias() calls. + class_alias( 'ConcatenatedGzipHistoryBlob', 'concatenatedgziphistoryblob' ); + class_alias( 'HistoryBlobCurStub', 'historyblobcurstub' ); + class_alias( 'HistoryBlobStub', 'historyblobstub' ); +} +// @codingStandardsIgnoreEnd -- 2.20.1