Commit graph

36 commits

Author SHA1 Message Date
ArtBaltai
8d2ebb5647 Hard deprecate Action construction with WikiPage
Tests, PermissionManager, EditAction: Construct Action with Article

Bug: T239975
Change-Id: Ia3f653f3c193312e03ccef56586e8b8222c80fa6
2020-04-14 23:13:59 +00:00
ArtBaltai
385d191025 Hard deprecate Action::factory with null argument $action
Bug: T248392
Change-Id: I68293a716ec90e5fd944c45d6ccd432ad3b82beb
2020-04-11 03:48:56 +00:00
Art-Baltai
6a0d3279f5 Revert "Revert "WikiPage/Article split. Rely on Article inside Action" "
This reverts commit 64650aaba9.

Reason for revert: incident T249162 is resolved

Change-Id: I3e16aed923b0f394d184b51cf7272318e1186837
2020-04-08 12:38:41 +03:00
Ppchelko
64650aaba9 Revert "WikiPage/Article split. Rely on Article inside Action"
This partialy reverts commit 07f57bd271.

Reason for revert: Article::newFromWikiPage causes an infinite loop
if 'ArticleFromTitle' hook handler ends up calling Action::getActionName.

The revert preserves new getArticle and getWikiPage methods since there
are a few extension changes merged dependent on these. Alternatively this partial revert, we could do a full revert with all the dependencies  https://gerrit.wikimedia.org/r/c/mediawiki/core/+/585343

Bug: T249162
Change-Id: Ifa642a631caa2d265ee097711dc8727f84435ef0
2020-04-01 22:30:51 +00:00
ArtBaltai
07f57bd271 WikiPage/Article split. Rely on Article inside Action
This is a first step in the split. This keeps b/c for
constructing the Action with a WikiPage, but is deprecated.
Introduces article accessor to remove direct access to
Action::page property.
Action::page property is deprecated for direct access.
 Use Action::getArticle or Action::getWikiPage instead.

Bug: T239975
Change-Id: Ib8eb8a141b4b7cb72ff65afbcd17385fcc6b3b1c
2020-03-25 01:54:43 +03:00
Daimona Eaytoy
e501bb3b50 Manual fix of the remaining assertInternalType & Co.
Bug: T192167
Change-Id: I3b8176745f49b1d4bfe6f36978b7879d546f68a9
2019-12-15 00:20:10 +00:00
Max Semenik
48a323f702 tests: Add explicit return type void to setUp() and tearDown()
Bug: T192167
Depends-On: I581e54278ac5da3f4e399e33f2c7ad468bae6b43
Change-Id: I3a21fb55db76bac51afdd399cf40ed0760e4f343
2019-10-30 14:31:22 -07:00
Vedmaka
dd6b94024c Re-apply: Factors out permissions check from User into PermissionManager service
Was reverted by I549810a4cd2e424cc4a438887d2f24614a24cc00 due to
T224607.

Original change by  Vedmaka Wakalaka was
Ia0d840b772ea5f20c9594ce151cc57adc270e48b.

Original commit message:

The following methods should are factored out of the User class into PermissionManager,
leaving only deprecated stubs:

- User::isAllowed -> PermissionManager::userHasRight
- User::getRights -> PermissionManager::getUserPermissions
- User::groupHasPermission -> PermissionManager::groupHasPermission
- User::getGroupPermissions -> PermissionManager::getGroupPermissions
 -User::getGroupsWithPermission -> PermissionManager::getGroupsWithPermission
- User::groupHasPermission -> PermissionManager::groupHasPermission
- User::isEveryoneAllowed -> PermissionManager::isEveryoneAllowed
- User::getAllRights -> PermissionManager::getAllPermissions

Depends-On: I7909e9bd6bbfbd708c0a00b861a9b22a38c6665d

Bug: T218558
Bug: T223294
Change-Id: I8899240378f636ea70f447616710516c0a3c5c31
2019-06-28 13:19:38 -07:00
Kosta Harlan
7f90d1e3a3 Revert "Factors out permissions check from User into PermissionManager service"
This reverts commit 7faa7a7420.

Reason for revert: T224607

Change-Id: I549810a4cd2e424cc4a438887d2f24614a24cc00
2019-05-30 13:51:37 +00:00
Vedmaka
7faa7a7420 Factors out permissions check from User into PermissionManager service
The following methods should are factored out of the User class into PermissionManager, leaving only deprecated stubs:

- User::isAllowed -> PermissionManager::userHasRight
- User::getRights -> PermissionManager::getUserPermissions
- User::groupHasPermission -> PermissionManager::groupHasPermission
- User::getGroupPermissions -> PermissionManager::getGroupPermissions
 -User::getGroupsWithPermission -> PermissionManager::getGroupsWithPermission
