universidadort / moodle-tool_autobackups Goto Github PK
View Code? Open in Web Editor NEWMoodle util for deleting automated backups
Moodle util for deleting automated backups
After purging the backups, there are obsolete directory entries left in mdl_files.
You might want to add something like that after line https://github.com/UniversidadORT/moodle-tool_autobackups/blob/master/cli/purge_autobackups.php#L89:
$sql2 = 'select id, contextid, itemid, filepath, filename
from {files}
where component = \'backup\' and filearea = \'automated\' and filename = \'.\';';
$sth2 = $DB -> get_records_sql($sql2);
foreach ($sth2 as $id => $row) {
$file = $fs -> get_file($row -> contextid, 'backup', 'automated', $row -> itemid, $row -> filepath, $row -> filename);
if ($file) { // file found
if (array_key_exists('c', $options) || array_key_exists('x', $options)) {
// Delete directory
if ( $file -> delete() ) {
echo 'Directory sent to trash: ' . $file -> get_filename() . "\n";
} else {
echo 'Could not delete directory: ' . $file -> get_filename() . "\n";
}
}
}
}
Cheers,
Alex
Hi,
the from_unixtime() clause in https://github.com/UniversidadORT/moodle-tool_autobackups/blob/master/cli/purge_autobackups.php#L48 is MySQL-specific. How about getting the raw timestamp from the DB and let PHP format it when it is output?
Cheers,
Alex
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.