columns.php
12 years ago
counter.php
12 years ago
cron.php
12 years ago
frontend.php
12 years ago
functions.php
12 years ago
query.php
12 years ago
settings.php
12 years ago
update.php
12 years ago
widgets.php
12 years ago
update.php
34 lines
| 1 | <?php |
| 2 | if(!defined('ABSPATH')) exit; |
| 3 | |
| 4 | new Post_Views_Counter_Update(); |
| 5 | |
| 6 | class Post_Views_Counter_Update |
| 7 | { |
| 8 | public function __construct() |
| 9 | { |
| 10 | // actions |
| 11 | add_action('init', array(&$this, 'check_update')); |
| 12 | } |
| 13 | |
| 14 | |
| 15 | /** |
| 16 | * |
| 17 | */ |
| 18 | public function check_update() |
| 19 | { |
| 20 | if(!current_user_can('manage_options')) |
| 21 | return; |
| 22 | |
| 23 | // gets current database version |
| 24 | $current_db_version = get_option('post_views_counter_version', '1.0.0'); |
| 25 | |
| 26 | // new version? |
| 27 | if(version_compare($current_db_version, Post_Views_Counter()->get_attribute('defaults', 'version'), '<')) |
| 28 | { |
| 29 | // updates plugin version |
| 30 | update_option('post_views_counter_version', Post_Views_Counter()->get_attribute('defaults', 'version')); |
| 31 | } |
| 32 | } |
| 33 | } |
| 34 | ?> |