protected function process_post_data($posts) {
        $discussionids = [];
        $forumids = [];
        $courseids = [];

        $this->log_start("Processing post information");

        $start = microtime(true);
        foreach ($posts as $id => $post) {
            $discussionids[$post->discussion] = true;
            $forumids[$post->forum] = true;
            $courseids[$post->course] = true;
            $this->add_data_for_post($post);
            $this->posts[$id] = $post;
        }
        $this->log_finish(sprintf("Processed %s posts", count($this->posts)));

        if (empty($this->posts)) {
            $this->log("No posts found. Returning early.");
            return;
        }

        // Please note, this order is intentional.
        // The forum cache makes use of the course.
        $this->log_start("Filling caches");

        $start = microtime(true);
        $this->log_start("Filling course cache", 1);
        $this->fill_course_cache(array_keys($courseids));
        $this->log_finish("Done", 1);

        $this->log_start("Filling forum cache", 1);
        $this->fill_forum_cache(array_keys($forumids));
        $this->log_finish("Done", 1);

        $this->log_start("Filling discussion cache", 1);
        $this->fill_discussion_cache(array_keys($discussionids));
        $this->log_finish("Done", 1);

        $this->log_start("Filling user subscription cache", 1);
        $this->fill_user_subscription_cache();
        $this->log_finish("Done", 1);

        $this->log_start("Filling digest cache", 1);
        $this->fill_digest_cache();
        $this->log_finish("Done", 1);

        $this->log_finish("All caches filled");

        $this->log_start("Queueing user tasks.");
        $this->queue_user_tasks();
        $this->log_finish("All tasks queued.");
    }
protected function process_post_data($posts) {
        $discussionids = [];
        $forumids = [];
        $courseids = [];

        $this->log_start("Processing post information");

        $start = microtime(true);
        foreach ($posts as $id => $post) {
            $discussionids[$post->discussion] = true;
            $forumids[$post->forum] = true;
            $courseids[$post->course] = true;
            $this->add_data_for_post($post);
            $this->posts[$id] = $post;
        }
        $this->log_finish(sprintf("Processed %s posts", count($this->posts)));

        if (empty($this->posts)) {
            $this->log("No posts found. Returning early.");
            return;
        }

        // Please note, this order is intentional.
        // The forum cache makes use of the course.
        $this->log_start("Filling caches");

        $start = microtime(true);
        $this->log_start("Filling course cache", 1);
        $this->fill_course_cache(array_keys($courseids));
        $this->log_finish("Done", 1);

        $this->log_start("Filling forum cache", 1);
        $this->fill_forum_cache(array_keys($forumids));
        $this->log_finish("Done", 1);

        $this->log_start("Filling discussion cache", 1);
        $this->fill_discussion_cache(array_keys($discussionids));
        $this->log_finish("Done", 1);

        $this->log_start("Filling user subscription cache", 1);
        $this->fill_user_subscription_cache();
        $this->log_finish("Done", 1);

        $this->log_start("Filling digest cache", 1);
        $this->fill_digest_cache();
        $this->log_finish("Done", 1);

        $this->log_finish("All caches filled");

        $this->log_start("Queueing user tasks.");
        $this->queue_user_tasks();
        $this->log_finish("All tasks queued.");
    }
protected function process_post_data ( $ posts ) { $ discussionids = [ ] ; $ forumids = [ ] ; $ courseids = [ ] ; $ this -> log_start ( "Processing post information" ) ; $ start = microtime ( true ) ; foreach ( $ posts as $ id => $ post ) { $ discussionids [ $ post -> discussion ] = true ; $ forumids [ $ post -> forum ] = true ; $ courseids [ $ post -> course ] = true ; $ this -> add_data_for_post ( $ post ) ; $ this -> posts [ $ id ] = $ post ; } $ this -> log_finish ( sprintf ( "Processed %s posts" , count ( $ this -> posts ) ) ) ; if ( empty ( $ this -> posts ) ) { $ this -> log ( "No posts found. Returning early." ) ; return ; } // Please note, this order is intentional. // The forum cache makes use of the course. $ this -> log_start ( "Filling caches" ) ; $ start = microtime ( true ) ; $ this -> log_start ( "Filling course cache" , 1 ) ; $ this -> fill_course_cache ( array_keys ( $ courseids ) ) ; $ this -> log_finish ( "Done" , 1 ) ; $ this -> log_start ( "Filling forum cache" , 1 ) ; $ this -> fill_forum_cache ( array_keys ( $ forumids ) ) ; $ this -> log_finish ( "Done" , 1 ) ; $ this -> log_start ( "Filling discussion cache" , 1 ) ; $ this -> fill_discussion_cache ( array_keys ( $ discussionids ) ) ; $ this -> log_finish ( "Done" , 1 ) ; $ this -> log_start ( "Filling user subscription cache" , 1 ) ; $ this -> fill_user_subscription_cache ( ) ; $ this -> log_finish ( "Done" , 1 ) ; $ this -> log_start ( "Filling digest cache" , 1 ) ; $ this -> fill_digest_cache ( ) ; $ this -> log_finish ( "Done" , 1 ) ; $ this -> log_finish ( "All caches filled" ) ; $ this -> log_start ( "Queueing user tasks." ) ; $ this -> queue_user_tasks ( ) ; $ this -> log_finish ( "All tasks queued." ) ; }
Process all posts and convert to appropriated hoc tasks.

@param   \stdClass[] $posts
Process all posts and convert to appropriated hoc tasks .