/** * Processes the droplet queue. * The queue processing involves extracting metadata from the droplets * saving these to the database. The extracted metadata could be links, * named entities, places * * @param string $channel Name of the channel whose droplets are to be processed */ public static function process($channel = NULL) { Kohana::$log->add(Log::INFO, "Post processing started"); Kohana::$log->write(); // If the queue is empty, fetch the unprocessed items from the DB self::$_queue = empty(self::$_queue) ? Model_Droplet::get_unprocessed_droplets(1000, $channel) : array_reverse(self::$_queue); // Process the items in the queue while (!empty(self::$_queue)) { // Pop that droplet! $droplet = array_pop(self::$_queue); // Submit the droplet to an extraction plugin Swiftriver_Event::run('swiftriver.droplet.extract_metadata', $droplet); // Add the droplet to the list of processed items self::$_processed[] = $droplet; // Mark the droplet as processed Model_Droplet::create_from_array(array($droplet)); } Kohana::$log->add(Log::INFO, "Post processing completed"); }