Commit graph

57 commits

Author SHA1 Message Date
Timo Tijhof
cbd25621f4 rdbms: Move IDBAccessObject from /includes/dao/ to /libs/rdbms
* Is generally useful for Rdbms consumers.
* Has no dependencies besides stable constants and interface from Rdbms.
* Is generic, i.e. not specific to MediaWiki in its naming, purpose,
  or required domain knowledge.

Current rationale is that "dao" is not a recognised component
in MediaWiki core. Its super tiny and a handful of changes in over a
decade, so seems overkill to make a big deal out of it by creating a
whole new component for it in all the usual places. Yet, having it
fall into a gap with no owner for issue tracking, code review, no
documentation, and no definition of what this directory is for
exactly, is also counter-productive. Hence, finding a suitable place
for it.

Change-Id: I8cbb9ebfa8873085a30cb355e3299493538006ae
2023-06-01 13:38:28 +01:00
Amir Sarabadani
c05c261491 auth: Use IConnectionProvider instead of LoadBalancer
Bug: T330641
Change-Id: Ia0722050b66f1d4919dc5f99da0c77cc98f35d92
2023-05-03 13:23:43 +02:00
Umherirrender
05a175b439 Simplify assertion for false around wiki id and domain id
false is accepted by Assert::class since 9090085

Change-Id: I243a63dca310a198c6f7a8bc52298c5c95939eb6
2022-06-18 09:49:13 +02:00
Aaron Schulz
1cc67dccc7 rdbms: remove deprecated DBAccessBase class
Change-Id: I6dfa4c3b5e1a456565daab58a3252feaa0e05cf1
2022-01-26 17:08:14 -08:00
Alexander Vorwerk
b6793e47de Make Block objects aware of which wiki they belong to
Bug: T274817
Depends-On: I1c46c712a3afefce56238108cb2e78382dd41956
Change-Id: I8ae8133f7e232cc75aae6b72fcd7feaeb313cba7
2022-01-17 21:49:20 +01:00
libraryupgrader
5357695270 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
  The following sniffs now pass and were enabled:
  * Generic.ControlStructures.InlineControlStructure
  * MediaWiki.PHPUnit.AssertCount.NotUsed

npm:
* svgo: 2.3.0 → 2.3.1
  * https://npmjs.com/advisories/1754 (CVE-2021-33587)

Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
2021-07-22 03:36:05 +00:00
DannyS712
20f24a4c85 DBAccessBase: do not document as both stable and deprecated
Remove `@stable to extend` from the class, and
`@stable to call` from the constructor, now that
the class is deprecated

Follow-up: I1a51a08885d910c23c3cafd63afccb1933baf5bc
Change-Id: I47d1e910100b1116b3a551000106c517b7fb5556
2021-06-02 14:11:35 +00:00
Lucas Werkmeister
7ce73555ca Hard-deprecate DBAccessBase class
Bug: T279063
Change-Id: I39ca311938faa9675324a48a5f8c7b210de1d54c
2021-05-17 11:22:20 +02:00
jenkins-bot
761d8cf255 Merge "Soft-deprecate DBAccessBase class" 2021-05-14 22:49:50 +00:00
Lucas Werkmeister
1a1dda50d2 Soft-deprecate DBAccessBase class
Bug: T279063
Change-Id: I1a51a08885d910c23c3cafd63afccb1933baf5bc
2021-05-14 15:21:35 -07:00
James D. Forrester
f2f9345e39 Replace uses of DB_MASTER with DB_PRIMARY in documentation and local variables
This is just a start.

Bug: T254646
Change-Id: I9213aad4660e27afe7ff9e5d2e730cbf03911068
2021-05-14 12:40:34 -07: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
Petr Pchelko
26be00fac4 Introduce helper WikiAwareEntityTrait
Bug: T273948
Change-Id: I21180d7031646f13413e2edb1bf0a17fbfdada13
2021-02-08 13:49:50 -06:00
Petr Pchelko
653789eaee Add WikiAwareEntity interface for cross-wiki entity methods.
Add an interface to hold cross-wiki assertion and constants.
This also is a good place to document the expectations.

Currently planned to be implemented by PageIdentity, RevisionRecord,
UserIdentity.

