getMainConfig()->get( 'LinterSubmitterWhitelist' ); $ipSet = new IPSet( array_keys( array_filter( $linterSubmitterAllowlist ) ) ); if ( !$ipSet->match( $this->getRequest()->getIP() ) ) { $this->dieWithError( 'apierror-linter-invalid-ip', 'invalid-ip' ); } $params = $this->extractRequestParams(); $data = FormatJson::decode( $params['data'], true ); if ( !is_array( $data ) ) { $this->dieWithError( 'apierror-linter-invalid-data', 'invalid-data' ); } if ( ( new Hooks )->onParserLogLinterData( $params['page'], $params['revision'], $data ) ) { $this->getResult()->addValue( $this->getModuleName(), 'success', true ); } else { $this->dieWithError( 'apierror-linter-invalid-title', 'invalid-title' ); } } public function isInternal() { return true; } /** @inheritDoc */ public function getAllowedParams() { return [ 'data' => [ ParamValidator::PARAM_TYPE => 'string', ParamValidator::PARAM_REQUIRED => true, ], 'page' => [ ParamValidator::PARAM_TYPE => 'string', ParamValidator::PARAM_REQUIRED => true, ], 'revision' => [ ParamValidator::PARAM_TYPE => 'integer', ParamValidator::PARAM_REQUIRED => true, ], ]; } }