Making WordPress.org


Ignore:
Timestamp:
12/19/2017 04:22:37 PM (9 years ago)
Author:
obenland
Message:

PLugins: Clean up formatting with phpcbf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-manager.php

    r5453 r6287  
    1818
    1919                // The actual cron hooks.
    20                 add_action( 'plugin_directory_meta_sync',        array( __NAMESPACE__ . '\Meta_Sync', 'cron_trigger' ) );
    21                 add_action( 'plugin_directory_svn_sync',         array( __NAMESPACE__ . '\SVN_Watcher', 'cron_trigger' ) );
     20                add_action( 'plugin_directory_meta_sync', array( __NAMESPACE__ . '\Meta_Sync', 'cron_trigger' ) );
     21                add_action( 'plugin_directory_svn_sync', array( __NAMESPACE__ . '\SVN_Watcher', 'cron_trigger' ) );
    2222                add_action( 'plugin_directory_update_api_check', array( __NAMESPACE__ . '\API_Update_Updater', 'cron_trigger' ) );
    2323
    2424                // A cronjob to check cronjobs
    25                 add_action( 'plugin_directory_check_cronjobs',   array( $this, 'register_cron_tasks' ) );
     25                add_action( 'plugin_directory_check_cronjobs', array( $this, 'register_cron_tasks' ) );
    2626
    2727                // Register the wildcard cron hook tasks.
     
    3636         */
    3737        public function register_schedules( $schedules ) {
    38                 $schedules['every_30s'] = array( 'interval' => 30, 'display' => 'Every 30 seconds' );
    39                 $schedules['every_120s'] = array( 'interval' => 120, 'display' => 'Every 120 seconds' );
     38                $schedules['every_30s']  = array(
     39                        'interval' => 30,
     40                        'display'  => 'Every 30 seconds',
     41                );
     42                $schedules['every_120s'] = array(
     43                        'interval' => 120,
     44                        'display'  => 'Every 120 seconds',
     45                );
    4046
    4147                return $schedules;
     
    121127                                        if ( ! $next_timestamp || $next_timestamp === $timestamp ) {
    122128                                                $events[] = [
    123                                                         'hook'      => $cron_item['_job']->hook,
    124                                                         'args'      => $cron_item['_job']->args,
    125                                                         'nextrun'   => $timestamp,
     129                                                        'hook'    => $cron_item['_job']->hook,
     130                                                        'args'    => $cron_item['_job']->args,
     131                                                        'nextrun' => $timestamp,
    126132                                                ];
    127133                                        }
     
    164170                                        }
    165171
    166                                         $event['_job']->args = $data['args'];
     172                                        $event['_job']->args    = $data['args'];
    167173                                        $event['_job']->nextrun = $data['nextrun'];
    168174                                        $event['_job']->save();
     
    227233         */
    228234        public function register_cron_tasks() {
    229                 if ( ! wp_next_scheduled ( 'plugin_directory_meta_sync' ) ) {
     235                if ( ! wp_next_scheduled( 'plugin_directory_meta_sync' ) ) {
    230236                        wp_schedule_event( time() + 60, 'hourly', 'plugin_directory_meta_sync' );
    231237                }
    232                 if ( ! wp_next_scheduled ( 'plugin_directory_svn_sync' ) ) {
     238                if ( ! wp_next_scheduled( 'plugin_directory_svn_sync' ) ) {
    233239                        wp_schedule_event( time() + 60, 'every_30s', 'plugin_directory_svn_sync' );
    234240                }
    235                 if ( ! wp_next_scheduled ( 'plugin_directory_update_api_check' ) ) {
     241                if ( ! wp_next_scheduled( 'plugin_directory_update_api_check' ) ) {
    236242                        wp_schedule_event( time() + 60, 'hourly', 'plugin_directory_update_api_check' );
    237243                }
    238                 if ( ! wp_next_scheduled ( 'plugin_directory_check_cronjobs' ) ) {
     244                if ( ! wp_next_scheduled( 'plugin_directory_check_cronjobs' ) ) {
    239245                        wp_schedule_event( time() + 60, 'every_120s', 'plugin_directory_check_cronjobs' );
    240246                }
     
    257263                );
    258264
    259                 foreach ( $cron_array as $timestamp => $handlers ) {
    260                         if ( ! is_numeric( $timestamp ) ) {
    261                                 continue;
    262                         }
    263                         foreach ( $handlers as $hook => $jobs ) {
    264                                 $pos = strpos( $hook, ':' );
    265                                 if ( ! $pos ) {
     265                if ( is_array( $cron_array ) ) {
     266                        foreach ( $cron_array as $timestamp => $handlers ) {
     267                                if ( ! is_numeric( $timestamp ) ) {
    266268                                        continue;
    267269                                }
    268270
    269                                 $partial_hook = substr( $hook, 0, $pos );
    270 
    271                                 if ( isset( $wildcard_cron_tasks[ $partial_hook ] ) ) {
    272                                         add_action( $hook, $wildcard_cron_tasks[ $partial_hook ], 10, PHP_INT_MAX );
     271                                foreach ( $handlers as $hook => $jobs ) {
     272                                        $pos = strpos( $hook, ':' );
     273                                        if ( ! $pos ) {
     274                                                continue;
     275                                        }
     276
     277                                        $partial_hook = substr( $hook, 0, $pos );
     278
     279                                        if ( isset( $wildcard_cron_tasks[ $partial_hook ] ) ) {
     280                                                add_action( $hook, $wildcard_cron_tasks[ $partial_hook ], 10, PHP_INT_MAX );
     281                                        }
    273282                                }
    274283                        }
Note: See TracChangeset for help on using the changeset viewer.