aboutsummaryrefslogtreecommitdiffstats
path: root/includes/gallery
Commit message (Collapse)AuthorAgeFilesLines
* Emit media structure as piloted in ParsoidArlo Breault2021-06-241-6/+31
| | | | | | | | | | | | | | Gated behind the flag $wgParserEnableLegacyMediaDOM. The scattershot usage of it is a little unfortunate but isn't expected to live very long so maybe that's acceptable. Further details can be found at, https://www.mediawiki.org/wiki/Parsing/Media_structure Bug: T51097 Bug: T266148 Bug: T271129 Change-Id: I978187f9f6e9e0a105521ab3e26821e36a96b911
* Use some more neutral languageReedy2021-04-182-2/+2
| | | | | Bug: T277987 Change-Id: Ieceb01f7a61693a0f03cc331213cb8f93163b8e9
* Make use of array deconstruction directly in foreach, if possibleThiemo Kreuz2020-11-121-6/+4
| | | | | | | | | | | Deconstructing non-sparse, numerically indexed arrays directly in foreach (a.k.a. using the list() syntax in foreach) is possible since PHP 5.5. The possibility to use string array keys as well as non-sequential numeric keys in array deconstruction was added in PHP 7.1. Change-Id: I56a48552a45f61cedc291b306cad8548fc70d485
* Merge "Use LinkBatchFactory"jenkins-bot2020-11-011-1/+2
|\
| * Use LinkBatchFactoryUmherirrender2020-10-251-1/+2
| | | | | | | | Change-Id: Ib82f91048faad8cf8be961d038f30c9261072af5
* | Remove documentation that literally repeats the codeThiemo Kreuz2020-10-271-1/+0
|/ | | | | | | | | | | | | | | For example, documenting the method getUser() with "get the User object" does not add any information that's not already there. But I have to read the text first to understand that it doesn't document anything that's not already obvious from the code. Some of this is from a time when we had a PHPCS sniff that was complaining when a line like `@param User $user` doesn't end with some descriptive text. Some users started adding text like `@param User $user The User` back then. Let's please remove this. Change-Id: I0ea8d051bc732466c73940de9259f87ffb86ce7a
* Document hook names in hook interfaces.daniel2020-09-271-0/+3
| | | | | Bug: T258665 Change-Id: Ifddbf57f8aa2e3eb0d5845601376cbafa08ed407
* Merge "Update stability annotations to follow new stable interface policy"jenkins-bot2020-07-131-2/+7
|\
| * Update stability annotations to follow new stable interface policydaniel2020-07-131-2/+7
| | | | | | | | | | | | | | This is a follow-up to I1939bb11038ec2. Bug: T247862 Change-Id: I69a1ec1700bfb68a36003d65cc2184f23f208794
* | Merge "Mark potential abstract classes stable for subclassing"jenkins-bot2020-07-131-1/+3
|\|
| * Mark potential abstract classes stable for subclassingNikki Nikkhoui2020-07-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Going through some more abstract classes in core, and marking those that are extended by extensions as stable. I have limited knowledge on the uses of these classes so marking for vibisility/review. Bug: T247862 Change-Id: I1939bb11038ec2536eebbdbd12524e83d615b86b
* | Replace "@stable for implementation" with "@stable to implement"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: I17e5e92e24c708ffc846945a136347670a3a20c7
* Remove terminating line breaks from debug messagesTim Starling2020-06-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Hooks::run() call site migrationTim Starling2020-05-302-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Make images on Special:NewFiles natively lazy-loadedgilles2020-05-222-8/+31
| | | | | Bug: T252423 Change-Id: I96a058469d21c37cc8d8a4f4ff21b73cbd93380c
* Remove more IE6 and IE7 compatibility and notesDannyS7122020-05-191-4/+1
| | | | | | | Neither is supported Bug: T232563 Change-Id: Ia7902f0b1df6148d819621dd5e57d2fe91a50973
* Add missing visibility on methods/consts of gallery related classesUmherirrender2020-05-103-13/+13
| | | | Change-Id: Ib8d3d3b12ff2aa4d5be8610dee52798c12958c73
* docs: Hook interface doc comment reviewapaskulin2020-04-211-5/+3
| | | | | | | | Edited doc comments for hook interfaces to improve consistency and add type hints. Bug: T246855 Change-Id: I38fa802463cd6f39bf5946dbbeb1b3ebaea604b2
* Automatically generated hook interfacesTim Starling2020-04-201-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add hook interfaces which were generated by a script which parses hooks.txt and identifies caller namespaces and directories. Hook interfaces are mostly placed in a Hook/ subdirectory relative to the caller location. When there are callers in multiple directories, a "primary" caller was manually selected. The exceptions to this are: * The source root, maintenance and tests, which use includes/Hook. Test hooks need to be autoloadable in a non-test request so that implementing test interfaces in a generic handler will not fail. * resources uses includes/resourceloader/Hook * The following third-level subdirectories had their hooks placed in the parent ../Hook: * includes/filerepo/file * includes/search/searchwidgets * includes/specials/forms * includes/specials/helpers * includes/specials/pagers Parameters marked as legacy references in hooks.txt are passed by value in the interfaces. Bug: T240307 Change-Id: I6efe2e7dd1f0c6a3d0f4d100a4c34e41f8428720
* Bundle services at top of TraditionalImageGallery::toHtmlUmherirrender2020-03-141-33/+26
| | | | | | | Add Parser::getBadFileLookup to get the instance from there when having a parser instance Change-Id: I48e254406ffb62d847404a5f8e81a35f8d4c83f1
* Replace Linker::link usage with LinkRenderer in includesMatěj Suchánek2020-01-111-10/+15
| | | | | | | Needs one unit test to become integration again :( Bug: T149346 Change-Id: I62fc566dfb542939431fd4a135c05e0924c70dbf
* Set method visibility for various constructorsUmherirrender2019-12-033-3/+3
| | | | Change-Id: Id3c88257e866923b06e878ccdeddded7f08f2c98
* Add phan-return to ImageGalleryBase::getImagesUmherirrender2019-11-041-1/+2
| | | | | | Use the same as @phan-var Change-Id: I42d38a8e653d27a4d430ab78bba8b4f3988d7a27
* Fix new phan errors, part 2Daimona Eaytoy2019-10-121-1/+2
| | | | | | | Still mostly doc-only. Bug: T231636 Change-Id: I65cec6c716ce6859e14da00a12ef71e03603e59a
* Declare dynamic propertiesDaimona Eaytoy2019-09-131-0/+9
| | | | | | This is for all classes with 2 or more undeclared properties. Change-Id: I1d80deb31f331bcc277b33f9e9f74857ba825637
* Unsuppress other phan issues (part 4)Daimona Eaytoy2019-08-311-4/+4
| | | | | | Bug: T231636 Depends-On: I58e67c2b38389df874438deada4239510d21654f Change-Id: I6e5fba7bd273219b1206559420b5bdb78734aa84
* BadFileLookup::isBadFile() expects null, not falseAryeh Gregor2019-08-271-7/+5
| | | | | | | | | | This deviation in behavior from wfIsBadImage() is accounted for in that function, but I didn't account for it when changing callers to use the service. Bug: T231340 Bug: T231353 Change-Id: Iddf177770fb1763ed295d694ed6bab441ea9ab73
* BadFileLookup to replace wfIsBadImageAryeh Gregor2019-08-211-2/+2
| | | | | | | | | | | | | | | | | | | | | I think this probably shouldn't be directly in the MediaWiki namespace, but I don't know where is a better place to put it. In order to avoid gratuitous use of TitleFormatter, I changed the cache format -- the old implementation used getPrefixedDBkey() and I switched to an ns/dbkey pair. I also changed the cache keys to use SHA1 instead of MD5, by Daniel's request. The previous implementation cached the parsed blacklist for one minute without invalidation, so it could return slightly stale results, but it didn't retrieve the bad image list message on a cache hit. The new implementation unconditionally retrieves the bad image list message, but uses a hash of it in the cache key and caches for one day. The new behavior happens to be more cleanly implementable in a service. Bug: T200882 Bug: T139216 Change-Id: I69fed1b1f3cfc1aa149e0739780e67f6de01609d
* Replace some uses of deprecated wfFindFile() and wfLocalFile()Derick Alangi2019-06-111-1/+4
| | | | | | | | | | | | | | | | | | | | | These global functions were deprecated in 1.34 and services made available to replace them. See services below; * wfFindFile() - MediaWikiServices::getInstance()->getRepoGroup()->findFile() * wfLocalFind() - MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()->newFile() NOTES: * wfFindFile() and wfLocalFind() usages in tests have been ignored in this change per @Timo's comments about state of objects. * includes/upload/UploadBase.php also maintained for now as it causes some failures I don't fully understand, will investigate and handle it in a follow up patch. * Also, includes/MovePage.php Change-Id: I9437494de003f40fbe591321da7b42d16bb732d6
* Mass conversion to NamespaceInfoAryeh Gregor2019-05-071-1/+2
| | | | Change-Id: I2fef157ceec772f304c0923a1cd8c0eef2e82a0f
* Move PackedHoverImageGallery from PackedOverlayImageGallery.phpZoranzoki212019-04-062-9/+28
| | | | Change-Id: I7a764fa89637dc7c3865dbbbbe0d90d5bc268ed2
* Make use of the list() feature where it makes senseThiemo Kreuz2019-03-241-4/+2
| | | | | | | | | | This code is functionally identical, but less error prone (not so easy to forget or mix these numerical indexes). This patch happens to touch the Parser, which might be a bit scary. We can remove this file from this patch if you prefer. Change-Id: I8cbe3a9a6725d1c42b86e67678c1af15fbc5961a
* build: Updating mediawiki/mediawiki-codesniffer to 24.0.0Kunal Mehta2019-02-071-1/+1
| | | | Change-Id: I66b1775b7c1d36076d9ca78cbeb42787a743f2aa
* build: Updating mediawiki/mediawiki-codesniffer to 22.0.0Umherirrender2018-09-161-1/+0
| | | | | | | | | Added spaces around . Removed empty return statement which are not required Removed return after phpunit markTestIncomplete, which is throwing to exit the test, no need for a return Change-Id: I2c80b965ee52ba09949e70ea9e7adfc58a1d89ce
* Fix spelling of word "necessary"petarpetkovic2018-08-161-1/+1
| | | | | Bug: T201491 Change-Id: Ic983889a5702b8b8552c88ebc4d676f35e9fe61e
* Mass conversion of $wgContLang to serviceAryeh Gregor2018-08-112-4/+5
| | | | | | | Brought to you by vim macros. Bug: T200246 Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
* Remove most uses of deprecated Language::truncate()C. Scott Ananian2018-07-091-2/+2
| | | | | | | | | | | | | | The Language::truncate() function was split into Language::truncateForVisual() (which measures characters) and Language::truncateForDatabase() (which measures bytes) in 1.31, but the patch which soft-deprecated Language::truncate() didn't actually remove all the uses in the codebase. Replace most of those old uses now, which should actually improve the situation for non-latin-alphabet users who were getting unfairly squeezed in a number of places. Bug: T197492 Change-Id: I2291c69d9df17c1a9e4ab1b7d4cbc73bc51d3ebb
* Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenientBartosz Dziewoński2018-05-301-1/+1
| | | | | | | | | | | | | | Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/ Replace with: '\1 ?? ' (Everywhere except includes/PHPVersionCheck.php) (Then, manually fix some line length and indentation issues) Then manually reviewed the replacements for cases where confusing operator precedence would result in incorrect results (fixing those in I478db046a1cc162c6767003ce45c9b56270f3372). Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
* TraditionalImageGallery factor getCaptionHtml into own functionMarius Hoch2018-04-251-13/+22
| | | | | | | Better design and also want to override this in Wikibase. Bug: T192869 Change-Id: I24de654ba9a14b8fe0925007e6ceeabca277c075
* Make ImageGallery more flexible for use in WikibaseMarius Hoch2018-04-132-6/+45
| | | | | | | | Also add missing declaration/ documentation of ImageGalleryBase::mCaptionLength. Bug: T46727 Change-Id: I314061b224ff2921eb5532be53e0c9cdc4f52c01
* Use ::class to resolve class names in includes filesUmherirrender2018-01-271-6/+6
| | | | | | | This helps to find renamed or misspelled classes earlier. Phan will check the class names Change-Id: I07a925c2a9404b0865e8a8703864ded9d14aa769
* Gallery: Use Parser::parseWidthParam() for gallery dimensionsPrateek Saxena2018-01-251-6/+10
| | | | | | | | | | Used by the `setWidths` and `setHeights` methods to make sure we are using correct values. Makes `parseWidthParam` static to be used in the gallery class. Bug: T129372 Change-Id: I38b9ef0ea26e3748ad5d5458fadd2545f677ef93
* Remove @param comments that literally repeat what the code saysThiemo Mättig2018-01-101-2/+2
| | | | | | | | | These comments do not add anything. I argue they are worse than having no comments, because I have to read them first to understand they actually don't explain anything. Removing them makes room for actual improvements in the future (if needed). Change-Id: Iee70aad681b3385e9af282d5581c10addbb91ac4
* A few doc comment fixupsTim Starling2017-12-041-3/+4
| | | | | | | | | | | | | | | | * Remove some creation dates, they are not protected by GPL * Remove duplicate @defgroup API * Remove @ingroup from some @file doc comments on class files. It is not useful to list class files alongside classes in the doxygen module menu. Add @ingroup to some more class files that had @ingroup on their file, that was probably the author's intent. * In PackedOverlayImageGallery, use the file comment as a class comment * Don't put @defgroup and @file in the same comment. @defgroup makes the whole doc comment describe the group. * Instead of putting AnsiTermColorer in two groups, use hierarchical groups. Change-Id: If54f6e0b2bc1ea6de42045885cf836ee67b8e961
* Add missing & to @param documentation to match functon callUmherirrender2017-08-111-1/+1
| | | | Change-Id: I81e68310abcbc59964b22e0e74842d509f6b1fb9
* Remove empty lines at begin of function, if, foreach, switchUmherirrender2017-07-011-1/+0
| | | | | | Organize phpcs.xml a bit Change-Id: Ifb767729b481b4b686e6d6444cf48b1f580cc478
* Show dimensions in TraditionalImageGalleryMatthias Mullie2017-03-072-9/+30
| | | | | Bug: T121869 Change-Id: Ie2cb3f1594302f1726ae3d9d2d668c81b7e6b0f1
* Merge "Add `showThumbnails` option to slideshow galleries"jenkins-bot2017-01-021-0/+4
|\
| * Add `showThumbnails` option to slideshow galleriespppery2016-12-201-0/+4
| | | | | | | | | | | | | | | | This option causes the thumbnail images for the slideshow to be visible as soon as the slideshow is loaded. They can still be closed normally.` Bug: T147913 Change-Id: Iae6fd4f016d9fc98280d4ba92e4332ff06e1fb9e
* | Removed deprecated class ImageGallerydivadsn2017-01-011-14/+0
|/ | | | | Bug: T61113 Change-Id: If315002ef7d1a3937f150d0dda930976c1d95f57