mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Gadgets
synced 2024-11-27 16:50:00 +00:00
dc84f149bc
The column user_properties.up_value is a text based type in all rdbms. postgres does not autoconvert strings to numbers, so SUM( up_value ) gives an error when running on postgres. The use of SUM( up_value ) is also problematic on mariadb/sqlite, as up_value can be set to any number via the Action API's options module. This value goes into the sum and produce a wrong result. Using a non-number value allows to remove the value from the sum and that also produce a wrong result. Change the query to exclude the rows which disables a gadget and just count the "active" ones. Typically there are only rows to disable a gadget, when the gadget is marked as default, but default gadget are displayed with the message 'gadgetusage-default' and does not needs to be counted. In case a gadget was default in the past, there could always such rows, so be safe and exclude them. That means it is safe to only count for "active" gadget option usage. This also allows to remove the up_value condition on the join to querycachetwo as only rows to enable a gadget are now selected and get joined to find the active users. For the join condition use an assoc array, as for database condition the database class is quoting the value of that array, if that is a string. In postgres the " is used to quote columns or tables, but not values, that gives a query error on postgres about the condition. fixed when using the array style and not "raw" sql. Define the condition only once as it should be the same for both queries. Use the new IDatabase::expr function to write that sql piece. Change-Id: I8dfc3fd5adc4c4bdabceaab20c4b37ffd48e6bee |
||
---|---|---|
.phan | ||
i18n | ||
includes | ||
tests/phpunit | ||
.eslintrc.json | ||
.gitignore | ||
.gitreview | ||
.phpcs.xml | ||
CODE_OF_CONDUCT.md | ||
composer.json | ||
COPYING | ||
extension.json | ||
Gadgets.alias.php | ||
Gadgets.namespaces.php | ||
Gruntfile.js | ||
package-lock.json | ||
package.json | ||
README.md |
Gadgets
The Gadgets extension provides a way for users to pick JavaScript or CSS based "gadgets" that other wiki users provide.
See https://www.mediawiki.org/wiki/Extension:Gadgets for more documentation.
The Gadgets extension was originally written by Daniel Kinzler in 2007 and is released under the GNU General Public Licence (GPL).
Prerequisites
This version of Gadgets requires MediaWiki 1.27 or later. To get a version compatible with an earlier MediaWiki release, visit ExtensionDistributor/Gadgets.
Installing
Copy the Gadgets directory into the extensions folder of your MediaWiki installation. Then add the following lines to your LocalSettings.php file (near the end):
wfLoadExtension( 'Gadgets' );
Usage
See https://www.mediawiki.org/wiki/Extension:Gadgets#Usage
Caveats
- Gadgets do not apply to Special:Preferences, Special:UserLogin and Special:ResetPass so users can always disable any broken gadgets they may have enabled, and malicious gadgets will be unable to steal passwords.
Configuration
$wgGadgetsRepo
: configures which GadgetRepo implementation will be used to source gadgets from. Currently, "definition" mode is the recommended setting and default. The "json" mode is not ready for production usage yet.$wgSpecialGadgetUsageActiveUsers
: configures whether or not to show active user stats on Special:GadgetUsage. True by default.