Manual:Shell.php/en

shell.php is a maintenance script that is located in the maintenance directory that you can use to play live with MediaWiki objects and functions. It replaces eval.php which is less robust and has less features.

 $ php maintenance/shell.php Psy Shell v0.8.5 (PHP 5.6.30-0+deb8u1 — cli) by Justin Hileman >>> User::newFromName('Foo') => User {#1075 +mId: null, +mName: "Foo", +mRealName: null, +mEmail: null, +mTouched: null, +mEmailAuthenticated: null, +mOptionsLoaded: false, +mFrom: "name", +mBlockedby: -1, +mRights: null, +mHideName: null, +mOptions: null, +mBlock: null, } >>> ls Message Class Constants: FORMAT_BLOCK_PARSE, FORMAT_ESCAPED, FORMAT_PARSE, FORMAT_PLAIN, FORMAT_TEXT Class Methods: __construct, __toString, bitrateParam, bitrateParams, content, durationParam, durationParams, escaped, exists, expiryParam, expiryParams, getFormat, getKey, getKeysToTry, getLanguage, getParams, getTitle, inContentLanguage, inLanguage, isBlank, isDisabled, isMultiKey, listParam, newFallbackSequence, newFromKey, newFromSpecifier, numParam, numParams, params, parse, parseAsBlock, plain, plaintextParam, plaintextParams, rawParam, rawParams, serialize, setContext, setInterfaceMessageFlag, sizeParam, sizeParams, text, timeperiodParam, timeperiodParams, title, toString, unserialize, useDatabase >>> doc Message::setContext public function setContext(IContextSource $context)

Description: Set the language and the title from a context object

Param: IContextSource $context

Return: Message $this

Since: 1.19

Some debugging is also possible:

 $ mwscript shell.php -d 2 [debug] [DBReplication] Wikimedia\Rdbms\LBFactory::getChronologyProtector: using request info { "IPAddress": "", "UserAgent": "", "ChronologyProtection": "true" } [debug] [DBConnection] Wikimedia\Rdbms\LoadBalancer::openConnection: calling initLB before first connection. [debug] [DBConnection] Connected to database 0 at '127.0.0.1'. [debug] [DBQuery] wiki SHOW /* Wikimedia\Rdbms\DatabaseMysqlBase::serverIsReadOnly */ GLOBAL VARIABLES LIKE 'read_only' [debug] [DBQuery] SHOW GLOBAL VARIABLES LIKE 'read_only' Psy Shell v0.8.5 (PHP 5.6.30-0+deb8u1 — cli) by Justin Hileman >>> wfMessage("Recentchanges")->text [debug] [CryptRand] mcrypt_create_iv generated 20 bytes of randomness. [debug] [CryptRand] 0 bytes of randomness leftover in the buffer. [info] [MessageCache] MessageCache::load: Loading en... local cache is empty, got from global cache => "Recent changes"