Skip to content

Commit

Permalink
version 1.0.1, scheduling fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
akeskitalo committed Jul 13, 2016
1 parent e27a33b commit da3be9d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions admin/class-kivi-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

}
1 change: 0 additions & 1 deletion includes/class-kivi-activator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class Kivi_Activator {
* @since 1.0.0
*/
public static function activate() {
add_filter( 'cron_schedules', 'kivi_add_30_minutes_schedule' );
}

}
4 changes: 3 additions & 1 deletion includes/class-kivi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
10 changes: 5 additions & 5 deletions kivi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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+
Expand All @@ -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;
}
Expand Down

0 comments on commit da3be9d

Please sign in to comment.