/** * @param SS_HTTPRequest $request */ public function run($request) { $compatibility = ContentReviewCompatability::start(); $now = class_exists("SS_Datetime") ? SS_Datetime::now()->URLDate() : SSDatetime::now()->URLDate(); // First grab all the pages with a custom setting $pages = Page::get("Page")->where("\"SiteTree\".\"NextReviewDate\" <= '{$now}'"); $overduePages = $this->getOverduePagesForOwners($pages); // Lets send one email to one owner with all the pages in there instead of no of pages // of emails. foreach ($overduePages as $memberID => $pages) { $this->notifyOwner($memberID, $pages); } ContentReviewCompatability::done($compatibility); }