- User::groupHasPermission -> PermissionManager::groupHasPermission
- User::isEveryoneAllowed -> PermissionManager::isEveryoneAllowed
- User::getAllRights -> PermissionManager::getAllPermissions

Depends-On: I258f02e286b6ba0387e1bff540a744fafb03dc55
Depends-On: Ie4cedf457eaaa93ec3055c37539322855e02ce26
Depends-On: Id274f240d687efa61cb9f7a15033ae2a7a532083

Bug: T218558
Bug: T223294
Change-Id: Ia0d840b772ea5f20c9594ce151cc57adc270e48b
2019-05-29 17:41:07 +02:00
Thalia
e65a5b5882 Rename Block to MediaWiki\Block\DatabaseBlock
Keep Block as a deprecated class alias for DatabaseBlock.
Update calls to the Block constructor and Block static
methods from external classes.

Also update documentation in several places that refer to
blocks as Blocks.

Bug: T222737
Change-Id: I6d96b63ca0a84bee19486471e0a16a53a79d768a
2019-05-28 12:20:48 +01:00
David Barratt
f205e6e9f0
Action::checkCanExecute should only block an Action if the user is sitewide blocked
The method over-enforces partial blocks by preventing users from performing
the action on unrelated pages.

Bug: T209284
Change-Id: I4ee0e7c0188d491cf8fc0bbbbf7e492cdf309f45
2018-11-14 14:45:30 -05:00
Kunal Mehta
e0193327bd Fix MediaWiki.Commenting.LicenseComment.InvalidLicenseTag errors
Change-Id: I936c3f5fca1a0061f215e80469f5d882cb32ee29
2018-05-23 16:23:42 -07:00
Umherirrender
69dbaf3f88 build: Updating mediawiki/mediawiki-codesniffer to 17.0.0
Change-Id: Ib494b47c54fe6354d166055b1e1b31d3583bb992
2018-03-29 21:53:10 +02:00
Umherirrender
45da581551 Use ::class to resolve class names in tests
This helps to find renamed or misspelled classes earlier.
Phan will check the class names

Change-Id: Ie541a7baae10ab6f5c13f95ac2ff6598b8f8950c
2018-01-26 22:49:13 +01:00
Thiemo Mättig
1f2ff32cca Family name of Thiemo changed
Change-Id: I5477d02111e53790e858624c4b7c4f09dbc418fa
2017-11-14 13:59:15 +01:00
Krinkle
caf87b4893 Revert "Make an empty "?action=" parameter default to "view""
This reverts commit b287ec2cc6.

Change-Id: I59e996dfe627e8a978ed849a8e82ad4e0b165d7f
2016-05-18 18:54:50 +00:00
Thiemo Mättig
b287ec2cc6 Make an empty "?action=" parameter default to "view"
When no action is given, e.g. in
https://en.wikipedia.org/wiki/URL
the action defaults to "view". Just like you called
https://en.wikipedia.org/wiki/URL?action=view

But when the action is empty, e.g.
https://en.wikipedia.org/wiki/URL?action=
you get an error message telling you that "the action specified"
can not be "recognized". Wait, I did not "specified" an action.
That's why I left the parameter empty. From the users point of
view I expect the empty string to behave like null/undefined.

This is a resubmit of I331924d without the problematic bits.

Change-Id: I07847600bb24ae078276acf98e6eb244039414d7
2016-05-17 18:36:39 +02:00
Timo Tijhof
46b04ec7ae Use static::class instead of get_called_class()
Available as of PHP 5.5 and more idomatic. Foo::class (explicit),
self::class (defined), and static::class (late bound).

Change-Id: I66937f32095a4e4ecde94ca20a935a3c3efc9cee
2016-02-29 22:43:58 +00: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
umherirrender
271da88127 Some bugzilla.wikimedia.org -> phabricator.wikimedia.org changes
Changed some old bugzilla links to new phabricator links in comments,
test data and error message. This reduces the need for redirects from
old bugzilla to new phabricator from our source code.

Change-Id: Id98278e26ce31656295a23f3cadb536859c4caa5
2015-09-24 17:17:25 +02:00
This, that and the other
5c4681012e UI for adding and removing change tags on revisions and log entries
There is a new special page, Special:EditTags, which is very similar to
Special:RevisionDelete in a lot of ways. In fact, the SpecialEditTags class
started off as a copy-paste of SpecialRevisiondelete.

You invoke this special page by going to an article history page, checking
some revisions, and clicking "Edit tags of selected revisions". Then you
pick the modifications you want to make and click "Apply". Very much like
the revision deletion workflow.

I had to restructure some of the Action routing code, which was only
designed to handle revision deletion. Also removing some code from
SpecialRevisiondelete which didn't work as advertised in the first place,
and definitely doesn't work now.

