Jump to content

Руководство:Eval.php

From mediawiki.org
This page is a translated version of the page Manual:Eval.php and the translation is 100% complete.

eval.php — это скрипт (сценарий) обслуживания, расположенный в каталоге maintenance, который вы можете использовать для работы с объектами и функциями MediaWiki. Сейчас он считается устаревшим и был заменён на shell.php , который более надёжен (не прерывается при фатальных ошибках) и имеет больше функций (автоматическая печать возвращаемых значений, отражение, средство просмотра документации, завершение табуляции и т. д.).

$ php maintenance/eval.php
> print wfMessage("Recentchanges")->plain();
Recent changes

Классы MediaWiki загружаются автоматически:

$ 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
> 

См. также