display-conditions
3 years ago
front
9 months ago
helpers
9 months ago
metas
3 years ago
multisite
3 years ago
palettes
3 years ago
provider
3 years ago
providers
9 months ago
templates
3 years ago
update
3 years ago
class-hustle-admin-page-abstract.php
9 months ago
class-hustle-black-friday-campaign.php
7 months ago
class-hustle-condition-factory.php
6 years ago
class-hustle-cross-sell.php
9 months ago
class-hustle-dashboard-admin.php
3 years ago
class-hustle-data.php
3 years ago
class-hustle-db.php
2 years ago
class-hustle-installer.php
4 years ago
class-hustle-meta.php
3 years ago
class-hustle-module-admin.php
9 months ago
class-hustle-module-collection.php
3 years ago
class-hustle-module-page-abstract.php
2 years ago
class-hustle-notifications.php
3 years ago
class-hustle-settings-admin.php
3 years ago
class-hustle-tutorials-page.php
4 years ago
class-hustle-wp-dashboard-page.php
3 years ago
hustle-deletion.php
3 years ago
hustle-embedded-admin.php
3 years ago
hustle-entries-admin.php
3 years ago
hustle-entry-model.php
3 years ago
hustle-general-data-protection.php
3 years ago
hustle-init.php
7 months ago
hustle-mail.php
3 years ago
hustle-migration.php
3 years ago
hustle-model.php
3 years ago
hustle-module-model.php
9 months ago
hustle-module-widget-legacy.php
3 years ago
hustle-module-widget.php
3 years ago
hustle-modules-common-admin-ajax.php
9 months ago
hustle-popup-admin.php
3 years ago
hustle-providers-admin.php
3 years ago
hustle-providers.php
3 years ago
hustle-settings-admin-ajax.php
3 years ago
hustle-settings-page.php
3 years ago
hustle-slidein-admin.php
3 years ago
hustle-sshare-admin.php
3 years ago
hustle-sshare-model.php
3 years ago
hustle-tracking-model.php
3 years ago
opt-in-geo.php
9 months ago
opt-in-utils.php
3 years ago
opt-in-wpmudev-api.php
3 years ago
class-hustle-installer.php
54 lines
| 1 | <?php |
| 2 | /** |
| 3 | * File for the Hustle_Installer class. |
| 4 | * |
| 5 | * @package Hustle |
| 6 | * @since 4.4.1 |
| 7 | */ |
| 8 | |
| 9 | /** |
| 10 | * Class Hustle_Installer |
| 11 | * |
| 12 | * @class Hustle_Installer |
| 13 | */ |
| 14 | class Hustle_Installer { |
| 15 | |
| 16 | /** |
| 17 | * Class constructor |
| 18 | * |
| 19 | * @since 4.4.1 |
| 20 | */ |
| 21 | public function __construct() { |
| 22 | |
| 23 | $current_version = get_option( 'hustle_version' ); |
| 24 | $is_forced = ! empty( filter_input( INPUT_GET, 'run-migration', FILTER_VALIDATE_INT ) ); |
| 25 | |
| 26 | // If it's the first run of this version or the migration is being forced. |
| 27 | if ( Opt_In::VERSION !== $current_version || $is_forced ) { |
| 28 | |
| 29 | // Using a site option for this prevents the migration from running in subsites. |
| 30 | if ( is_multisite() ) { |
| 31 | // Remove the site option introduced in 4.4.1. |
| 32 | delete_site_option( 'hustle_version' ); |
| 33 | } |
| 34 | |
| 35 | // This isn't a fresh install. Do migrations. |
| 36 | if ( ! empty( get_option( 'hustle_migrations' ) ) ) { |
| 37 | |
| 38 | // The option 'hustle_version' was introduced in 4.4.1. |
| 39 | // Re-run migration for multisites. |
| 40 | if ( |
| 41 | $is_forced || |
| 42 | empty( $current_version ) || |
| 43 | ( is_multisite() && version_compare( Opt_In::VERSION, '4.4.3', '<' ) ) |
| 44 | ) { |
| 45 | $migrator_441 = new Hustle_441_Migration(); |
| 46 | $migrator_441->maybe_migrate(); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | update_option( 'hustle_version', Opt_In::VERSION ); |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 |