Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
Jetpack_Backup_Upgrades
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
30
0.00% covered (danger)
0.00%
0 / 1
 upgrade
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
20
 clear_disabled_plugin
n/a
0 / 0
n/a
0 / 0
1
1<?php
2/**
3 * Handle Backup plugin upgrades
4 *
5 * @package automattic/jetpack-backup-plugin
6 */
7
8// After changing this file, consider increasing the version number ("VXXX") in all the files using this namespace, in
9// order to ensure that the specific version of this file always get loaded. Otherwise, Jetpack autoloader might decide
10// to load an older/newer version of the class (if, for example, both the standalone and bundled versions of the plugin
11// are installed, or in some other cases).
12namespace Automattic\Jetpack\Backup\V0005;
13
14use function get_option;
15use function update_option;
16
17/**
18 * The Upgrades class.
19 */
20class Jetpack_Backup_Upgrades {
21
22    /**
23     * Run all methods only once and store an option to make sure it never runs again
24     */
25    public static function upgrade() {
26
27        $upgrades = get_class_methods( __CLASS__ );
28
29        foreach ( $upgrades as $upgrade ) {
30            $option_name = '_upgrade_' . $upgrade;
31            if ( 'upgrade' === $upgrade || get_option( $option_name ) ) {
32                continue;
33            }
34
35            update_option( $option_name, 1 );
36
37            call_user_func( array( __CLASS__, $upgrade ) );
38
39        }
40    }
41
42    /**
43     * The plugin is not checking if it was disabled and reactivating it when we reconnect, therefore we need to clear this information from DB so other plugins know we are still using the connection
44     *
45     * @deprecated since 1.7.0 No longer required after removing soft disconnect functionality.
46     */
47    public static function clear_disabled_plugin() {}
48}