/** * Create a new scan * @param scan_type str: the plaintext id of the scan (eg. library) * @return scan_id */ public function addScan($scan_type) { $scan = new Scan(); $scan->scan_time = date('Y-m-d h:i:s'); $scan->scan_type = $scan_type; $scan->save(); $id = $scan->getId(); $scan->free(); unset($scan); if ($id) { return $id; } else { throw new Exception('Could not get a new scan id - please check your database is set up correctly'); } }