Пример #1
0
function forum_backup_one_mod($bf, $preferences, $forum)
{
    global $CFG, $DB;
    if (is_numeric($forum)) {
        $forum = $DB->get_record('forum', array('id' => $forum));
    }
    $instanceid = $forum->id;
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print forum data
    fwrite($bf, full_tag("ID", 4, false, $forum->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "forum"));
    fwrite($bf, full_tag("TYPE", 4, false, $forum->type));
    fwrite($bf, full_tag("NAME", 4, false, $forum->name));
    fwrite($bf, full_tag("INTRO", 4, false, $forum->intro));
    fwrite($bf, full_tag("ASSESSED", 4, false, $forum->assessed));
    fwrite($bf, full_tag("ASSESSTIMESTART", 4, false, $forum->assesstimestart));
    fwrite($bf, full_tag("ASSESSTIMEFINISH", 4, false, $forum->assesstimefinish));
    fwrite($bf, full_tag("MAXBYTES", 4, false, $forum->maxbytes));
    fwrite($bf, full_tag("SCALE", 4, false, $forum->scale));
    fwrite($bf, full_tag("FORCESUBSCRIBE", 4, false, $forum->forcesubscribe));
    fwrite($bf, full_tag("TRACKINGTYPE", 4, false, $forum->trackingtype));
    fwrite($bf, full_tag("RSSTYPE", 4, false, $forum->rsstype));
    fwrite($bf, full_tag("RSSARTICLES", 4, false, $forum->rssarticles));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $forum->timemodified));
    fwrite($bf, full_tag("WARNAFTER", 4, false, $forum->warnafter));
    fwrite($bf, full_tag("BLOCKAFTER", 4, false, $forum->blockafter));
    fwrite($bf, full_tag("BLOCKPERIOD", 4, false, $forum->blockperiod));
    fwrite($bf, full_tag("COMPLETIONDISCUSSIONS", 4, false, $forum->completiondiscussions));
    fwrite($bf, full_tag("COMPLETIONREPLIES", 4, false, $forum->completionreplies));
    fwrite($bf, full_tag("COMPLETIONPOSTS", 4, false, $forum->completionposts));
    //if we've selected to backup users info, then execute backup_forum_suscriptions and
    //backup_forum_discussions
    if (backup_userdata_selected($preferences, 'forum', $forum->id)) {
        $status = backup_forum_subscriptions($bf, $preferences, $forum->id);
        if ($status) {
            $status = backup_forum_discussions($bf, $preferences, $forum->id);
        }
        if ($status) {
            $status = backup_forum_read($bf, $preferences, $forum->id);
        }
        if ($status) {
            $status = backup_forum_files_instance($bf, $preferences, $forum->id);
        }
    }
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}
Пример #2
0
function forum_backup_one_mod($bf, $preferences, $forum)
{
    global $CFG;
    include_once $CFG->dirroot . '/backup/incremental_backuplib.php';
    if (is_numeric($forum)) {
        $forum = get_record('forum', 'id', $forum);
    }
    $instanceid = $forum->id;
    $status = true;
    //Start mod
    fwrite($bf, start_tag("MOD", 3, true));
    //Print forum data
    fwrite($bf, full_tag("GUID", 4, false, get_backup_guid('forum', 'id', $forum->id)));
    fwrite($bf, full_tag("ID", 4, false, $forum->id));
    fwrite($bf, full_tag("MODTYPE", 4, false, "forum"));
    fwrite($bf, full_tag("TYPE", 4, false, $forum->type));
    fwrite($bf, full_tag("NAME", 4, false, $forum->name));
    fwrite($bf, full_tag("INTRO", 4, false, $forum->intro));
    fwrite($bf, full_tag("ASSESSED", 4, false, $forum->assessed));
    fwrite($bf, full_tag("ASSESSTIMESTART", 4, false, $forum->assesstimestart));
    fwrite($bf, full_tag("ASSESSTIMEFINISH", 4, false, $forum->assesstimefinish));
    fwrite($bf, full_tag("MAXBYTES", 4, false, $forum->maxbytes));
    fwrite($bf, full_tag("SCALE", 4, false, $forum->scale));
    fwrite($bf, full_tag("FORCESUBSCRIBE", 4, false, $forum->forcesubscribe));
    fwrite($bf, full_tag("TRACKINGTYPE", 4, false, $forum->trackingtype));
    fwrite($bf, full_tag("RSSTYPE", 4, false, $forum->rsstype));
    fwrite($bf, full_tag("RSSARTICLES", 4, false, $forum->rssarticles));
    fwrite($bf, full_tag("TIMEMODIFIED", 4, false, $forum->timemodified));
    fwrite($bf, full_tag("WARNAFTER", 4, false, $forum->warnafter));
    fwrite($bf, full_tag("BLOCKAFTER", 4, false, $forum->blockafter));
    fwrite($bf, full_tag("BLOCKPERIOD", 4, false, $forum->blockperiod));
    //if we've selected to backup users info, then execute backup_forum_suscriptions and
    //backup_forum_discussions
    if (backup_userdata_selected($preferences, 'forum', $forum->id)) {
        $status = backup_forum_subscriptions($bf, $preferences, $forum->id);
        if ($status) {
            $status = backup_forum_discussions($bf, $preferences, $forum->id);
        }
        if ($status) {
            $status = backup_forum_read($bf, $preferences, $forum->id);
        }
        if ($status) {
            $status = backup_forum_files_instance($bf, $preferences, $forum->id);
        }
    }
    //End mod
    $status = fwrite($bf, end_tag("MOD", 3, true));
    return $status;
}