Commit graph

160 commits

Author SHA1 Message Date
Umherirrender
4de76550a3 Fix various real types related to scalar types
Swap null/false or use real strings if needed

Found by phan strict checks

Change-Id: Id82ea609f05a76c5cb8c661d5cf2b7922d6cfbc1
2022-03-10 19:35:34 +00:00
Bartosz Dziewoński
b6b2cb79d1 LogEventsList: Modernize warnings with log excerpts
Markup is changed slightly to allow using Html::warningBox().

Change-Id: I632e42ee9065b38dca443beae1cb01ef714cae7b
2022-02-10 22:51:51 +01:00
Bartosz Dziewoński
41d167ff52 LogEventsList: Set context page for {{PAGENAME}} etc. in showLogExtract()
Bug: T300184
Change-Id: I6e9356a6cc3b9df9b508c3d37a0b9b75d6825efd
2022-02-10 05:34:40 +00:00
Bartosz Dziewoński
d5326a88fb LogEventsList: Simplify using the ... splat operator
Change-Id: I84ce3a22e1f764f9797d40ca540a10492cbed151
2022-01-31 20:19:34 +00:00
TChin
47adb6d65a Refactor global variables to use MediaWikiServices instead
Automatically refactors wg prefixed globals to use MediaWikiServices config using Rector. Doesn't include files that set globals or files that fail CI.

Rector Gist: https://gist.github.com/tchin25/7cc54f6d23aedef010b22e4dfbead228

* This patch uses a modified source code rector library for our specific use case and the rector will have different effects without it.

A writeup for future reference is here: https://meta.wikimedia.org/wiki/User:TChin_(WMF)/Using_Rector_On_MediaWiki

Change-Id: I1a691f01cd82e60bf41207d32501edb4b9835e37
2022-01-10 13:55:53 -05:00
Umherirrender
362a48e316 Change null to [] for html attributes on call of Html functions
Change-Id: Ia84f5b1f210396cba5daa7b9e8bb8c4069e0171d
2021-09-22 22:47:28 +02:00
Umherirrender
07b499fbcf build: Update mediawiki/mediawiki-phan-config to 0.11.0
Addition and remove of suppression needs to be done with the version
update.

Change-Id: I3288b3cefa744b507eadebb67b8ab08c86517c1c
2021-09-07 17:19:05 +02:00
Umherirrender
a55ca2fc66 logging: Cleanup LogEventsList constructor
Each Skin is a IContextSource, which makes the instanceof checks in the
constructor not needed.

Follows-up 265dd5d23c (I4e2dd5d3ab64) and 9712def7 (I6dde2a23d).

Change-Id: Ibfb271bf61d03086433a9bb7b0e1081f01298615
2021-08-31 00:10:02 +00:00
jenkins-bot
8b04c7a8d8 Merge "Deprecate passing Skin to LogEventsList constructor" 2021-08-26 23:42:53 +00:00
James D. Forrester
719cf161f2 More master -> primary documentation and internal var renaming
Bug: T254646
Change-Id: I63cc8895033714bdfbf09aee933a8f0a43b387f3
2021-07-15 11:20:20 +01:00
Umherirrender
4f602d4d01 Use HTMLForm::setWrapperLegend and ::setSubmitTextMsg to set messages
setWrapperLegendMsg and setSubmitTextMsg are calling Message::text
Replacing setSubmitText + Message::text with setSubmitTextMsg makes the
code easier to read

Change-Id: I73389991fea82e1927027dc95c3debc3d8c15939
2021-06-15 18:56:49 +00:00
Ammarpad
265dd5d23c Deprecate passing Skin to LogEventsList constructor
This was deprecated since 9712def7 but never raised deprecation
warnings. No code is using the old parameters

Change-Id: I4e2dd5d3ab64743fde89698fb986a2883aa9eb57
2021-06-08 15:38:45 +00:00
DannyS712
19739de872 Remove some unneeded uses of full User objects
Change-Id: Ib86399445a77d3005f23ae87d87f3cf742b13b1f
2021-05-22 03:58:25 +00:00
jenkins-bot
6951a7549f Merge "Simplify use of 'label-raw' on html forms for tag-filter message" 2021-05-15 11:47:40 +00:00
Petr Pchelko
6a7508c1ab LogEventsList: always define $pageName
Bug: T282834
Change-Id: I0162bdd72a4a8c5e2a694474a60539a0a7dcd844
2021-05-13 17:01:25 -07:00
Umherirrender
4f348bfb0f Simplify use of 'label-raw' on html forms for tag-filter message
label-message is using Message::parse, changing 'label-raw' with parse
to label-message is a noop, but easier to read.

