MCPcopy Create free account
hub / github.com/BaseXdb/basex / run

Method run

basex-core/src/main/java/org/basex/core/cmd/DropBackup.java:27–47  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25 }
26
27 @Override
28 protected boolean run() {
29 final String pattern = args[0];
30 final boolean general = pattern.isEmpty();
31 if(!(general || Databases.validPattern(pattern))) return error(NAME_INVALID_X, pattern);
32
33 // loop through all databases and collect databases to be dropped
34 final Databases db = context.databases;
35 final User user = context.user();
36 final StringList names = general ? new StringList("") : db.list(user, pattern);
37 // if the given argument is not a database name, it could be the name of a backup file
38 if(names.isEmpty() && user.has(Perm.READ, pattern)) names.add(pattern);
39
40 // drop all backups
41 for(final String name : names) {
42 for(final String backup : db.backups(name)) {
43 drop(backup, soptions);
44 }
45 }
46 return info(BACKUP_DROPPED_X, pattern);
47 }
48
49 /**
50 * Drops a backup with the specified name.

Callers

nothing calls this directly

Calls 10

validPatternMethod · 0.95
listMethod · 0.95
hasMethod · 0.95
addMethod · 0.95
backupsMethod · 0.95
dropMethod · 0.95
infoMethod · 0.65
isEmptyMethod · 0.45
errorMethod · 0.45
userMethod · 0.45

Tested by

no test coverage detected