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


PHP restore_decode_content_links_worker函数代码示例

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


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

示例1: restore_data

 public static function restore_data($data, $restore)
 {
     $linknamestatus = $linkurlstatus = false;
     foreach ($data as $datum) {
         switch ($datum->name) {
             case 'linkname':
                 // We just want to know that it is there
                 $linknamestatus = true;
                 break;
             case 'linkurl':
                 $content = $datum->value;
                 $result = restore_decode_content_links_worker($content, $restore);
                 if ($result != $content) {
                     $datum->value = addslashes($result);
                     if (debugging() and !defined('RESTORE_SILENTLY')) {
                         echo '<br /><hr />' . s($content) . '<br />changed to<br />' . s($result) . '<hr /><br />';
                     }
                     $linkurlstatus = update_record('pagemenu_link_data', $datum);
                 } else {
                     $linkurlstatus = true;
                 }
                 break;
             default:
                 debugging('Deleting unknown data type: ' . $datum->name);
                 // Not recognized
                 delete_records('pagemenu_link_data', 'id', $datum->id);
                 break;
         }
     }
     return $linkurlstatus and $linknamestatus;
 }
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:31,代码来源:link.class.php

示例2: decode_content_links_caller

 /**
  * This function makes all the necessary calls to {@link restore_decode_content_links_worker()}
  * function in order to decode contents of this block from the backup
  * format to destination site/course in order to mantain inter-activities
  * working in the backup/restore process.
  *
  * This is called from {@link restore_decode_content_links()} function in the restore process.
  *
  * NOTE: There is no block instance when this method is called.
  *
  * @param object $restore Standard restore object
  * @return boolean
  **/
 function decode_content_links_caller($restore)
 {
     global $CFG;
     if ($restored_blocks = get_records_select("backup_ids", "table_name = 'block_instance' AND backup_code = {$restore->backup_unique_code} AND new_id > 0", "", "new_id")) {
         $restored_blocks = implode(',', array_keys($restored_blocks));
         $sql = "SELECT bi.*\n                      FROM {$CFG->prefix}block_instance bi\n                           JOIN {$CFG->prefix}block b ON b.id = bi.blockid\n                     WHERE b.name = 'html' AND bi.id IN ({$restored_blocks})";
         if ($instances = get_records_sql($sql)) {
             foreach ($instances as $instance) {
                 $blockobject = block_instance('featured', $instance);
                 $blockobject->config->text = restore_decode_absolute_links($blockobject->config->text);
                 $blockobject->config->text = restore_decode_content_links_worker($blockobject->config->text, $restore);
                 $blockobject->instance_config_commit($blockobject->pinned);
             }
         }
     }
     return true;
 }
开发者ID:NextEinstein,项目名称:riverhills,代码行数:30,代码来源:block_featured.php

示例3: customlabel_decode_content_links_caller

