Unverified Commit 6bc1691e authored by Joe Hoyle's avatar Joe Hoyle Committed by GitHub
Browse files

Merge pull request #262 from humanmade/trigger-put-action-on-local-env

Trigger putObject action on local wrapper as well
parents 4feae298 05d55946
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -261,7 +261,21 @@ class S3_Uploads_Local_Stream_Wrapper {
	 * @see http://php.net/manual/streamwrapper.stream-flush.php
	 */
	public function stream_flush() {
		return fflush( $this->handle );
		$result = fflush( $this->handle );

		$params = [
			'Bucket' => S3_UPLOADS_BUCKET,
			'Key' => trim( str_replace( S3_UPLOADS_BUCKET, '', $this->getTarget() ), '/' ),
		];

		/**
		 * Action when a new object has been uploaded to s3.
		 *
		 * @param array  $params S3Client::putObject parameters.
		 */
		do_action( 's3_uploads_putObject', $params );

		return $result;
	}

	/**