当前位置: 首页>>代码示例>>PHP>>正文


PHP backup_flush函数代码示例

本文整理汇总了PHP中backup_flush函数的典型用法代码示例。如果您正苦于以下问题:PHP backup_flush函数的具体用法?PHP backup_flush怎么用?PHP backup_flush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了backup_flush函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: webscheme_restore_mods

function webscheme_restore_mods($mod, $restore)
{
    global $CFG;
    $status = true;
    //Get record from backup_ids
    $data = backup_getid($restore->backup_unique_code, $mod->modtype, $mod->id);
    if ($data) {
        //Now get completed xmlized object
        $info = $data->info;
        // (STOLEN FROM CHOICE) if necessary, write to restorelog and adjust date/time fields
        if ($restore->course_startdateoffset) {
            restore_log_date_changes('Webscheme', $restore, $info['MOD']['#'], array('TIMEOPEN', 'TIMECLOSE'));
        }
        //traverse_xmlize($info);                                                                     //Debug
        //print_object ($GLOBALS['traverse_array']);                                                  //Debug
        //$GLOBALS['traverse_array']="";                                                              //Debug
        //Now, build the WEBSCHEME record structure
        $webscheme->course = $restore->course_id;
        $webscheme->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        $webscheme->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
        $webscheme->introformat = backup_todb($info['MOD']['#']['INTROFORMAT']['0']['#']);
        $webscheme->timecreated = $info['MOD']['#']['TIMECREATED']['0']['#'];
        $webscheme->timemodified = $info['MOD']['#']['TIMEMODIFIED']['0']['#'];
        $ws_settings = $info['MOD']['#']['WS_SETTINGS']['0']['#'];
        $ws_settings = backup_todb(html_entity_decode($ws_settings));
        $webscheme->ws_settings = $ws_settings;
        $ws_events = $info['MOD']['#']['WS_EVENTS']['0']['#'];
        $ws_events = backup_todb(html_entity_decode($ws_events));
        $webscheme->ws_events = $ws_events;
        $ws_initexpr = $info['MOD']['#']['WS_INITEXPR']['0']['#'];
        $ws_initexpr = backup_todb(html_entity_decode($ws_initexpr));
        $webscheme->ws_initexpr = $ws_initexpr;
        $ws_loadurls = $info['MOD']['#']['WS_LOADURLS']['0']['#'];
        $ws_loadurls = backup_todb(html_entity_decode($ws_loadurls));
        $webscheme->ws_loadurls = $ws_loadurls;
        $ws_html = $info['MOD']['#']['WS_HTML']['0']['#'];
        $ws_html = backup_todb(html_entity_decode($ws_html));
        $webscheme->ws_html = $ws_html;
        //The structure is equal to the db, so insert the webscheme
        //  ah?  Do we need to addslashes or anything?
        $newid = insert_record("webscheme", $webscheme);
        //Do some output
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("modulename", "webscheme") . " \"" . format_string($webscheme->name, true) . "\"</li>";
        }
        backup_flush(300);
        if ($newid) {
            //We have the newid, update backup_ids
            backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid);
        } else {
            $status = false;
        }
    } else {
        $status = false;
    }
    return $status;
}
开发者ID:andrewhuang,项目名称:webscheme,代码行数:57,代码来源:restorelib.php

示例2: wwassignment_restore_mods

function wwassignment_restore_mods($mod, $restore)
{
    global $CFG;
    $status = true;
    //error_log("mod id ".$mod->id);
    //         if ($mod->id == "66666") {
    //         	$wwlinkdata  = backup_getid($restore->backup_unique_code,"wwassignment_bridge","wwassignment_bridge");
    //             error_log("wwlink data ".print_r($wwlinkdata, true ));
    //             return $status;
    //          }
    //Get record from backup_ids
    $data = backup_getid($restore->backup_unique_code, $mod->modtype, $mod->id);
    if ($data) {
        //Now get completed xmlized object
        $info = $data->info;
        //if necessary, write to restorelog and adjust date/time fields
        if ($restore->course_startdateoffset) {
            //restore_log_date_changes('Wwassignment', $restore, $info['MOD']['#'], array('TIMEDUE', 'TIMEAVAILABLE'));
        }
        //traverse_xmlize($info);                                                                     //Debug
        //print_object ($GLOBALS['traverse_array']);                                                  //Debug
        //$GLOBALS['traverse_array']="";                                                              //Debug
        //Now, build the ASSIGNMENT record structure
        $wwassignment->course = $restore->course_id;
        $wwassignment->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        $wwassignment->description = backup_todb($info['MOD']['#']['DESCRIPTION']['0']['#']);
        $wwassignment->webwork_set = backup_todb($info['MOD']['#']['WEBWORK_SET']['0']['#']);
        $wwassignment->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
        //The structure is equal to the db, so insert the assignment
        $newid = insert_record("wwassignment", $wwassignment);
        //Do some output
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("modulename", "wwassignment") . " \"" . format_string(stripslashes($wwassignment->name), true) . "\"</li>";
        }
        backup_flush(300);
        if ($newid) {
            //We have the newid, update backup_ids
            backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid);
        } else {
            $status = false;
        }
    } else {
        $status = false;
    }
    //error_log("mod id is ".print_r($mod,true));
    return $status;
}
开发者ID:bjornbe,项目名称:wwassignment,代码行数:47,代码来源:restorelib.php

