src/Modules/Rollback.php
private function start_rollback_theme() {
		add_filter( 'update_theme_complete_actions', array( $this, 'alter_links_theme_upgrade' ) );
		$rollback   = $this->get_rollback();
		$transient  = get_site_transient( 'update_themes' );
		$folder     = $this->product->get_slug();
		$version    = $rollback['version'];
		$temp_array = array(
			'new_version' => $version,
			'package'     => $rollback['url'],
		);

		$transient->response[ $folder . '/style.css' ] = $temp_array;
		set_site_transient( 'update_themes', $transient );

		$transient = get_transient( $this->product->get_key() . '_warning_rollback' );

		if ( false === $transient ) {
			set_transient( $this->product->get_key() . '_warning_rollback', 'in progress', 30 );
			require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
			$title = sprintf( apply_filters( $this->product->get_key() . '_rollback_message', 'Rolling back %s to v%s' ), $this->product->get_name(), $version );
			$theme = $folder . '/style.css';
			$nonce = 'upgrade-theme_' . $theme;
			$url   = 'update.php?action=upgrade-theme&theme=' . urlencode( $theme );

			$upgrader = new \Theme_Upgrader( new \Theme_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'theme' ) ) );
			$upgrader->upgrade( $theme );
			delete_transient( $this->product->get_key() . '_warning_rollback' );
			wp_die(
				'',
				$title,
				array(
					'response' => 200,
				)
			);
		}
	}
private function start_rollback_theme() {
		add_filter( 'update_theme_complete_actions', array( $this, 'alter_links_theme_upgrade' ) );
		$rollback   = $this->get_rollback();
		$transient  = get_site_transient( 'update_themes' );
		$folder     = $this->product->get_slug();
		$version    = $rollback['version'];
		$temp_array = array(
			'new_version' => $version,
			'package'     => $rollback['url'],
		);

		$transient->response[ $folder . '/style.css' ] = $temp_array;
		set_site_transient( 'update_themes', $transient );

		$transient = get_transient( $this->product->get_key() . '_warning_rollback' );

		if ( false === $transient ) {
			set_transient( $this->product->get_key() . '_warning_rollback', 'in progress', 30 );
			require_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
			$title = sprintf( apply_filters( $this->product->get_key() . '_rollback_message', 'Rolling back %s to v%s' ), $this->product->get_name(), $version );
			$theme = $folder . '/style.css';
			$nonce = 'upgrade-theme_' . $theme;
			$url   = 'update.php?action=upgrade-theme&theme=' . urlencode( $theme );

			$upgrader = new \Theme_Upgrader( new \Theme_Upgrader_Skin( compact( 'title', 'nonce', 'url', 'theme' ) ) );
			$upgrader->upgrade( $theme );
			delete_transient( $this->product->get_key() . '_warning_rollback' );
			wp_die(
				'',
				$title,
				array(
					'response' => 200,
				)
			);
		}
	}
private function start_rollback_theme ( ) { add_filter ( 'update_theme_complete_actions' , array ( $ this , 'alter_links_theme_upgrade' ) ) ; $ rollback = $ this -> get_rollback ( ) ; $ transient = get_site_transient ( 'update_themes' ) ; $ folder = $ this -> product -> get_slug ( ) ; $ version = $ rollback [ 'version' ] ; $ temp_array = array ( 'new_version' => $ version , 'package' => $ rollback [ 'url' ] , ) ; $ transient -> response [ $ folder . '/style.css' ] = $ temp_array ; set_site_transient ( 'update_themes' , $ transient ) ; $ transient = get_transient ( $ this -> product -> get_key ( ) . '_warning_rollback' ) ; if ( false === $ transient ) { set_transient ( $ this -> product -> get_key ( ) . '_warning_rollback' , 'in progress' , 30 ) ; require_once ( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ) ; $ title = sprintf ( apply_filters ( $ this -> product -> get_key ( ) . '_rollback_message' , 'Rolling back %s to v%s' ) , $ this -> product -> get_name ( ) , $ version ) ; $ theme = $ folder . '/style.css' ; $ nonce = 'upgrade-theme_' . $ theme ; $ url = 'update.php?action=upgrade-theme&theme=' . urlencode ( $ theme ) ; $ upgrader = new \ Theme_Upgrader ( new \ Theme_Upgrader_Skin ( compact ( 'title' , 'nonce' , 'url' , 'theme' ) ) ) ; $ upgrader -> upgrade ( $ theme ) ; delete_transient ( $ this -> product -> get_key ( ) . '_warning_rollback' ) ; wp_die ( '' , $ title , array ( 'response' => 200 , ) ) ; } }
Start the rollback operation for the theme.
Start the rollback operation for the theme .