src/dird/ua_cmds.c
static int delete_volume(UAContext *ua)
{
   MEDIA_DBR mr;
   char buf[1000];
   db_list_ctx lst;

   if (!select_media_dbr(ua, &mr)) {
      return 1;
   }
   ua->warning_msg(_("\nThis command will delete volume %s\n"
      "and all Jobs saved on that volume from the Catalog\n"),
      mr.VolumeName);

   if (find_arg(ua, "yes") >= 0) {
      ua->pint32_val = 1; /* Have "yes" on command line already" */
   } else {
      bsnprintf(buf, sizeof(buf), _("Are you sure you want to delete Volume \"%s\"? (yes/no): "),
         mr.VolumeName);
      if (!get_yesno(ua, buf)) {
         return 1;
      }
   }
   if (!ua->pint32_val) {
      return 1;
   }

   /* If not purged, do it */
   if (strcmp(mr.VolStatus, "Purged") != 0) {
      if (!db_get_volume_jobids(ua->jcr, ua->db, &mr, &lst)) {
         ua->error_msg(_("Can't list jobs on this volume\n"));
         return 1;
      }
      if (lst.count) {
         purge_jobs_from_catalog(ua, lst.list);
      }
   }

   db_delete_media_record(ua->jcr, ua->db, &mr);
   return 1;
}
/*
 * Delete media records from database -- dangerous
 */
Delete media records from database -- dangerous
Delete media records from database -- dangerous
static int delete_volume(UAContext *ua)
{
   MEDIA_DBR mr;
   char buf[1000];
   db_list_ctx lst;
   if (!select_media_dbr(ua, &mr)) {
      return 1;
   }
   ua->warning_msg(_("\nThis command will delete volume %s\n"
      "and all Jobs saved on that volume from the Catalog\n"),
      mr.VolumeName);
   if (find_arg(ua, "yes") >= 0) {
      ua->pint32_val = 1; 
   } else {
      bsnprintf(buf, sizeof(buf), _("Are you sure you want to delete Volume \"%s\"? (yes/no): "),
         mr.VolumeName);
      if (!get_yesno(ua, buf)) {
         return 1;
      }
   }
   if (!ua->pint32_val) {
      return 1;
   }
   if (strcmp(mr.VolStatus, "Purged") != 0) {
      if (!db_get_volume_jobids(ua->jcr, ua->db, &mr, &lst)) {
         ua->error_msg(_("Can't list jobs on this volume\n"));
         return 1;
      }
      if (lst.count) {
         purge_jobs_from_catalog(ua, lst.list);
      }
   }
   db_delete_media_record(ua->jcr, ua->db, &mr);
   return 1;
}
static int delete_volume ( UAContext * ua ) { MEDIA_DBR mr ; char buf [ 1000 ] ; db_list_ctx lst ; if ( ! select_media_dbr ( ua , & mr ) ) { return 1 ; } ua -> warning_msg ( _ ( " \n \n " " \n " ) , mr . VolumeName ) ; if ( find_arg ( ua , " " ) >= 0 ) { ua -> pint32_val = 1 ; } else { bsnprintf ( buf , sizeof ( buf ) , _ ( " \" \" " ) , mr . VolumeName ) ; if ( ! get_yesno ( ua , buf ) ) { return 1 ; } } if ( ! ua -> pint32_val ) { return 1 ; } if ( strcmp ( mr . VolStatus , " " ) != 0 ) { if ( ! db_get_volume_jobids ( ua -> jcr , ua -> db , & mr , & lst ) ) { ua -> error_msg ( _ ( " \n " ) ) ; return 1 ; } if ( lst . count ) { purge_jobs_from_catalog ( ua , lst . list ) ; } } db_delete_media_record ( ua -> jcr , ua -> db , & mr ) ; return 1 ; }
Delete media records from database -- dangerous
Delete media records from database -- dangerous
/* Have "yes" on command line already" */ /* If not purged, do it */