function customlabel_decode_content_links_caller($restore)
{
    global $CFG;
    $status = true;
    $sql = "\r\n            SELECT \r\n                l.id, \r\n                l.content\r\n            FROM \r\n                {$CFG->prefix}customlabel l\r\n            WHERE \r\n                l.course = {$restore->course_id}\r\n        ";
    if ($customlabels = get_records_sql($sql)) {
        $i = 0;
        //Counter to send some output to the browser to avoid timeouts
        foreach ($customlabels as $customlabel) {
            //Increment counter
            $i++;
            $content = $customlabel->content;
            $result = restore_decode_content_links_worker($content, $restore);
            if ($result != $content) {
                //Update record
                $customlabel->content = addslashes($result);
                $status = update_record("customlabel", $customlabel);
                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:nadavkav,项目名称:MoodleTAO,代码行数:37,代码来源:restorelib.php

示例4: groupselect_decode_content_links_caller

function groupselect_decode_content_links_caller($restore)
{
    global $CFG;
    $status = true;
    if ($groupselects = get_records_sql("SELECT l.id, l.intro\n                                   FROM {$CFG->prefix}groupselect l\n                                   WHERE l.course = {$restore->course_id}")) {
        $i = 0;
        //Counter to send some output to the browser to avoid timeouts
        foreach ($groupselects as $groupselect) {
            //Increment counter
            $i++;
            $intro = $groupselect->intro;
            $result = restore_decode_content_links_worker($intro, $restore);
            if ($result != $intro) {
                //Update record
                $groupselect->intro = addslashes($result);
                $status = update_record("groupselect", $groupselect);
                if (debugging()) {
                    if (!defined('RESTORE_SILENTLY')) {
                        echo '<br /><hr />' . s($intro) . '<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:NigelCunningham,项目名称:moodle-mod_groupselect,代码行数:36,代码来源:restorelib.php

示例5: 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

示例6: 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

示例7: lightboxgallery_decode_content_links_caller

function lightboxgallery_decode_content_links_caller($restore)
{
    global $CFG;
    $status = true;
    if ($galleries = get_records_sql("SELECT l.id, l.description FROM {$CFG->prefix}lightboxgallery l WHERE l.course = {$restore->course_id}")) {
        $i = 0;
        foreach ($galleries as $gallery) {
            $i++;
            $content = $gallery->description;
            $result = restore_decode_content_links_worker($content, $restore);
            if ($content != $result) {
                $gallery->description = addslashes($result);
                $status = update_record('lightboxgallery', $gallery);
                if (debugging()) {
                    if (!defined('RESTORE_SILENTLY')) {
                        echo '<br /><hr />' . s($content) . '<br />changed to<br />' . s($result) . '<hr /><br />';
                    }
                }
            }
            if (($i + 1) % 50 == 0) {
                if (!defined('RESTORE_SILENTLY')) {
                    echo '.';
                    if (($i + 1) % 1000 == 0) {
                        echo '<br />';
                    }
                }
                backup_flush(300);
            }
        }
    }
    return $status;
}
开发者ID:itziko,项目名称:Moodle-jQuery-Lightbox-Gallery,代码行数:32,代码来源:restorelib.php

示例8: restore_decode_content_links

function restore_decode_content_links($restore)
{
    global $CFG, $DB;
    $status = true;
    if (!defined('RESTORE_SILENTLY')) {
        echo "<ul>";
    }
    // Recode links in the course summary.
    if (!defined('RESTORE_SILENTLY')) {
        echo '<li>' . get_string('from') . ' ' . get_string('course');
    }
    $course = $DB->get_record('course', array('id' => $restore->course_id), 'id,summary');
    $coursesummary = restore_decode_content_links_worker($course->summary, $restore);
    if ($coursesummary != $course->summary) {
        $course->summary = addslashes($coursesummary);
        if (!update_record('course', $course)) {
            $status = false;
        }
    }
    if (!defined('RESTORE_SILENTLY')) {
        echo '</li>';
    }
    // Recode links in section summaries.
    $sections = $DB->get_records('course_sections', array('course', $restore->course_id), 'id,summary');
    if ($sections) {
        if (!defined('RESTORE_SILENTLY')) {
            echo '<li>' . get_string('from') . ' ' . get_string('sections');
        }
        foreach ($sections as $section) {
            $sectionsummary = restore_decode_content_links_worker($section->summary, $restore);
            if ($sectionsummary != $section->summary) {
                $section->summary = addslashes($sectionsummary);
                if (!update_record('course_sections', $section)) {
                    $status = false;
                }
            }
        }
        if (!defined('RESTORE_SILENTLY')) {
            echo '</li>';
        }
    }
    // Restore links in modules.
    foreach ($restore->mods as $name => $info) {
        //If the module is being restored
        if (isset($info->restore) && $info->restore == 1) {
            //Check if the xxxx_decode_content_links_caller exists
            include_once "{$CFG->dirroot}/mod/{$name}/restorelib.php";
            $function_name = $name . "_decode_content_links_caller";
            if (function_exists($function_name)) {
                if (!defined('RESTORE_SILENTLY')) {
                    echo "<li>" . get_string("from") . " " . get_string("modulenameplural", $name);
                }
                $status = $function_name($restore) && $status;
                if (!defined('RESTORE_SILENTLY')) {
                    echo '</li>';
                }
            }
        }
    }
    // Process all html text also in blocks too
    if (!defined('RESTORE_SILENTLY')) {
        echo '<li>' . get_string('from') . ' ' . get_string('blocks');
    }
    if ($blocks = $DB->get_records('block', array('visible' => 1))) {
        foreach ($blocks as $block) {
            if ($blockobject = block_instance($block->name)) {
                $blockobject->decode_content_links_caller($restore);
            }
        }
    }
    if (!defined('RESTORE_SILENTLY')) {
        echo '</li>';
    }
    // Restore links in questions.
    require_once "{$CFG->dirroot}/question/restorelib.php";
    if (!defined('RESTORE_SILENTLY')) {
        echo '<li>' . get_string('from') . ' ' . get_string('questions', 'quiz');
    }
    $status = question_decode_content_links_caller($restore) && $status;
    if (!defined('RESTORE_SILENTLY')) {
        echo '</li>';
    }
    if (!defined('RESTORE_SILENTLY')) {
        echo "</ul>";
    }
    return $status;
}
开发者ID:e-rasvet,项目名称:reader,代码行数:87,代码来源:restorelib.php

示例9: mail_decode_content_links_caller

function mail_decode_content_links_caller($restore)
{
    global $CFG;
    $status = true;
    //Process every Mail in the course
    if ($mails = get_records_sql("SELECT m.id, m.summary\r\n                                   FROM {$CFG->prefix}mail m\r\n                                   WHERE m.course = {$restore->course_id}")) {
        //Iterate over each forum->intro
        $i = 0;
        //Counter to send some output to the browser to avoid timeouts
        foreach ($mails as $mail) {
            //Increment counter
            $i++;
            $content_summary = $mail->summary;
            $result_summary = restore_decode_content_links_worker($content_summary, $restore);
            if ($result_summary != $content_summary) {
                //Update record
                $mail->summary = addslashes($result_summary);
                $status = update_record("mail", $mail);
                if ($CFG->debug > 7) {
                    if (!defined('RESTORE_SILENTLY')) {
                        echo '<br /><hr />' . s($content_summary) . '<br />changed to<br />' . s($result_summary) . '<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:henriquecrang,项目名称:e-UNI,代码行数:38,代码来源:restorelib.php

示例10: wiki_decode_content_links_caller

function wiki_decode_content_links_caller($restore)
{
    global $CFG, $DB;
    $status = true;
    //Process every wiki PAGE in the course
    if ($pages = $DB->get_records_sql("SELECT p.id, p.content\n                                             FROM {wiki_pages} p, {wiki} w\n                                            WHERE w.course = ? AND\n                                                  p.wiki = w.id", array($restore->course_id))) {
        //Iterate over each post->message
        $i = 0;
        //Counter to send some output to the browser to avoid timeouts
        foreach ($pages as $page) {
            //Increment counter
            $i++;
            $content = $page->definition;
            $result = restore_decode_content_links_worker($content, $restore);
            if ($result != $content) {
                //Update record
                $page->content = $result;
                $status = $DB->update_record("wiki_pages", $page);
                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);
            }
        }
    }
    //Process every wiki (summary) in the course
    if ($wikis = $DB->get_records('wiki', array('course' => $restore->course_id), '', "id,summary")) {
        //Iterate over each wiki->summary
        $i = 0;
        //Counter to send some output to the browser to avoid timeouts
        foreach ($wikis as $wiki) {
            //Increment counter
            $i++;
            $content = $wiki->summary;
            $result = restore_decode_content_links_worker($content, $restore);
            if ($result != $content) {
                //Update record
                $wiki->summary = $result;
                $status = $DB->update_record("wiki", $wiki);
                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,代码行数:70,代码来源:restorelib.php

示例11: 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

示例12: decode_content_links_caller

 /**
  * Decode links in question type specific tables.
  * @return bool success or failure.
  */
 function decode_content_links_caller($questionids, $restore, &$i)
 {
     $status = true;
     // Decode links in the question_multichoice table.
     if ($multichoices = get_records_list('question_multichoice', 'question', implode(',', $questionids), '', 'id, correctfeedback, partiallycorrectfeedback, incorrectfeedback')) {
         foreach ($multichoices as $multichoice) {
             $correctfeedback = restore_decode_content_links_worker($multichoice->correctfeedback, $restore);
             $partiallycorrectfeedback = restore_decode_content_links_worker($multichoice->partiallycorrectfeedback, $restore);
             $incorrectfeedback = restore_decode_content_links_worker($multichoice->incorrectfeedback, $restore);
             if ($correctfeedback != $multichoice->correctfeedback || $partiallycorrectfeedback != $multichoice->partiallycorrectfeedback || $incorrectfeedback != $multichoice->incorrectfeedback) {
                 $subquestion->correctfeedback = addslashes($correctfeedback);
                 $subquestion->partiallycorrectfeedback = addslashes($partiallycorrectfeedback);
                 $subquestion->incorrectfeedback = addslashes($incorrectfeedback);
                 if (!update_record('question_multichoice', $multichoice)) {
                     $status = false;
                 }
             }
             // Do some output.
             if (++$i % 5 == 0 && !defined('RESTORE_SILENTLY')) {
                 echo ".";
                 if ($i % 100 == 0) {
                     echo "<br />";
                 }
                 backup_flush(300);
             }
         }
     }
     return $status;
 }
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:33,代码来源:questiontype.php

示例13: forum_decode_content_links_caller

function forum_decode_content_links_caller($restore)
{
    global $CFG, $DB, $DB;
    $status = true;
    //Process every POST (message) in the course
    if ($posts = $DB->get_records_sql("SELECT p.id, p.message\n                                             FROM {forum_posts} p,\n                                                  {forum_discussions} d\n                                            WHERE d.course = ? AND\n                                                  p.discussion = d.id", array($restore->course_id))) {
        //Iterate over each post->message
        $i = 0;
        //Counter to send some output to the browser to avoid timeouts
        foreach ($posts as $post) {
            //Increment counter
            $i++;
            $content = $post->message;
            $result = restore_decode_content_links_worker($content, $restore);
            if ($result != $content) {
                //Update record
                $post->message = $result;
                $status = $DB->update_record("forum_posts", $post);
                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);
            }
        }
    }
    //Process every FORUM (intro) in the course
    if ($forums = $DB->get_records('forum', array('course' => $restore->course_id), '', "id,intro")) {
        //Iterate over each forum->intro
        $i = 0;
        //Counter to send some output to the browser to avoid timeouts
        foreach ($forums as $forum) {
            //Increment counter
            $i++;
            $content = $forum->intro;
            $result = restore_decode_content_links_worker($content, $restore);
            if ($result != $content) {
                //Update record
                $forum->intro = $result;
                $status = $DB->update_record("forum", $forum);
                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:nicolasconnault,项目名称:moodle2.0,代码行数:70,代码来源:restorelib.php

示例14: glossary_decode_content_links_caller

function glossary_decode_content_links_caller($restore)
{
    global $CFG, $DB;
    $status = true;
    //Process every glossary ENTRY in the course
    if ($entries = $DB->get_records_sql("SELECT e.id, e.definition\n                                               FROM {glossary_entries} e,\n                                                    {glossary} g\n                                              WHERE g.course = ? AND\n                                                    e.glossaryid = g.id", array($restore->course_id))) {
        //Iterate over each post->message
        $i = 0;
        //Counter to send some output to the browser to avoid timeouts
        foreach ($entries as $entry) {
            //Increment counter
            $i++;
            $content = $entry->definition;
            $result = restore_decode_content_links_worker($content, $restore);
            if ($result != $content) {
                //Update record
                $entry->definition = $result;
                $status = $DB->update_record("glossary_entries", $entry);
                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);
            }
        }
    }
    //Process every glossary (intro) in the course
    if ($glossarys = $DB->get_records('glossary', array('course' => $restore->course_id), '', "id,intro")) {
        //Iterate over each glossary->intro
        $i = 0;
        //Counter to send some output to the browser to avoid timeouts
        foreach ($glossarys as $glossary) {
            //Increment counter
            $i++;
            $content = $glossary->intro;
            $result = restore_decode_content_links_worker($content, $restore);
            if ($result != $content) {
                //Update record
                $glossary->intro = $result;
                $status = $DB->update_record("glossary", $glossary);
                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,代码行数:70,代码来源:restorelib.php

示例15: webquest_decode_content_links_caller

function webquest_decode_content_links_caller($restore)
{
    global $CFG;
    $status = true;
    //Process every description,process,taskdescription,conclussion from WEBQUEST
    if ($webquests = get_records_sql("SELECT *\n                                           FROM {$CFG->prefix}webquest w\n                                           WHERE w.course = {$restore->course_id}")) {
        $i = 0;
        foreach ($webquests as $webquest) {
            $i++;
            $todo = false;
            $content = $webquest->description;
            $result = restore_decode_content_links_worker($content, $restore);
            if ($result != $content) {
                $webquest->description = addslashes($result);
                if ($CFG->debug > 7) {
                    if (!defined('RESTORE_SILENTLY')) {
                        echo '<br /><hr />' . s($content) . '<br />changed to<br />' . s($result) . '<hr /><br />';
                    }
                }
                $todo = true;
            }
            $content = $webquest->process;
            $result = restore_decode_content_links_worker($content, $restore);
            if ($result != $content) {
                $webquest->process = addslashes($result);
                if ($CFG->debug > 7) {
                    if (!defined('RESTORE_SILENTLY')) {
                        echo '<br /><hr />' . s($content) . '<br />changed to<br />' . s($result) . '<hr /><br />';
                    }
                }
                $todo = true;
            }
            $content = $webquest->conclussion;
            $result = restore_decode_content_links_worker($content, $restore);
            if ($result != $content) {
                $webquest->process = addslashes($result);
                if ($CFG->debug > 7) {
                    if (!defined('RESTORE_SILENTLY')) {
                        echo '<br /><hr />' . s($content) . '<br />changed to<br />' . s($result) . '<hr /><br />';
                    }
                }
                $todo = true;
            }
            $content = $webquest->taskdescription;
            $result = restore_decode_content_links_worker($content, $restore);
            if ($result != $content) {
                $webquest->process = addslashes($result);
                if ($CFG->debug > 7) {
                    if (!defined('RESTORE_SILENTLY')) {
                        echo '<br /><hr />' . s($content) . '<br />changed to<br />' . s($result) . '<hr /><br />';
                    }
                }
                $todo = true;
            }
            if ($todo) {
                $status = update_record("webquest", $webquest);
            }
            //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,代码行数:71,代码来源:restorelib.php


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