Page MenuHomePhorge

Get wiki data
Closed, ResolvedPublic

Description

Get data such as the wiki name, database, user, etc for use in email forms.

Revisions and Commits

Event Timeline

Extension:EnhanceContactForm is how we currently do this in Special:Contact.

If you have any questions about that, @jack created it, and I'm sure he'll happily help you integrate it into AdminPanel.

lewiscawte renamed this task from Get wikidata to Get wiki data.Jul 18 2016, 7:49 AM

The EnhanceContactForm extension is about as simple as they come (although I should note that 1) the upstream version is slightly outdated again, the one in our repo includes an important HHVM patch, as ShoutWiki is using HHVM and thus we must address its quirks to avoid breaking the site, and 2) for whatever bizarre reasons that are beyond my comprehension upstream has managed to bloat a single-file extension into a bunch of irrelevant files and unnecessary (IMO) i18n).

While using globals (like EnhanceContactForm does) will work, at least for the forseeable future, using RequestContext where possible is better, and the SpecialPage class extends RequestContext, so do this whereever you need to access the request data or a certain config global:

$config = $this->getConfig();
$request = $this->getRequest();
// you probably also want $out = $this->getOutput(); (equivalent to old $wgOut global)
// and $user = $this->getUser(); (equivalent to old $wgUser global)

$someVal = $request->getVal( 'whatever', 'default val if not supplied' ); // Refer to WebRequest's documentation for furher details etc.
$databaseName = $config->get( 'DBname' ); // equivalent to using the $wgDBname global
$server = $config->get( 'Server' ); // equivalent to using the $wgServer global

and so on.

CJC added a commit: Restricted Diffusion Commit.Jul 27 2016, 11:05 PM