MediaWiki  1.23.0
eval.php File Reference

This script lets a command-line user start up the wiki engine and then poke about by issuing PHP commands directly. More...

Go to the source code of this file.

Variables

if( $useReadline) $e = null
 
 $optionsWithArgs = array( 'd' )
 
if(isset( $options['d'])) $useReadline
 
while(( $line=Maintenance::readconsole()) !==false) print n
 

Detailed Description

This script lets a command-line user start up the wiki engine and then poke about by issuing PHP commands directly.

Unlike eg Python, you need to use a 'return' statement explicitly for the interactive shell to print out the value of the expression. Multiple lines are evaluated separately, so blocks need to be input without a line break. Fatal errors such as use of undeclared functions can kill the shell.

To get decent line editing behavior, you should compile PHP with support for GNU readline (pass –with-readline to configure).

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Definition in file eval.php.

Variable Documentation

◆ $e

if ($useReadline) $e = null
Examples
/src/tests/phpunit/MediaWikiTestCase.php.

Definition at line 66 of file eval.php.

Referenced by SpecialUploadStash\__construct(), ORAResult\__construct(), SVGReader\__construct(), DBLockManager\__construct(), SwiftFileBackend\__construct(), FSFileBackendList\__construct(), MWMemcached\_flush_read_buffer(), RedisBagOStuff\add(), UploadFromChunks\addChunk(), BackupDumperPageTest\addDBData(), TextPassDumperTest\addDBData(), ApiQueryContinue2Test\addDBData(), ApiQueryContinueTest\addDBData(), ApiQueryBasicTest\addDBData(), BackupDumperLoggerTest\addDBData(), FetchTextTest\addDBData(), SVGMetadataExtractorTest\assertMetadata(), ApiQueryTestBase\assertResult(), SpecialChangePassword\attemptReset(), RedisBagOStuff\cas(), SqlBagOStuff\cas(), Sqlite\checkSqlSyntax(), MessageBlobStore\clear(), CategoryViewer\clearCategoryState(), SwiftFileBackend\convertSwiftDate(), Installer\createMainpage(), RedisBagOStuff\delete(), SqlBagOStuff\delete(), DatabaseMssql\delete(), Article\delete(), SqlBagOStuff\deleteAll(), DatabaseMssql\deleteJoin(), SqlBagOStuff\deleteObjectsExpiringBefore(), ApiUpload\dieRecoverableError(), Installer\dirIsExecutable(), profile_point\display(), JobQueueRedis\doAck(), JobQueueDB\doAck(), BitmapMetadataHandler\doApp13(), JobQueueRedis\doBatchPush(), JobQueueDB\doBatchPushInternal(), DatabaseSqlite\doBegin(), DatabaseSqlite\doCommit(), JobQueueFederated\doDeduplicateRootJob(), JobQueueRedis\doDeduplicateRootJob(), FileDeleteForm\doDelete(), JobQueueFederated\doDelete(), JobQueueRedis\doDelete(), JobQueueDB\doDelete(), WikiPage\doEditContent(), JobQueueDB\doGetAbandonedCount(), JobQueueRedis\doGetAbandonedCount(), JobQueueDB\doGetAcquiredCount(), JobQueueRedis\doGetAcquiredCount(), JobQueueAggregatorRedis\doGetAllReadyWikiQueues(), JobQueueRedis\doGetDelayedCount(), JobQueueFederated\doGetSiblingQueueSizes(), JobQueueRedis\doGetSiblingQueueSizes(), JobQueueFederated\doGetSiblingQueuesWithJobs(), JobQueueDB\doGetSize(), JobQueueRedis\doGetSize(), SpecialImport\doImport(), JobQueueDB\doIsEmpty(), JobQueueFederated\doIsEmpty(), JobQueueFederated\doIsRootJobOldDuplicate(), JobQueueRedis\doIsRootJobOldDuplicate(), DBFileJournal\doLogChangeBatch(), JobQueueAggregatorRedis\doNotifyQueueEmpty(), JobQueueAggregatorRedis\doNotifyQueueNonEmpty(), TestFileOpPerformance\doPerfTest(), JobQueueDB\doPop(), JobQueueRedis\doPop(), JobQueueFederated\doPop(), JobQueueAggregatorRedis\doPurge(), ViewCountUpdate\doUpdate(), DeferredUpdates\doUpdates(), DatabaseInstaller\doUpgrade(), JobQueueFederated\doWaitForBackups(), TextPassDumper\dump(), WikiExporter\dumpFrom(), ConfEditor\edit(), ApiImport\execute(), ApiQueryStashImageInfo\execute(), ApiUpload\execute(), JSParseHelper\execute(), MwSql\execute(), RunJobs\execute(), PPFuzzTester\execute(), ApiFeedWatchlist\execute(), FormlessAction\execute(), FormAction\execute(), ZipDirectoryReader\execute(), ApiMain\executeActionWithErrorHandling(), SpecialRunJobs\executeJobs(), JobQueueGroup\executeReadyPeriodicTasks(), DatabaseOracle\fieldInfoMulti(), ResourceLoader\filter(), TrackBlobs\findOrphanBlobs(), LCStoreCDB\finishWrite(), ResourceLoader\formatException(), ContribsPager\formatRow(), RedisLockManager\freeLocksOnServer(), RedisBagOStuff\get(), LCStoreCDB\get(), JobQueueRedis\getAllDelayedJobs(), Interwiki\getAllPrefixesCached(), JobQueueRedis\getAllQueuedJobs(), JobQueueDB\getAllQueuedJobs(), ApiUpload\getChunkResult(), LocalisationCache\getCompiledPluralRules(), RedisConnectionPool\getConnection(), JobQueueFederated\getCrossPartitionSum(), WebInstallerOutput\getCSS(), UploadForm\getDescriptionSection(), BmpHandler\getImageSize(), Interwiki\getInterwikiCacheEntry(), JobQueueRedis\getJobFromUidInternal(), RequestContext\getLanguage(), RedisLockManager\getLocksOnServer(), MWExceptionHandler\getLogId(), MWExceptionHandler\getLogMessage(), JobQueueDB\getMasterDB(), GIFHandler\getMetadata(), JpegHandler\getMetadata(), PNGHandler\getMetadata(), TiffHandler\getMetadata(), SvgHandler\getMetadata(), DjVuHandler\getMetaTree(), RedisBagOStuff\getMulti(), SqlBagOStuff\getMulti(), MWExceptionHandler\getRedactedTrace(), MWExceptionHandler\getRedactedTraceAsString(), UIDGenerator\getSequentialPerNodeIDs(), JobQueueDB\getSlaveDB(), NewFilesPager\getStartBody(), ApiUpload\getStashResult(), ResourceLoaderFileModule\getStyles(), TextPassDumper\getText(), LocalFile\getThumbnails(), SpecialRandomInCategory\getTimestampOffset(), ApiUpload\getWarningsResult(), MWExceptionHandler\handle(), ApiMain\handleApiBeforeMainException(), RedisConnectionPool\handleError(), JobQueueAggregatorRedis\handleException(), RedisConnectionPool\handleException(), RedisBagOStuff\handleException(), ApiMain\handleException(), SqlBagOStuff\handleWriteError(), Installer\includeExtensions(), RedisBagOStuff\incr(), SqlBagOStuff\incr(), DatabaseMssql\insert(), MessageBlobStore\insertMessageBlob(), DatabaseOracle\insertOneRow(), DatabaseMssql\insertSelect(), DBLockManager\isServerUp(), MWExceptionHandler\jsonSerializeException(), DatabaseOracle\lastErrno(), DatabaseSqlite\lastError(), DatabaseOracle\lastError(), Profiler\logData(), MWExceptionHandler\logException(), FileOp\logFailure(), FormatMetadata\makeFormattedData(), ResourceLoader\makeModuleResponse(), JSMinPlus\min(), FSFileBackendList\next(), MWTimestamp\offsetForUser(), SpecialChangePassword\onSubmit(), MysqlInstaller\openConnection(), OracleInstaller\openConnection(), SqliteInstaller\openConnection(), MssqlInstaller\openConnection(), PostgresInstaller\openConnectionWithParams(), DatabaseSqlite\openFile(), OracleInstaller\openSYSDBAConnection(), XMPReader\parse(), Installer\parse(), lessc_parser\parseChunk(), AjaxDispatcher\performAction(), ApiUpload\performStash(), JobQueue\pop(), PreprocessDump\processRevision(), lessc\pushEnv(), ApiQueryContinueTestBase\query(), LoadBalancer\reallyOpenConnection(), QueryPage\recache(), JobQueueDB\recycleAndDeleteStaleJobs(), JobQueueRedis\recyclePruneAndUndelayJobs(), PoolCounterRedis\release(), PoolCounterRedis\releaseAll(), MySqlLockManager\releaseAllLocks(), PostgreSqlLockManager\releaseAllLocks(), MWExceptionHandler\report(), DBConnectionError\reportHTML(), FSFileBackendList\rewind(), MWExceptionHandler\rollbackMasterChangesAndLog(), TextPassDumper\rotateDb(), PublishStashedFileJob\run(), AssembleUploadChunksJob\run(), Hooks\run(), MediaWiki\run(), DatabaseBase\runOnTransactionIdleCallbacks(), DatabaseBase\runOnTransactionPreCommitCallbacks(), DatabaseMssql\selectDB(), DatabaseOracle\selectDB(), UserMailer\send(), RedisBagOStuff\set(), SqlBagOStuff\set(), LCStoreCDB\set(), MWTimestamp\setTimestamp(), MWTimestamp\setTimezone(), JobQueueTest\setUp(), PostgresInstaller\setupPLpgSQL(), PostgresInstaller\setupSchema(), MysqlInstaller\setupUser(), PostgresInstaller\setupUser(), SpecialUploadStash\showUpload(), DatabaseBase\sourceFile(), WebInstaller\startSession(), LCStoreDB\startWrite(), LCStoreCDB\startWrite(), MediaWikiTestCase\stashMwGlobals(), MssqlInstaller\submitSettingsForm(), MysqlInstaller\submitSettingsForm(), ApiMain\substituteResultWithError(), ConfEditor\test(), ApiOptionsTest\testAnon(), UserNotLoggedInTest\testConstruction(), ReadOnlyErrorTest\testConstruction(), ErrorPageErrorTest\testConstruction(), ApiEditPageTest\testEditSection(), BadTitleErrorTest\testExceptionSetsStatusCode(), ThrottledErrorTest\testExceptionSetsStatusCode(), MWExceptionHandlerTest\testGetRedactedTrace(), MWExceptionTest\testisCommandLine(), MWExceptionTest\testIsLogable(), UploadFromUrlTest\testLeaveMessage(), ApiOptionsTest\testNoChanges(), ApiOptionsTest\testNoOptionname(), HtmlCheckMatrixTest\testPlainInstantiation(), ErrorPageErrorTest\testReport(), MWExceptionTest\testRunHooks(), WikitextContentHandlerTest\testSerializeContent(), UploadFromUrlTest\testSetupUrlDownload(), ApiQueryTest\testTitlePartToKey(), WikitextContentHandlerTest\testUnserializeContent(), ApiUploadTest\testUpload(), ApiUploadTest\testUploadChunks(), ApiUploadTest\testUploadMissingParams(), ApiUploadTest\testUploadRequiresToken(), ApiUploadTest\testUploadSameContent(), ApiUploadTest\testUploadSameFileName(), ApiUploadTest\testUploadStash(), ApiUploadTest\testUploadZeroLength(), MWExceptionTest\testUseMessageCache(), MWExceptionTest\testUseOutputPage(), JobQueueDB\throwDBException(), JobQueueRedis\throwRedisException(), BitmapHandler\transformImageMagickExt(), JobQueueFederated\tryJobInsertions(), ResourceLoader\tryRespondFromFileCache(), DatabaseMssql\update(), DatabaseOracle\update(), MessageBlobStore\updateMessage(), MessageBlobStore\updateModule(), PopulateRevisionSha1\upgradeLegacyArchiveRow(), PopulateRevisionSha1\upgradeRow(), DatabaseBase\upsert(), ResourceLoaderModule\validateScriptFile(), PoolCounterRedis\waitForSlotOrNotif(), and wfStreamThumb().

◆ $optionsWithArgs

$optionsWithArgs = array( 'd' )

Definition at line 33 of file eval.php.

◆ $useReadline

if (isset($options[ 'd'])) $useReadline
Initial value:
= function_exists( 'readline_add_history' )

Definition at line 57 of file eval.php.

Referenced by MwSql\execute().

◆ n

while (($line=Maintenance::readconsole()) !==false) print n

Definition at line 67 of file eval.php.

Maintenance\posix_isatty
static posix_isatty( $fd)
Wrapper for posix_isatty() We default as considering stdin a tty (for nice readline methods) but trea...
Definition: Maintenance.php:1121