Change-Id: I41a7a82a0386a52a765774ade1ab56a26aaf0741
2021-01-29 10:29:03 +00:00
Thiemo Kreuz
fd7363a1e1 Fix broken PHPDoc comments that don't start with /**
Change-Id: I8db56ff0f73873864dde260e51adcd729aa74e94
2020-07-23 16:09:41 +00:00
jenkins-bot
a5f4732261 Merge "Replace "@stable for implementation" with "@stable to implement"" 2020-07-13 09:31:44 +00:00
jenkins-bot
39705eb311 Merge "Replace "@stable for subclassing" with "@stable to extend"" 2020-07-13 09:31:38 +00:00
daniel
e6e0ad2472 Replace "@stable for implementation" with "@stable to implement"
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
2020-07-13 11:05:49 +02:00
daniel
3c50afa46b Replace "@stable for subclassing" with "@stable to extend"
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
2020-07-13 11:00:30 +02:00
daniel
272db6afde Replace "@stable for calling" by "@stable to call"
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
2020-07-13 08:55:28 +00:00
daniel
7572a152fc Annotate extensible classes.
This marks some base classes as stable for subclassing.

Bug: T247862
Change-Id: I7b77075849aa40960f2486b463e498a3ea8058e9
2020-07-09 11:07:38 +02:00
daniel
442fb30ce1 Stability annotations for interfaces.
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
2020-07-07 22:01:29 +00:00
Reedy
34729dedcf Fix numerous PSR12.Properties.ConstantVisibility.NotFound
Change-Id: I9b08bde11727f47e262f5f7f422eac5585ea7fca
2020-05-11 01:59:00 +00:00
Aaron Schulz
2d20924ebf Make DBAccessBase use DBConnRef, rename $wiki, and hide getLoadBalancer()
Note that only one extension uses this class and should not be affected.
Also, make the constructor take an optional LoadBalancer for DI.

Change-Id: Ibb7192ac199427266d7e3f3f14437d0495061911
2019-09-08 03:34:18 +00:00
Derick Alangi
e1f5364f56 dao: Correct return type doc for getLoadBalancer()
This method creates a load balancer object using services and calls
getMainLB() which returns an instance of ILoadBalancer and not an
instance of LoadBalancer, hence, getLoadBalancer() should return an
instance of ILoadBalancer instead.

Change-Id: I8859f293985d256d02ddc6f90e2aea813ebfc955
2019-04-11 22:24:43 +00:00
Fomafix
4b46994799 Fix usage of MediaWikiServices in comments and documentation
MediaWikiServices::getFoo()

is wrong. Right is:

MediaWikiServices::getInstance()->getFoo()

Change-Id: Ib6d844ddfe5bd6ccd72b887a63d9ad476c8d196f
2019-03-03 14:09:33 +00:00
Derick Alangi
324f03ede5 dao: Add a type hint to getConnection() and some extra newlines
Change-Id: I57a060394403a6b7335fda68edaeabc02888e14d
2019-01-16 14:29:53 +01:00
Bartosz Dziewoński
52b0799e8d Use PHP 5.6 constant expressions for some bitfield constants
I searched the entire codebase for 'const' and looked for things
that looked suspiciously like manually calculated bitfield unions.
As of PHP 5.6, we can have them calculated automatically when
defining constants.

Change-Id: I7d971d1a63f8916db2f8f6c053c7dd0a13add92d
2018-05-30 18:05:18 -07:00
Kunal Mehta
e0193327bd Fix MediaWiki.Commenting.LicenseComment.InvalidLicenseTag errors
Change-Id: I936c3f5fca1a0061f215e80469f5d882cb32ee29
2018-05-23 16:23:42 -07:00
Umherirrender
e1a203603c Replace wfGetLB
@deprecated since 1.27

Change-Id: Ibdd49fdfc0d1511503e1ed2173a592c612996c53
2018-05-02 22:30:24 +02:00
Umherirrender
69dbaf3f88 build: Updating mediawiki/mediawiki-codesniffer to 17.0.0
Change-Id: Ib494b47c54fe6354d166055b1e1b31d3583bb992
2018-03-29 21:53:10 +02:00
Thiemo Mättig
eb6c589e54 Use IDatabase interface instead of Database in DBAccessBase
There is one subclass I'm aware of that overwrites the releaseConnection
method. It's in the EducationProgram extension and already updated, see
Ibb067ca.

Change-Id: I68504f9cd32aa0d0c6c068dbaa1f2ee65649afa4
2018-01-09 13:58:48 +01:00
Umherirrender
3f1a52805e Use short type bool/int in param documentation
Enable the phpcs sniffs for this and used phpcbf

Change-Id: Iaa36687154ddd2bf663b9dd519f5c99409d37925
2017-08-20 13:20:59 +02:00
Aaron Schulz
d735dc562d Move Database and subclasses to Rdbms namespace
Change-Id: I52bef87512f9ddd155d1f4cc0052f6b7a0db5b42
2017-04-12 10:43:57 -07:00
Aaron Schulz
64df456b39 Move remaining LoadBalancer classes to Rdbms
The old names are left as aliases.

