Пример #1
0
function backup_delete_old_data()
{
    global $CFG, $DB;
    //Change this if you want !!
    $hours = 4;
    //End change this
    $seconds = $hours * 60 * 60;
    $delete_from = time() - $seconds;
    //Now delete from tables
    $status = $DB->execute("DELETE FROM {backup_ids}\n                                 WHERE backup_code < ?", array($delete_from));
    if ($status) {
        $status = $DB->execute("DELETE FROM {backup_files}\n                                     WHERE backup_code < ?", array($delete_from));
    }
    //Now, delete old directory (if exists)
    if ($status) {
        $status = backup_delete_old_dirs($delete_from);
    }
    return $status;
}
Пример #2
0
function backup_delete_old_data()
{
    global $CFG;
    //Change this if you want !!
    $hours = 4;
    //End change this
    $seconds = $hours * 60 * 60;
    $delete_from = time() - $seconds;
    //Now delete from tables
    $status = execute_sql("DELETE FROM {$CFG->prefix}backup_ids\n                               WHERE backup_code < '{$delete_from}'", false);
    if ($status) {
        $status = execute_sql("DELETE FROM {$CFG->prefix}backup_files\n                                   WHERE backup_code < '{$delete_from}'", false);
    }
    //Now, delete old directory (if exists)
    if ($status) {
        $status = backup_delete_old_dirs($delete_from);
    }
    return $status;
}