Exemplo n.º 1
0
 function test_get_incremental()
 {
     $crnt_course = get_records('incremental_instance', 'courseid', '1', 'timecreated');
     //print_object($crnt_course);
     $newbkup = array_pop($crnt_course);
     //get latest course hash.
     while ($newbkup->hash == $newbkup->filename) {
         //make sure the record is valid - if both hash and filename are exact - this is related to a client update - not the server backup.
         $newbkup = array_pop($crnt_course);
         //get latest course hash.
     }
     $returnfile = new object();
     $incremental = get_incremental($newbkup->hash);
     if ($incremental->name == 'uptodate') {
         $this->assertTrue(true);
     } else {
         $this->assertTrue(false);
     }
 }
Exemplo n.º 2
0
<?php

/*
 * This file is called by the offline Moodle SERVER and sends the existing
 * incremental or Full backup if no incremental is available to the client.
 * 
 */
require '../config.php';
require_once "{$CFG->dirroot}/backup/backup_sch_incremental.php";
require_once "{$CFG->dirroot}/backup/incremental_backuplib.php";
require_once "{$CFG->dirroot}/backup/backuplib.php";
require_once "{$CFG->dirroot}/backup/lib.php";
require_once "{$CFG->dirroot}/lib/filelib.php";
$currenthash = required_param('hash');
// hash
$action = required_param('action');
// what to do?
$file = get_incremental($currenthash);
if ($file) {
    if ($action == 'curldownload') {
        readfile_chunked($file->path . $file->name);
    } elseif ($action == 'download') {
        send_file($file->path, $file->name, 864, 0, true, true);
    } elseif ($action == 'check') {
        echo $file->name;
    } else {
        echo 'no action specified';
    }
} else {
    echo 'ERROR!!! No file returned';
}