aboutsummaryrefslogtreecommitdiffstats
path: root/includes/historyblob
Commit message (Collapse)AuthorAgeFilesLines
* Fix "Call to undefined method HistoryBlobStub::getItem()"Paladox2024-02-011-1/+5
| | | | | | | This happens sometimes so we fix this by checking if the method exists on object. If not return false like we do a few lines above. Change-Id: I943def36276b18164c6bbf00b5a7191d7ea948da
* Change uses of getDBLoadBalancerFactory() to getConnectionProvider()Bartosz DziewoƄski2024-01-222-2/+2
| | | | | | | | | | | | Update cases where one of the IConnectionProvider methods is called immediately. This doesn't really change anything, but I hope it helps promote getConnectionProvider() as the common way to do this. Follow-up to 8604c384f624273f46b653ec252ffaed30e6ff89. Change-Id: Id0e7d02bab0c570343c2b1f03c70b44ee39db112
* Replace more usages of deprecated MWExceptionDaimona Eaytoy2024-01-191-7/+3
| | | | | Bug: T328220 Change-Id: Ie9b56bcf5e962e275d80570cad98d676da505894
* Use thousands separators in selected integer literalsTim Starling2023-12-122-2/+2
| | | | | | | | | | For readability. Allowed since PHP 7.4. I searched for integer literals of 6 or more digits, and also changed some nearby smaller numbers for consistency. Bug: T353205 Change-Id: I8518e04889ba8fd52e0f9476a74f8e3e1454b678
* Migrate off wfGetDB() in more places to ICPAmir Sarabadani2023-11-202-2/+4
| | | | | | | | | | | | | | | | | This function is uber-deprecated, meaning even its replacement is deprecated, We have already migrated in static functions and more. In this batch, all calls have been migrated that there is already a call to MediaWikiServices::getInstance() making the migration easier. Of course in most cases, they should eventually turn into proper service injection but this at least makes it clear what services should be injected. Also removing "category" group since we are removing all groups except a handful from mw (see T263127 for more information). Bug: T330641 Change-Id: I90cd35ee45a37eb6e6bf7a531cc8f75effbd0328
* HistoryBlob: Remove unused constantAmmarpad2023-10-131-1/+0
| | | | | | | Not used anywhere since introduction and does not seem particularly useful Change-Id: Ic5596aeb86fa9e27abf7c54d8d81e1c728963be2
* Migrate more calls of Database::select* to SelectQueryBuilderAmir Sarabadani2023-07-262-7/+10
| | | | | | | | | Using a php parser written on top of ANTLR4, done semi-automatically. I checked everything and made adjustments. Bug: T311866 Change-Id: I6150c6909bce8f3dbd745a26380cc0af9d9c547f
* Replace some usages of MWExceptionDaimona Eaytoy2023-01-261-1/+1
| | | | | | | | These exceptions are not documented with @throws and they're really not meant to be caught. Bug: T86704 Change-Id: I07f32e42c6fd4bc8785bac91547858f15a9fc2a8
* Merge "Make use of ?:, ?? and ??= operators in mostly trivial cases"jenkins-bot2022-12-161-4/+1
|\
| * Make use of ?:, ?? and ??= operators in mostly trivial casesthiemowmde2022-12-051-4/+1
| | | | | | | | | | | | | | | | | | | | The motivation is to make the code less confusing. I hope this is the case. ?? is an older PHP 7.0 feature. ??= was added in PHP 7.4, which we can finally use. Change-Id: Id807affa52bd1151a74c064623b41d950a389560
* | Protect HistoryBlob storage against malicious class injectionTim Starling2022-12-024-10/+60
|/ | | | | | | | | | | | | | | * Add a safe unserialize() wrapper for HistoryBlob classes * Add a safe unserialize() wrapper for plain array data as used for compressed internal storage by ConcatenatedGzipHistoryBlob and DiffHistoryBlob. * Fix tests broken by this. * Fix unnecessary call to uncompress(), __wakeup() does this already. Was a phan error now that we have more information about the type of $obj. * Add tests for successful unserialize and wakeup of WMF production data. Change-Id: Ic995dda16d9c6045b33f2fdae7f6575ac8329976
* HistoryBlob serialization stabilityTim Starling2022-11-213-0/+12
| | | | | | | * Add comments about serialization stability to the HistoryBlob classes * Clarify the SqlBlobStore comment about legacy encoding Change-Id: I7dd0f889419ffb5e5dc435e95e02ef05154cd224
* Merge "DiffHistoryBlob: Remove workarounds for old PECL xdiff versions"jenkins-bot2022-06-091-14/+4
|\
| * DiffHistoryBlob: Remove workarounds for old PECL xdiff versionsKevin Israel2022-05-311-14/+4
| | | | | | | | | | | | | | | | | | Versions of PECL xdiff older than 1.5.2 cannot be compiled against PHP 5.4 and newer (we require PHP 7.2+). See changelog: https://pecl.php.net/package-changelog.php?package=xdiff Change-Id: I28d27fd3bbac6a42827a2b46f06f25657023cc10
* | Merge "DiffHistoryBlob: Don't check for hash PHP extension"jenkins-bot2022-06-091-7/+3
|\|
| * DiffHistoryBlob: Don't check for hash PHP extensionKevin Israel2022-05-311-7/+3
| | | | | | | | | | | | | | MediaWiki has required this PHP extension for quite a while by now. Furthermore, it is always available in PHP 7.4 and later. Change-Id: Ifbf3400bca75351ea8fa461ca27259ee31543237
* | Remove unused configuration global $wgLegacySchemaConversiondiesel kapasule2022-05-301-3/+0
|/ | | | | | | | I removed $wgLegacySchemaConversion from config-vars and HistoryBlobCurStub. Bug: T303684 Change-Id: I7f918ab61ffea377bd827721f9b41ae5d8f82226
* historyblob: Improve param and property documentationUmherirrender2022-03-084-14/+17
| | | | | | Also cast scalar types when needed Change-Id: I88b17fe03d398df1ce2686aa0e223fc58e97e037
* Replace some more usages of Wikimedia\(suppress|restore)Warnings()Reedy2022-02-241-4/+6
| | | | Change-Id: I2eb133a9e32116cd155f59086245bc4d15ecbfcc
* HistoryBlobStub: add getLocation() to get $mOldIdUniversal Omega2021-10-191-0/+8
| | | | | | | For use in the checkStorage and resolveStubs maintenance scripts, in order to fix them. Follows-Up: Id1f530c2c8ec1171615f726dc7446431ee7ca8fe Change-Id: Iade3d1660f2b7db62f829f5e5ca94372614ae7e5
* docs: Fix nullable documentation for class propertiesUmherirrender2021-09-241-1/+1
| | | | Change-Id: I6d0577124d852103f485ffdc819876a13f6641c3
* Post Revision-removal cleanupDannyS7122021-06-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Updates for the removal of the Revision class itself and the various methods/hooks/variables removed in the process, including: - Update some documentation removing most references to the Revision class and updating the MCR migration notes to reflect the past tense for Revision methods. - Change some capitalization from "Revision" to "revision" to make it clear comments are about revisions in general, not the Revision class in particular. - Minor code tweaks including removing unused variables that were around for the old hooks that were removed, and removing the use of DeprecatablePropertyArray where no longer needed for anything. - Fix incorrect documentation for PageUpdater::getStatus(), the status value changed a while ago to have revision-record in addition to revision, and recently to only have the revision-record, but ironically PageUpdater was never updated. - Removed Parser::$mRevisionObject, used to be a Revision object and was deprecated in 1.35, missed earlier because it was no longer being set to Revision objects, always null. - Add RevisionRecord typehints in DummyLinker to match those in the corresponding Linker methods This should be a no-op in terms of functionality. Bug: T247143 Change-Id: I03bbb94fc29085855448780b1a5ad9063911ecc4
* Safer autoloading with respect to file-scope codeTim Starling2021-01-113-30/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many files were in the autoloader despite having potentially harmful file-scope code. * Exclude all CommandLineInc maintenance scripts from the autoloader. * Introduce "NO_AUTOLOAD" tag which excludes the file containing it from the autoloader. Use it on CommandLineInc.php and a few suspicious-looking files without classes in case they are refactored to add classes in the future. * Add a test which parses all non-PSR4 class files and confirms that they do not contain dangerous file-scope code. It's slow (15s) but its results were enlightening. * Several maintenance scripts define constants in the file scope, intending to modify the behaviour of MediaWiki. Either move the define() to a later setup function, or protect with NO_AUTOLOAD. * Use require_once consistently with Maintenance.php and doMaintenance.php, per the original convention which is supposed to allow one maintenance script to use the class of another maintenance script. Using require breaks autoloading of these maintenance class files. * When Maintenance.php is included, check if MediaWiki has already started, and if so, return early. Revert the fix for T250003 which is incompatible with this safety measure. Hopefully it was superseded by splitting out the class file. * In runScript.php add a redundant PHP_SAPI check since it does some things in file-scope code before any other check will be run. * Change the if(false) class_alias(...) to something more hackish and more compatible with the new test. * Some site-related scripts found Maintenance.php in a non-standard way. Use the standard way. * fileOpPerfTest.php called error_reporting(). Probably debugging code left in; removed. * Moved mediawiki.compress.7z registration from the class file to the caller. Change-Id: I1b1be90343a5ab678df6f1b1bdd03319dcf6537f
* phan: Enable redundant_condition_detectionUmherirrender2020-07-013-0/+3
| | | | | | | | Remove duplicate casts Suppress false positives Bug: T248438 Change-Id: I2f89664a4bcd3b39b15e7cf850adda2f0c90ae6f
* Pass function name to database functionsUmherirrender2020-06-072-2/+3
| | | | | | Useful for logging Change-Id: Ia2160fb6be5fc93f28ab51f7ae23d7f078247481
* Remove terminating line breaks from debug messagesTim Starling2020-06-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | A terminating line break has not been required in wfDebug() since 2014, however no migration was done. Some of these line breaks found their way into LoggerInterface::debug() calls, where they mess up the formatting of the debug log. So, remove terminating line breaks from wfDebug() and LoggerInterface::debug() calls. Also: * Fix the stripping of leading line breaks from the log header emitted by Setup.php. This feature, accidentally broken in 2014, allows requests to be distinguished in the log file. * Avoid using the global variable $self. * Move the logging of the client IP back to Setup.php. It was moved to WebRequest in the hopes that it would not always be needed, however $wgRequest->getIP() is now called unconditionally a few lines up in Setup.php. This means that it is put in its proper place after the "start request" message. * Wrap the log header code in a closure so that variables like $name do not leak into global scope. * In Linker.php, remove a few instances of an unnecessary second parameter to wfDebug(). Change-Id: I96651d3044a95b9d210b51cb8368edc76bebbb9e
* Fix more Squiz.Scope.MethodScope.MissingReedy2020-05-182-18/+18
| | | | | | | | | | | Member variables in HistoryBlobStub have been marked protected SpecialPage::setListed() and listed() have been deprecated CategoryPage::getCategoryViewerClass() and setCategoryViewerClass() have been deprecated Change-Id: Id1f530c2c8ec1171615f726dc7446431ee7ca8fe
* Fix even more Squiz.Scope.MethodScope.MissingReedy2020-05-172-6/+6
| | | | Change-Id: I0c3f8ce7fddfa6886413cdaf1edc236c4dfff44e
* Fix numerous PSR12.Properties.ConstantVisibility.NotFoundReedy2020-05-111-3/+3
| | | | Change-Id: I2ec09c02c2e4ed399d993cb1871e67df02167ca8
* Set visibility on php magic functions __destruct/sleep/wakeup/get/callUmherirrender2019-12-052-4/+4
| | | | | | | All the magic functions needs public visibility to be callable from php internals like garbage collector Change-Id: I1baf04bf8ff787da880d46e4a6daa77f5a6de73f
* Set method visibility for various constructorsUmherirrender2019-12-033-3/+3
| | | | Change-Id: Id3c88257e866923b06e878ccdeddded7f08f2c98
* phan: Disable enable_class_alias_supportUmherirrender2019-09-153-3/+0
| | | | | | It is enabled for b/c in extensions, but not needed in core Change-Id: I51dca12be9c77049f77563d9bf0edd07928c2300
* Unsuppress phan issues part 6Daimona Eaytoy2019-09-011-6/+5
| | | | | | Bug: T231636 Depends-On: I50377746f01749b058c39fd8229f9d566224cc43 Change-Id: I2cd24e73726394e3200a570c45d5e86b6849bfa9
* Unsuppress more phan issues (part 3)Daimona Eaytoy2019-08-311-1/+8
| | | | | | Bug: T231636 Depends-On: I78354bf5f0c831108c8f606e50c87cf6bc00d8bd Change-Id: I58e67c2b38389df874438deada4239510d21654f
* Unsuppress other phan issues with low countDaimona Eaytoy2019-08-301-1/+1
| | | | | | | | | And also update approximated counts, which for the most part are lower than reported (hooray!) Bug: T231636 Depends-On: Ica50297ec7c71a81ba2204f9763499da925067bd Change-Id: I78354bf5f0c831108c8f606e50c87cf6bc00d8bd
* build: Updating mediawiki/mediawiki-phan-config to 0.6.1James D. Forrester2019-07-103-0/+3
| | | | Change-Id: I370fed5248c8b243527cafb77d80ddb6f4bc7064
* Make ExternalStore wrap ExternalStoreFactory and create access classAaron Schulz2019-06-281-2/+5
| | | | | | | | | | | | | | | * Inject settings and global instances as dependencies to the ExternalStoreMedium instances. This includes the local wiki domain, so that wfWikiId() calls are not scattered around. * Create ExternalStoreAccess service for read/write logic. * Deprecate the ExternalStore wrapper methods. * Add some exception cases for bogus store URLs are used instead of just giving PHP warnings and failing later. * Make moveToExternal.php require the type/protocol to decide which ExternalStoreMedium to use instead of assuming "DB". * Convert logging calls to use LoggerInterface. Change-Id: I40c3b5534fc8a31116c4c5eb64ee6e4903a6197a
* Move HistoryBlob classes to own filesUmherirrender2019-03-255-0/+813
Move all into own subfolder Change-Id: Iccf1bb9a2c8927c1b4dc0952d59d745109a71f76