Skip to content

Commit

Permalink
Merge branch 'hotfix/1.3.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
danielmilner committed May 23, 2019
2 parents 2a4db10 + d083ddc commit f67b15e
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 80 deletions.
116 changes: 58 additions & 58 deletions ccbpress-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: CCBPress Core
* Plugin URI: https://ccbpress.com/
* Description: Display information from Church Community Builder on your WordPress site.
* Version: 1.3.5
* Version: 1.3.6
* Author: CCBPress <info@ccbpress.com>
* Author URI: https://ccbpress.com/
* Text Domain: ccbpress-core
Expand All @@ -28,15 +28,15 @@
*/
class CCBPress_Core {

/**
* Instance
*
* @var CCBPress_Core The one true CCBPress_Core
* @since 1.0.0
*/
/**
* Instance
*
* @var CCBPress_Core The one true CCBPress_Core
* @since 1.0.0
*/
private static $instance;

/**
/**
* CCBPress Transients Object
*
* @var object
Expand All @@ -45,63 +45,63 @@ class CCBPress_Core {
public $transients;

/**
* CCBPress CCB Object
*
* @var object
* @since 1.0.0
*/
* CCBPress CCB Object
*
* @var object
* @since 1.0.0
*/
public $ccb;

/**
* CCBPress Sync Object
*
* @var object
* @since 1.0.0
*/
public $sync;
* CCBPress Sync Object
*
* @var object
* @since 1.0.0
*/
public $sync;

/**
* CCBPress Version
*
* @var string
* @since 1.0.0
*/
public $version = '1.3.5';
* CCBPress Version
*
* @var string
* @since 1.0.0
*/
public $version = '1.3.6';

/**
* Main CCBPress_Core Instance
*
* Insures that only one instance of CCBPress_Core exists in memory at any
* one time.
*
* @since 1.0
* @static
* @staticvar array $instance
* @uses CCBPress_Core::includes() Include the required files
* @see CCBPress_Core()
* @return The one true CCBPress_Core
*/
public static function instance() {

if ( ! isset( self::$instance ) && ! ( self::$instance instanceof CCBPress_Core ) ) {

self::$instance = new CCBPress_Core;
self::$instance->setup_constants();
self::$instance->includes();

self::$instance->transients = new CCBPress_Transients();
self::$instance->ccb = new CCBPress_Connection();
self::$instance->get = new CCBPress_Background_Get();
* Main CCBPress_Core Instance
*
* Insures that only one instance of CCBPress_Core exists in memory at any
* one time.
*
* @since 1.0
* @static
* @staticvar array $instance
* @uses CCBPress_Core::includes() Include the required files
* @see CCBPress_Core()
* @return The one true CCBPress_Core
*/
public static function instance() {

if ( ! isset( self::$instance ) && ! ( self::$instance instanceof CCBPress_Core ) ) {

self::$instance = new CCBPress_Core();
self::$instance->setup_constants();
self::$instance->includes();

self::$instance->transients = new CCBPress_Transients();
self::$instance->ccb = new CCBPress_Connection();
self::$instance->get = new CCBPress_Background_Get();

self::$instance->init();
self::$instance->transients->init();
self::$instance->ccb->init();

}
}

return self::$instance;
return self::$instance;

}
}

/**
* Setup plugin constants
Expand Down Expand Up @@ -170,7 +170,7 @@ private function includes() {
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/import.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/upgrades.php';
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/admin/admin-rest-api.php';

// Blocks.
require_once CCBPRESS_CORE_PLUGIN_DIR . 'includes/blocks.php';

Expand Down Expand Up @@ -243,14 +243,14 @@ public static function unschedule_cron() {

/**
* Display a warning that cron is disabled
*
*
* @since 1.3.0
*
*
* @return void
*/
public static function cron_disabled() {
global $pagenow;

if ( 'admin.php' !== $pagenow ) {
return;
}
Expand All @@ -268,14 +268,14 @@ public static function cron_disabled() {

/**
* Display a warning that alternative cron is enabled
*
*
* @since 1.3.2
*
*
* @return void
*/
public static function cron_alternate() {
global $pagenow;

if ( 'admin.php' !== $pagenow ) {
return;
}
Expand Down
43 changes: 23 additions & 20 deletions includes/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
/**
* CCBPress - Import
*
* @since 1.0.3
* @package CCBPress Core
* @since 1.0.3
* @package CCBPress Core
*/

// Exit if accessed directly.
Expand Down Expand Up @@ -33,9 +33,9 @@ public static function init() {

/**
* Reset the impor status
*
*
* @since 1.1.12
*
*
* @return void
*/
public static function reset() {
Expand All @@ -45,9 +45,9 @@ public static function reset() {

/**
* Reschedule the import job
*
*
* @since 1.1.12
*
*
* @return void
*/
public static function reschedule() {
Expand Down Expand Up @@ -160,30 +160,33 @@ public static function import_complete() {

/**
* Check if the queue is empty
*
*
* @since 1.3.2
*
*
* @return boolean
*/
public static function is_queue_empty() {

global $wpdb;

$table = $wpdb->options;
$column = 'option_name';

if ( is_multisite() ) {
$table = $wpdb->sitemeta;
$column = 'meta_key';
}

$key = $wpdb->esc_like( 'wp_ccbpress_get_batch_' ) . '%';
$count = $wpdb->get_var( $wpdb->prepare( "
SELECT COUNT(*)
FROM {$table}
WHERE {$column} LIKE %s
", $key ) );


$key = $wpdb->esc_like( 'wp_ccbpress_get_batch_' ) . '%';
$count = $wpdb->get_var(
$wpdb->prepare(
"SELECT COUNT(*)
FROM {$table}
WHERE {$column} LIKE %s",
$key
)
);

return ( $count > 0 ) ? false : true;

}
Expand All @@ -197,7 +200,7 @@ public static function find_stalled_imports() {
$is_stalled = false;
$in_progress = false;
$job_cron_exists = false;
$job_queue_exists = self::is_queue_empty();
$job_queue_exists = ! self::is_queue_empty();

if ( false !== get_option( 'ccbpress_import_in_progress', false ) ) {
$in_progress = true;
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [CCBPress Core](https://ccbpress.com/)

![Plugin Version](https://img.shields.io/wordpress/plugin/v/ccbpress-core.svg?maxAge=2592000) ![Total Downloads](https://img.shields.io/wordpress/plugin/dt/ccbpress-core.svg?maxAge=2592000) ![WordPress Compatibility](https://img.shields.io/wordpress/v/ccbpress-core.svg?maxAge=2592000)
![Plugin Version](https://img.shields.io/wordpress/plugin/v/ccbpress-core.svg) ![WordPress Compatibility](https://img.shields.io/wordpress/v/ccbpress-core.svg) ![Total Downloads](https://img.shields.io/wordpress/plugin/dt/ccbpress-core.svg)

Introducing the easiest way to display information from Church Community Builder
(CCB) on your church WordPress site.
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: church, ccb, church community builder, chms, gutenberg
Requires at least: 4.3
Tested up to: 5.2
Requires PHP: 5.3
Stable tag: 1.3.5
Stable tag: 1.3.6
License: GPLv2 or later
License URI: http://ww.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -45,6 +45,9 @@ Extend the capabilities of CCBPress with these add-ons:

== Changelog ==

= 1.3.6 =
* Fixed an issue with the stalled import detection.

= 1.3.5 =
* Added a task to the hourly maintenance that looks for stalled import jobs and deletes them.
* Adjusted some parameters to help import jobs run more reliably on some hosts.
Expand Down

0 comments on commit f67b15e

Please sign in to comment.