X-Git-Url: http://git.cyclocoop.org/%27.%28%24current%20%3E%202?a=blobdiff_plain;f=includes%2Fapi%2FApiMain.php;h=d2c957d485fafae15fe48faffc81b2ed592ac5af;hb=995aad376af72419dd2fe8870954c9b400be4766;hp=574d83bd1835cc294b6d94d7087ea7fd87c4501b;hpb=13f4dfb519ebdc75b39109c11d31868faa56d49c;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 574d83bd18..d2c957d485 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -167,6 +167,7 @@ class ApiMain extends ApiBase { * @param IContextSource|WebRequest|null $context If this is an instance of * FauxRequest, errors are thrown and no printing occurs * @param bool $enableWrite Should be set to true if the api may modify data + * @suppress PhanUndeclaredMethod */ public function __construct( $context = null, $enableWrite = false ) { if ( $context === null ) { @@ -280,7 +281,10 @@ class ApiMain extends ApiBase { } $this->mResult->setErrorFormatter( $this->getErrorFormatter() ); - $this->mModuleMgr = new ApiModuleManager( $this ); + $this->mModuleMgr = new ApiModuleManager( + $this, + MediaWikiServices::getInstance()->getObjectFactory() + ); $this->mModuleMgr->addModules( self::$Modules, 'action' ); $this->mModuleMgr->addModules( $config->get( 'APIModules' ), 'action' ); $this->mModuleMgr->addModules( self::$Formats, 'format' ); @@ -292,7 +296,6 @@ class ApiMain extends ApiBase { $this->mEnableWrite = $enableWrite; $this->mCdnMaxAge = -1; // flag for executeActionWithErrorHandling() - $this->mCommit = false; } /** @@ -1151,8 +1154,7 @@ class ApiMain extends ApiBase { } if ( $this->getParameter( 'curtimestamp' ) ) { - $result->addValue( null, 'curtimestamp', wfTimestamp( TS_ISO_8601, time() ), - ApiResult::NO_SIZE_CHECK ); + $result->addValue( null, 'curtimestamp', wfTimestamp( TS_ISO_8601 ), ApiResult::NO_SIZE_CHECK ); } if ( $this->getParameter( 'responselanginfo' ) ) { @@ -1707,7 +1709,7 @@ class ApiMain extends ApiBase { * @return string */ protected function encodeRequestLogValue( $s ) { - static $table; + static $table = []; if ( !$table ) { $chars = ';@$!*(),/:'; $numChars = strlen( $chars ); @@ -1913,6 +1915,10 @@ class ApiMain extends ApiBase { ]; } + /** + * @inheritDoc + * @phan-param array{nolead?:bool,headerlevel?:int,tocnumber?:int[]} $options + */ public function modifyHelp( array &$help, array $options, array &$tocData ) { // Wish PHP had an "array_insert_before". Instead, we have to manually // reindex the array to get 'permissions' in the right place.