@@ -18,164 +18,164 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | class Wordlift_Install_Service { |
| 20 | 20 | |
| 21 | - /** |
|
| 22 | - * A {@link Wordlift_Log_Service} instance. |
|
| 23 | - * |
|
| 24 | - * @since 3.18.0 |
|
| 25 | - * @access private |
|
| 26 | - * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 27 | - */ |
|
| 28 | - private $log; |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * The singleton instance. |
|
| 32 | - * |
|
| 33 | - * @since 3.18.0 |
|
| 34 | - * @access private |
|
| 35 | - * @var \Wordlift_Install_Service $instance A {@link Wordlift_Install_Service} instance. |
|
| 36 | - */ |
|
| 37 | - private static $instance; |
|
| 38 | - |
|
| 39 | - /** |
|
| 40 | - * @var array |
|
| 41 | - */ |
|
| 42 | - private $installs; |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * Wordlift_Install_Service constructor. |
|
| 46 | - * |
|
| 47 | - * @since 3.18.0 |
|
| 48 | - */ |
|
| 49 | - public function __construct() { |
|
| 50 | - |
|
| 51 | - /** Installs. */ |
|
| 52 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php'; |
|
| 53 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php'; |
|
| 54 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php'; |
|
| 55 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php'; |
|
| 56 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php'; |
|
| 57 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php'; |
|
| 58 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php'; |
|
| 59 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-3.php'; |
|
| 60 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-19-5.php'; |
|
| 61 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-20-0.php'; |
|
| 62 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-23-4.php'; |
|
| 63 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-24-2.php'; |
|
| 64 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-all-entity-types.php'; |
|
| 65 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-package-type.php'; |
|
| 66 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-25-0.php'; |
|
| 67 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-27-0.php'; |
|
| 68 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-27-1.php'; |
|
| 69 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-28-0.php'; |
|
| 70 | - |
|
| 71 | - // Get the install services. |
|
| 72 | - $this->installs = array( |
|
| 73 | - new Wordlift_Install_1_0_0(), |
|
| 74 | - new Wordlift_Install_3_10_0(), |
|
| 75 | - new Wordlift_Install_3_12_0(), |
|
| 76 | - new Wordlift_Install_3_14_0(), |
|
| 77 | - new Wordlift_Install_3_15_0(), |
|
| 78 | - new Wordlift_Install_3_18_0(), |
|
| 79 | - new Wordlift_Install_3_18_3(), |
|
| 80 | - new Wordlift_Install_3_19_5(), |
|
| 81 | - new Wordlift_Install_3_20_0(), |
|
| 82 | - /* |
|
| 21 | + /** |
|
| 22 | + * A {@link Wordlift_Log_Service} instance. |
|
| 23 | + * |
|
| 24 | + * @since 3.18.0 |
|
| 25 | + * @access private |
|
| 26 | + * @var \Wordlift_Log_Service $log A {@link Wordlift_Log_Service} instance. |
|
| 27 | + */ |
|
| 28 | + private $log; |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * The singleton instance. |
|
| 32 | + * |
|
| 33 | + * @since 3.18.0 |
|
| 34 | + * @access private |
|
| 35 | + * @var \Wordlift_Install_Service $instance A {@link Wordlift_Install_Service} instance. |
|
| 36 | + */ |
|
| 37 | + private static $instance; |
|
| 38 | + |
|
| 39 | + /** |
|
| 40 | + * @var array |
|
| 41 | + */ |
|
| 42 | + private $installs; |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * Wordlift_Install_Service constructor. |
|
| 46 | + * |
|
| 47 | + * @since 3.18.0 |
|
| 48 | + */ |
|
| 49 | + public function __construct() { |
|
| 50 | + |
|
| 51 | + /** Installs. */ |
|
| 52 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php'; |
|
| 53 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php'; |
|
| 54 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php'; |
|
| 55 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php'; |
|
| 56 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php'; |
|
| 57 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php'; |
|
| 58 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php'; |
|
| 59 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-3.php'; |
|
| 60 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-19-5.php'; |
|
| 61 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-20-0.php'; |
|
| 62 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-23-4.php'; |
|
| 63 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-24-2.php'; |
|
| 64 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-all-entity-types.php'; |
|
| 65 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-package-type.php'; |
|
| 66 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-25-0.php'; |
|
| 67 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-27-0.php'; |
|
| 68 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-27-1.php'; |
|
| 69 | + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-28-0.php'; |
|
| 70 | + |
|
| 71 | + // Get the install services. |
|
| 72 | + $this->installs = array( |
|
| 73 | + new Wordlift_Install_1_0_0(), |
|
| 74 | + new Wordlift_Install_3_10_0(), |
|
| 75 | + new Wordlift_Install_3_12_0(), |
|
| 76 | + new Wordlift_Install_3_14_0(), |
|
| 77 | + new Wordlift_Install_3_15_0(), |
|
| 78 | + new Wordlift_Install_3_18_0(), |
|
| 79 | + new Wordlift_Install_3_18_3(), |
|
| 80 | + new Wordlift_Install_3_19_5(), |
|
| 81 | + new Wordlift_Install_3_20_0(), |
|
| 82 | + /* |
|
| 83 | 83 | * This should be enabled with #852. |
| 84 | 84 | */ |
| 85 | - // new Wordlift_Install_All_Entity_Types(), |
|
| 86 | - new Wordlift_Install_Package_Type(), |
|
| 87 | - new Wordlift_Install_3_23_4(), |
|
| 88 | - new Wordlift_Install_3_24_2(), |
|
| 89 | - new Wordlift_Install_3_25_0(), |
|
| 90 | - new Wordlift_Install_3_27_0(), |
|
| 91 | - new Wordlift_Install_3_27_1(), |
|
| 92 | - new Wordlift_Install_3_28_0(), |
|
| 93 | - ); |
|
| 94 | - self::$instance = $this; |
|
| 85 | + // new Wordlift_Install_All_Entity_Types(), |
|
| 86 | + new Wordlift_Install_Package_Type(), |
|
| 87 | + new Wordlift_Install_3_23_4(), |
|
| 88 | + new Wordlift_Install_3_24_2(), |
|
| 89 | + new Wordlift_Install_3_25_0(), |
|
| 90 | + new Wordlift_Install_3_27_0(), |
|
| 91 | + new Wordlift_Install_3_27_1(), |
|
| 92 | + new Wordlift_Install_3_28_0(), |
|
| 93 | + ); |
|
| 94 | + self::$instance = $this; |
|
| 95 | 95 | |
| 96 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 96 | + $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 97 | 97 | |
| 98 | - add_action( 'init', array( $this, 'install' ) ); |
|
| 98 | + add_action( 'init', array( $this, 'install' ) ); |
|
| 99 | 99 | |
| 100 | - } |
|
| 100 | + } |
|
| 101 | 101 | |
| 102 | - /** |
|
| 103 | - * Get the singleton instance. |
|
| 104 | - * |
|
| 105 | - * @since 3.18.0 |
|
| 106 | - */ |
|
| 107 | - public static function get_instance() { |
|
| 102 | + /** |
|
| 103 | + * Get the singleton instance. |
|
| 104 | + * |
|
| 105 | + * @since 3.18.0 |
|
| 106 | + */ |
|
| 107 | + public static function get_instance() { |
|
| 108 | 108 | |
| 109 | - return self::$instance; |
|
| 110 | - } |
|
| 109 | + return self::$instance; |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * Loop thought all versions and install the updates. |
|
| 114 | - * |
|
| 115 | - * @return void |
|
| 116 | - * @since 3.18.0 |
|
| 117 | - * |
|
| 118 | - * @since 3.20.0 use a transient to avoid concurrent installation calls. |
|
| 119 | - */ |
|
| 120 | - public function install() { |
|
| 112 | + /** |
|
| 113 | + * Loop thought all versions and install the updates. |
|
| 114 | + * |
|
| 115 | + * @return void |
|
| 116 | + * @since 3.18.0 |
|
| 117 | + * |
|
| 118 | + * @since 3.20.0 use a transient to avoid concurrent installation calls. |
|
| 119 | + */ |
|
| 120 | + public function install() { |
|
| 121 | 121 | |
| 122 | - $version = null; |
|
| 122 | + $version = null; |
|
| 123 | 123 | |
| 124 | - if ( $this->install_required() && false === get_transient( '_wl_installing' ) ) { |
|
| 125 | - set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS ); |
|
| 126 | - /** @var Wordlift_Install $install */ |
|
| 127 | - foreach ( $this->installs as $install ) { |
|
| 128 | - // Get the install version. |
|
| 129 | - $version = $install->get_version(); |
|
| 124 | + if ( $this->install_required() && false === get_transient( '_wl_installing' ) ) { |
|
| 125 | + set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS ); |
|
| 126 | + /** @var Wordlift_Install $install */ |
|
| 127 | + foreach ( $this->installs as $install ) { |
|
| 128 | + // Get the install version. |
|
| 129 | + $version = $install->get_version(); |
|
| 130 | 130 | |
| 131 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
| 132 | - || $install->must_install() ) { |
|
| 133 | - $class_name = get_class( $install ); |
|
| 131 | + if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
| 132 | + || $install->must_install() ) { |
|
| 133 | + $class_name = get_class( $install ); |
|
| 134 | 134 | |
| 135 | - $this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." ); |
|
| 136 | - // Install version. |
|
| 137 | - $install->install(); |
|
| 135 | + $this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." ); |
|
| 136 | + // Install version. |
|
| 137 | + $install->install(); |
|
| 138 | 138 | |
| 139 | 139 | |
| 140 | - $this->log->info( "$class_name installed." ); |
|
| 140 | + $this->log->info( "$class_name installed." ); |
|
| 141 | 141 | |
| 142 | - // Bump the version. |
|
| 143 | - update_option( 'wl_db_version', $version ); |
|
| 144 | - } |
|
| 142 | + // Bump the version. |
|
| 143 | + update_option( 'wl_db_version', $version ); |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - } |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - @delete_transient( '_wl_installing' ); |
|
| 148 | + @delete_transient( '_wl_installing' ); |
|
| 149 | 149 | |
| 150 | - } |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - } |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - private function install_required() { |
|
| 154 | + private function install_required() { |
|
| 155 | 155 | |
| 156 | - /** @var Wordlift_Install $install */ |
|
| 157 | - foreach ( $this->installs as $install ) { |
|
| 158 | - // Get the install version. |
|
| 159 | - $version = $install->get_version(); |
|
| 156 | + /** @var Wordlift_Install $install */ |
|
| 157 | + foreach ( $this->installs as $install ) { |
|
| 158 | + // Get the install version. |
|
| 159 | + $version = $install->get_version(); |
|
| 160 | 160 | |
| 161 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
| 162 | - || $install->must_install() ) { |
|
| 163 | - return true; |
|
| 164 | - } |
|
| 161 | + if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
| 162 | + || $install->must_install() ) { |
|
| 163 | + return true; |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | - } |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | - return false; |
|
| 169 | - } |
|
| 168 | + return false; |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - /** |
|
| 172 | - * Retrieve the current db version. |
|
| 173 | - * |
|
| 174 | - * @return type |
|
| 175 | - */ |
|
| 176 | - private function get_current_version() { |
|
| 177 | - return get_option( 'wl_db_version', '0.0.0' ); |
|
| 178 | - } |
|
| 171 | + /** |
|
| 172 | + * Retrieve the current db version. |
|
| 173 | + * |
|
| 174 | + * @return type |
|
| 175 | + */ |
|
| 176 | + private function get_current_version() { |
|
| 177 | + return get_option( 'wl_db_version', '0.0.0' ); |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | 180 | |
| 181 | 181 | |
@@ -49,24 +49,24 @@ discard block |
||
| 49 | 49 | public function __construct() { |
| 50 | 50 | |
| 51 | 51 | /** Installs. */ |
| 52 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install.php'; |
|
| 53 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-1-0-0.php'; |
|
| 54 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-10-0.php'; |
|
| 55 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-12-0.php'; |
|
| 56 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-14-0.php'; |
|
| 57 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-15-0.php'; |
|
| 58 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-0.php'; |
|
| 59 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-18-3.php'; |
|
| 60 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-19-5.php'; |
|
| 61 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-20-0.php'; |
|
| 62 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-23-4.php'; |
|
| 63 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-24-2.php'; |
|
| 64 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-all-entity-types.php'; |
|
| 65 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-package-type.php'; |
|
| 66 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-25-0.php'; |
|
| 67 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-27-0.php'; |
|
| 68 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-27-1.php'; |
|
| 69 | - require_once plugin_dir_path( dirname( __FILE__ ) ) . 'install/class-wordlift-install-3-28-0.php'; |
|
| 52 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install.php'; |
|
| 53 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-1-0-0.php'; |
|
| 54 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-10-0.php'; |
|
| 55 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-12-0.php'; |
|
| 56 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-14-0.php'; |
|
| 57 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-15-0.php'; |
|
| 58 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-18-0.php'; |
|
| 59 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-18-3.php'; |
|
| 60 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-19-5.php'; |
|
| 61 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-20-0.php'; |
|
| 62 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-23-4.php'; |
|
| 63 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-24-2.php'; |
|
| 64 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-all-entity-types.php'; |
|
| 65 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-package-type.php'; |
|
| 66 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-25-0.php'; |
|
| 67 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-27-0.php'; |
|
| 68 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-27-1.php'; |
|
| 69 | + require_once plugin_dir_path(dirname(__FILE__)).'install/class-wordlift-install-3-28-0.php'; |
|
| 70 | 70 | |
| 71 | 71 | // Get the install services. |
| 72 | 72 | $this->installs = array( |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | ); |
| 94 | 94 | self::$instance = $this; |
| 95 | 95 | |
| 96 | - $this->log = Wordlift_Log_Service::get_logger( get_class() ); |
|
| 96 | + $this->log = Wordlift_Log_Service::get_logger(get_class()); |
|
| 97 | 97 | |
| 98 | - add_action( 'init', array( $this, 'install' ) ); |
|
| 98 | + add_action('init', array($this, 'install')); |
|
| 99 | 99 | |
| 100 | 100 | } |
| 101 | 101 | |
@@ -121,31 +121,31 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | $version = null; |
| 123 | 123 | |
| 124 | - if ( $this->install_required() && false === get_transient( '_wl_installing' ) ) { |
|
| 125 | - set_transient( '_wl_installing', true, 5 * MINUTE_IN_SECONDS ); |
|
| 124 | + if ($this->install_required() && false === get_transient('_wl_installing')) { |
|
| 125 | + set_transient('_wl_installing', true, 5 * MINUTE_IN_SECONDS); |
|
| 126 | 126 | /** @var Wordlift_Install $install */ |
| 127 | - foreach ( $this->installs as $install ) { |
|
| 127 | + foreach ($this->installs as $install) { |
|
| 128 | 128 | // Get the install version. |
| 129 | 129 | $version = $install->get_version(); |
| 130 | 130 | |
| 131 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
| 132 | - || $install->must_install() ) { |
|
| 133 | - $class_name = get_class( $install ); |
|
| 131 | + if (version_compare($version, $this->get_current_version(), '>') |
|
| 132 | + || $install->must_install()) { |
|
| 133 | + $class_name = get_class($install); |
|
| 134 | 134 | |
| 135 | - $this->log->info( "Current version is {$this->get_current_version()}, installing $class_name..." ); |
|
| 135 | + $this->log->info("Current version is {$this->get_current_version()}, installing $class_name..."); |
|
| 136 | 136 | // Install version. |
| 137 | 137 | $install->install(); |
| 138 | 138 | |
| 139 | 139 | |
| 140 | - $this->log->info( "$class_name installed." ); |
|
| 140 | + $this->log->info("$class_name installed."); |
|
| 141 | 141 | |
| 142 | 142 | // Bump the version. |
| 143 | - update_option( 'wl_db_version', $version ); |
|
| 143 | + update_option('wl_db_version', $version); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - @delete_transient( '_wl_installing' ); |
|
| 148 | + @delete_transient('_wl_installing'); |
|
| 149 | 149 | |
| 150 | 150 | } |
| 151 | 151 | |
@@ -154,12 +154,12 @@ discard block |
||
| 154 | 154 | private function install_required() { |
| 155 | 155 | |
| 156 | 156 | /** @var Wordlift_Install $install */ |
| 157 | - foreach ( $this->installs as $install ) { |
|
| 157 | + foreach ($this->installs as $install) { |
|
| 158 | 158 | // Get the install version. |
| 159 | 159 | $version = $install->get_version(); |
| 160 | 160 | |
| 161 | - if ( version_compare( $version, $this->get_current_version(), '>' ) |
|
| 162 | - || $install->must_install() ) { |
|
| 161 | + if (version_compare($version, $this->get_current_version(), '>') |
|
| 162 | + || $install->must_install()) { |
|
| 163 | 163 | return true; |
| 164 | 164 | } |
| 165 | 165 | |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | * @return type |
| 175 | 175 | */ |
| 176 | 176 | private function get_current_version() { |
| 177 | - return get_option( 'wl_db_version', '0.0.0' ); |
|
| 177 | + return get_option('wl_db_version', '0.0.0'); |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | |
@@ -6,33 +6,33 @@ |
||
| 6 | 6 | */ |
| 7 | 7 | class Wordlift_Install_3_28_0 extends Wordlift_Install { |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * {@inheritdoc} |
|
| 11 | - */ |
|
| 12 | - protected static $version = '3.28.0'; |
|
| 9 | + /** |
|
| 10 | + * {@inheritdoc} |
|
| 11 | + */ |
|
| 12 | + protected static $version = '3.28.0'; |
|
| 13 | 13 | |
| 14 | - public function install() { |
|
| 14 | + public function install() { |
|
| 15 | 15 | |
| 16 | - global $wpdb; |
|
| 16 | + global $wpdb; |
|
| 17 | 17 | |
| 18 | - $dataset_uri = Wordlift_Configuration_Service::get_instance()->get_dataset_uri(); |
|
| 18 | + $dataset_uri = Wordlift_Configuration_Service::get_instance()->get_dataset_uri(); |
|
| 19 | 19 | |
| 20 | - if ( ! $dataset_uri ) { |
|
| 21 | - // Dont run the query, running it would delete all the values. |
|
| 22 | - return; |
|
| 23 | - } |
|
| 24 | - $post_meta_table_name = $wpdb->postmeta; |
|
| 25 | - $meta_key = Wordlift_Schema_Service::FIELD_SAME_AS; |
|
| 20 | + if ( ! $dataset_uri ) { |
|
| 21 | + // Dont run the query, running it would delete all the values. |
|
| 22 | + return; |
|
| 23 | + } |
|
| 24 | + $post_meta_table_name = $wpdb->postmeta; |
|
| 25 | + $meta_key = Wordlift_Schema_Service::FIELD_SAME_AS; |
|
| 26 | 26 | |
| 27 | - $http = $wpdb->esc_like( 'http://' ) . '%'; |
|
| 28 | - $https = $wpdb->esc_like( 'https://' ) . '%'; |
|
| 29 | - $dataset_uri = $wpdb->esc_like( $dataset_uri ) . '%'; |
|
| 30 | - $sql = $wpdb->prepare( "DELETE FROM $post_meta_table_name WHERE meta_key='$meta_key' |
|
| 27 | + $http = $wpdb->esc_like( 'http://' ) . '%'; |
|
| 28 | + $https = $wpdb->esc_like( 'https://' ) . '%'; |
|
| 29 | + $dataset_uri = $wpdb->esc_like( $dataset_uri ) . '%'; |
|
| 30 | + $sql = $wpdb->prepare( "DELETE FROM $post_meta_table_name WHERE meta_key='$meta_key' |
|
| 31 | 31 | AND ( ( meta_value NOT LIKE %s AND meta_value NOT LIKE %s ) |
| 32 | 32 | OR meta_value LIKE %s )", $http, $https, $dataset_uri ); |
| 33 | - $wpdb->query( $sql ); |
|
| 33 | + $wpdb->query( $sql ); |
|
| 34 | 34 | |
| 35 | - } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | } |
@@ -17,20 +17,20 @@ |
||
| 17 | 17 | |
| 18 | 18 | $dataset_uri = Wordlift_Configuration_Service::get_instance()->get_dataset_uri(); |
| 19 | 19 | |
| 20 | - if ( ! $dataset_uri ) { |
|
| 20 | + if ( ! $dataset_uri) { |
|
| 21 | 21 | // Dont run the query, running it would delete all the values. |
| 22 | 22 | return; |
| 23 | 23 | } |
| 24 | 24 | $post_meta_table_name = $wpdb->postmeta; |
| 25 | 25 | $meta_key = Wordlift_Schema_Service::FIELD_SAME_AS; |
| 26 | 26 | |
| 27 | - $http = $wpdb->esc_like( 'http://' ) . '%'; |
|
| 28 | - $https = $wpdb->esc_like( 'https://' ) . '%'; |
|
| 29 | - $dataset_uri = $wpdb->esc_like( $dataset_uri ) . '%'; |
|
| 30 | - $sql = $wpdb->prepare( "DELETE FROM $post_meta_table_name WHERE meta_key='$meta_key' |
|
| 27 | + $http = $wpdb->esc_like('http://').'%'; |
|
| 28 | + $https = $wpdb->esc_like('https://').'%'; |
|
| 29 | + $dataset_uri = $wpdb->esc_like($dataset_uri).'%'; |
|
| 30 | + $sql = $wpdb->prepare("DELETE FROM $post_meta_table_name WHERE meta_key='$meta_key' |
|
| 31 | 31 | AND ( ( meta_value NOT LIKE %s AND meta_value NOT LIKE %s ) |
| 32 | -OR meta_value LIKE %s )", $http, $https, $dataset_uri ); |
|
| 33 | - $wpdb->query( $sql ); |
|
| 32 | +OR meta_value LIKE %s )", $http, $https, $dataset_uri); |
|
| 33 | + $wpdb->query($sql); |
|
| 34 | 34 | |
| 35 | 35 | } |
| 36 | 36 | |