/** * This will push all the currently cached insert statements to be pushed * into the database * * @return void */ public static function push_urls_to_db() { foreach (self::$insert_statements as $stmt) { $insertSQL = 'INSERT INTO "StaticPagesQueue" ("Created", "LastEdited", "Priority", "URLSegment") VALUES ' . $stmt; DB::query($insertSQL); } self::remove_old_cache(self::$urls); // Flush the cache so DataObject::get works correctly if (!empty(self::$insert_statements) && DB::affectedRows()) { singleton(__CLASS__)->flushCache(); } self::$insert_statements = array(); }