Warning: session_start(): open(/var/lib/php/sessions/sess_fsks1u828sd8o81o5ppg64igas, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
sS progID = #1007510;
p {
new L files;
new Map ageMap;
Pattern pat = Pattern.compile("^(.*)\\.backup(20\\d\\d)(\\d\\d)(\\d\\d)-(\\d\\d)$");
for (File f : listFilesNotDirs(programDir(progID))) {
S s = f.getName();
Matcher matcher = pat.matcher(s);
continue unless matcher.find();
S originalName = matcher.group(1);
continue unless eq(originalName, "concepts.structure.gz");
//print("Found backup: " + sfu(matcherGroups(matcher)));
int year = matcherInt(matcher, 2);
int month = matcherInt(matcher, 3);
int day = matcherInt(matcher, 4);
int hour = matcherInt(matcher, 5);
long time = timestampFromYMDH(year, month, day, hour);
double age = ((now()-time)/1000.0/60/60/24;
//print("Age: " + age + " days");
ageMap.put(f, age);
files.add(f);
}
sortByMap_inPlace(files, ageMap);
double lastAge = -1;
for (File f : files) {
double age = ageMap.get(f);
if (!shouldKeep(age, lastAge))
print("Deleting: " + f);
else {
print("Keeping: " + f);
lastAge = age;
}
}
}
// age = age in days
sbool shouldKeep(double age, double lastAge) {
if (age <= 2) true;
if (age >= lastAge+1) true;
false;
}