Completed
Push — update/remove-icon-disconnect-... ( 4b6a2c )
by
unknown
59:55 queued 50:17
created

update()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 6
nc 2
nop 0
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
class Jetpack_JSON_API_Translations_Modify_Endpoint extends Jetpack_JSON_API_Translations_Endpoint {
4
	// POST /sites/%s/translations
5
	// POST /sites/%s/translations/update
6
	protected $action              = 'default_action';
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned correctly; expected 1 space but found 14 spaces

This check looks for improperly formatted assignments.

Every assignment must have exactly one space before and one space after the equals operator.

To illustrate:

$a = "a";
$ab = "ab";
$abc = "abc";

will have no issues, while

$a   = "a";
$ab  = "ab";
$abc = "abc";

will report issues in lines 1 and 2.

Loading history...
7
	protected $new_version;
8
	protected $log;
9
10 View Code Duplication
	public function default_action() {
11
		$args = $this->input();
12
13
		if ( isset( $args['autoupdate'] ) && is_bool( $args['autoupdate'] ) ) {
14
			Jetpack_Options::update_option( 'autoupdate_translations', $args['autoupdate'] );
15
		}
16
17
		return true;
18
	}
19
20
	protected function update() {
21
		include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
22
23
		$upgrader = new Language_Pack_Upgrader( new Automatic_Upgrader_Skin() );
24
		$result = $upgrader->bulk_upgrade();
25
26
		$this->log = $upgrader->skin->get_upgrade_messages();
27
		$this->success = ( ! is_wp_error( $result ) ) ? (bool) $result : false;
28
	}
29
}
30