Commit 12fb9535 authored by Eric Mann's avatar Eric Mann
Browse files

Remove the add_option() fallback

Previously, we were attempting to explicitly add the option first and only
calling `update_option()` the option didn't exist. This was both to
explicitly force the option to autoload and also to ensure a minimum
amount of code was called (`update_option()` runs several filters and
eventually defers to `add_option()` for a new option anyway). However, to
avoid confusion, we'll just settle with `update_option()` regardless if
the option exists or not.
parent 0c7ac67e
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -365,9 +365,7 @@ class S3_Uploads_WP_CLI_Command extends WP_CLI_Command {
	 * Ensable the auto-rewriting of media links to S3
	 */
	public function enable( $args, $assoc_args ) {
		if ( false === add_option( 's3_uploads_enabled', 'enabled', '', 'yes' ) ) {
		update_option( 's3_uploads_enabled', 'enabled' );
		}

		WP_CLI::success( 'Media URL rewriting enabled.' );
	}