Ejemplo n.º 1
0
 /**
  * Sends an event when the user has updated
  * the Drupal module
  */
 public static function update_check()
 {
     $version = ShareaholicUtilities::get_option('version');
     if (ShareaholicUtilities::get_option('api_key') && $version != ShareaholicUtilities::get_version()) {
         ShareaholicUtilities::set_version(ShareaholicUtilities::get_version());
         ShareaholicUtilities::log_event('Upgrade', array('previous_plugin_version' => $version));
     }
 }
Ejemplo n.º 2
0
 /**
  * Runs any update code if the version is different from what's
  * stored in the settings. This will only run if we are on the
  * shareaholic admin page to minimize any concurrency issues.
  */
 public static function update()
 {
     if (isset($_GET['page']) && preg_match('/shareaholic/', $_GET['page'])) {
         if (!ShareaholicUtilities::has_accepted_terms_of_service()) {
             add_action('admin_notices', array('ShareaholicAdmin', 'show_terms_of_service'));
         } else {
             if (ShareaholicUtilities::get_version() != self::VERSION) {
                 ShareaholicUtilities::log_event("Upgrade", array('previous_plugin_version' => ShareaholicUtilities::get_version()));
                 ShareaholicUtilities::perform_update();
                 ShareaholicUtilities::set_version(self::VERSION);
                 ShareaholicUtilities::notify_content_manager_sitemap();
                 ShareaholicUtilities::notify_content_manager_singledomain();
                 // Call the share counts api to check for connectivity on update
                 if (has_action('wp_ajax_nopriv_shareaholic_share_counts_api') && has_action('wp_ajax_shareaholic_share_counts_api')) {
                     ShareaholicUtilities::share_counts_api_connectivity_check();
                 }
                 // Activate the Shareaholic Cron job for existing plugin users
                 ShareaholicCron::activate();
             }
         }
     }
 }