Change-Id: I7d3ef927b5686f6211bc5817776286ead19d916b
2015-04-15 18:31:12 +00:00
Timo Tijhof
b4bac102b6 tests: Clean up file headers
* Remove redundant @licence/@license from test suite files.
  They already have full licence headers. And @licence raises a
  warning in Doxygen.

* Fix weird messes of comments inside comments and other things.

Change-Id: I38da8ca76330f72b8dc22b0ecf1ea69d5ea55ede
2015-04-01 00:17:12 +01:00
jenkins-bot
4be623a6b3 Merge "Revert "Make an empty "?action=" parameter default to "view""" 2014-10-11 17:23:21 +00:00
Brion VIBBER
4587cd5c71 Revert "Make an empty "?action=" parameter default to "view""
Breaks all non-view actions on dev wikis, something's not right with the patch.

This reverts commit a90b7ea969.

Change-Id: Ib9a5eb07ef48716df193fbb62a86c13e5c80dafd
2014-10-11 17:15:49 +00:00
Thiemo Mättig
e1a4fe4be5 Add test for canUseWikiPage special case to ActionTest
Change-Id: I6b037d4aa9101a3a416cdf3bd1e26f14b056b4f7
2014-10-11 00:30:21 +00:00
Thiemo Mättig
a90b7ea969 Make an empty "?action=" parameter default to "view"
When no action is given, e.g. in
https://en.wikipedia.org/wiki/URL
the action defaults to "view". Just like you called
https://en.wikipedia.org/wiki/URL?action=view

But when the action is empty, e.g.
https://en.wikipedia.org/wiki/URL?action=
you get an error message telling you that "the action specified"
can not be "recognized". Wait. I did not "specified" an action.
That's why I left the parameter empty. It doesn't make much sense
to have an empty action name that's different from the "view"
default, right? From the users point of view I expect the empty
string to behave like null/undefined.

Change-Id: I331924d9223e597293bc8285f0c330edf08e429b
2014-10-10 21:52:07 +02:00
Jeff Janes
7e3fcc39ea PHPUnit: Add Database tags
Several unit tests access the database, but did not declare
themselves in the Database @group.  This causes
"make databaseless" to fail needlessly.  Add the
missing tags.

tests/phpunit/includes/LinkerTest.php
tests/phpunit/includes/actions/ActionTest.php
tests/phpunit/includes/specials/ImageListPagerTest.php
tests/phpunit/includes/specials/SpecialMIMESearchTest.php
tests/phpunit/includes/title/MediaWikiPageLinkRendererTest.php

Other than ActionTest.php, these also are problematic in 1.23

Change-Id: I7c1c957e2194c13e48b7ba68d7529e5d89901875
2014-09-16 18:42:27 -07:00
Thiemo Mättig
5043b4993b Add tests for IE workarounds to ActionTest
Change-Id: Iafaa3266e57f22f108c0253053103681bd88bd10
2014-07-22 13:55:44 +02:00
Thiemo Mättig
e2675eaeef Add tests for NULL to ActionTest
NULL should default to 'view'. But both the exists check and the
factory should fail when asked for a NULL action.

Change-Id: I5751489eed890bb44101f2a4ef73002bff68b207
2014-07-22 13:55:44 +02:00
Thiemo Mättig
1ccdd5bec0 Add tests for disabled actions in ActionTest
Change-Id: I2c742fca0fa87604c1d503b938ecc495aafd8376
2014-07-22 13:55:44 +02:00
Thiemo Mättig
d3e26d2906 Add more test cases to ActionTest
1. The 'dummy' test case already tested ucfirst(), but strtolower()
was not tested. The new 'DUMMY' tests fixes that.

2. Add a new test where the requested action is false.

3. Refactored the dummy builder a bit to make it easier to reuse.

Change-Id: Id7d9adac064b307b04bf6accb83ffd7f217a857c
2014-07-22 12:37:05 +02:00
umherirrender
53c420e278 Fixed spacing
- use tab as indent instead of spaces
- Added space after closures "function"
- Added spaces around string_concat
- Added newline inside empty blocks
- Removed four spaces after comma

Change-Id: I4425b0c6a69b36f40acfea6511b8950cf09ce2b2
2014-07-20 21:41:41 +02:00
umherirrender
2b021dc48a Fixed spacing
- Added/removed spaces around parenthesis
- Added space after switch/if/foreach
- changed else if to elseif

Change-Id: I99cda543e0e077320091addd75c188cb6e3a42c2
2014-07-19 23:12:10 +02:00
Thiemo Mättig
bf0d2a110a Improve tests for Action::exists
Change-Id: I905fd8e88ff625cd88c672ddac7a5ac4f4a94b36
2014-07-18 15:33:21 +00:00
Thiemo Mättig
20a1087bd5 Add ActionTest for static Action methods
Change-Id: Ifea52280486b8aa29fbab42e4c7d3ea907849b52
2014-07-18 15:29:35 +02:00