Change-Id: I374142562cba591e15061df2640e5898770a10e5
2021-05-08 02:10:46 +02:00
daniel
60734d3b19 LogPager: replace Title in method signatures
Bug: T278459
Change-Id: Icd273b598fefe5e5d18aef4e4d12adfbf88e291a
2021-05-07 17:12:23 +02:00
James D. Forrester
df5eb22f83 Replace uses of DB_MASTER with DB_PRIMARY
Just an auto-replace from codesniffer for now.

Change-Id: I5240dc9ac5929d291b0ef1c743ea2bfd3f428266
2021-04-29 09:24:31 -07:00
mainframe98
84197bf6bb Move several legacy style rules to existing dedicated modules
These are often two or three css rules and can be included in the
style sheets of other modules.

To facilitate a good migration from mw-warning-with-logexcerpt,
mw-logevent-loglines has been added to the log event list of
LogEventsList, to allow styling previously provided under
mw-warning-with-logexcerpt to be selected only in cases where
the styles should actually be applied. See also T278002.

Bug: T278576
Change-Id: I3f45c95d2856c8fce2da5175b52089d4e629a41e
2021-03-26 20:39:39 +01:00
daniel
4dce6dd0c3 Deprecate UserIdentity::getActorId()
Note: User::getActorId() is not (yet) deprecated.

Bug: T274179
Change-Id: Ic2ca6d489db821fc2334e53bf2496c7b0d3ea5b1
2021-03-13 19:45:57 +01:00
jenkins-bot
4ca69110af Merge "Convert ChangeTags public interface to Authority." 2021-03-01 21:18:44 +00:00
Petr Pchelko
ee7d3e9335 Convert ChangeTags public interface to Authority.
Bug: T275507
Change-Id: I3b7f99391ab299df2b046a2878010cf6afe7fed7
2021-02-24 14:09:16 -07:00
Petr Pchelko
3a5c8f0f25 Convert logging namespace to Authority
Change-Id: Icb44acf275a7f9231c4d229b3886ed8a36d5cbd4
2021-02-23 21:58:37 +00:00
Ammarpad
ef4c5bf344 LogEventsList: Remove unused property
Deprecated and unused. No class is extending LogEventsList, so it
can't possibly be in use elsewhere.

Change-Id: I7781c06c8382103e774486717d643f8868670a3f
2021-01-20 09:53:57 +00:00
jenkins-bot
26849c6438 Merge "Inject services into SpecialLog" 2020-11-20 18:59:09 +00:00
DannyS712
4e6e2ab274 Implement links-in-logs script, linking LogEventsList rows to log entries
Bug: T207562
Change-Id: Icb9405a5f9491bfe4c639b5fe5b8799cab8b35da
2020-11-14 00:46:56 +00:00
Umherirrender
7d14ded394 Inject services into SpecialLog
This covers only directly used services by this special page and pager
Services used by the base class are not part of this patch set

Bug: T259960
Change-Id: Ib4b5edf6b4c56ef626875df8d95496225cddf501
2020-10-26 16:25:17 +00:00
David Barratt
65d1b042b2
LogEventList::userCanViewLogType() accepts a string not an stdClass
The LogEventList::userCanViewLogType() method accepts a string, but is
documented as accepting a stdClass. This change fixes the documentation.

Change-Id: I410f7cef58a2c89f5a15fd047cc703a90b0812ab
2020-10-10 12:54:14 -04:00
sbassett
ad21a02e16 SECURITY: Unescaped message used in HTML within LogEventsList
* Use options-messages instead of text() for messages used to
  build HTML multi-select field.
* Clean up old FIXME conditional since T199657 has been resolved
  for over a year now.

CVE-2020-25815

