Making WordPress.org

Changeset 9967


Ignore:
Timestamp:
06/16/2020 10:09:20 PM (4 years ago)
Author:
coffee2code
Message:

Developer theme: Add support for custom Markdown import interval.

If a non-default interval is specified, 'cron_schedules' must still separately be filtered to define it, otherwise default interval is used.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/import-docs.php

    r8685 r9967  
    3333     */
    3434    protected $manifest_url;
     35
     36    /**
     37     * The cron update interval schedule.
     38     *
     39     * @var string
     40     */
     41    protected $cron_interval = '15_minutes';
    3542
    3643    /**
     
    152159     */
    153160    public function register_cron_jobs() {
     161        // If configured cron interval does not exist, then fall back to default.
     162        if ( ! in_array( $this->cron_interval, array_keys( wp_get_schedules() ) ) ) {
     163            $this->cron_interval = '15_minutes';
     164        }
     165
    154166        if ( ! wp_next_scheduled( "devhub_{$this->post_type}_import_manifest" ) ) {
    155             wp_schedule_event( time(), '15_minutes', "devhub_{$this->post_type}_import_manifest" );
     167            wp_schedule_event( time(), $this->cron_interval, "devhub_{$this->post_type}_import_manifest" );
    156168        }
    157169
    158170        if ( ! wp_next_scheduled( "devhub_{$this->post_type}_import_all_markdown" ) ) {
    159             wp_schedule_event( time(), '15_minutes', "devhub_{$this->post_type}_import_all_markdown" );
     171            wp_schedule_event( time(), $this->cron_interval, "devhub_{$this->post_type}_import_all_markdown" );
    160172        }
    161173    }
Note: See TracChangeset for help on using the changeset viewer.