示例#1
0
function backup_getid($backup_unique_code, $table, $old_id)
{
    global $CFG;
    $status = true;
    $status2 = true;
    $status = get_record("backup_ids", "backup_code", $backup_unique_code, "table_name", $table, "old_id", $old_id);
    //If info field = "infile", get file contents
    if (!empty($status->info) && $status->info == "infile") {
        $filename = $CFG->dataroot . "/temp/backup/" . $backup_unique_code . "/" . $backup_unique_code . "_" . $table . "_" . $old_id . ".info";
        //Read data from file
        $status2 = backup_file2data($filename, $info);
        if ($status2) {
            //unserialize data
            $status->info = unserialize($info);
        } else {
            $status = false;
        }
    } else {
        //Only if status (record exists)
        if ($status) {
            ////First strip slashes
            $temp = stripslashes($status->info);
            //Now unserialize
            $status->info = unserialize($temp);
        }
    }
    return $status;
}
示例#2
0
文件: lib.php 项目: vuchannguyen/web
function backup_getid($backup_unique_code, $table, $old_id)
{
    global $CFG, $DB;
    $status = true;
    $status2 = true;
    $status = $DB->get_record("backup_ids", array("backup_code" => $backup_unique_code, "table_name" => $table, "old_id" => $old_id));
    //If info field = "infile", get file contents
    if (!empty($status->info) && $status->info == "infile") {
        $filename = $CFG->dataroot . "/temp/backup/" . $backup_unique_code . "/" . $backup_unique_code . "_" . $table . "_" . $old_id . ".info";
        //Read data from file
        $status2 = backup_file2data($filename, $info);
        if ($status2) {
            //unserialize data
            $status->info = unserialize($info);
        } else {
            $status = false;
        }
    } else {
        //Only if status (record exists)
        if (!empty($status->info)) {
            if ($status->info === 'needed') {
                // TODO: ugly hack - fix before 1.9.1
                debugging('Incorrect string "needed" in $status->info, please fix the code (table:' . $table . '; old_id:' . $old_id . ').', DEBUG_DEVELOPER);
            } else {
                ////First strip slashes
                $temp = $status->info;
                //Now unserialize
                $status->info = unserialize($temp);
            }
        }
    }
    return $status;
}
示例#3
0
文件: lib.php 项目: r007/PMoodle
function backup_getid($backup_unique_code, $table, $old_id)
{
    global $CFG;
    $status = true;
    $status2 = true;
    $status = get_record("backup_ids", "backup_code", $backup_unique_code, "table_name", $table, "old_id", $old_id);
    //If info field = "infile", get file contents
    if (!empty($status->info) && $status->info == "infile") {
        $filename = $CFG->dataroot . "/temp/backup/" . $backup_unique_code . "/" . $backup_unique_code . "_" . $table . "_" . $old_id . ".info";
        //Read data from file
        $status2 = backup_file2data($filename, $info);
        if ($status2) {
            //unserialize data
            $status->info = unserialize($info);
        } else {
            $status = false;
        }
    } else {
        //Only if status (record exists)
        if (!empty($status->info)) {
            if ($status->info === 'needed') {
                //DAN - Commented out of incremental backup process - will fix this when upstream fixes it. :-)
                // TODO: ugly hack - fix before 1.9.1
                //  debugging('Incorrect string "needed" in $status->info, please fix the code (table:'.$table.'; old_id:'.$old_id.').', DEBUG_DEVELOPER);
            } else {
                ////First strip slashes
                $temp = stripslashes($status->info);
                //Now unserialize
                $status->info = unserialize($temp);
            }
        }
    }
    return $status;
}