aboutsummaryrefslogtreecommitdiffstats
path: root/includes/specials/SpecialWhatLinksHere.php
Commit message (Collapse)AuthorAgeFilesLines
...
* specials: Inject TitleFactory into Special:WhatLinksHereUmherirrender2022-04-021-6/+9
| | | | | Follow-Up: I95d2441756b9d4e7219cbf353202a84eb0216371 Change-Id: I5e247b325e780219adc33087a102de74e746b2c0
* SECURITY: Sort Special:WhatLinksHere by namespaceLucas Werkmeister2022-03-311-43/+110
| | | | | | | | | | | | | | | | | | | | | | | ApiQueryBacklinks already sorts by the from_namespace column before the from column, but SpecialWhatLinksHere only sorted by the from column so far (i.e. the page ID of the linking page). This means that MySQL cannot always use the indexes on the backlinks and related tables efficiently, turning the special page into a potential DoS vector for certain parameter combinations (where it reads millions of rows and then sorts them in memory). Fix this by sorting by namespace first (except for the redirect table, which doesn’t have an rd_from column); this also means that we always want to add a filter for the namespaces, even when it’s just filtering for all the known namespaces. The URL changes format again, and now looks like &offset=0|123, where 0 is the namespace of page 123, and the results will be the pages in the same namespace with an ID above 123, or the pages in namespaces above 0 regardless of page ID (though still sorted). Old URLs are of course supported, and we look up the relevant namespace of the given page ID on-the-fly in that case. Bug: T297754 Change-Id: I5ad7fabc3445ad60cc856cf288f140b6995b59ce
* phan: Remove PhanPossiblyUndeclaredVariable suppressionUmherirrender2022-03-301-0/+9
| | | | | | | | | 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
* Merge "Fix notice for Special:WhatLinksHere?limit=0"jenkins-bot2021-08-311-1/+4
|\
| * Fix notice for Special:WhatLinksHere?limit=0Tim Starling2021-08-301-1/+4
| | | | | | | | | | | | | | | | | | | | | | Fix a notice which occurred when the limit was zero or a string that converts to zero. Disabling the prev/next links seems like the best way to respect limit=0. Follows-up b9c68590d68cace. Bug: T289351 Change-Id: Ic06bbfd0ef5c16c658ccf2fe27895789510ee317
* | specials: Do not hard code function name as caller on WhatlinkshereUmherirrender2021-08-301-2/+3
|/ | | | Change-Id: Ia794e381ade707ffa77f03b93a982910de175c0f
* Fix SelectQueryBuilder use in SpecialWhatLinksHereLucas Werkmeister2021-08-111-1/+1
| | | | | | | | | | If I understand correctly, joined tables are not supposed to be listed in ->tables(), but only in ->join(). This seems to fix the database error when loading Special:WhatLinksHere with the hidelinks parameter, at least on localhost. Bug: T288565 Change-Id: I84b1d70e6b440e69e5846022f083ec4b4caf9928
* Use pagination on Special:Whatlinkshere based on offset/dir systemmikolajmeller2021-08-091-36/+64
| | | | | | | | Fix pagination by switching from a from/back system to and offset/dir system, as is already used on (e.g.) Special:Categories Bug: T45509 Change-Id: I016938cf4ead1edd90d3ce2f9ebfb17f8dfbde79
* SpecialWhatLinksHere: Conditionally hide the namespace invert checkboxFomafix2021-07-051-7/+13
| | | | | | | | | | | | | | This changes hides the namespace invert checkbox like on SpecialRecentchanges and on SpecialContributions. Also use class="mw-input-with-label" to prevent line breaks between checkbox and label and inside of the label. Also use normal space (U+0020) instead of no-break space (U+00A0) because the no-break space does not prevent any line breaks here but gets visible at the beginning of the line in case of wrapping. Change-Id: Id8f7201087cc35c45a4be5f457aee2b37c64511e
* Remove page inner join from subquery in SpecialWhatLinksHereBrandonXLF2021-03-211-2/+1
| | | | | | | | | Change Id247178e85b11e790a4378617b7f98d5924ef2ba added a redundant inner join with the page table to the subquery at SpecialWhatLinksHere::showIndirectLinks. Bug: T254688 Change-Id: I48f866e5cbfd70d135d89e8a9089fc629946374d
* Introduce SpecialPage::getAuthority shortcut to contextPetr Pchelko2021-03-021-1/+1
| | | | Change-Id: I6f856e830ffd47a119e9e184da89121c825d8973
* Convert first batch of special pages to AuthorityPetr Pchelko2021-03-011-8/+1
| | | | Change-Id: I4c6877ef2b1f32610190c6de0f1bcaaa3c835fb0
* Use static closures where safe to useUmherirrender2021-02-111-1/+1
| | | | | | | | | This is micro-optimization of closure code to avoid binding the closure to $this where it is not needed. Created by I25a17fb22b6b669e817317a0f45051ae9c608208 Change-Id: I0ffc6200f6c6693d78a3151cb8cea7dce7c21653
* Do inverse namespace filtering of links tables with a big IN()Tim Starling2021-01-141-7/+20
| | | | | | | | | | | | | | | Inverted filtering, e.g. namespace != 6, has no special handling in MariaDB/MySQL and does not use the relevant index. In the linked bug, this confuses the query planner and causes the query to take much longer than an unfiltered query. So, instead of "namespace != 6" use "namespace IN(...)" with every other valid namespace index listed. MySQL implements this like a union. It is apparently much faster to do ~20 index dives than to scan 30 million rows and then sort them. Bug: T241837 Change-Id: I236cccdba85238c73867b2a952987bc2572b6171
* Fix prev/next links on Special:WhatLinksHereLucas Werkmeister2020-12-101-2/+2
| | | | | | | | When the previous/next texts are proper links (i.e. we’re not at the end of that range), we don’t want them to be escaped for the message. Bug: T269830 Change-Id: I2bd214d8df7153c5780332998600251b191b6396
* Rework message handling on Special:WhatLinksHereUmherirrender2020-12-031-34/+15
| | | | | | | | | | Remove HtmlArmor and use unescaped messages. LinkRenderer::make*Link escape itself Remove message cache, it is not useful when having different output formats Change-Id: I8d668919b8c357795d719f297d5898b5ad49a387
* Inject SearchEngineFactory into special pagesUmherirrender2020-11-251-2/+8
| | | | | | | New optional argument for Specialpage::prefixSearchString Bug: T259960 Change-Id: Ibb2b522b1d1a6e5dc140a20fb7039f66f3198832
* Inject services into SpecialWhatLinksHereUmherirrender2020-10-101-11/+36
| | | | | | | | | This covers only directly used services by this special page Services used by the base class are not part of this patch set Bug: T259960 Change-Id: Ic069fe38962d5dfcdd973052b808241f4f5eda40
* Use LinkBatchFactory in pagers, special pages and actionsUmherirrender2020-09-061-1/+2
| | | | Change-Id: I299900316c8d3129844a047228cd1c15ae7dff63
* Use strict (in)equality with namespaces constants when LHS is definitely an ↵Ed Sanders2020-07-311-2/+2
| | | | | | integer Change-Id: I8fede00dfe1270d93c5d78d3c36e788cddfc8a99
* 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
* Merge "Use a SelectQueryBuilder in SpecialWhatLinksHere"jenkins-bot2020-05-211-18/+18
|\
| * Use a SelectQueryBuilder in SpecialWhatLinksHereTim Starling2020-05-181-18/+18
| | | | | | | | | | Bug: T243051 Change-Id: Id247178e85b11e790a4378617b7f98d5924ef2ba
* | Fix the rest of includes/specials/ Squiz.Scope.MethodScope.MissingReedy2020-05-181-5/+5
| | | | | | | | Change-Id: Ica6397199603f2979b8c863a1f250da2edd77ba5
* | Fix some includes/specials/ Squiz.Scope.MethodScope.MissingReedy2020-05-181-1/+1
|/ | | | Change-Id: I9c19e5ce8d789847d0f019372738a2eecb4c37a6
* SpecialWhatLinksHere: Display section anchor for redirectsKunal Mehta2020-02-271-4/+10
| | | | | | | | If a redirect is to a specific section anchor (`rd_fragment`), include that in the output of Special:WhatLinksHere. Bug: T103281 Change-Id: I3c20a9d7068faf352194051c2079dd73be5da21c
* Merge "SpecialWhatLinksHere: Fix queries (2020 edition)"jenkins-bot2020-02-251-13/+39
|\
| * SpecialWhatLinksHere: Fix queries (2020 edition)Brad Jorsch2020-02-121-13/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The query being used when 'hidelinks' is set but 'hideredirs' is not was not behaving well on pages with a very large number of pagelinks, as the STRAIGHT_JOIN in the query was forcing it to scan all the pagelinks rows to find the handful that were redirects. The STRAIGHT_JOIN was added in I825eedac to avoid another stupid plan, where MySQL decided to scan the whole of the `page` table then filter by `redirect` and `pagelinks`. But the need for the `page` table in there at all was removed when I4ccd7dfe removed $wgUseLinkNamespaceDBFields. So we can get rid of the `page` join, which should let us remove the STRAIGHT_JOIN without reopening T106682. But we can also do one better: If 'hidelinks' is set we don't need to check `pagelinks` at all, we can use `redirect` alone to get the information we need directly. Bug: T144235 Change-Id: Ida5f2fee548215cc190c401c2677c943f7bfe87b
* | Show number of displayed pages on WhatLinksHereGlaisher2020-02-121-0/+2
|/ | | | | Bug: T44357 Change-Id: I9ba977ade78e67cfcf96ef9b62e74b8f5e1d2d6c
* Introduce ContentHandlerFactoryArtBaltai2020-02-071-1/+4
| | | | | | | | | | | | | | | | | Added: - ContentHandlerFactory Tests: - PHPUnit Changed - Calls of changed and deprecated - DI for some service/api Deprecated: - ContentHandler::* then similar to ContentHandlerFactory - ContentHandler::getForTitle - ContentHandler::$handlers Bug: T235165 Change-Id: I59246938c7ad7b3e70e46c9e698708ef9bc672c6
* Replace usages of deprecated User::isAllowed. Step 2.Petr Pchelko2019-09-111-1/+4
| | | | | | Bug: T220191 Depends-On: I509cd88355cfd0cc074f4135ec86399b4075f89f Change-Id: I2341e6f1d108c92924620fba3c64ec090cb09918
* Unsuppress more phan issues (part 5)Daimona Eaytoy2019-09-011-0/+2
| | | | | | Bug: T231636 Depends-On: I6e5fba7bd273219b1206559420b5bdb78734aa84 Change-Id: I50377746f01749b058c39fd8229f9d566224cc43
* Fix casing of Special Pages to match class nameReedy2019-04-141-0/+591
Change-Id: Ifc9e827202493e8f055a21875c54ff827a38d1f7