[ Index ]

PHP Cross Reference of BuddyPress

title

Body

[close]

/src/bp-forums/bbpress/ -> bb-cron.php (source)

   1  <?php
   2  /**
   3   * bbPress Cron Implementation for hosts, which do not offer CRON or for which
   4   * the user has not setup a CRON job pointing to this file.
   5   *
   6   * The HTTP request to this file will not slow down the visitor who happens to
   7   * visit when the cron job is needed to run.
   8   *
   9   * @package bbPress
  10   */
  11  
  12  ignore_user_abort( true );
  13  
  14  if ( !empty( $_POST ) || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ) ) {
  15      die();
  16  }
  17  
  18  /**
  19   * Tell bbPress we are doing the CRON task.
  20   *
  21   * @var bool
  22   */
  23  define( 'DOING_CRON', true );
  24  
  25  /** Setup bbPress environment */
  26  require_once ( './bb-load.php' );
  27  
  28  if ( false === $crons = _get_cron_array() ) {
  29      die();
  30  }
  31  
  32  $keys = array_keys( $crons );
  33  $local_time = time();
  34  
  35  if ( !is_array( $crons ) || ( isset($keys[0]) && $keys[0] > $local_time ) ) {
  36      die();
  37  }
  38  
  39  foreach ( $crons as $timestamp => $cronhooks ) {
  40      if ( $timestamp > $local_time ) {
  41          break;
  42      }
  43      foreach ( $cronhooks as $hook => $keys ) {
  44          foreach ( $keys as $key => $args ) {
  45              $schedule = $args['schedule'];
  46              if ( $schedule != false ) {
  47                  $new_args = array( $timestamp, $schedule, $hook, $args['args'] );
  48                  call_user_func_array( 'wp_reschedule_event' , $new_args );
  49              }
  50              wp_unschedule_event( $timestamp, $hook, $args['args'] );
  51               do_action_ref_array( $hook, $args['args'] );
  52          }
  53      }
  54  }


Generated: Thu Dec 7 01:01:35 2017 Cross-referenced by PHPXref 0.7.1