Jump to content

Manuel:Eval.php

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

Le fichier eval.php est un script de maintenance situé dans le répertoire maintenance que vous pouvez utiliser pour exécuter en ligne les objets et les fonctions de MediaWiki. Dorénavent il est considéré comme obsolète et remplacé par shell.php qui est plus robuste (pas d'abort sur les erreurs fatales) et possède davantage de fonctionnalités (valeurs renvoyées qui s'affichent automatiquement, réflection, afficheur de documentation, completion de la tabulation, etc).

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

Les classes MediaWiki sont automatiquement chargées :

$ php maintenance/eval.php
> echo Xml::label( 'My label', 'someInput', array( 'class' => 'pink' ) );
<label for="someInput" class="pink">My label</label>

Il est possible de faire du débogage :

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

Voir aussi