EDD_SL_Plugin_Updater.php
6 years ago
ad-ajax.php
6 years ago
ad-debug.php
8 years ago
ad-health-notices.php
6 years ago
ad-model.php
6 years ago
ad-select.php
9 years ago
ad.php
6 years ago
ad_ajax_callbacks.php
6 years ago
ad_group.php
6 years ago
ad_placements.php
6 years ago
ad_type_abstract.php
6 years ago
ad_type_content.php
6 years ago
ad_type_dummy.php
6 years ago
ad_type_group.php
6 years ago
ad_type_image.php
6 years ago
ad_type_plain.php
6 years ago
checks.php
6 years ago
compatibility.php
6 years ago
display-conditions.php
6 years ago
filesystem.php
8 years ago
frontend-notices.php
6 years ago
frontend_checks.php
6 years ago
plugin.php
6 years ago
upgrades.php
7 years ago
utils.php
6 years ago
visitor-conditions.php
6 years ago
widget.php
6 years ago
upgrades.php
44 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Upgrade logic from older data to new one |
| 5 | * |
| 6 | * the version number itself is changed in /admin/includes/class-notices.php::register_version_notices() |
| 7 | * |
| 8 | * @since 1.7 |
| 9 | * @todo we need internal markers to check if the update ran on a normal request and not AJAX, where it happened to break sometimes |
| 10 | */ |
| 11 | class Advanced_Ads_Upgrades { |
| 12 | |
| 13 | public function __construct(){ |
| 14 | |
| 15 | $internal_options = Advanced_Ads_Plugin::get_instance()->internal_options(); |
| 16 | |
| 17 | // the 'advanced_ads_edit_ads' capability was added to POST_TYPE_SLUG post type in this version |
| 18 | if ( ! isset( $internal_options['version'] ) || version_compare( $internal_options['version'], '1.7.2', '<' ) ) { |
| 19 | Advanced_Ads_Plugin::get_instance()->create_capabilities(); |
| 20 | } |
| 21 | |
| 22 | // suppress version update? |
| 23 | $suppress_version_number_update = false; |
| 24 | |
| 25 | // don’t upgrade if no previous version existed |
| 26 | if( ! empty( $internal_options['version'] ) ) { |
| 27 | |
| 28 | /** |
| 29 | * example of how to use an update |
| 30 | * this is no longer valid |
| 31 | */ |
| 32 | /* |
| 33 | if ( version_compare( $internal_options['version'], '1.7' ) == -1 ) { |
| 34 | // run with wp_loaded action, because WP_Query is needed and some plugins inject data that is not yet initialized |
| 35 | add_action( 'wp_loaded', array( $this, 'upgrade_1_7') ); |
| 36 | }*/ |
| 37 | } |
| 38 | |
| 39 | // update version notices – if this doesn’t happen here, the upgrade might run multiple times and destroy updated data |
| 40 | if( ! $suppress_version_number_update ){ |
| 41 | Advanced_Ads_Admin_Notices::get_instance()->update_version_number(); |
| 42 | } |
| 43 | } |
| 44 | } |