示例3: restore

 function restore($old_question_id, $new_question_id, $info, $restore)
 {
     global $DB;
     $status = true;
     //Get the truefalse array
     if (array_key_exists('TRUEFALSE', $info['#'])) {
         $truefalses = $info['#']['TRUEFALSE'];
     } else {
         $truefalses = array();
     }
     //Iterate over truefalse
     for ($i = 0; $i < sizeof($truefalses); $i++) {
         $tru_info = $truefalses[$i];
         //Now, build the question_truefalse record structure
         $truefalse = new stdClass();
         $truefalse->question = $new_question_id;
         $truefalse->trueanswer = stripslashes(backup_todb($tru_info['#']['TRUEANSWER']['0']['#']));
         $truefalse->falseanswer = stripslashes(backup_todb($tru_info['#']['FALSEANSWER']['0']['#']));
         ////We have to recode the trueanswer field
         $answer = backup_getid($restore->backup_unique_code, "question_answers", $truefalse->trueanswer);
         if ($answer) {
             $truefalse->trueanswer = $answer->new_id;
         }
         ////We have to recode the falseanswer field
         $answer = backup_getid($restore->backup_unique_code, "question_answers", $truefalse->falseanswer);
         if ($answer) {
             $truefalse->falseanswer = $answer->new_id;
         }
         //The structure is equal to the db, so insert the question_truefalse
         $newid = $DB->insert_record("question_truefalse", $truefalse);
         //Do some output
         if (($i + 1) % 50 == 0) {
             if (!defined('RESTORE_SILENTLY')) {
                 echo ".";
                 if (($i + 1) % 1000 == 0) {
                     echo "<br />";
                 }
             }
             backup_flush(300);
         }
         if (!$newid) {
             $status = false;
         }
     }
     return $status;
 }
开发者ID:e-rasvet,项目名称:reader,代码行数:46,代码来源:questiontype.php

示例4: adobeconnect_pages_restore_mods

