/** * Upgrade the logs structure. * * This upgrade routine was added in 1.3.0. * * @see Charitable_Upgrade::update_upgrade_system() * @see Charitable_upgrade::fix_donation_dates() * * @return void * @access public * @since 1.3.0 */ public function upgrade_logs() { /** * Deal with old upgrades. */ $log = get_option($this->upgrade_log_key, false); /** * Both of the 1.3 upgrades call this, so we need to make sure it hasn't run yet. */ if (is_array($log) && isset($log['legacy_logs'])) { return; } $last_log = !is_array($log) ? false : end($log); /** * If we're upgrading from prior to 1.1.0, we'll schedule events and flush rewrite rules. */ if (false === $last_log || version_compare($last_log['to'], '1.1.0', '<')) { Charitable_Cron::schedule_events(); // 1.1.0 upgrade flush_rewrite_rules(); // 1.2.0 upgrade } elseif (version_compare($last_log['to'], '1.2.0', '<')) { flush_rewrite_rules(); // 1.2.0 upgrade } /** * Update the upgrade log and save all old logs as 'legacy_logs'. */ if (is_array($log)) { $new_log = array('legacy_logs' => array('time' => time(), 'version' => charitable()->get_version(), 'logs' => $log)); update_option($this->upgrade_log_key, $new_log); } }
/** * Upgrade to version 1.1.0. * * This sets up the daily scheduled event. * * @return void * @access public * @since 1.1.0 */ public function upgrade_1_1_0() { Charitable_Cron::schedule_events(); }
/** * Finish the plugin installation. * * @return void * @access public * @static * @since 1.3.4 */ public static function finish_installing() { Charitable_Cron::schedule_events(); add_action('init', 'flush_rewrite_rules'); }