Skip to content

Commit

Permalink
IMAP: Do not load inbox spawner if auto-connect is on.
Browse files Browse the repository at this point in the history
If auto-connect is off, we'll rely on the old "page load to spawn inbox
check" method.

If auto-connect is on, we're going to be using the auto-connect admin option
to manually ping the IMAP inbox from the admin settings page.  This will
prevent duplicate IMAP connections from occurring and will also workaround
using wp_remote_post() to spawn the inbox check.  This logic will be
added in subsequent commits.

See #40.
  • Loading branch information
r-a-y committed Mar 7, 2017
1 parent 48ecd06 commit 0e0bebb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions includes/bp-rbe-hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@

// imap mode hooks
if ( ! bp_rbe_is_inbound() ) {
// cron - only run on the root blog and if WP cron is not active
if ( bp_is_root_blog() && ! defined( 'DOING_CRON' ) ) {
/*
* Cron - only run if:
* - We're the root blog and if WP cron is not active
* - And if auto-connect is off.
*/
if ( bp_is_root_blog() && ! defined( 'DOING_CRON' ) && 1 !== (int) bp_rbe_get_setting( 'keepaliveauto' ) ) {
add_action( 'init', 'bp_rbe_should_connect', 20 );
add_action( 'init', 'bp_rbe_run_inbox_listener', 999 );
}
Expand Down

0 comments on commit 0e0bebb

Please sign in to comment.