function adobeconnect_pages_restore_mods($adobeconnectid, $info, $restore)
{
    global $CFG;
    $status = true;
    //Get the lesson_elements array
    $meetgroups = $info['MOD']['#']['MEETINGGROUPS']['0']['#']['MEETINGGROUP'];
    //Iterate over lesson pages (they are held in their logical order)
    $prevpageid = 0;
    for ($i = 0; $i < sizeof($meetgroups); $i++) {
        $meetgroup_info = $meetgroups[$i];
        //traverse_xmlize($ele_info);                                                          //Debug
        //print_object ($GLOBALS['traverse_array']);                                           //Debug
        //$GLOBALS['traverse_array']="";                                                       //Debug
        //Now, build the lesson_pages record structure
        $oldid = backup_todb($meetgroup_info['#']['ID']['0']['#']);
        $meeting = new stdClass();
        $meeting->instanceid = $adobeconnectid;
        $meeting->meetingscoid = backup_todb($meetgroup_info['#']['MEETINGSCOID']['0']['#']);
        $meeting->groupid = backup_todb($meetgroup_info['#']['GROUPID']['0']['#']);
        //We have to recode the groupid field
        $group = restore_group_getid($restore, $meeting->groupid);
        if ($group) {
            $meeting->groupid = $group->new_id;
        }
        //The structure is equal to the db, so insert the certificate_issue
        $newid = insert_record("adobeconnect_meeting_groups", $meeting);
        //Do some output
        if (($i + 1) % 10 == 0) {
            if (!defined('RESTORE_SILENTLY')) {
                echo ".";
                if (($i + 1) % 200 == 0) {
                    echo "<br/>";
                }
            }
            backup_flush(300);
        }
        if ($newid) {
            //We have the newid, update backup_ids (restore logs will use it!!)
            backup_putid($restore->backup_unique_code, "adobeconnect_meeting_groups", $oldid, $newid);
        } else {
            $status = false;
        }
    }
    return $status;
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:45,代码来源:restorelib.php

示例5: poodllpairwork_restore_mods

/**
 * restores a complete module
 * @param object $mod
 * @param object $restore
 * @uses $CFG
 */
function poodllpairwork_restore_mods($mod, $restore)
{
    global $CFG;
    $status = true;
    //Get record from backup_ids
    $data = backup_getid($restore->backup_unique_code, $mod->modtype, $mod->id);
    if ($data) {
        //Now get completed xmlized object
        $info = $data->info;
        //traverse_xmlize($info);                                                                     //Debug
        //print_object ($GLOBALS['traverse_array']);                                                  //Debug
        //$GLOBALS['traverse_array']="";                                                              //Debug
        //Now, build the poodllpairwork record structure
        $poodllpairwork->course = $restore->course_id;
        $poodllpairwork->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        $poodllpairwork->intro = backup_todb($info['MOD']['#']['INTRO']['0']['#']);
        $poodllpairwork->introa = backup_todb($info['MOD']['#']['INTROA']['0']['#']);
        $poodllpairwork->introb = backup_todb($info['MOD']['#']['INTROB']['0']['#']);
        $poodllpairwork->sessiontype = backup_todb($info['MOD']['#']['SESSIONTYPE']['0']['#']);
        $poodllpairwork->introformat = backup_todb($info['MOD']['#']['INTROFORMAT']['0']['#']);
        $poodllpairwork->timecreated = backup_todb($info['MOD']['#']['TIMECREATED']['0']['#']);
        $poodllpairwork->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
        //The structure is equal to the db, so insert the poodllpairwork
        $newid = insert_record('poodllpairwork', $poodllpairwork);
        //Do some output
        echo '<ul><li>' . get_string('modulename', 'poodllpairwork') . " \"" . $poodllpairwork->name . "\"<br>";
        backup_flush(300);
        if ($newid) {
            //We have the newid, update backup_ids
            backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid);
            //Now restore files
            $status = $status && poodllpairwork_restore_files($mod->id, $newid, $restore);
        } else {
            $status = false;
        }
        //Finalize ul
        echo '</ul>';
    } else {
        $status = false;
    }
    return $status;
}
开发者ID:laiello,项目名称:poodll,代码行数:48,代码来源:restorelib.php

示例6: bigbluebutton_restore_mods

function bigbluebutton_restore_mods($mod, $restore)
{
    global $CFG;
    $status = true;
    //Get record from backup_ids
    $data = backup_getid($restore->backup_unique_code, $mod->modtype, $mod->id);
    if ($data) {
        //Now get completed xmlized object
        $info = $data->info;
        //traverse_xmlize($info);                                                                     //Debug
        //print_object ($GLOBALS['traverse_array']);                                                  //Debug
        //$GLOBALS['traverse_array']="";                                                              //Debug
        //Now, build the LABEL record structure
        $bigbluebutton->course = $restore->course_id;
        $bigbluebutton->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        $bigbluebutton->moderatorpass = backup_todb($info['MOD']['#']['MODERATORPASS']['0']['#']);
        $bigbluebutton->viewerpass = backup_todb($info['MOD']['#']['VIEWERPASS']['0']['#']);
        $bigbluebutton->wait = backup_todb($info['MOD']['#']['WAIT']['0']['#']);
        $bigbluebutton->meetingid = backup_todb($info['MOD']['#']['MEETINGID']['0']['#']);
        $bigbluebutton->timemodified = backup_todb($info['MOD']['#']['TIMEMODIFIED']['0']['#']);
        //The structure is equal to the db, so insert the bigbluebutton
        $newid = insert_record("bigbluebutton", $bigbluebutton);
        //Do some output
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("modulename", "bigbluebutton") . " \"" . format_string(stripslashes($bigbluebutton->name), true) . "\"</li>";
        }
        backup_flush(300);
        if ($newid) {
            //We have the newid, update backup_ids
            backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid);
        } else {
            $status = false;
        }
    } else {
        $status = false;
    }
    return $status;
}
开发者ID:netspotau,项目名称:bigbluebutton-integrations,代码行数:38,代码来源:restorelib.php