Bug: T256171
Change-Id: Ib8f95f5510320f7fc2163625214c3c198be5941a
2020-09-24 14:30:58 +01:00
Umherirrender
90f6829ce0 Use ::class to refer HTML form field classes
Change-Id: Ie5248123cb0facdad896339def502bcd31a47565
2020-09-19 09:48:24 +02:00
jenkins-bot
1ead4567f5 Merge "CSS 'class' names can be an array in Html::…element" 2020-09-10 16:27:17 +00:00
DannyS712
ed6711b65f Remove support for LogEventsList::userCan* functions without a user
Bug: T245704
Change-Id: I947dfa910fda448282407c6ba340405f9efdf57e
2020-09-10 01:07:08 +00:00
DannyS712
b82b1cc61a Remove LogEventsList::typeAction support for rights
Bug: T246412
Change-Id: I07fbaa8d9dfc10bc11bca3f8ea444b3bd393832f
2020-09-10 00:28:15 +00:00
DannyS712
7b0396a6ad Remove LogEventsList::getExcludeClause fallback to $wgUser
Bug: T246413
Change-Id: Ia3187fc8892505fa82989640bee8f35534cbfd2f
2020-09-09 23:55:52 +00:00
Thiemo Kreuz
d206da0e1e CSS 'class' names can be an array in Html::…element
Change-Id: I301d23066b19051b9e1cb9363639f6189a8b173c
2020-09-08 19:11:19 +00:00
Umherirrender
42507e73cd Use LinkBatchFactory in pagers, special pages and actions
Change-Id: I299900316c8d3129844a047228cd1c15ae7dff63
2020-09-06 01:26:09 +02:00
Umherirrender
bc5cb7ae64 phan: Enable redundant_condition_detection
Remove duplicate casts
Suppress false positives

Bug: T248438
Change-Id: I2f89664a4bcd3b39b15e7cf850adda2f0c90ae6f
2020-07-01 20:13:07 +00:00
Tim Starling
47a1619027 Remove terminating line breaks from debug messages
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
2020-06-03 12:01:16 +10:00
Tim Starling
68c433bd23 Hooks::run() call site migration
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
2020-05-30 14:23:28 +00:00
Reedy
988174411c Fix even more PSR12.Properties.ConstantVisibility.NotFound
Change-Id: If1335359b545c36fc979676c3e88d87628f9389e
2020-05-16 00:51:31 +01:00
DannyS712
4d4d4b61ab Forgot to include the deprecation version
Change-Id: I8d001bf97134e83998ac697bb2871833742cf087
2020-03-03 09:11:35 +00:00
jenkins-bot
fcf993dfc4 Merge "Hard deprecate LogEventsList::getExcludeClause $wgUser fallback" 2020-02-28 06:50:04 +00:00
DannyS712
ef9dae1e00 Deprecate requiring a right in LogEventsList::typeAction
Bug: T246410
Change-Id: I77d0892cd0d6dd4b85bdb7430b2ebafa2f22f5bf
2020-02-28 06:29:16 +00:00
DannyS712
af7674db64 Hard deprecate LogEventsList::getExcludeClause $wgUser fallback
Bug: T246409
Change-Id: Ib7810070a870a541fa1889f3fdfa0a0a6e0f9009
2020-02-28 06:10:20 +00:00
DannyS712
b3451ba87a Use __METHOD__ instead of __FUNCTION__
Follow up to I8990bc16

Change-Id: Id6435add2eea34ee8f79b70df152d08c3fb29ce1
2020-02-20 03:08:51 +00:00
DannyS712
328f093458 Deprecate falling back to $wgUser in some functions
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
2020-02-19 21:43:46 +00:00
Volker E
6fd6651c17 Add .warningbox to .mw-warning-with-logexcerpt container to standardize
Standardizing system warning message by using general `.warningbox` class.

Bug: T234509
Change-Id: If814916af9b9a095cb038d64d859339e0f290c72
2019-10-03 11:19:45 -07:00
Petr Pchelko
7b4eafda0d Replace usages of deprecated User::isAllowed. Step 2.
Bug: T220191
Depends-On: I509cd88355cfd0cc074f4135ec86399b4075f89f
Change-Id: I2341e6f1d108c92924620fba3c64ec090cb09918
2019-09-11 16:00:03 -07:00
Derick Alangi
e5f1f622b9 logging: Deprecate LogEventsList::$mDefaultQuery member
This is a follow up on follow-up-I91003a9a3f2a56114de5b

Change-Id: If670ed959bcbc3149b0979541c641ada63377b7f
2019-08-29 22:18:50 +01:00
Derick Alangi
fb6e0ec767 mime,logging: Remove unused private methods
These methods are defined but not used.

Change-Id: I91003a9a3f2a56114de5baede6a1034ee4ed8d80
2019-08-29 17:46:44 +00:00