match( $this->getRequest()->getIP() ) ) { $this->dieUsage( 'Your IP address has not been whitelisted to report lint errors', 'invalid-ip' ); } $params = $this->extractRequestParams(); $data = FormatJson::decode( $params['data'], true ); if ( !is_array( $data ) ) { $this->dieUsage( 'Invalid data', 'invalid-data' ); } $errors = []; $title = Title::newFromText( $params['page'] ); if ( !$title || !$title->getArticleID() || $title->getLatestRevID() != $params['revision'] ) { $this->dieUsage( 'Invalid, non-existent, or outdated title', 'invalid-title' ); } foreach ( $data as $info ) { $info['params']['location'] = array_slice( $info['dsr'], 0, 2 ); if ( isset( $info['templateInfo'] ) && $info['templateInfo'] ) { $info['params']['templateInfo'] = $info['templateInfo']; } $errors[] = $info; } $job = new RecordLintJob( $title, [ 'errors' => $errors, 'revision' => $params['revision'], ] ); JobQueueGroup::singleton()->push( $job ); $this->getResult()->addValue( $this->getModuleName(), 'success', true ); } public function isInternal() { return true; } public function getAllowedParams() { return [ 'data' => 'string', 'page' => 'string', 'revision' => 'int', ]; } }