summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/jetpack_vendor/automattic/jetpack-backup/src/class-jetpack-backup-upgrades.php')
-rw-r--r--plugins/jetpack/jetpack_vendor/automattic/jetpack-backup/src/class-jetpack-backup-upgrades.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/plugins/jetpack/jetpack_vendor/automattic/jetpack-backup/src/class-jetpack-backup-upgrades.php b/plugins/jetpack/jetpack_vendor/automattic/jetpack-backup/src/class-jetpack-backup-upgrades.php
new file mode 100644
index 00000000..46e09d82
--- /dev/null
+++ b/plugins/jetpack/jetpack_vendor/automattic/jetpack-backup/src/class-jetpack-backup-upgrades.php
@@ -0,0 +1,46 @@
+<?php
+/**
+ * Handle Backup plugin upgrades
+ *
+ * @package automattic/jetpack-backup-plugin
+ */
+
+namespace Automattic\Jetpack\Backup;
+
+use Automattic\Jetpack\Connection\Manager as Connection_Manager;
+
+/**
+ * The Upgrades class.
+ */
+class Jetpack_Backup_Upgrades {
+
+ /**
+ * Run all methods only once and store an option to make sure it never runs again
+ */
+ public static function upgrade() {
+
+ $upgrades = get_class_methods( __CLASS__ );
+
+ foreach ( $upgrades as $upgrade ) {
+ $option_name = '_upgrade_' . $upgrade;
+ if ( 'upgrade' === $upgrade || get_option( $option_name ) ) {
+ continue;
+ }
+
+ update_option( $option_name, 1 );
+
+ call_user_func( array( __CLASS__, $upgrade ) );
+
+ }
+
+ }
+
+ /**
+ * 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
+ */
+ public static function clear_disabled_plugin() {
+ $manager = new Connection_Manager( 'jetpack-backup' );
+ $manager->enable_plugin();
+ }
+
+}