aboutsummaryrefslogtreecommitdiffstats
path: root/includes/logging
Commit message (Collapse)AuthorAgeFilesLines
...
* | Remove LogEventsList::typeAction support for rightsDannyS7122020-09-101-11/+1
| | | | | | | | | | Bug: T246412 Change-Id: I07fbaa8d9dfc10bc11bca3f8ea444b3bd393832f
* | Remove LogEventsList::getExcludeClause fallback to $wgUserDannyS7122020-09-091-7/+4
|/ | | | | Bug: T246413 Change-Id: Ia3187fc8892505fa82989640bee8f35534cbfd2f
* Use LinkBatchFactory in pagers, special pages and actionsUmherirrender2020-09-062-3/+24
| | | | Change-Id: I299900316c8d3129844a047228cd1c15ae7dff63
* Merge "Remove support for PatrolLog::record without passing a user object"jenkins-bot2020-09-041-9/+2
|\
| * Remove support for PatrolLog::record without passing a user objectDannyS7122020-09-031-9/+2
| | | | | | | | | | | | | | Hard deprecated in 1.35, all callers already updated Bug: T245707 Change-Id: Ib51ce75fe9f33bca0f097010b0a67b6a158357e9
* | Add `delete-redirect` for deleting single-rev redirects during movesDannyS7122020-09-041-0/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | A new user right, `delete-redirect`, is added (not given to anyone by default). At Special:MovePage, if attempting to move to a single revision redirect that would otherwise be an invalid target (i.e. doesn't point to the source page), the user is able to delete the target. Deletions are logged as `delete/delete_redir2`, and the move is then logged normally as `move/move`, mirroring current delete and move logging. To allow for separate handling by Special:MovePage, MovePage::isValidMove now returns a fatal status `redirectexists` if the target isn't valid but passes Title::isSingleRevRedirect. Otherwise, `articleexists` is returned (as previously). Other callers that don't intend to treat single revision redirects differently should treat `redirectexists` the same as `articleexists`. Currently, this deletion (like normal delete and move) cannot be done through the move api. Since the deletion is only valid when moving a page, unlike for normal deletion, deleting redirects with this right cannot be done via the delete api either. Bug: T239277 Change-Id: I36c8df0a12d326ae07018046541bd00103936144
* Remove support for calling LogPage::addEntry without a userDannyS7122020-08-271-8/+4
| | | | | Bug: T245701 Change-Id: I2bd3859032c12e4fb4d6fb4dc03e85f203be081a
* logging: Document LSP violations in RCDatabaseLogEntryDaimona Eaytoy2020-07-141-0/+12
| | | | | | | | | | - RCDatabaseLogEntry::newFromId currently doesn't work, because the parent has 'logging' fields hardcoded. Make the failure explicit with a LogicException to avoid sneaky failures and/or DB query errors. There's no need to implement the missing part, given the lack of a use case. - Same for ::getSelectQueryData Change-Id: I748733da1a34f9af1cd431c933809c23dc37a3d6
* Merge "Replace "@stable for implementation" with "@stable to implement""jenkins-bot2020-07-135-5/+5
|\
| * Replace "@stable for implementation" with "@stable to implement"daniel2020-07-135-5/+5
| | | | | | | | | | | | | | | | | | | | | | 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
* | 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
* | Merge "Replace "@stable for calling" by "@stable to call""jenkins-bot2020-07-133-3/+3
|\ \
| * | Replace "@stable for calling" by "@stable to call"daniel2020-07-133-3/+3
| |/ | | | | | | | | | | | | | | | | | | | | 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: If560596f5e1e0a3da91afc36e656e7c27f040968
* / Replace "@stable for overriding" with "@stable to override"daniel2020-07-131-10/+10
|/ | | | | | | | | | | 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
* Annotate extensible classes.daniel2020-07-091-0/+17
| | | | | | | This marks some base classes as stable for subclassing. Bug: T247862 Change-Id: I7b77075849aa40960f2486b463e498a3ea8058e9
* Mark additional classes as newable for now.daniel2020-07-082-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | The following glasses are marked as newable per the Stable Interface Policy, even though logically, they should not be newable. This is done for classes that are currently instantiated by extensions, and lack an alternative. A better way for obtaining an instance of these classes should be created in the future. At that point, direct instantiation should be deprecated and replaced. - includes/ApiMain.php - needs factory - includes/media/BitmapMetadataHandler.php - should become a stateless service or use handler pattern - includes/GitInfo.php - should become a stateless service - includes/logging/LogPage.php - should become a stateless service or use command pattern - includes/logging/ManualLogEntry.php - should become a stateless service or use command pattern - includes/poolcounter/PoolCounterWorkViaCallback.php - needs a factory - includes/context/RequestContext.php - needs to be narrowed down, and should use a factory - includes/search/SearchHighlighter.php - should have a factory - includes/TitleArrayFromResult.php - should perhaps be part of TitleFactory - includes/user/User.php - should at least get a factory method for anons - includes/diff/Diff.php: needs a TextDiffGenerator service or a factory - includes/EditPage.php: needs a factory Bug: T247862 Change-Id: I033158e693c98630ee167d9528fc8c9936f978d4
* Stability annotations for interfaces.daniel2020-07-071-0/+1
| | | | | | | | | Per the Stable Interface Policy, PHP interfaces should not be directly implemented by extensions, unless they are marked to be safe for that purpose. Bug: T247862 Change-Id: Idd5783b70fc00c03d57f5b1a887f0e47c4d7b146
* phan: Enable redundant_condition_detectionUmherirrender2020-07-012-0/+6
| | | | | | | | Remove duplicate casts Suppress false positives Bug: T248438 Change-Id: I2f89664a4bcd3b39b15e7cf850adda2f0c90ae6f
* Hook: Mark abortable=false hooks as voidTimo Tijhof2020-06-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove the mention of 'return true' being legal. This is only allowed for compat with code from before MW 1.21, when I added hook aborting as well as tolerance for null to be the same as true. Since then, there is no reason to return null or return true. For early returns, an explicitly void 'return;' should be used instead. Returning anything else like null/true serves no purpose other than to confuse the reader. * Mark the interfaces as natively 'void' with return type hints. This means in core code that runs the hook, static analysis like Phan and in IDEs, it will be known that these onFoo()s never return a value, thus allowing them to detect if its return value is assigned or used in a conditional for any reason, which can be an easy mistake. It also means that in the future when extensions start using these interfaces in 'implements' statement, they will be required to mark their hooks as void. That migration is opt-in and still up ahead. This is not a breaking change even for all existing extensions where a return true/null may exist in an abortable hook since this only applies to code directly typed against the interface. The internal run() method doesn't care. Change-Id: Ib79289bd486ac97cec492e72f9a8dee70cf2f6c2
* Merge "Add doc to DatabaseLogEntry"jenkins-bot2020-06-152-0/+4
|\
| * Add doc to DatabaseLogEntryUmherirrender2020-05-312-0/+4
| | | | | | | | | | | | See I13b5fd2989f9e640718ecf5083f83017abefef25 for more information Change-Id: I455ef14b8ee764ab5377fa72afa9c47e32a85ef7
* | Merge "Revert "RCDatabaseLogEntry: add a method to get the last rev_id""jenkins-bot2020-06-151-10/+0
|\ \
| * | Revert "RCDatabaseLogEntry: add a method to get the last rev_id"Umherirrender2020-05-281-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit b96d2808fd743efb6f0a6f2c4ed7697e3b3682f0. This class should only be used in context of the LogFormatter and the method is not needed there. This was added in 1.35 and the revert should be part of 1.35 to avoid deprecation process. Change-Id: I13b5fd2989f9e640718ecf5083f83017abefef25 Depends-On: I3af1e42594f8235be815ce38e3411c762ae01092
* | | Remove terminating line breaks from debug messagesTim Starling2020-06-032-2/+2
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-303-6/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Use Message::rawParam() in RightsLogFormatterThiemo Kreuz2020-05-291-4/+4
| | | | | | | | | | | | | | | | | | … instead of basically copy-pasting this implementation detail of the Message class. All the …Param() methods are there for a reason, so we can depend and rely on them and don't have to guess and hope that the Message class still accepts manually constructed arrays. Change-Id: I96a2fda4196e960ee085123313ecb301404ac518
* | Fix even more PSR12.Properties.ConstantVisibility.NotFoundReedy2020-05-162-9/+9
| | | | | | | | Change-Id: If1335359b545c36fc979676c3e88d87628f9389e
* | Fix numerous Squiz.Scope.MethodScope.MissingReedy2020-05-151-1/+1
| | | | | | | | Change-Id: I7a5aa8555e94a0bcb97b37ec6f8ca854de7c5575
* | Fix SingleSpaceBeforeSingleLineCommentReedy2020-05-111-4/+0
| | | | | | | | Change-Id: I285af438ce484af40741489797f20455726ec110
* | Hook interface doc comment followupTim Starling2020-04-211-2/+2
| | | | | | | | | | | | Mostly just narrower array types. A handful of other errors fixed. Change-Id: Ied79d9e389867911bf83696dbb47f43305f8be7b
* | docs: Hook interface doc comment reviewapaskulin2020-04-215-41/+54
| | | | | | | | | | | | | | | | Edited doc comments for hook interfaces to improve consistency and add type hints. Bug: T246855 Change-Id: I38fa802463cd6f39bf5946dbbeb1b3ebaea604b2
* | Automatically generated hook interfacesTim Starling2020-04-205-0/+144
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | doxygen: Changed Doxygen tags causing warnings during documentation generationHolger Knust2020-04-141-4/+4
| | | | | | | | | | | | | | | | | | | | | | Updated Doxygen markup in several .php files triggering warnings when mwdocgen.php is executed. Removed obsolete settings MSCGEN_PATH and TCL_SUBST from Doxyfile. The former would generate a warning in 1.8.16 while TCL support was removed in 1.8.18. Since TCL_SUBST was blank anyway, it was removed prior to getting to .18 in production. Increased DOT_GRAPH_MAX_NODES from 50 to 200 since Doxygen complained about it being too low for API and Maintenance. Bug: T248706 Change-Id: I9c67f0807d1b43089d351263d4f591dee5501f36
* | Reduce the length of 6 long lines of codeSam Wilson2020-03-131-2/+6
| | | | | | | | | | | | | | | | | | This shortens some lines below 120 characters when a tab is counted as 4 characters (not that line lengths are currently counted like that). Bug: T243598 Change-Id: I828cd540268810bd56589885e38ad03f8bafc6f9
* | Forgot to include the deprecation versionDannyS7122020-03-031-2/+2
| | | | | | | | Change-Id: I8d001bf97134e83998ac697bb2871833742cf087
* | Merge "Hard deprecate LogEventsList::getExcludeClause $wgUser fallback"jenkins-bot2020-02-281-1/+6
|\ \
| * | Hard deprecate LogEventsList::getExcludeClause $wgUser fallbackDannyS7122020-02-281-1/+6
| | | | | | | | | | | | | | | Bug: T246409 Change-Id: Ib7810070a870a541fa1889f3fdfa0a0a6e0f9009
* | | Deprecate requiring a right in LogEventsList::typeActionDannyS7122020-02-281-0/+3
|/ / | | | | | | | | Bug: T246410 Change-Id: I77d0892cd0d6dd4b85bdb7430b2ebafa2f22f5bf
* | Use __METHOD__ instead of __FUNCTION__DannyS7122020-02-203-5/+5
| | | | | | | | | | | | Follow up to I8990bc16 Change-Id: Id6435add2eea34ee8f79b70df152d08c3fb29ce1
* | Deprecate falling back to $wgUser in some functionsDannyS7122020-02-193-4/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not passing a user to the following functions is deprecated: * Title::getNotificationTimestamp * Revision::newNullRevision * WikiPage::insertProtectNullRevision * PatrolLog::record * LogEventsList::userCan * LogEventsList::userCanBitfield * LogEventsList::userCanViewLogType * LogPage::addEntry Bug: T242935 Bug: T243652 Change-Id: I8990bc16ac72680fb65f8ca37eb7908749a9e5cc
* | Remove usages of deprecated Language methodsPetr Pchelko2020-02-161-2/+5
| | | | | | | | Change-Id: Iad3375b141b1d87c890baec6ecd16ed92f93e699
* | LogPage: Unstub $wgLang before useDaimona Eaytoy2020-02-131-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | The code using $wgLang is also moved inside a conditional, to avoid unstubbing $wgLang when unnecessary. A possible improvement is to use Skin::getLanguage() instead of $wgLang, but that's not guaranteed to be safe, and we want to unblock the train without introducing new issues. Bug: T245178 Change-Id: Ifb06d9b890456092633e38b14674cc3ef48690e3
* | Fix @todo asking to document LogPage::getTitleLink()Thiemo Kreuz2020-01-291-19/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is motivated by I1568d44, a 5 (!) year old patch. This patch does: * Change the visibility from protected to private. I checked. There are no subclasses. No need to make this method available. * Remove unused function parameters. * Turn some conditions into guard clauses. * Turn all these hard to read "if: big chunk of code, else: 1-liner" around to have the 1-liner first, or just get rid of the not needed else. * Avoid reusing the same variable name for different things. This is really confusing. * Inline trivial stuff. * Improve some "@return string" documentation to say what the string is. * Reduce the amount of duplicate code. Change-Id: Ied90f020057d9bdf4d979f380c3aedad5eb3ad5f
* | Merge "logging: Remove unused autopatrol code from PatrolLog class"jenkins-bot2020-01-261-10/+5
|\ \ | |/ |/|
| * logging: Remove unused autopatrol code from PatrolLog classDannyS7122020-01-241-10/+5
| | | | | | | | | | | | | | Follows up 922be5106. These code paths are no longer reachable given the early return for `$auto`. Change-Id: I4f3de2e49c60326aa78234cf211e9d179505df6d
* | RCDatabaseLogEntry: add a method to get the last rev_idDaimona Eaytoy2020-01-221-0/+10
| | | | | | | | Change-Id: I72290129610245fe7b8f7be0258c0efe8911c242
* | Coding style: Auto-fix MediaWiki.Usage.IsNull.IsNullJames D. Forrester2020-01-103-4/+4
| | | | | | | | Change-Id: I90cfe8366c0245c9c67e598d17800684897a4e27
* | Coding style: Auto-fix MediaWiki.Classes.UnsortedUseStatements.UnsortedUseJames D. Forrester2020-01-101-1/+1
| | | | | | | | Change-Id: I94a0ae83c65e8ee419bbd1ae1e86ab21ed4d8210
* | Merge "Preload titles for page restrictions on Special:Log"jenkins-bot2020-01-081-2/+10
|\ \ | |/ |/|