The bug has actually already been fixed, so this
patch just removes extraneous function calls and code in
User::getOption() and User::setOption(). It also adds
unit tests for user options (including a test for the
case provided in the bug report).
Change-Id: Idd8af9cf1a26a4adbde3ca71dde64539ecd0a207
Caching the result of User::getDefaultOptions as it always returns
the same data, despite for unit tests, which can't use the cached
values as they do evil things with variables being constant in normal
operation.
Change-Id: I02d557006d2f879e7ce510a5e47fa1543baab8a6
Made action=query&list=users use User::getRights() if
usprop rights given. This not only removes redundant
code, but makes it execute the UserGetRights hook, so
that this now includes rights given by Extensions (eg.
CentralAuth does that).
Patch Set 2: Modified the User class to be able to
inject further data into User::newFromRow() and using
that to inject the groups taken out of one SQL query
(for performance reasons). Furthermore I've split up
the query in ApiQueryUsers.php into one for user data
and one for the groups, to only have one row for each
user.
After all the perfomance of this should now be ok, not
extremly good, but bearable (though I couldn't test it
deeply, as I don't have much data in my CentralAuth
environment).
Change-Id: Ie5b2924abb82ac254c77e1d04cc4d5b308962dad
* Has to keep actual messages for IRC notification
* Catch really old log entries with no parameters and use an
appropriate message in that case to not always display erroneous
"X changed group membership for Y from (none) to (none)".
Change-Id: Ie188bc6fcdf672fe31f0f389a158aab6256031fa
(bug 41198) If clearInstanceCache() is to clear cached user data apart
from the data from the user table, as addToDatabase() expects, then
$this->mOptionsLoaded needs to be set to false. Clearing $this->mOptions
may reduce memory usage a bit, but is not sufficient.
Change-Id: I6912415dc154d06f62839a1ee777c2c3747253d6
User::edits() lets you fetch a cached number of edits from a slave database.
in case the field is not yet filed, we initialize if by hitting the `revision`
table and saving the result in user_editcount.
User::incEditCount() updates the edit countr and also does a lazy
initialization, if needed.
As both methods use the same $dbw->update() statement for this, I've
created a new, protected initEditCount() function which can take care of that.
Change-Id: If111270a84d4278bc4ea14d32ae602069f7c276f
Moved the logic from the old static User::edits() into
User::getEditCount() and deprecated User::edits() as it's
not following the class hierarchy.
Change-Id: Id2b939ffb903accb8f4dc132a6ac6b6576f81beb
Currently, if a user with Accept-Language: zh-tw header accesses a zh site,
the page contents are served in zh-tw variant, but the interface language
is zh (falling back to zh-hans) so the user is seeing interface messages
in zh(-hans) unless a &variant= is manually set (originally variant set in
URL is checked by getDefaultVariant).
There were debates that serving different languages based on headers from
the same URL breaks cache, but currently contents are served in different
variants based on headers and it works. So I assume this is not an issue.
PS2-4: HTTP header settings shouldn't affect user preference settings of
logged-in users.
PS5-6: Move code loading variant settings for anonymous requests from
User::getDefaultOptions() to User::loadOptions() to avoid pollution of
defaults. A visual bug of this is that if I have variant set to zh and
load index.php?title=Special:Preferences&variant=zh-cn, the dropdown is
shown as zh-cn because I was using the default value and now it thinks the
default value is zh-cn instead of zh.
PS7-8: Rebase to add dependency and tweak commit summary etc.
PS9: Remove the argument added to getDefaultVariant, which was intended to
keep B/C of getDefaultVariant (not to check headers by default).
Change-Id: Ie600ab24294a1add804875e921c32febe6ed645f
Created a new method User::groupHasPermission and check also
$wgRevokePermissions for the given right
Change-Id: I41edb091fa35c8c68b6f95cc5fd208ea99418cdb
Fix the DB error which comes from User::addToDatabase() if it is called
when the user already exists. This is the most common DB error we log at
WMF in normal operation, perhaps because of double clicks on the "create
account" button, or perhaps due to CentralAuth autocreation when
multiple pages on another wiki are opened in the browser simultaneously,
as the bug reporter suggests.
See the doc comment for the interface rationale. Patched
Special:Userlogin to be aware of the new return value. Most extension
callers will continue to work, I will patch a couple that need it in
subsequent commits.
Change-Id: I1f6ef5e6319bfe692fb82a3fa50dc66c9fde8f15
(After a question in r26457): Let User::clearInstanceCache
clear out the cached edit count as well, as a user session
can be open for a long time.
Change-Id: I4444f352e3b5df7b24f37668a5f1fbf9d64d6978
Rather than have separate calls to User::loadDefaults()
every time User::loadFromSession() fails, there is now just
one call in User::load() if loadFromSession() returns false.
This fixes the case where a UserLoadFromSession hook aborts
loading from session, leaving the User object uninitialized.
Change-Id: I8d1a114d7ec361b27b260791f742c473a1497f26
Signed-off-by: Tyler Anthony Romeo <tylerromeo@gmail.com>
* Added parameter to login link so that wpStickHTTPS
is set to true by default when the user is coming
from HTTPS.
* Added redirect in Special:Userlogin so that when
$wgSecureLogin is enabled it automatically redirects
to HTTPS.
* Adjusted User::setCookies() to add a parameter for
forcing secure/insecure cookies, and then added the
appropriate argument to Special:Userlogin so that
cookies are set appropriately.
Change-Id: I17ac68014840daa47bfd4768e978e9ff2edb00db
Sets a cookie on user login (removed on logout) if wpStickHTTPS
was checked, which causes the browser to get a redirect if they
visit the HTTP version of the site.
Change-Id: I60f44a1062a93d15198edae6674bb3310a148b2d
Allow AuthPlugin to determine if user passwords should be stored
locally.
* Released as part of 1.20wmf10, 1.19.2, 1.18.5
Change-Id: Ie41bed7ecf5390f8815128c227bae371880a6058
Last round of easy replacements. About 30 uses in core remain (outside of HISTORY
and GlobalFunctions::wfMsg*). I'll work with IAlex and Nikerabbit to work towards
getting rid of those, too.
Updated method documentation in a few places.
Change-Id: I2491c006b62a9cc183230e31a0bd96c91e5b6142
now it is shown and selectable on api (list=allusers&aurights=) and
Special:GlobalGroupPermissions (from CentralAuth)
Change-Id: I9464109c2d1648e5668e545b9c7109ced656f4d7
Follow up bug 5057, now it is shown and selectable on api
(list=allusers&aurights=) and Special:GlobalGroupPermissions
(from CentralAuth)
Change-Id: Ic7c57c8b29a385ad9c1ad8328ee08af758e3a4f7
Follow up bug 30636, now it should be shown and selectable on api
(list=allusers&aurights=) and Special:GlobalGroupPermissions (from
CentralAuth)
Change-Id: Id09d144f523c1ed687bd766945dbf9281e1d38c6
Follow up bug 13137, now it should be shown and selectable on
Special:GlobalGroupPermissions (of CentralAuth)
Change-Id: Iebdf0454ff3636585983b07eab3d2387f404498f
The 'beta' project uses DNS blacklist lookup to automatically block open
proxy and active spammers. This patch simply creates the new
'dnsblacklist' debug group so we can easily log the lookup result.
Change-Id: Idfc9fb2d3db4a0bb5387c76fdef07bf9e74eeff4
Previously, $wgDisableAnonTalk was only used as a visual
hack in includes/Linker.php. Now, if the variable is set,
no queries will be made to user_newtalk at all.
Change-Id: Id5521abbec7f05f2de7230f9f0316176abc7f215
Signed-off-by: parent5446 <tylerromeo@gmail.com>
This change adds a new permission ('deletelogentry') which is required to be able
to delete log entries.
It does not affect who can see deleted content.
Change-Id: I6b69919a1bdc502becc1ae4ac9169b8b0e85bfdc
Using User::getDefaultOption() in User::setOption() sets preferences like
'language' to the right default value, whereas using $wgDefaultOptions
sets the language to null because language is not part of $wgDefaultUserOptions,
but it is part of return value of User::getDefaultOption().
This only makes problems when reusing the same user object, because when
a new user object is created, the value of 'language' is correct.
Change-Id: I43a32c66fc3997a4f842c63af374e84d234602b2
When inserting XML elements inline <such as this one>, doxygen chokes
about it not being known. Simply enclosing the tag in double quotes
prevents doxygen from emitting a warning.
Also enclosed a few invalid functions calls such as \. and double quoted
the HTML entities such as &foobar;
Change-Id: I4019637145e683c2bec3d17b2fd98b0c50a932f1
* The problem is that Title::userIsWatching() relies on $wgUser,
which is not suitable on every case. Instead User::isWatched()
requires both an User and a Title object.
* Replaced all core calls from the former to the latter
* Added a cache in User for the WatchedItem instances so we do not
need to do a database request every time something want to know
whether a page is watched or not, which can happen several times
per request.
Change-Id: Ifa9c55b7ffb487ce6893c74df233eedc7654dc5e
Also pluralize properly.
"You have a new message from another user (last change)"
if only one unseen revision, or
"You have new messages [from another user|from N users|]
(last changes)" if there are several unseen revisions.
Contains a fix in Title::countAuthorsBetween() adding options to include
(one or both of) the delimiting revisions in the count.
Change-Id: I8870111802085d0bd188cb508c4f4b852985634d