Completed
Push — update/core-version-upgrade-ro... ( 3d6e97...e1c6f7 )
by
unknown
76:14 queued 66:29
created

class.jetpack-upgrade.php (1 issue)

Labels
Severity

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
class Jetpack_Upgrade {
4
5
	static public $previous_version;
6
7
	static function run() {
8
		if ( Jetpack::is_active() ) {
9
			$version_option = Jetpack_Options::get_option( 'version' );
10
			list( self::$previous_version ) = explode( ':', $version_option );
11
			if ( JETPACK__VERSION != self::$previous_version ) {
12
				Jetpack_Options::update_options(
13
					array(
14
						'version'     => JETPACK__VERSION . ':' . time(),
15
						'old_version' => self::$previous_version,
16
					)
17
				);
18
				add_action( 'init', array( 'Jetpack_Upgrade', 'init' ) );
19
			}
20
		}
21
	}
22
23
	static function init() {
24
		do_action( 'updating_jetpack_version', self::$previous_version );
25
		self::modules_cleanup();
26
	}
27
28
	static function modules_cleanup() {
29
		if ( ! self::$previous_version ) { // For new sites
30
			self::activate_module( 'manage', false, false );
0 ignored issues
show
The method activate_module() does not seem to exist on object<Jetpack_Upgrade>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
31
		}
32
		// Check which active modules actually exist and remove others from active_modules list
33
		Jetpack_Options::update_option( 'active_modules', array_intersect( Jetpack::get_active_modules(), Jetpack::get_available_modules() ) );
34
		Jetpack::activate_new_modules();
35
	}
36
}
37