Example #1
0
 public function ud_wp_maybe_auto_update($lock_value)
 {
     $lock_result = get_option($this->lock_name);
     if ($lock_result != $lock_value) {
         return;
     }
     // Remove the lock, to allow the WP updater to claim it and proceed
     delete_option($lock_name);
     $this->do_not_filter_auto_backup = true;
     wp_maybe_auto_update();
 }
 protected function result()
 {
     add_action('automatic_updates_complete', array($this, 'get_update_results'), 100, 1);
     wp_maybe_auto_update();
     $result['log'] = $this->update_results;
     if (empty($result['log'])) {
         $possible_reasons_for_failure = Jetpack_Autoupdate::get_possible_failures();
         if ($possible_reasons_for_failure) {
             $result['log']['error'] = $possible_reasons_for_failure;
         }
     }
     return $result;
 }
 /**
  * @param string $sRedirect
  *
  * @return bool
  */
 public function doForceRunAutomaticUpdates($sRedirect = '')
 {
     $lock_name = 'auto_updater.lock';
     //ref: /wp-admin/includes/class-wp-upgrader.php
     delete_option($lock_name);
     if (!defined('DOING_CRON')) {
         define('DOING_CRON', true);
         // this prevents WP from disabling plugins pre-upgrade
     }
     // does the actual updating
     wp_maybe_auto_update();
     if (!empty($sRedirect)) {
         $this->doRedirect(network_admin_url($sRedirect));
     }
     return true;
 }