private function truncateDataSetHistory($configurationID) { $prefix = Core::getDbTablePrefix(); $maxHistory = Core::getMaxDataSetHistorySize(); if (empty($maxHistory) || !is_numeric($maxHistory)) { return; } // first, get the ID of the oldest saved history item, according to however large this $response = Core::$db->query("\n SELECT *\n FROM {$prefix}configuration_history\n WHERE configuration_id = {$configurationID}\n ORDER BY history_id DESC\n LIMIT 1\n OFFSET {$maxHistory}\n "); if ($response["success"] && !empty($response["results"])) { $results = mysqli_fetch_assoc($response["results"]); $historyID = $results["history_id"]; Core::$db->query("\n DELETE FROM {$prefix}configuration_history\n WHERE configuration_id = {$configurationID} AND history_id <= {$historyID}\n "); } }