removeDuplicates = true; $this->user = null; $this->cacheKey = UploadFromUrl::getCacheKey( $this->params ); } /** * Deduplicate on title, url alone. * * Please note that this could cause some * edge case failure, when the image at the * same remote url is changed before the first upload * is ran. * * @return array */ public function getDeduplicationInfo() { $info = parent::getDeduplicationInfo(); if ( is_array( $info['params'] ) ) { $info['params'] = [ 'url' => $info['params']['url'], 'title' => $info['params']['filename'] ]; } return $info; } /** * getter for the upload * * @return UploadBase */ protected function getUpload(): UploadBase { if ( $this->upload === null ) { $this->upload = new UploadFromUrl; $this->upload->initialize( $this->params['filename'], $this->params['url'] ); } return $this->upload; } /** * Get the parameters for job logging * * @param Status[] $status * @return array */ public function logJobParams( $status ): array { return [ 'stage' => $status['stage'] ?? '-', 'result' => $status['result'] ?? '-', 'status' => (string)( $status['status'] ?? '-' ), 'url' => $this->params['url'], 'filename' => $this->params['filename'], 'user' => $this->user->getName(), ]; } }