aboutsummaryrefslogtreecommitdiffstats
path: root/includes/specialpage/QueryPage.php
Commit message (Collapse)AuthorAgeFilesLines
* QueryPage: Improve isExpensive() docs and ref UpdateSpecialPagesTimo Tijhof2022-07-291-3/+15
| | | | | | | Referred to from https://www.mediawiki.org/wiki/Wikimedia_Performance_Team/Backend_performance Change-Id: I6e51a418757209e21d2a815f7cd6bce1ab086e1b
* specialpage: Fix deprecation for QueryPage::getSQLUmherirrender2022-06-251-6/+7
| | | | | | | | | The deprecation must be detected outside of the function, which gets overridden, because there is no need to call parent by the overridden function. Follow-Up: Idd60ef34cd808952a3156fb61904f193a445b9f8 Change-Id: Ice85209f0bfe3bfdf7373cf9e1a728a1fe9d25b6
* Merge "specialpage: Use upsert() when updating querycache_info timestamp"jenkins-bot2022-06-211-7/+10
|\
| * specialpage: Use upsert() when updating querycache_info timestampKunal Mehta2022-06-131-7/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use upsert() instead of a delete()/insert() when updating the timestamp the query page was updated at in the querycache_info table. == Test plan == * Run `DELETE FROM querycache_info` to clear the table. * Run `php updateSpecialPages.php`, inspect querycache_info table to see all query pages have a row with the correct timestamp. * Wait a few seconds, re-run the update script, and look at the table to see that the timestamp was properly updated. Change-Id: I70c18906f2507e6ef3660b77ea99dd5650e3155f
* | Hard deprecate QueryPage::getSQL()Alexander Vorwerk2022-06-131-2/+7
|/ | | | | | | Unused and discouraged. Can be replaced with getQueryInfo(). Bug: T244138 Change-Id: Idd60ef34cd808952a3156fb61904f193a445b9f8
* Use MainConfigNames instead of string literalsAryeh Gregor2022-04-111-8/+10
| | | | | | | | Part 1, proof of concept. Hundreds of files left to go. These changes brought to you in large part by vim macros. Bug: T305805 Change-Id: I44789091e9f6394c800a11b29f22528c8dcacf71
* phan: Remove PhanPossiblyUndeclaredVariable suppressionUmherirrender2022-03-301-0/+1
| | | | | | | | | Make phan stricter about conditional variable declaration Remaining false positive issues are suppressed. The suppression and the setting change can only be done together Bug: T259172 Change-Id: I1f200ac37df7448453688bf464a8250c97313e5d
* phan: Disable null_casts_as_any_type settingUmherirrender2022-03-211-0/+1
| | | | | | | | | | | Make phan stricter about null types by setting null_casts_as_any_type to false (the default in mediawiki-phan-config) Remaining false positive issues are suppressed. The suppression and the setting change can only be done together Bug: T242536 Bug: T301991 Change-Id: I0f295382b96fb3be8037a01c10487d9d591e7e01
* maintenance: Improve updateSpecialPages.php and related documentationUmherirrender2022-03-141-10/+10
| | | | | | | | | Fix MediaStatistics if $wgQueryCacheLimit is very small to still show all entries as documented in the class. Found by phan strict checks Change-Id: Ic1a8a66063f6604db4a7e92c46df94a3f6d97711
* Add explicit casts between scalar typesUmherirrender2022-03-081-1/+1
| | | | | | | | | php internal functions like floor/round/ceil documented to return float, most cases the result is used as int, added casts Found by phan strict checks Change-Id: I92daeb0f7be8a0566fd9258f66ed3aced9a7b792
* Explicit cast TS_UNIX to int for arithmetic operations and int argsUmherirrender2022-01-111-2/+1
| | | | | | | | When the called function has a doc of int, it should be cast to be explicit here. Also cast for arithmetic operations to be explicit about the number Change-Id: I905b78dfb66e66443e0e3203488bab5b548db543
* Improve nullable documentation in special page class about argsUmherirrender2021-10-221-1/+1
| | | | | | Change documentation to null or false where the type is allowed Change-Id: Id8fd2b94a986e85af1c5aa6b4a8de2a9b3081b9e
* QueryPage: s/Sometime/Sometimes/Reedy2021-09-271-1/+1
| | | | Change-Id: Ibdc16044fabfe9fe3677985d10b2dbe1ac2e7c84
* Using @return never documentation on always-throw-functionUmherirrender2021-09-071-0/+1
| | | | | | | | | | This helps phan to detect unreachable code and also impossible types after the functions. It helps phan to avoid false positives for array keys when the keys are checked before Bug: T240141 Change-Id: I895f70e82b3053a46cd44135b15437e6f82a07b2
* docs: Change wording master to primary in comments and log textUmherirrender2021-09-011-1/+1
| | | | | Bug: T254646 Change-Id: I5379dc79be60c99f0a30f74e5d624f81fe6f921b
* Turn hashes into commentsTChin2021-06-241-23/+23
| | | | | | | Standardized double-slash comments Bug: T285484 Change-Id: I5dd8a0ecd78063751ae6d009359cdc449e1b2fb8
* Replace uses of DB_MASTER with DB_PRIMARYJames D. Forrester2021-04-291-3/+3
| | | | | | Just an auto-replace from codesniffer for now. Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
* Merge "Delete cached data of non-cached querypages with updateSpecialPages.php"jenkins-bot2021-04-221-2/+24
|\
| * Delete cached data of non-cached querypages with updateSpecialPages.phpUmherirrender2021-03-101-2/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If a special page is no longer expensive (by code or by config like DisableQueryPages) the data should not longer stored in the database, because always fresh data are shown and never the cached data This does not delete on disabled query pages, because the data still visible on the page. This only affectes query pages and not very special pages like ActiveUsers Bug: T174513 Change-Id: Ia9015cb7bc0ab7b1a3d96d1b481c31b3e6c39657
* | Make SpecialFileDuplicateSearch not be a QueryPageTim Starling2021-04-081-1/+0
| | | | | | | | | | | | | | | | | | | | Since 2011, FileDuplicateSearch has been especially awkward as a QueryPage subclass. The only thing of value in the parent was construction of <ol></ol> tags, but that's not enough to justify it. getQueryInfo() was unused -- my motivation is to not have to maintain it. A LoadBalancer was injected but was unused. Change-Id: I2f0c18913260ee74ef266352bb93cfbdc1143d85
* | QueryPage: Remove useless checkAmmarpad2021-03-291-3/+0
|/ | | | Change-Id: I676b26633103c10b1aa20646cbbe46e6450cc7cf
* Improve doc about object to be stdClass in QueryPage::formatResultUmherirrender2020-11-151-1/+1
| | | | Change-Id: Ib1fadd74f2f3223ea8a9343d1524533f00b991df
* Inject LinkBatchFactory into QueryPage and use itUmherirrender2020-11-021-2/+28
| | | | | | | | | The LinkBatchFactory service is only used in one method call in the QueryPage class, so make it optional and provide it when needed with a setter Bug: T259960 Change-Id: Iee446b1defc9a4f116dc264b012ab972f89d95fc
* Merge "Inject DBLoadBalancer into abstract QueryPage"jenkins-bot2020-11-021-5/+31
|\
| * Inject DBLoadBalancer into abstract QueryPageUmherirrender2020-11-021-5/+31
| | | | | | | | | | | | | | | | Every QueryPage needs a database to work Inject the new service on special pages with already using services. Bug: T259960 Change-Id: I96d91993b70052484c1a6a918a1e2ccc91e39ae7
* | Inject ContentLanguage into SpecialPage and use itUmherirrender2020-11-021-1/+1
|/ | | | | | | | | The ContentLanguage is already present in the factory, pass it to the created object and make every object aware of the content language along with the user language for easier access Bug: T259960 Change-Id: I32bbacbb45d0844ca99f0c5ee168be6a26e8974a
* Use LinkBatchFactory in pagers, special pages and actionsUmherirrender2020-09-061-1/+2
| | | | Change-Id: I299900316c8d3129844a047228cd1c15ae7dff63
* Merge "Replace "@stable for subclassing" with "@stable to extend""jenkins-bot2020-07-131-1/+1
|\
| * Replace "@stable for subclassing" with "@stable to extend"daniel2020-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | For compliance with the new version of the table interface policy (T255803). This patch was created by an automated search & replace operation on the includes/ directory. Bug: T257789 Change-Id: Ie32c1b11b3d16ddfc0c83a757327d449ff80b2e4
* | Replace "@stable for overriding" with "@stable to override"daniel2020-07-131-19/+19
|/ | | | | | | | | | | For compliance with the new version of the table interface policy (T255803). This patch was created by an automated search & replace operation on the includes/ directory. Bug: T257789 Change-Id: I5ffbb91882ecce2019ab644839eab5e8fb8a1c5f
* Mark special page base classes as stable for subclassingdaniel2020-07-101-0/+25
| | | | | Bug: T247862 Change-Id: I44d9dddd99c0106a30058cd80377a65f9b1694a9
* Shorter code in QueryPage::execute()Edward Chernenko2020-06-271-5/+2
| | | | | | | This eliminates code duplication: SpecialPage::checkPermissions() does exactly the same thing. Change-Id: I9ae84582b92ae1231f96df7ad453ffbe1f00614f
* Hooks::run() call site migrationTim Starling2020-05-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Migrate all callers of Hooks::run() to use the new HookContainer/HookRunner system. General principles: * Use DI if it is already used. We're not changing the way state is managed in this patch. * HookContainer is always injected, not HookRunner. HookContainer is a service, it's a more generic interface, it is the only thing that provides isRegistered() which is needed in some cases, and a HookRunner can be efficiently constructed from it (confirmed by benchmark). Because HookContainer is needed for object construction, it is also needed by all factories. * "Ask your friendly local base class". Big hierarchies like SpecialPage and ApiBase have getHookContainer() and getHookRunner() methods in the base class, and classes that extend that base class are not expected to know or care where the base class gets its HookContainer from. * ProtectedHookAccessorTrait provides protected getHookContainer() and getHookRunner() methods, getting them from the global service container. The point of this is to ease migration to DI by ensuring that call sites ask their local friendly base class rather than getting a HookRunner from the service container directly. * Private $this->hookRunner. In some smaller classes where accessor methods did not seem warranted, there is a private HookRunner property which is accessed directly. Very rarely (two cases), there is a protected property, for consistency with code that conventionally assumes protected=private, but in cases where the class might actually be overridden, a protected accessor is preferred over a protected property. * The last resort: Hooks::runner(). Mostly for static, file-scope and global code. In a few cases it was used for objects with broken construction schemes, out of horror or laziness. Constructors with new required arguments: * AuthManager * BadFileLookup * BlockManager * ClassicInterwikiLookup * ContentHandlerFactory * ContentSecurityPolicy * DefaultOptionsManager * DerivedPageDataUpdater * FullSearchResultWidget * HtmlCacheUpdater * LanguageFactory * LanguageNameUtils * LinkRenderer * LinkRendererFactory * LocalisationCache * MagicWordFactory * MessageCache * NamespaceInfo * PageEditStash * PageHandlerFactory * PageUpdater * ParserFactory * PermissionManager * RevisionStore * RevisionStoreFactory * SearchEngineConfig * SearchEngineFactory * SearchFormWidget * SearchNearMatcher * SessionBackend * SpecialPageFactory * UserNameUtils * UserOptionsManager * WatchedItemQueryService * WatchedItemStore Constructors with new optional arguments: * DefaultPreferencesFactory * Language * LinkHolderArray * MovePage * Parser * ParserCache * PasswordReset * Router setHookContainer() now required after construction: * AuthenticationProvider * ResourceLoaderModule * SearchEngine Change-Id: Id442b0dbe43aba84bd5cf801d86dedc768b082c7
* Fix more Squiz.Scope.MethodScope.MissingReedy2020-05-181-14/+14
| | | | | | | | | | | 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
* Replace WebRequest::getLimitOffset with ::getLimitOffsetForUserDannyS7122020-02-191-2/+3
| | | | | Bug: T243805 Change-Id: I8b084e447e12a330bdce2bff18fd7c756ac5f698
* Coding style: Auto-fix MediaWiki.Usage.IsNull.IsNullJames D. Forrester2020-01-101-1/+1
| | | | Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
* Coding style: Auto-fix MediaWiki.Classes.UnsortedUseStatements.UnsortedUseJames D. Forrester2020-01-101-2/+2
| | | | Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210
* Add a run mode to $wgDisableQueryPageUpdateUmherirrender2019-09-261-7/+39
| | | | | | | | | | The run mode is used to show a different message on the special page, instead of the current one "Updates for this page are currently disabled. Data here will not presently be refreshed." even the data gets updated with a different cron job. Bug: T78711 Change-Id: Ib63d16bfea477dec43323b39671cc068530e2f0b
* Make most special pages class names match filenameReedy2019-09-101-31/+31
| | | | Change-Id: I3a9f932acb7d9cf44a984b5d97f9fbc6b8670f7d
* Merge "Add QueryPage::delete method"jenkins-bot2019-07-311-0/+18
|\
| * Add QueryPage::delete methodGergő Tisza2019-07-261-0/+18
| | | | | | | | | | | | | | | | Add a method for delete the cached result for a page. This is useful for backlog-type query pages which provide some interface for fixing the problem in-place. Change-Id: I36b750d71b6551bb5c662e82c24f029db01acd3b
* | QueryPage: allow arbitrary sortingGergő Tisza2019-07-261-2/+2
|/ | | | | | | | When the value field is not provided in QueryPage::getQueryInfo, it is set to zero, essentially randomizing the result. Use a sequential index instead. Change-Id: I8b67268e3c59a51ed00bd832f80df184dd771c3b
* Use IResultWrapper in code comments instead of ResultWrapperAaron Schulz2019-06-221-4/+4
| | | | Change-Id: Idb813c20bef0d41d0f9f01440daab4fee6cdb38d
* Remove tryLastResult function from includes/specials/QueryPage.phpzoranzoki212019-05-201-26/+0
| | | | | | It is deprecated in 1.27 Change-Id: Ia10696a3d8e700cdf889c15e9b16b9d8e3e7f94f
* Typehint against IDatabase in special pagesUmherirrender2019-05-181-1/+1
| | | | Change-Id: I1ec906cc7b284a3de02bb67fb41b5cf9e67ff3d2
* Sunsetting viewPrevNexteranroz2019-04-011-2/+2
| | | | | | | | | Removing viewPrevNext from Language and moving it to SpecialPage. Used soley in special pages, and we aim to remove/reduce the dependency of messages and language Bug:T207977 Change-Id: I49b41a89ba59cfc24982b321f02c5cca9939decd
* specials: Fix incomplete documentation of execute() paramThiemo Kreuz2019-03-281-1/+1
| | | | | | | | | | | | | | | The parameter passed to the execute() method of each special page can be null, and usually is. In some of these files this fact was already mentioned in the comment, but not listed as a type. In this patch I also remove comments that do not explain much. Saying that the execute() method of a special page "executes a special page" or is the "main entry point to a special page" is not super helpful. That's usually what the documentation in the parent class shoudl explain. We can add @inheritDoc tags in all these cases if you prefer. Please tell me. Change-Id: I1d811ab0c6d5c956e36f6a74120a425abc4332e6
* Merge "specialpage: Remove unused QueryPage::doFeed()"jenkins-bot2019-03-261-92/+0
|\
| * specialpage: Remove unused QueryPage::doFeed()Thiemo Kreuz2019-03-251-92/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code was written in 2004, and pretty much untouched since then. The last non-trivial update to this code was done in 2014 via I1de6301. But as far as I can tell this was just maintenance, not motivated by somebody actually using this code. I suspect this is unused for a long time already, long before 2014. Possibly even unused in 2004. Really: I tried to dig into the revision history of the core codebase to find when and where this was used, and when it became unused. I could not find anything. I also used https://codesearch.wmflabs.org to make sure there are no known callers or subclasses hidden anywhere. I could not find anything either. In conclusion I suggest to skip any deprecation phase. Change-Id: I5f52c44760b903bcb348bebf8c6a0f6faf8180b7
* | Update some minor type hintsThiemo Kreuz2019-03-251-4/+13
|/ | | | Change-Id: If5a6372e79038d3750d30a931badd0c110da2fe5