Change-Id: I52a327f2463a2ba7437324047b5b00d28cd1d758
2017-02-23 20:38:31 -08:00
Aaron Schulz
30f4b3c103 Replace DatabaseBase => Database in more places
Change-Id: If37a7909056bf2c31a8228cbc84f0fbbf5f1c517
2016-09-28 15:53:02 -07:00
Aaron Schulz
5bbac35ed1 Replace DatabaseBase:: with Database:: and update type hints
Change-Id: I3919b04eb2de4fa0bf8a02239fb5bbf17d347511
2016-09-27 04:20:03 +00:00
Aaron Schulz
7cc14e02d6 Only apply DB_MASTER fallback in Revision::fetchText() if READ_LATEST
Add support to DBAccessObjectUtils for fallback logic to make
this simple for other callers too.

Change-Id: I58ab7bd7d31a481f9dc9a773392ea90feb1ebeac
2016-09-08 03:50:56 +00:00
Aaron Schulz
950cf6016c Rename DB_SLAVE constant to DB_REPLICA
This is more consistent with LoadBalancer, modern, and inclusive
of master/master mysql, NDB cluster, and MariaDB galera cluster.

The old constant is an alias now.

Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
2016-09-05 22:55:53 -07:00
Aaron Schulz
16266edff3 Change "slave" => "replica DB" in /includes
Change-Id: Icb716219c9335ff8fa447b1733d04b71d9712bf9
2016-09-05 21:01:01 +00:00
Aaron Schulz
55187457ba Beef up and generalize IDBAccessObject constants a bit
Change-Id: Id8df6131df57b6a3e0aae90f4431ce0a467ec590
2016-08-08 21:02:15 -07:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Ricordisamoa
df9ebe6f99 Fix some space-related phpcs warnings in includes/
Change-Id: I7cf7206696a5e77bc02e3630d1d88d4c176ea844
2015-08-15 08:56:03 +00:00
Aaron Schulz
704583440e Added DBAccessObjectUtils class to avoid duplication
* WikiPage is the first caller to use this instead of DIY
* This can be used elsewhere to keep callers uniform

Change-Id: Ia6371eaa185d70d1431271b2c6c955523cd424e8
2015-07-14 19:53:09 +00:00
Aaron Schulz
8006aa946a Avoid key conflict errors in User::addToDatabase
* Also cleaned up the IDBAccessObject constants to cover more cases.

Bug: 66185
Change-Id: Ide28af552b3c59428923b373c0f5764414d50a1f
2014-06-24 10:59:27 +00:00
umherirrender
829886b10a Fixed some @params documentation
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.

Change-Id: I64e8cfe478cb0ba438f40b0631d6e9049cdab567
2014-04-14 12:59:19 +00:00
Siebrand Mazeland
210edff11b Remove underscore from classes LBFactory_*, LoadBalancer_*, LoadMonitor_*
Part of program to remove underscores from class names. Checked core and
600+ extensions for occurrences. All uses are in core in core are updated
in this patch.

Patches for extensions:
* https://gerrit.wikimedia.org/r/#/c/96463/ CentralAuth
* https://gerrit.wikimedia.org/r/#/c/96460/ SimpleSecurity
* https://gerrit.wikimedia.org/r/#/c/96459/ WikiBase
* https://gerrit.wikimedia.org/r/#/c/96472/ Wikimedia configuration

Antoine added tests to test the back compatibility.

Change-Id: I507ba00a83bca8375a0215f00891b47e3c7afb9f
2013-12-26 16:30:15 -05:00
Siebrand Mazeland
a67dc5e269 Update formatting in includes/dao/
Change-Id: Id3cfc68ff463831d7cd3329661619c33d70d7085
2013-11-20 05:30:23 +00:00
Tyler Anthony Romeo
4dcc7961df Fixed @param tags to conform with Doxygen format.
Doxygen expects parameter types to come before the
parameter name in @param tags. Used a quick regex
to switch everything around where possible. This
only fixes cases where a primitve variable (or a
primitive followed by other types) is the variable
type. Other cases will need to be fixed manually.

Change-Id: Ic59fd20856eb0489d70f3469a56ebce0efb3db13
2013-03-11 13:15:01 -04:00
umherirrender
d63121016d fix some spacing
Added/removed spaces around logical/arithmetic operator
Reduced multiple empty lines to one empty line
Removed wrong tabs before comments at end of line
Removed too many spaces in assigments

Change-Id: I2bba4e72f9b5f88c53324d7b70e6042f1aad8f6b
2013-03-07 17:53:21 +01:00