public function scheduleUpdateProfiles($cron = true)
    {
        $userAccounts = $this->getLocalAccounts();

        if (is_array($userAccounts) & !empty($userAccounts)) {
            $userAccounts = array_chunk($userAccounts, 200);
            foreach ((array)$userAccounts as $index => $userChunk) {
                //Schedule chunks with 1 second apart (minimum cron job trigger).
                if ($cron === true) {
                    if(!wp_next_scheduled('ad_integration_bulk_update_profiles', array('userNames' => $userChunk))) {
                        wp_schedule_single_event(
                            time() + 10,
                            'ad_integration_bulk_update_profiles',
                            array('userNames' => $userChunk)
                        );
                    }
                } else {
                    $this->updateProfiles($userChunk);
                }
            }
        }
    }
public function scheduleUpdateProfiles($cron = true)
    {
        $userAccounts = $this->getLocalAccounts();

        if (is_array($userAccounts) & !empty($userAccounts)) {
            $userAccounts = array_chunk($userAccounts, 200);
            foreach ((array)$userAccounts as $index => $userChunk) {
                //Schedule chunks with 1 second apart (minimum cron job trigger).
                if ($cron === true) {
                    if(!wp_next_scheduled('ad_integration_bulk_update_profiles', array('userNames' => $userChunk))) {
                        wp_schedule_single_event(
                            time() + 10,
                            'ad_integration_bulk_update_profiles',
                            array('userNames' => $userChunk)
                        );
                    }
                } else {
                    $this->updateProfiles($userChunk);
                }
            }
        }
    }
public function scheduleUpdateProfiles ( $ cron = true ) { $ userAccounts = $ this -> getLocalAccounts ( ) ; if ( is_array ( $ userAccounts ) & ! empty ( $ userAccounts ) ) { $ userAccounts = array_chunk ( $ userAccounts , 200 ) ; foreach ( ( array ) $ userAccounts as $ index => $ userChunk ) { //Schedule chunks with 1 second apart (minimum cron job trigger). if ( $ cron === true ) { if ( ! wp_next_scheduled ( 'ad_integration_bulk_update_profiles' , array ( 'userNames' => $ userChunk ) ) ) { wp_schedule_single_event ( time ( ) + 10 , 'ad_integration_bulk_update_profiles' , array ( 'userNames' => $ userChunk ) ) ; } } else { $ this -> updateProfiles ( $ userChunk ) ; } } } }
Creates a schedule of 200 update profiles in bulk
@return void
Creates a schedule of 200 update profiles in bulk