Manual:Eval.php/en

eval.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 is now considered deprecated and has been replaced by which is more robust (does not abort on fatal errors) and has more features (auto-printing return values, reflection, documentation viewer, tab completion etc).

MediaWiki classes are automatically autoloaded:

Some debugging is also possible:

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