• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP backup_copy_file函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: webquest_upgrade

function webquest_upgrade($oldversion)
{
    /// This function does anything necessary to upgrade
    /// older versions to match current functionality
    $status = true;
    global $CFG;
    if ($oldversion < 2007081222) {
        require_once $CFG->dirroot . '/backup/lib.php';
        //make the change into each course
        $courses = get_records("course");
        foreach ($courses as $course) {
            $newdir = "{$course->id}/{$CFG->moddata}/webquest";
            if (make_upload_directory($newdir)) {
                $olddir = "{$CFG->dataroot}/{$course->id}/{$CFG->moddata}/webquest/submissions";
                //chec k if the old directory exists
                if (is_dir($olddir)) {
                    $status = backup_copy_file($olddir, $CFG->dataroot . "/" . $newdir);
                }
                if ($status) {
                    fulldelete($olddir);
                }
            }
        }
    }
    return $status;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:26,代码来源:mysql.php


示例2: lightboxgallery_restore_files

function lightboxgallery_restore_files($gallery, $restore)
{
    global $CFG;
    $status = true;
    if (is_numeric($gallery)) {
        $gallery = get_record('lightboxgallery', 'id', $gallery);
    }
    $newpath = $CFG->dataroot . '/' . $gallery->course . '/' . $gallery->folder;
    $status = check_dir_exists($newpath, true, true);
    if ($status) {
        $tmppath = $CFG->dataroot . '/temp/backup/' . $restore->backup_unique_code . '/' . $gallery->folder;
        if (is_dir($tmppath)) {
            $status = backup_copy_file($tmppath, $newpath);
        }
    }
    return $status;
}
开发者ID:itziko,项目名称:Moodle-jQuery-Lightbox-Gallery,代码行数:17,代码来源:restorelib.php


示例3: backup_lightboxgallery_files_instance

function backup_lightboxgallery_files_instance($bf, $preferences, $gallery)
{
    global $CFG;
    $status = true;
    if (is_numeric($gallery)) {
        $gallery = get_record('lightboxgallery', 'id', $gallery);
    }
    $tmppath = $CFG->dataroot . '/temp/backup/' . $preferences->backup_unique_code . '/' . $gallery->folder;
    $status = check_dir_exists($tmppath, true, true);
    if ($status) {
        $oldpath = $CFG->dataroot . '/' . $preferences->backup_course . '/' . $gallery->folder;
        if (is_dir($oldpath)) {
            $status = backup_copy_file($oldpath, $tmppath);
        }
    }
    return $status;
}
开发者ID:itziko,项目名称:Moodle-jQuery-Lightbox-Gallery,代码行数:17,代码来源:backuplib.php


示例4: backup_poodllpairwork_files_instance

function backup_poodllpairwork_files_instance($bf, $preferences, $instanceid)
{
    global $CFG;
    $status = true;
    //First we check to moddata exists and create it as necessary
    //in temp/backup/$backup_code  dir
    $status = check_and_create_moddata_dir($preferences->backup_unique_code);
    $status = check_dir_exists($CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . "/moddata/poodllpairwork/", true);
    //Now copy the poodllpairwork dir
    if ($status) {
        //Only if it exists !! Thanks to Daniel Miksik.
        if (is_dir($CFG->dataroot . "/" . $preferences->backup_course . "/" . $CFG->moddata . "/poodllpairwork/" . $instanceid)) {
            $status = backup_copy_file($CFG->dataroot . "/" . $preferences->backup_course . "/" . $CFG->moddata . "/poodllpairwork/" . $instanceid, $CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . "/moddata/poodllpairwork/" . $instanceid);
        }
    }
    return $status;
}
开发者ID:laiello,项目名称:poodll,代码行数:17,代码来源:backuplib.php


示例5: backup_imagegallery_files

function backup_imagegallery_files($bf, $preferences, $image)
{
    global $CFG;
    $status = true;
    //First we check to moddata exists and create it as necessary
    //in temp/backup/$backup_code  dir
    $status = check_and_create_moddata_dir($preferences->backup_unique_code);
    //Now we check that moddata/glossary dir exists and create it as necessary
    //in temp/backup/$backup_code/moddata dir
    $gal_dir_to = $CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . "/" . $CFG->moddata . "/imagegallery";
    //Let's create it as necessary
    $status = check_dir_exists($gal_dir_to, true);
    // Check imagegalleryid directory.
    $gal_dir_to .= '/' . $image->galleryid;
    $status = check_dir_exists($gal_dir_to, true);
    // structure for imagegallery data directory starting from moddata:
    // moddata
    //    |
    //    |- imagegallery
    //            |
    //            |- <imagegalleryid>
    //                      |
    //                      |- non-categorized images
    //                      |- <categoryid>
    //                              |
    //                              |- categorized images.
    if (!empty($image->categoryid)) {
        // Copy categorized image under it's directory ( create directory if necessary ).
        $gal_dir_to .= '/' . $image->categoryid;
        $status = check_dir_exists($gal_dir_to, true);
        $filesource = $CFG->dataroot . $image->path;
        $filedestin = $gal_dir_to . '/' . $image->name;
        if (is_dir($gal_dir_to) && file_exists($filesource)) {
            $status = backup_copy_file($filesource, $filedestin);
        }
        // Copy thumbnail
        $filesource = $CFG->dataroot . str_replace($image->name, "thumb_" . $image->name, $image->path);
        $filedestin = $gal_dir_to . '/thumb_' . $image->name;
        if (is_dir($gal_dir_to) && file_exists($filesource)) {
            $status = backup_copy_file($filesource, $filedestin);
        }
    } else {
        // Copy uncategorized image under imagegallery id.
        $filesource = $CFG->dataroot . $image->path;
        $filedestin = $gal_dir_to . '/' . $image->name;
        if (is_dir($gal_dir_to) && file_exists($filesource)) {
            $status = backup_copy_file($filesource, $filedestin);
        }
        // Copy thumbnail
        $filesource = $CFG->dataroot . str_replace($image->name, "thumb_" . $image->name, $image->path);
        $filedestin = $gal_dir_to . '/thumb_' . $image->name;
        if (is_dir($gal_dir_to) && file_exists($filesource)) {
            $status = backup_copy_file($filesource, $filedestin);
        }
    }
    return $status;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:57,代码来源:backuplib.php


示例6: backup_exercise_student_files

function backup_exercise_student_files($bf, $preferences, $exerciseid)
{
    global $CFG;
    $status = true;
    //First we check to moddata exists and create it as necessary
    //in temp/backup/$backup_code  dir
    $status = check_and_create_moddata_dir($preferences->backup_unique_code);
    if ($status) {
        //Now copy the submission dirs
        if ($submissions = get_records_select("exercise_submissions", "exerciseid = {$exerciseid}\n                        AND isexercise = 0")) {
            foreach ($submissions as $submission) {
                //Only if it exists !! Thanks to Daniel Miksik.
                if (is_dir("{$CFG->dataroot}/{$preferences->backup_course}/{$CFG->moddata}/exercise/{$submission->id}")) {
                    $status = backup_copy_file("{$CFG->dataroot}/{$preferences->backup_course}/{$CFG->moddata}/exercise/{$submission->id}", "{$CFG->dataroot}/temp/backup/{$preferences->backup_unique_code}/moddata/exercise/{$submission->id}");
                }
            }
        }
    }
    return $status;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:20,代码来源:backuplib.php


示例7: backup_copy_dir

function backup_copy_dir($from_file, $to_file)
{
    global $CFG;
    $status = true;
    // Initialize this, next code will change its value if needed
    if (!is_dir($to_file)) {
        //echo "<br />Creating ".$to_file;                                //Debug
        umask(00);
        $status = mkdir($to_file, $CFG->directorypermissions);
    }
    $dir = opendir($from_file);
    while (false !== ($file = readdir($dir))) {
        if ($file == "." || $file == "..") {
            continue;
        }
        $status = backup_copy_file("{$from_file}/{$file}", "{$to_file}/{$file}");
    }
    closedir($dir);
    return $status;
}
开发者ID:vuchannguyen,项目名称:web,代码行数:20,代码来源:lib.php


示例8: mail_restore_files

function mail_restore_files($oldmailid, $newmailid, $oldmessageid, $newmessageid, $restore)
{
    global $CFG;
    $status = true;
    $todo = false;
    $moddata_path = "";
    $mail_path = "";
    $temp_path = "";
    //First, we check to "course_id" exists and create is as necessary
    //in CFG->dataroot
    $dest_dir = $CFG->dataroot . "/" . $restore->course_id;
    $status = check_dir_exists($dest_dir, true);
    //Now, locate course's moddata directory
    $moddata_path = $CFG->dataroot . "/" . $restore->course_id . "/" . $CFG->moddata;
    //Check it exists and create it
    $status = check_dir_exists($moddata_path, true);
    //Now, locate assignment directory
    if ($status) {
        $mail_path = $moddata_path . "/mail";
        //Check it exists and create it
        $status = check_dir_exists($mail_path, true);
    }
    //Now locate the temp dir we are gong to restore
    if ($status) {
        $temp_path = $CFG->dataroot . "/temp/backup/" . $restore->backup_unique_code . "/moddata/mail/" . $oldmailid . "/" . $oldmessageid;
        //Check it exists
        if (is_dir($temp_path)) {
            $todo = true;
        }
    }
    //If todo, we create the neccesary dirs in course moddata/mail
    if ($status and $todo) {
        //First this assignment id
        $this_mail_path = $mail_path . "/" . $newmailid;
        $status = check_dir_exists($this_mail_path, true);
        //Now this message id
        $message_mail_path = $this_mail_path . "/" . $newmessageid;
        //And now, copy temp_path to message_mail_path
        $status = backup_copy_file($temp_path, $message_mail_path);
    }
    return $status;
}
开发者ID:henriquecrang,项目名称:e-UNI,代码行数:42,代码来源:restorelib.php


示例9: resource_restore_files

function resource_restore_files($oldid, $newid, $resource, $restore)
{
    global $CFG;
    $status = true;
    $status = check_dir_exists($CFG->dataroot . "/" . $restore->course_id, true);
    // we need to do anything referenced by $resource->reference and anything in moddata/resource/instance
    // do referenced files/dirs first.
    $temp_path = $CFG->dataroot . "/temp/backup/" . $restore->backup_unique_code . '/course_files/' . $resource->reference;
    if (file_exists($temp_path)) {
        // ok, it was backed up, restore it.
        $new_path = $CFG->dataroot . '/' . $restore->course_id . '/' . $resource->reference;
        // if this is somewhere deeply nested we need to do all the structure stuff first.....
        $bits = explode('/', $resource->reference);
        $newbit = '';
        for ($i = 0; $i < count($bits) - 1; $i++) {
            $newbit .= $bits[$i] . '/';
            $status = $status && check_dir_exists($CFG->dataroot . '/' . $restore->course_id . '/' . $newbit, true);
        }
        $status = $status && backup_copy_file($temp_path, $new_path);
    }
    // and now for moddata.
    $temp_path = $CFG->dataroot . "/temp/backup/" . $restore->backup_unique_code . "/moddata/resource/" . $oldid;
    if (file_exists($temp_path)) {
        // there's something to back up, restore it.
        $new_path = $CFG->dataroot . "/" . $restore->course_id . "/" . $CFG->moddata;
        $status = $status && check_dir_exists($new_path, true);
        $new_path .= '/resource';
        $status = $status && check_dir_exists($new_path, true);
        $new_path .= '/' . $newid;
        $status = $status && backup_copy_file($temp_path, $new_path);
    }
    return $status;
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:33,代码来源:restorelib.php


示例10: project_restore_course_files

/**
 * コースファイルのコピー
 * 
 * @param object $restore
 * @return
 */
function project_restore_course_files(&$restore)
{
    global $CFG;
    $status = true;
    $counter = 0;
    // 対象のコース情報の取得
    if (!($course = get_record("course", "id", $restore->course_id))) {
        error("Course ID was incorrect (can't find it)");
    }
    // 対象のセクション情報の取得
    if (!($section = get_course_section($restore->section, $restore->course_id))) {
        error("Section data was incorrect (can't find it)");
    }
    // 現在のセクションのディレクトリ名を取得
    if (!($sectiontitle = project_format_get_title($course, $section->id))) {
        error("Section directory was incorrect");
    }
    //First, we check to "course_id" exists and create is as necessary
    //in CFG->dataroot
    $dest_dir = $CFG->dataroot . "/" . $restore->course_id . '/' . $restore->newdirectoryname;
    $status = check_dir_exists($dest_dir, true);
    //Now, we iterate over "course_files" records to check if that file/dir must be
    //copied to the "dest_dir" dir.
    $rootdir = $CFG->dataroot . "/temp/backup/" . $restore->backup_unique_code . "/course_files/" . $restore->olddirectoryname;
    // ディレクトリをまるごとコピーする
    if (is_dir($rootdir)) {
        $status = backup_copy_file($rootdir, $dest_dir);
    }
    return $status;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:36,代码来源:restorelib.php


示例11: flv_backup_files

function flv_backup_files($bf, $preferences, $flv)
{
    global $CFG;
    $status = true;
    if (!file_exists($CFG->dataroot . '/' . $preferences->backup_course . '/' . $flv->flvfile)) {
        return true;
        // doesn't exist but we don't want to halt the entire process so still return true.
    }
    $status = $status && check_and_create_course_files_dir($preferences->backup_unique_code);
    // if this is somewhere deeply nested we need to do all the structure stuff first.....
    $bits = explode('/', $flv->flvfile);
    $newbit = '';
    for ($i = 0; $i < count($bits) - 1; $i++) {
        $newbit .= $bits[$i] . '/';
        $status = $status && check_dir_exists($CFG->dataroot . '/temp/backup/' . $preferences->backup_unique_code . '/course_files/' . $newbit, true);
    }
    if ($flv->flvfile === '') {
        $status = $status && backup_copy_course_files($preferences);
        // copy while ignoring backupdata and moddata!!!
    } else {
        if (strpos($flv->flvfile, 'backupdata') === 0 or strpos($flv->flvfile, $CFG->moddata) === 0) {
            // no copying - these directories must not be shared anyway!
        } else {
            $status = $status && backup_copy_file($CFG->dataroot . "/" . $preferences->backup_course . "/" . $flv->flvfile, $CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . "/course_files/" . $flv->flvfile);
        }
    }
    // now, just in case we check moddata ( going forwards, flvs should use this )
    $status = $status && check_and_create_moddata_dir($preferences->backup_unique_code);
    $status = $status && check_dir_exists($CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . "/" . $CFG->moddata . "/flv/", true);
    if ($status) {
        //Only if it exists !! Thanks to Daniel Miksik.
        $instanceid = $flv->id;
        if (is_dir($CFG->dataroot . "/" . $preferences->backup_course . "/" . $CFG->moddata . "/flv/" . $instanceid)) {
            $status = backup_copy_file($CFG->dataroot . "/" . $preferences->backup_course . "/" . $CFG->moddata . "/flv/" . $instanceid, $CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . "/moddata/flv/" . $instanceid);
        }
    }
    return $status;
}
开发者ID:googlecode-mirror,项目名称:moodle-flv-player,代码行数:38,代码来源:backuplib.php


示例12: taoresource_backup_files

function taoresource_backup_files($bf, $preferences, $taoresource_entry)
{
    global $CFG;
    require_once "{$CFG->dirroot}/mod/taoresource/lib.php";
    $status = true;
    if (empty($taoresource_entry->file)) {
        return true;
    }
    $filename = $CFG->dataroot . TAORESOURCE_RESOURCEPATH . $taoresource_entry->file;
    if (!file_exists($filename)) {
        return true;
        // doesn't exist but we don't want to halt the entire process so still return true.
    }
    $status = $status && check_dir_exists($CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . TAORESOURCE_RESOURCEPATH, true);
    // if this is somewhere deeply nested we need to do all the structure stuff first.....
    $status = $status && backup_copy_file($filename, $CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . TAORESOURCE_RESOURCEPATH . $taoresource_entry->file);
    return $status;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:18,代码来源:backuplib.php


示例13: backup_wiki_files

function backup_wiki_files($bf, $preferences)
{
    global $CFG;
    $status = true;
    //First we check to moddata exists and create it as necessary
    //in temp/backup/$backup_code  dir
    $status = check_and_create_moddata_dir($preferences->backup_unique_code);
    //Now copy the forum dir
    if ($status) {
        //Only if it exists !! Thanks to Daniel Miksik.
        if (is_dir($CFG->dataroot . "/" . $preferences->backup_course . "/" . $CFG->moddata . "/wiki")) {
            $handle = opendir($CFG->dataroot . "/" . $preferences->backup_course . "/" . $CFG->moddata . "/wiki");
            while (false !== ($item = readdir($handle))) {
                if ($item != '.' && $item != '..' && is_dir($CFG->dataroot . "/" . $preferences->backup_course . "/" . $CFG->moddata . "/wiki/" . $item) && array_key_exists($item, $preferences->mods['wiki']->instances) && !empty($preferences->mods['wiki']->instances[$item]->backup)) {
                    $status = backup_copy_file($CFG->dataroot . "/" . $preferences->backup_course . "/" . $CFG->moddata . "/wiki/" . $item, $CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . "/moddata/wiki/", $item);
                }
            }
        }
    }
    return $status;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:21,代码来源:backuplib.php


示例14: backup_turnitintool_files_instance

function backup_turnitintool_files_instance($bf, $preferences, $instanceid)
{
    global $CFG;
    $status = true;
    $status = check_and_create_moddata_dir($preferences->backup_unique_code);
    $status = check_dir_exists($CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . "/moddata/turnitintool/", true);
    if ($status) {
        if (is_dir($CFG->dataroot . "/" . $preferences->backup_course . "/" . $CFG->moddata . "/turnitintool/" . $instanceid)) {
            $status = backup_copy_file($CFG->dataroot . "/" . $preferences->backup_course . "/" . $CFG->moddata . "/turnitintool/" . $instanceid, $CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . "/moddata/turnitintool/" . $instanceid);
        }
    }
    return $status;
}
开发者ID:netspotau,项目名称:moodle-mod_turnitintool,代码行数:13,代码来源:backuplib.php


示例15: copy_zip_to_course_dir

function copy_zip_to_course_dir($preferences)
{
    global $CFG, $DB;
    $status = true;
    //Define zip location (from)
    $from_zip_file = $CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . "/" . $preferences->backup_name;
    //Initialise $to_zip_file
    $to_zip_file = "";
    //If $preferences->backup_destination isn't empty, then copy to custom directory
    if (!empty($preferences->backup_destination)) {
        $to_zip_file = $preferences->backup_destination . "/" . $preferences->backup_name;
        //Copy zip file
        if ($status) {
            $status = backup_copy_file($from_zip_file, $to_zip_file);
        }
    } else {
        //Define zip destination (course dir)
        $context = get_context_instance(CONTEXT_COURSE, $preferences->backup_course);
        $fs = get_file_storage();
        $file_record = array('contextid' => $context->id, 'filearea' => 'course_backup', 'itemid' => 0, 'filepath' => '/', 'filename' => $preferences->backup_name, 'timecreated' => time(), 'timemodified' => time());
        $fs->create_file_from_pathname($file_record, $from_zip_file);
    }
    return $status;
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:24,代码来源:backuplib.php


示例16: backup_podcast_files_instance

//Backup podcast files because we've selected to backup user info
//and files are user info's level
function backup_podcast_files_instance($bf, $preferences, $instanceid)
{
    global $CFG;
    $status = true;
    // MEDIA
    // in temp/backup/$backup_code  dir
    $status = check_and_create_moddata_dir($preferences->backup_unique_code);
    $status = check_dir_exists($CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . "/moddata/podcast/", true);
    if ($status) {
        // Copie des fichiers multim�dia
        if (is_dir($CFG->dirroot . "/mod/podcast/media/" . $preferences->backup_course . "/" . $instanceid)) {
            $status = backup_copy_file($CFG->dirroot . "/mod/podcast/media/" . $preferences->backup_course . "/" . $instanceid, $CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . "/moddata/podcast/media/" . $instanceid);
        }
    }
    // XML
    // in temp/backup/$backup_code  dir
    $status = check_and_create_moddata_dir($preferences->backup_unique_code);
    $status = check_dir_exists($CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . "/moddata/podcast/", true);
    if ($status) {
        // Copie des fichiers rss
        if (is_dir($CFG->dirroot . "/mod/podcast/media/" . $preferences->backup_course . "/" . $instanceid)) {
            $status = backup_copy_file($CFG->dirroot . "/mod/podcast/publication/" . $preferences->backup_course, $CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . "/moddata/podcast/publication/");
        }
    }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:26,代码来源:backuplib.php


示例17: print_error

}
/// Ensure it's empty
if (!delete_dir_contents($resourcedir)) {
    print_error('errorcleaningdirectory', 'error', '', $resourcedir);
}
/// Copy files
$origin = $CFG->dataroot . '/' . $courseid . '/' . $file;
if (!is_file($origin)) {
    print_error('filenotfound', 'error', '', $file);
}
$mimetype = mimeinfo("type", $file);
if ($mimetype != "application/zip") {
    print_error('invalidfiletype', 'error', '', $file);
}
$resourcefile = $resourcedir . '/' . basename($origin);
if (!backup_copy_file($origin, $resourcefile)) {
    print_error('errorcopyingfiles', 'error');
}
/// Unzip files
if (!unzip_file($resourcefile, '', false)) {
    print_error('errorunzippingfiles', 'error');
}
/// Check for imsmanifest
if (!file_exists($resourcedir . '/imsmanifest.xml')) {
    print_error('filenotfound', 'error', '', 'imsmanifest.xml');
}
/// Load imsmanifest to memory (instead of using a full parser,
/// we are going to use xmlize intensively (because files aren't too big)
if (!($imsmanifest = ims_file2var($resourcedir . '/imsmanifest.xml'))) {
    print_error('errorreadingfile', 'error', '', 'imsmanifest.xml');
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:deploy.php


示例18: wiki_restore_files

function wiki_restore_files($oldwikiid, $newwikiid, $oldentryid, $newentryid, $restore)
{
    global $CFG;
    $status = true;
    $todo = false;
    $moddata_path = "";
    $forum_path = "";
    $temp_path = "";
    //First, we check to "course_id" exists and create is as necessary
    //in CFG->dataroot
    $dest_dir = $CFG->dataroot . "/" . $restore->course_id;
    $status = check_dir_exists($dest_dir, true);
    //First, locate course's moddata directory
    $moddata_path = $CFG->dataroot . "/" . $restore->course_id . "/" . $CFG->moddata;
    //Check it exists and create it
    $status = check_dir_exists($moddata_path, true);
    //Now, locate wiki directory
    if ($status) {
        $wiki_path = $moddata_path . "/wiki";
        //Check it exists and create it
        $status = check_dir_exists($wiki_path, true);
    }
    //Now locate the temp dir we are restoring from
    if ($status) {
        $temp_path = $CFG->dataroot . "/temp/backup/" . $restore->backup_unique_code . "/moddata/wiki/" . $oldwikiid . "/" . $oldentryid;
        //Check it exists
        if (is_dir($temp_path)) {
            $todo = true;
        }
    }
    //If todo, we create the neccesary dirs in course moddata/wiki
    if ($status and $todo) {
        //First this wiki id
        $this_wiki_path = $wiki_path . "/" . $newwikiid;
        $status = check_dir_exists($this_wiki_path, true);
        //Now this entry id
        $entry_wiki_path = $this_wiki_path . "/" . $newentryid;
        //And now, copy temp_path to entry_wiki_path
        $status = backup_copy_file($temp_path, $entry_wiki_path);
    }
    return $status;
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:42,代码来源:restorelib.php


示例19: poodllpairwork_restore_files

function poodllpairwork_restore_files($oldpairworkid, $newpairworkid, $restore)
{
    global $CFG;
    $status = true;
    $todo = false;
    $moddata_path = "";
    $poodllpairwork_path = "";
    $temp_path = "";
    //First, we check to "course_id" exists and create is as necessary
    //in CFG->dataroot
    $dest_dir = $CFG->dataroot . "/" . $restore->course_id;
    $status = check_dir_exists($dest_dir, true);
    //First, locate course's moddata directory
    $moddata_path = $CFG->dataroot . "/" . $restore->course_id . "/" . $CFG->moddata;
    //Check it exists and create it
    $status = check_dir_exists($moddata_path, true);
    //Now, locate forum directory
    if ($status) {
        $poodllpairwork_path = $moddata_path . "/poodllpairwork";
        //Check if exists and create it
        $status = check_dir_exists($poodllpairwork_path, true);
    }
    //Now locate the temp dir we are restoring from
    if ($status) {
        $temp_path = $CFG->dataroot . "/temp/backup/" . $restore->backup_unique_code . "/moddata/poodllpairwork/" . $oldpairworkid;
        //Check it exists
        if (is_dir($temp_path)) {
            $todo = true;
        }
    }
    //If todo, we create the neccesary dirs in course moddata/forum
    if ($status and $todo) {
        //First this poodllpairwork id
        $this_poodllpairwork_path = $poodllpairwork_path . "/" . $newpairworkid;
        $status = check_dir_exists($this_poodllpairwork_path, true);
        //And now, copy temp_path to poodllpairwork_path
        $status = backup_copy_file($temp_path, $this_poodllpairwork_path);
    }
    return $status;
}
开发者ID:laiello,项目名称:poodll,代码行数:40,代码来源:restorelib.php


示例20: copy_zip_to_course_dir

function copy_zip_to_course_dir($preferences)
{
    global $CFG;
    $status = true;
    //Define zip location (from)
    $from_zip_file = $CFG->dataroot . "/temp/backup/" . $preferences->backup_unique_code . "/" . $preferences->backup_name;
    //Initialise $to_zip_file
    $to_zip_file = "";
    //If $preferences->backup_destination isn't empty, then copy to custom directory
    if (!empty($preferences->backup_destination)) {
        $to_zip_file = $preferences->backup_destination . "/" . $preferences->backup_name;
    } else {
        //Define zip destination (course dir)
        $to_zip_file = $CFG->dataroot . "/" . $preferences->backup_course;
        //echo "<p>From: ".$from_zip_file."<br />";                                              //Debug
        //echo "<p>Checking: ".$to_zip_file."<br />";                                          //Debug
        //Checks course dir exists
        $status = check_dir_exists($to_zip_file, true);
        //Define zip destination (backup dir)
        $to_zip_file = $to_zip_file . "/backupdata";
        //echo "<p>Checking: ".$to_zip_file."<br />";                                          //Debug
        //Checks backup dir exists
        $status = check_dir_exists($to_zip_file, true);
        //Define zip destination (zip file)
        $to_zip_file = $to_zip_file . "/" . $preferences->backup_name;
    }
    //echo "<p>To: ".$to_zip_file."<br />";                                              //Debug
    //Copy zip file
    if ($status) {
        $status = backup_copy_file($from_zip_file, $to_zip_file);
    }
    return $status;
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:33,代码来源:backuplib.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP backup_delete_old_data函数代码示例发布时间:2022-05-24
下一篇:
PHP backup函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap