Code Duplication    Length = 30-30 lines in 2 locations

json-endpoints/jetpack/class.jetpack-json-api-themes-modify-endpoint.php 2 locations

@@ 55-84 (lines=30) @@
52
		Jetpack_Options::update_option( 'autoupdate_themes_translations', $autoupdate_themes_translations );
53
	}
54
55
	function update() {
56
		include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
57
58
		// Clear the cache.
59
		wp_update_themes();
60
61
		foreach ( $this->themes as $theme ) {
62
			/**
63
			 * Pre-upgrade action
64
			 * 
65
			 * @since 3.9.3
66
			 * 
67
			 * @param object $theme WP_Theme object
68
			 * @param array $themes Array of theme objects
69
			 */
70
			do_action('jetpack_pre_theme_upgrade', $theme, $this->themes);
71
			// Objects created inside the for loop to clean the messages for each theme
72
			$skin = new Automatic_Upgrader_Skin();
73
			$upgrader = new Theme_Upgrader( $skin );
74
			$upgrader->init();
75
			$result   = $upgrader->upgrade( $theme );
76
			$this->log[ $theme ][] = $upgrader->skin->get_upgrade_messages();
77
		}
78
79
		if ( ! $this->bulk && ! $result ) {
80
			return new WP_Error( 'update_fail', __( 'There was an error updating your theme', 'jetpack' ), 400 );
81
		}
82
83
		return true;
84
	}
85
86
	function update_translation() {
87
		include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
@@ 86-115 (lines=30) @@
83
		return true;
84
	}
85
86
	function update_translation() {
87
		include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
88
89
		// Clear the cache.
90
		wp_update_themes();
91
92
		foreach ( $this->themes as $theme ) {
93
			/**
94
			 * Pre-upgrade action
95
			 *
96
			 * @since 3.9.3
97
			 *
98
			 * @param object $theme WP_Theme object
99
			 * @param array $themes Array of theme objects
100
			 */
101
			do_action('jetpack_pre_theme_upgrade', $theme, $this->themes);
102
			// Objects created inside the for loop to clean the messages for each theme
103
			$skin = new Automatic_Upgrader_Skin();
104
			$upgrader = new Language_Pack_Upgrader( $skin );
105
			$upgrader->init();
106
			$result   = $upgrader->upgrade( $theme );
107
			$this->log[ $theme ][] = $upgrader->skin->get_upgrade_messages();
108
		}
109
110
		if ( ! $this->bulk && ! $result ) {
111
			return new WP_Error( 'update_fail', __( 'There was an error updating your theme', 'jetpack' ), 400 );
112
		}
113
114
		return true;
115
	}
116
117
}
118