| @@ -150,13 +150,8 @@ | ||
| 150 | 150 | $posts = new ConvertKit_Resource_Posts( 'cron' ); |
| 151 | 151 | $posts->schedule_cron_event(); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - // Actions that should run regardless of the version number | |
| 155 | - // whenever the Plugin is updated. | |
| 156 | - $this->remove_v3_api_secret_from_settings(); | |
| 157 | - $this->maybe_delete_old_cached_resource_structure(); | |
| 158 | - | |
| 159 | 154 | // Update the installed version number in the options table. |
| 160 | 155 | update_option( 'convertkit_version', CONVERTKIT_PLUGIN_VERSION ); |
| 161 | 156 | |
| 162 | 157 | } |
| @@ -161,64 +156,8 @@ | ||
| 161 | 156 | |
| 162 | 157 | } |
| 163 | 158 | |
| 164 | 159 | /** |
| 165 | - * Remove v3 API Secret from settings. | |
| 166 | - * | |
| 167 | - * @since 3.2.4 | |
| 168 | - */ | |
| 169 | - private function remove_v3_api_secret_from_settings() { | |
| 170 | - | |
| 171 | - $settings = new ConvertKit_Settings(); | |
| 172 | - $settings->save( | |
| 173 | - array( | |
| 174 | - 'api_secret' => '', | |
| 175 | - ) | |
| 176 | - ); | |
| 177 | - | |
| 178 | - } | |
| 179 | - | |
| 180 | - /** | |
| 181 | - * Deletes any cached resources stored in the options table if they are a flat array | |
| 182 | - * that originates from between 1.6.0 and 1.9.5.2 of the Plugin. | |
| 183 | - * i.e. [id => name], rather than the expected [id => [id => '...', name => '...', ...]]. | |
| 184 | - * | |
| 185 | - * This will permit the Resources classes to fetch and cache the Form resources correctly | |
| 186 | - * from the API, and prevent fatal errors when a user activates the latest version of the Plugin | |
| 187 | - * on a site that previously had a very old Plugin version installed. | |
| 188 | - * | |
| 189 | - * @since 3.2.5 | |
| 190 | - */ | |
| 191 | - private function maybe_delete_old_cached_resource_structure() { | |
| 192 | - | |
| 193 | - // Define the resource options to check. | |
| 194 | - $resource_options = array( | |
| 195 | - 'convertkit_forms', | |
| 196 | - 'convertkit_landing_pages', | |
| 197 | - 'convertkit_tags', | |
| 198 | - ); | |
| 199 | - | |
| 200 | - foreach ( $resource_options as $resource_option ) { | |
| 201 | - // Get the resource option. | |
| 202 | - $resource = get_option( $resource_option, false ); | |
| 203 | - | |
| 204 | - // If the resource option does not exist, there's nothing to delete. | |
| 205 | - if ( false === $resource ) { | |
| 206 | - return; | |
| 207 | - } | |
| 208 | - | |
| 209 | - // If the resource structure is correct e.g. [id => [name => '...']], there's nothing to delete. | |
| 210 | - if ( is_array( reset( $resource ) ) ) { | |
| 211 | - return; | |
| 212 | - } | |
| 213 | - | |
| 214 | - // Delete the cached resource. | |
| 215 | - delete_option( $resource_option ); | |
| 216 | - } | |
| 217 | - | |
| 218 | - } | |
| 219 | - | |
| 220 | - /** | |
| 221 | 160 | * Adds form_id column and key to form entries database table. |
| 222 | 161 | * |
| 223 | 162 | * @since 3.0.4 |
| 224 | 163 | */ |
| @@ -620,9 +559,9 @@ | ||
| 620 | 559 | $convertkit_settings->get_api_secret(), |
| 621 | 560 | get_site_url() |
| 622 | 561 | ); |
| 623 | 562 | |
| 624 | - // Bail if an error occurred. | |
| 563 | + // Bail if an error occured. | |
| 625 | 564 | if ( is_wp_error( $result ) ) { |
| 626 | 565 | return; |
| 627 | 566 | } |
| 628 | 567 | |