手册:Eval.php
Outdated translations are marked like this.
MediaWiki文件: eval.php | |
---|---|
位置: | maintenance/ |
源代码: | master • 1.42.3 • 1.41.4 • 1.39.10 |
类: | 查找代码 • 查找帮助文档 |
eval.php是位于maintenance
目录中的维护脚本,您可以使用该文件实时播放MediaWiki对象和功能。
现在认为它已被弃用,并已由shell.php 取代,它更可靠(不会因致命错误而中止),并具有更多功能(自动打印返回值,反射,文档查看器,制表符补全,等等)。
$ php maintenance/eval.php
> print wfMessage("Recentchanges")->plain();
Recent changes
MediaWiki classes are automatically autoloaded:
$ php maintenance/eval.php
> echo Xml::label( 'My label', 'someInput', array( 'class' => 'pink' ) );
<label for="someInput" class="pink">My label</label>
也可以进行一些调试:
$ php maintenance/eval.php --d 3 > print wfMessage("Recentchanges")->text(); Unstubbing $wgLang on call of $wgLang::getCode from MessageCache::get Connecting to localhost minitest... Profiler::instance called with bogus $wgProfiler setting, falling back to ProfilerStub for safety IP: 127.0.0.1 Query minitest (1) (slave): SET /* DatabasePostgres::open 127.0.0.1 */ client_encoding='UTF8' Query minitest (2) (slave): SET /* DatabasePostgres::open 127.0.0.1 */ datestyle = 'ISO, YMD' Query minitest (3) (slave): SET /* DatabasePostgres::open 127.0.0.1 */ timezone = 'GMT' Query minitest (4) (slave): SET /* DatabasePostgres::open 127.0.0.1 */ standard_conforming_strings = on Query minitest (5) (slave): BEGIN Transaction state changed from IDLE -> TRANS Query minitest (6) (slave): SELECT /* DatabasePostgres::schemaExists 127.0.0.1 */ 1 FROM "pg_catalog"."pg_namespace" WHERE nspname = 'mediawiki' LIMIT 1 Query minitest (7) (slave): SELECT /* DatabasePostgres::getSchemas 127.0.0.1 */ current_schemas(false) Query minitest (8) (slave): SHOW /* DatabasePostgres::getSearchPath 127.0.0.1 */ search_path Query minitest (9) (slave): SET /* 127.0.0.1 */ search_path = "mediawiki", "$user", public Schema "mediawiki" added to the search path Query minitest (10) (slave): COMMIT Transaction state changed from TRANS -> IDLE Connected to localhost minitest. Query minitest (11) (slave): SELECT /* LCStore_DB::get 127.0.0.1 */ lc_value FROM "l10n_cache" WHERE lc_lang = 'en' AND lc_key = 'deps' LIMIT 1 Query minitest (12) (slave): SELECT /* LCStore_DB::get 127.0.0.1 */ lc_value FROM "l10n_cache" WHERE lc_lang = 'en' AND lc_key = 'list' LIMIT 1 Query minitest (13) (slave): SELECT /* LCStore_DB::get 127.0.0.1 */ lc_value FROM "l10n_cache" WHERE lc_lang = 'en' AND lc_key = 'preload' LIMIT 1 Query minitest (14) (slave): SELECT /* LCStore_DB::get 127.0.0.1 */ lc_value FROM "l10n_cache" WHERE lc_lang = 'en' AND lc_key = 'preload' LIMIT 1 Connecting to localhost minitest... Query minitest (15) (slave): SET /* DatabasePostgres::open 127.0.0.1 */ client_encoding='UTF8' Query minitest (16) (slave): SET /* DatabasePostgres::open 127.0.0.1 */ datestyle = 'ISO, YMD' Query minitest (17) (slave): SET /* DatabasePostgres::open 127.0.0.1 */ timezone = 'GMT' Query minitest (18) (slave): SET /* DatabasePostgres::open 127.0.0.1 */ standard_conforming_strings = on Query minitest (19) (slave): BEGIN Transaction state changed from IDLE -> TRANS Query minitest (20) (slave): SELECT /* DatabasePostgres::schemaExists 127.0.0.1 */ 1 FROM "pg_catalog"."pg_namespace" WHERE nspname = 'mediawiki' LIMIT 1 Query minitest (21) (slave): SELECT /* DatabasePostgres::getSchemas 127.0.0.1 */ current_schemas(false) Schema "mediawiki" already in the search path Query minitest (22) (slave): COMMIT Transaction state changed from TRANS -> IDLE Connected to localhost minitest. Query minitest (23) (slave): SELECT /* SqlBagOStuff::get 127.0.0.1 */ value,exptime FROM "objectcache" WHERE keyname = 'minitest:messages:en' LIMIT 1 MessageCache::load: Loading en... got from global cache Recent changes >