From da3be9d537aeee583b2d76d8fbc43ee562a20d74 Mon Sep 17 00:00:00 2001 From: Keskitalo Antti Date: Wed, 13 Jul 2016 11:47:04 +0300 Subject: [PATCH] version 1.0.1, scheduling fixes --- README.md | 15 ++++++++++++--- admin/class-kivi-admin.php | 6 +++--- includes/class-kivi-activator.php | 1 - includes/class-kivi.php | 4 +++- kivi.php | 10 +++++----- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 797f01e..b53859f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # KIVI WP-plugin -- Requires at least: 3.0.1 -- Tested up to: 3.4 -- Stable tag: 4.3 +- Requires at least: 4.0 +- Tested up to: 4.5.3 +- Stable tag: 1.0.1 - License: GPLv2 or later (http://www.gnu.org/licenses/gpl-2.0.html) ## Description @@ -59,3 +59,12 @@ for example: We are not too actively developing individual features for the plugin as it's meant to be a starting point for development anyways. However, we do fix bugs and for example add support for new data if such data appears in the source system. If there are specific needs you can of course contact our sales. We are also happy to accept any pull requests if they are generic enough and seem fit for our users. + +## Changelog + +** 1.0.1 ** +- Fix scheduling initalialization (the scheduling did not work at all) +- Change scheduling interval to 15 minutes + +** 1.0.0 ** +- Initial version diff --git a/admin/class-kivi-admin.php b/admin/class-kivi-admin.php index 4f5a55e..c8eb40a 100644 --- a/admin/class-kivi-admin.php +++ b/admin/class-kivi-admin.php @@ -405,13 +405,13 @@ public function register_kivi_item_post_type() { * the new xml and does it's stuff every 30 minutes. */ public function start_scheduler() { - if (! wp_next_scheduled ( 'kivi_hourly_sync' )) { - wp_schedule_event(time(), 'every30minutes', 'kivi_hourly_sync'); + if (! wp_next_scheduled ( 'kivi_items_sync' )) { + wp_schedule_event(time(), 'every15minutes', 'kivi_items_sync'); } } public function stop_scheduler() { - wp_clear_scheduled_hook('kivi_hourly_sync'); + wp_clear_scheduled_hook('kivi_items_sync'); } } diff --git a/includes/class-kivi-activator.php b/includes/class-kivi-activator.php index 1aea61f..7086121 100644 --- a/includes/class-kivi-activator.php +++ b/includes/class-kivi-activator.php @@ -20,7 +20,6 @@ class Kivi_Activator { * @since 1.0.0 */ public static function activate() { - add_filter( 'cron_schedules', 'kivi_add_30_minutes_schedule' ); } } diff --git a/includes/class-kivi.php b/includes/class-kivi.php index d03f898..b3299f5 100644 --- a/includes/class-kivi.php +++ b/includes/class-kivi.php @@ -161,13 +161,15 @@ private function define_admin_hooks() { $this->loader->add_action( 'admin_menu', $plugin_admin, 'kivi_register_menu_page' ); $this->loader->add_action( 'in_admin_header', $plugin_admin, 'show_status_bar' ); $this->loader->add_action( 'wp_ajax_kivi_sync', $plugin_admin, 'kivi_sync' ); - $this->loader->add_action( 'kivi_hourly_sync', $plugin_admin, 'kivi_sync' ); + $this->loader->add_action( 'kivi_items_sync', $plugin_admin, 'kivi_sync' ); $this->loader->add_action( 'wp_ajax_kivi_stop', $plugin_admin, 'kivi_stop' ); $this->loader->add_action( 'wp_ajax_kivi_reset', $plugin_admin, 'kivi_reset' ); $this->loader->add_action( 'wp_ajax_kivi_set_remote_url', $plugin_admin, 'kivi_set_remote_url' ); $this->loader->add_action( 'wp_ajax_kivi_save_settings', $plugin_admin, 'kivi_save_settings' ); $this->loader->add_action( 'wp_ajax_kivi_save_settings', $plugin_admin, 'register_kivi_item_post_type' ); + add_filter( 'cron_schedules', 'kivi_add_schedule' ); + } public function register_kivi_settings() { diff --git a/kivi.php b/kivi.php index e8b26d9..c651b6d 100644 --- a/kivi.php +++ b/kivi.php @@ -10,7 +10,7 @@ * Plugin Name: Kivi * Plugin URI: https://github.com/almamedia/kivi-wordpress * Description: A plugin for displaying KIVI real estate system items in WordPress - * Version: 1.0.0 + * Version: 1.0.1 * Author: Alma Medapartners Oy * Author URI: https://kivi.etuovi.com/ * License: GPL-2.0+ @@ -26,10 +26,10 @@ /* Schedule for kivi background jobs */ -function kivi_add_30_minutes_schedule( $schedules ) { - $schedules['every30minutes'] = array( - 'interval' => 1800, - 'display' => __('Every 30 minutes') +function kivi_add_schedule( $schedules ) { + $schedules['every15minutes'] = array( + 'interval' => 900, + 'display' => __('Every 15 minutes') ); return $schedules; }