示例7: label_decode_content_links_caller

function label_decode_content_links_caller($restore)
{
    global $CFG, $DB;
    $status = true;
    if ($labels = $DB->get_records('label', array('course' => $restore->course_id), '', "id,content")) {
        $i = 0;
        //Counter to send some output to the browser to avoid timeouts
        foreach ($labels as $label) {
            //Increment counter
            $i++;
            $content = $label->intro;
            $result = restore_decode_content_links_worker($content, $restore);
            if ($result != $content) {
                //Update record
                $label->intro = $result;
                $status = $DB->update_record("label", $label);
                if (debugging()) {
                    if (!defined('RESTORE_SILENTLY')) {
                        echo '<br /><hr />' . s($content) . '<br />changed to<br />' . s($result) . '<hr /><br />';
                    }
                }
            }
            //Do some output
            if (($i + 1) % 5 == 0) {
                if (!defined('RESTORE_SILENTLY')) {
                    echo ".";
                    if (($i + 1) % 100 == 0) {
                        echo "<br />";
                    }
                }
                backup_flush(300);
            }
        }
    }
    return $status;
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:36,代码来源:restorelib.php

示例8: skype_decode_content_links_caller

function skype_decode_content_links_caller($restore)
{
    global $CFG;
    $status = true;
    if ($skypes = get_records_sql("SELECT l.id, l.participants\n                                   FROM {$CFG->prefix}skype l\n                                   WHERE l.course = {$restore->course_id}")) {
        $i = 0;
        //Counter to send some output to the browser to avoid timeouts
        foreach ($skypes as $skype) {
            //Increment counter
            $i++;
            $participants = $skype->participants;
            $result = restore_decode_content_links_worker($participants, $restore);
            if ($result != $participants) {
                //Update record
                $skype->participants = addslashes($result);
                $status = update_record("skype", $skype);
                if ($CFG->debug > 7) {
                    if (!defined('RESTORE_SILENTLY')) {
                        echo '<br /><hr />' . s($content) . '<br />changed to<br />' . s($result) . '<hr /><br />';
                    }
                }
            }
            //Do some output
            if (($i + 1) % 5 == 0) {
                if (!defined('RESTORE_SILENTLY')) {
                    echo ".";
                    if (($i + 1) % 100 == 0) {
                        echo "<br />";
                    }
                }
                backup_flush(300);
            }
        }
    }
    return $status;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:36,代码来源:restorelib.php

示例9: wwassignment_restore_mods

function wwassignment_restore_mods($mod, $restore)
{
    global $CFG;
    $status = true;
    //Get record from backup_ids
    $data = backup_getid($restore->backup_unique_code, $mod->modtype, $mod->id);
    if ($data) {
        //Now get completed xmlized object
        $info = $data->info;
        //traverse_xmlize($info);                                                                     //Debug
        //print_object ($GLOBALS['traverse_array']);                                                  //Debug
        //$GLOBALS['traverse_array']="";                                                              //Debug
        //Now, build the QUIZ record structure
        $wwassignment = new stdClass();
        $wwassignment->course = $restore->course_id;
        $wwassignment->name = backup_todb($info['MOD']['#']['NAME']['0']['#']);
        $wwassignment->description = backup_todb($info['MOD']['#']['DESCRIPTION']['0']['#']);
        $wwassignment->webwork_set = backup_todb($info['MOD']['#']['WEBWORK_SET']['0']['#']);
        //The structure is equal to the db, so insert the quiz
        $newid = insert_record("wwassignment", $wwassignment);
        //Do some output
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("modulename", "wwassignment") . " \"" . format_string(stripslashes($wwassignment->name), true) . "\"</li>";
        }
        backup_flush(300);
        if ($newid) {
            //We have the newid, update backup_ids
            backup_putid($restore->backup_unique_code, $mod->modtype, $mod->id, $newid);
        } else {
            $status = false;
        }
    } else {
        $status = false;
    }
    return $status;
}
开发者ID:bjornbe,项目名称:wwassignment,代码行数:36,代码来源:restorelib.php

示例10: label_decode_content_links_caller

function label_decode_content_links_caller($restore)
{
    global $CFG;
    $status = true;
    if ($labels = get_records_sql("SELECT l.id, l.content\n                                   FROM {$CFG->prefix}label l\n                                   WHERE l.course = {$restore->course_id}")) {
        $i = 0;
        //Counter to send some output to the browser to avoid timeouts
        foreach ($labels as $label) {
            //Increment counter
            $i++;
            $content = $label->content;
            $result = restore_decode_content_links_worker($content, $restore);
            if ($result != $content) {
                //Update record
                $label->content = addslashes($result);
                $status = update_record("label", $label);
                if (debugging()) {
                    if (!defined('RESTORE_SILENTLY')) {
                        echo '<br /><hr />' . s($content) . '<br />changed to<br />' . s($result) . '<hr /><br />';
                    }
                }
            }
            //Do some output
            if (($i + 1) % 5 == 0) {
                if (!defined('RESTORE_SILENTLY')) {
                    echo ".";
                    if (($i + 1) % 100 == 0) {
                        echo "<br />";
                    }
                }
                backup_flush(300);
            }
        }
    }
    return $status;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:36,代码来源:restorelib.php

示例11: backup_copy_user_files

function backup_copy_user_files($preferences)
{
    global $CFG;
    $status = true;
    //First we check that "user_files" exists and create it if necessary
    //in temp/backup/$backup_code  dir
    $status = check_and_create_user_files_dir($preferences->backup_unique_code);
    //now get a list of users that we need for this backup.
    $backup_users = get_recordset_select("backup_ids", "backup_code='{$preferences->backup_unique_code}' AND table_name='user'", "", "id, old_id");
    while ($user = rs_fetch_next_record($backup_users)) {
        //If this user's directory exists, copy it
        $userdir = make_user_directory($user->old_id, true);
        if (check_dir_exists($userdir)) {
            //first remove dirroot so we can split out the folders.
            $parts = explode('/', str_replace($CFG->dataroot . '/user/', '', $userdir));
            $status = true;
            if (is_array($parts)) {
                $group = $parts[0];
                $userid = $parts[1];
                // Create group dir first
                $status = check_dir_exists("{$CFG->dataroot}/temp/backup/{$preferences->backup_unique_code}/user_files/" . $group, true);
            }
            $status = $status && backup_copy_file($userdir, "{$CFG->dataroot}/temp/backup/{$preferences->backup_unique_code}/user_files/{$group}/{$user->old_id}");
        }
        //Do some output
        backup_flush(30);
    }
    rs_close($backup_users);
    return $status;
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:30,代码来源:backuplib.php

示例12: restore

 /**
  * Restores the data in the question
  *
  * This is used in question/restorelib.php
  */
 function restore($old_question_id, $new_question_id, $info, $restore)
 {
     $status = true;
     //Get the webworks array
     $webworks = $info['#']['WEBWORK'];
     //Iterate over webworks
     for ($i = 0; $i < sizeof($webworks); $i++) {
         $webwork_info = $webworks[$i];
         //Now, build the question_webwork record structure
         $webwork = new stdClass();
         $webwork->question = $new_question_id;
         $webwork->codecheck = backup_todb($webwork_info['#']['CODECHECK']['0']['#']);
         $webwork->code = backup_todb($webwork_info['#']['CODE']['0']['#']);
         $webwork->grading = backup_todb($webwork_info['#']['GRADING']['0']['#']);
         //The structure is equal to the db, so insert the question_shortanswer
         $newid = insert_record("question_webwork", $webwork);
         //Do some output
         if (($i + 1) % 50 == 0) {
             if (!defined('RESTORE_SILENTLY')) {
                 echo ".";
                 if (($i + 1) % 1000 == 0) {
                     echo "<br />";
                 }
             }
             backup_flush(300);
         }
         if (!$newid) {
             $status = false;
         }
     }
     return $status;
 }
开发者ID:xiongchiamiov,项目名称:wwmqt-svn,代码行数:37,代码来源:questiontype.php

示例13: restore

 function restore($old_question_id, $new_question_id, $info, $restore)
 {
     $status = true;
     //Get the calculated-s array
     $calculateds = $info['#']['CALCULATED'];
     //Iterate over calculateds
     for ($i = 0; $i < sizeof($calculateds); $i++) {
         $cal_info = $calculateds[$i];
         //traverse_xmlize($cal_info);                                                                 //Debug
         //print_object ($GLOBALS['traverse_array']);                                                  //Debug
         //$GLOBALS['traverse_array']="";                                                              //Debug
         //Now, build the question_calculated record structure
         $calculated->question = $new_question_id;
         $calculated->answer = backup_todb($cal_info['#']['ANSWER']['0']['#']);
         $calculated->tolerance = backup_todb($cal_info['#']['TOLERANCE']['0']['#']);
         $calculated->tolerancetype = backup_todb($cal_info['#']['TOLERANCETYPE']['0']['#']);
         $calculated->correctanswerlength = backup_todb($cal_info['#']['CORRECTANSWERLENGTH']['0']['#']);
         $calculated->correctanswerformat = backup_todb($cal_info['#']['CORRECTANSWERFORMAT']['0']['#']);
         ////We have to recode the answer field
         $answer = backup_getid($restore->backup_unique_code, "question_answers", $calculated->answer);
         if ($answer) {
             $calculated->answer = $answer->new_id;
         }
         //The structure is equal to the db, so insert the question_calculated
         $newid = insert_record("question_calculated", $calculated);
         //Do some output
         if (($i + 1) % 50 == 0) {
             if (!defined('RESTORE_SILENTLY')) {
                 echo ".";
                 if (($i + 1) % 1000 == 0) {
                     echo "<br />";
                 }
             }
             backup_flush(300);
         }
         //Now restore numerical_units
         $status = question_restore_numerical_units($old_question_id, $new_question_id, $cal_info, $restore);
         //Now restore dataset_definitions
         if ($status && $newid) {
             $status = question_restore_dataset_definitions($old_question_id, $new_question_id, $cal_info, $restore);
         }
         if (!$newid) {
             $status = false;
         }
     }
     return $status;
 }
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:47,代码来源:questiontype.php

示例14: endElementUsers

 function endElementUsers($parser, $tagName)
 {
     global $CFG;
     //Check if we are into USERS zone
     if ($this->tree[3] == "USERS") {
         //if (trim($this->content))                                                                     //Debug
         //    echo "C".str_repeat("&nbsp;",($this->level+2)*2).$this->getContents()."<br />\n";           //Debug
         //echo $this->level.str_repeat("&nbsp;",$this->level*2)."&lt;/".$tagName."&gt;<br />\n";          //Debug
         //Dependig of different combinations, do different things
         if ($this->level == 4) {
             switch ($tagName) {
                 case "USER":
                     //Increment counter
                     $this->counter++;
                     //Save to db, only save if record not already exist
                     // if there already is an new_id for this entry, just use that new_id?
                     $newuser = backup_getid($this->preferences->backup_unique_code, "user", $this->info->tempuser->id);
                     if (isset($newuser->new_id)) {
                         $newid = $newuser->new_id;
                     } else {
                         $newid = null;
                     }
                     backup_putid($this->preferences->backup_unique_code, "user", $this->info->tempuser->id, $newid, $this->info->tempuser);
                     //Do some output
                     if ($this->counter % 10 == 0) {
                         if (!defined('RESTORE_SILENTLY')) {
                             echo ".";
                             if ($this->counter % 200 == 0) {
                                 echo "<br />";
                             }
                         }
                         backup_flush(300);
                     }
                     //Delete temp obejct
                     unset($this->info->tempuser);
                     break;
             }
         }
         if ($this->level == 5) {
             switch ($tagName) {
                 case "ID":
                     $this->info->users[$this->getContents()] = $this->getContents();
                     $this->info->tempuser->id = $this->getContents();
                     break;
                 case "AUTH":
                     $this->info->tempuser->auth = $this->getContents();
                     break;
                 case "CONFIRMED":
                     $this->info->tempuser->confirmed = $this->getContents();
                     break;
                 case "POLICYAGREED":
                     $this->info->tempuser->policyagreed = $this->getContents();
                     break;
                 case "DELETED":
                     $this->info->tempuser->deleted = $this->getContents();
                     break;
                 case "USERNAME":
                     $this->info->tempuser->username = $this->getContents();
                     break;
                 case "PASSWORD":
                     $this->info->tempuser->password = $this->getContents();
                     break;
                 case "IDNUMBER":
                     $this->info->tempuser->idnumber = $this->getContents();
                     break;
                 case "FIRSTNAME":
                     $this->info->tempuser->firstname = $this->getContents();
                     break;
                 case "LASTNAME":
                     $this->info->tempuser->lastname = $this->getContents();
                     break;
                 case "EMAIL":
                     $this->info->tempuser->email = $this->getContents();
                     break;
                 case "EMAILSTOP":
                     $this->info->tempuser->emailstop = $this->getContents();
                     break;
                 case "ICQ":
                     $this->info->tempuser->icq = $this->getContents();
                     break;
                 case "SKYPE":
                     $this->info->tempuser->skype = $this->getContents();
                     break;
                 case "AIM":
                     $this->info->tempuser->aim = $this->getContents();
                     break;
                 case "YAHOO":
                     $this->info->tempuser->yahoo = $this->getContents();
                     break;
                 case "MSN":
                     $this->info->tempuser->msn = $this->getContents();
                     break;
                 case "PHONE1":
                     $this->info->tempuser->phone1 = $this->getContents();
                     break;
                 case "PHONE2":
                     $this->info->tempuser->phone2 = $this->getContents();
                     break;
                 case "INSTITUTION":
                     $this->info->tempuser->institution = $this->getContents();
//.........这里部分代码省略.........
开发者ID:kai707,项目名称:ITSA-backup,代码行数:101,代码来源:restorelib.php

示例15: econsole_decode_content_links_caller

function econsole_decode_content_links_caller($restore)
{
    global $CFG;
    $status = true;
    if ($econsoles = get_records_sql("SELECT e.id, e.content, e.url1, e.url2, e.url3, e.url4, e.url5, e.url6 \r\n                                   FROM {$CFG->prefix}econsole e\r\n                                   WHERE e.course = {$restore->course_id}")) {
        //Iterate over each econsole->intro
        $i = 0;
        //Counter to send some output to the browser to avoid timeouts
        foreach ($econsoles as $econsole) {
            //Increment counter
            $i++;
            $content1 = $econsole->content;
            $content2 = $econsole->url1;
            $content3 = $econsole->url2;
            $content4 = $econsole->url3;
            $content5 = $econsole->url4;
            $content6 = $econsole->url5;
            $content7 = $econsole->url6;
            $result1 = restore_decode_content_links_worker($content1, $restore);
            $result2 = restore_decode_content_links_worker($content2, $restore);
            $result3 = restore_decode_content_links_worker($content3, $restore);
            $result4 = restore_decode_content_links_worker($content4, $restore);
            $result5 = restore_decode_content_links_worker($content5, $restore);
            $result6 = restore_decode_content_links_worker($content6, $restore);
            $result7 = restore_decode_content_links_worker($content7, $restore);
            if ($result1 != $content1 || $result2 != $content2 || $result3 != $content3 || $result4 != $content4 || $result5 != $content5 || $result6 != $content6 || $result7 != $content7) {
                //Update record
                $econsole->content = addslashes($result1);
                $econsole->url1 = addslashes($result2);
                $econsole->url2 = addslashes($result3);
                $econsole->url3 = addslashes($result4);
                $econsole->url4 = addslashes($result5);
                $econsole->url5 = addslashes($result6);
                $econsole->url6 = addslashes($result7);
                $status = update_record("econsole", $econsole);
                if (debugging()) {
                    if (!defined('RESTORE_SILENTLY')) {
                        echo '<br /><hr />' . s($content1) . '<br />changed to<br />' . s($result1) . '<hr /><br />';
                        echo '<br /><hr />' . s($content2) . '<br />changed to<br />' . s($result2) . '<hr /><br />';
                        echo '<br /><hr />' . s($content3) . '<br />changed to<br />' . s($result3) . '<hr /><br />';
                        echo '<br /><hr />' . s($content4) . '<br />changed to<br />' . s($result4) . '<hr /><br />';
                        echo '<br /><hr />' . s($content5) . '<br />changed to<br />' . s($result5) . '<hr /><br />';
                        echo '<br /><hr />' . s($content6) . '<br />changed to<br />' . s($result6) . '<hr /><br />';
                        echo '<br /><hr />' . s($content7) . '<br />changed to<br />' . s($result7) . '<hr /><br />';
                    }
                }
            }
            //Do some output
            if (($i + 1) % 5 == 0) {
                if (!defined('RESTORE_SILENTLY')) {
                    echo ".";
                    if (($i + 1) % 100 == 0) {
                        echo "<br />";
                    }
                }
                backup_flush(300);
            }
        }
    }
    return $status;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:61,代码来源:restorelib.php


注:本文中的backup_flush函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。