/**
  * check for existing backups
  *
  */
 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     $array = array($this->getFullLocationWithExtension());
     $arrayOfIDs = DatabasebackupLog::get()->map("ID", "ID")->toArray();
     for ($i = 0; $i < 100; $i++) {
         $array[] = $this->olderBackupFileName($array[0], $i);
     }
     foreach ($array as $fileLocation) {
         clearstatcache();
         if (file_exists($fileLocation)) {
             $obj = DatabasebackupLog::get()->filter(array("FullLocation" => $fileLocation))->First();
             if ($obj) {
                 //do nothing
             } else {
                 $className = $this->class;
                 $obj = new $className();
                 //make sure it has a full file location!
                 $obj->FullLocation = $fileLocation;
                 $obj->write();
             }
             unset($arrayOfIDs[$obj->ID]);
         }
     }
     $objects = DatabasebackupLog::get()->filter(array("ID" => $arrayOfIDs));
     foreach ($objects as $obj) {
         $obj->delete();
     }
 }
 function download($request)
 {
     $id = intval($request->param("ID"));
     if ($id) {
         $obj = DatabasebackupLog::get()->byID($id);
         return SS_HTTPRequest::send_file(file_get_contents($obj->FullLocation), basename($obj->FullLocation));
     }
     user_error("Could not action download", E_USER_WARNING);
 }