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


PHP clean_temp_data函数代码示例

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


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

示例1: backup_execute


//.........这里部分代码省略.........
        if ($backup_file) {
            backup_close_xml($backup_file);
        }
        //End xml contents (close ul)
        if (!defined('BACKUP_SILENTLY')) {
            echo "</ul></li>";
        }
    }
    //Now, if selected, copy user files
    if ($status) {
        if ($preferences->backup_user_files) {
            if (!defined('BACKUP_SILENTLY')) {
                echo "<li>" . get_string("copyinguserfiles") . '</li>';
            }
            if (!($status = backup_copy_user_files($preferences))) {
                if (!defined('BACKUP_SILENTLY')) {
                    notify("An error occurred while copying user files");
                } else {
                    $errorstr = "An error occurred while copying user files";
                    return false;
                }
            }
        }
    }
    //Now, if selected, copy course files
    if ($status) {
        if ($preferences->backup_course_files) {
            if (!defined('BACKUP_SILENTLY')) {
                echo "<li>" . get_string("copyingcoursefiles") . '</li>';
            }
            if (!($status = backup_copy_course_files($preferences))) {
                if (!defined('BACKUP_SILENTLY')) {
                    notify("An error occurred while copying course files");
                } else {
                    $errorstr = "An error occurred while copying course files";
                    return false;
                }
            }
        }
    }
    //Now, if selected, copy site files
    if ($status) {
        if ($preferences->backup_site_files) {
            if (!defined('BACKUP_SILENTLY')) {
                echo "<li>" . get_string("copyingsitefiles") . '</li>';
            }
            if (!($status = backup_copy_site_files($preferences))) {
                if (!defined('BACKUP_SILENTLY')) {
                    notify("An error occurred while copying site files");
                } else {
                    $errorstr = "An error occurred while copying site files";
                    return false;
                }
            }
        }
    }
    //Now, zip all the backup directory contents
    if ($status) {
        if (!defined('BACKUP_SILENTLY')) {
            echo "<li>" . get_string("zippingbackup") . '</li>';
        }
        if (!($status = backup_zip($preferences))) {
            if (!defined('BACKUP_SILENTLY')) {
                notify("An error occurred while zipping the backup");
            } else {
                $errorstr = "An error occurred while zipping the backup";
                return false;
            }
        }
    }
    //Now, copy the zip file to course directory
    if ($status) {
        if (!defined('BACKUP_SILENTLY')) {
            echo "<li>" . get_string("copyingzipfile") . '</li>';
        }
        if (!($status = copy_zip_to_course_dir($preferences))) {
            if (!defined('BACKUP_SILENTLY')) {
                notify("An error occurred while copying the zip file to the course directory");
            } else {
                $errorstr = "An error occurred while copying the zip file to the course directory";
                return false;
            }
        }
    }
    //Now, clean temporary data (db and filesystem)
    if ($status) {
        if (!defined('BACKUP_SILENTLY')) {
            echo "<li>" . get_string("cleaningtempdata") . '</li>';
        }
        if (!($status = clean_temp_data($preferences))) {
            if (!defined('BACKUP_SILENTLY')) {
                notify("An error occurred while cleaning up temporary data");
            } else {
                $errorstr = "An error occurred while cleaning up temporary data";
                return false;
            }
        }
    }
    return $status;
}
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:101,代码来源:backuplib.php

示例2: schedule_inc_backup_course_execute


//.........这里部分代码省略.........
            backup_add_to_log($starttime, $preferences->backup_course, "      groupings", 'incrementalbackup');
            $status = backup_groupings_info($backup_file, $preferences);
        }
        //Print groupings_groups info
        if ($status) {
            backup_add_to_log($starttime, $preferences->backup_course, "      groupings_groups", 'incrementalbackup');
            $status = backup_groupings_groups_info($backup_file, $preferences);
        }
        //Print events info
        if ($status) {
            backup_add_to_log($starttime, $preferences->backup_course, "      events", 'incrementalbackup');
            $status = backup_events_info($backup_file, $preferences);
        }
        //Print gradebook info
        if ($status) {
            backup_add_to_log($starttime, $preferences->backup_course, "      gradebook", 'incrementalbackup');
            $status = backup_gradebook_info($backup_file, $preferences);
        }
        //Module info, this unique function makes all the work!!
        //db export and module fileis copy
        if ($status) {
            $mods_to_backup = false;
            //Check if we have any mod to backup
            if (!empty($preferences->mods)) {
                foreach ($preferences->mods as $module) {
                    if ($module->backup) {
                        $mods_to_backup = true;
                    }
                }
            }
            //If we have to backup some module
            if ($mods_to_backup) {
                backup_add_to_log($starttime, $preferences->backup_course, "      modules", 'incrementalbackup');
                //Start modules tag
                $status = backup_modules_start($backup_file, $preferences);
                //Iterate over modules and call backup
                foreach ($preferences->mods as $module) {
                    if ($module->backup and $status) {
                        backup_add_to_log($starttime, $preferences->backup_course, "        {$module->name}", 'incrementalbackup');
                        $status = backup_module($backup_file, $preferences, $module->name);
                    }
                }
                //Close modules tag
                $status = backup_modules_end($backup_file, $preferences);
            }
        }
        //Backup course format data, if any.
        if ($status) {
            backup_add_to_log($starttime, $preferences->backup_course, "      course format data", 'incrementalbackup');
            $status = backup_format_data($backup_file, $preferences);
        }
        //Prints course end
        if ($status) {
            $status = backup_course_end($backup_file, $preferences);
        }
        //Close the xml file and xml data
        if ($backup_file) {
            backup_close_xml($backup_file);
        }
    }
    //Now, if selected, copy user files
    if ($status) {
        if ($preferences->backup_user_files) {
            backup_add_to_log($starttime, $preferences->backup_course, "    copying user files", 'incrementalbackup');
            $status = backup_copy_user_files($preferences);
        }
    }
    //Now, if selected, copy course files
    if ($status) {
        if ($preferences->backup_course_files) {
            backup_add_to_log($starttime, $preferences->backup_course, "    copying course files", 'incrementalbackup');
            $status = backup_copy_course_files($preferences);
        }
    }
    //Now, if selected, copy site files
    if ($status) {
        if ($preferences->backup_site_files) {
            backup_add_to_log($starttime, $preferences->backup_course, "    copying site files", 'incrementalbackup');
            $status = backup_copy_site_files($preferences);
        }
    }
    //Now, zip all the backup directory contents
    if ($status) {
        backup_add_to_log($starttime, $preferences->backup_course, "    zipping files", 'incrementalbackup');
        $status = backup_zip($preferences);
    }
    //Now, copy the zip file to course directory
    if ($status) {
        backup_add_to_log($starttime, $preferences->backup_course, "    copying backup", 'incrementalbackup');
        $status = copy_zip_to_course_dir($preferences);
    }
    //Now, clean temporary data (db and filesystem)
    if ($status) {
        backup_add_to_log($starttime, $preferences->backup_course, "    cleaning temp data", 'incrementalbackup');
        $status = clean_temp_data($preferences);
    }
    //Unset CFG->backup_preferences only needed in scheduled backups
    unset($CFG->backup_preferences);
    return $status;
}
开发者ID:r007,项目名称:PMoodle,代码行数:101,代码来源:backup_sch_incremental.php

示例3: restore_execute


//.........这里部分代码省略.........
        } else {
            // for moodle versions before 1.9, those grades need to be converted to use the new gradebook
            // this code needs to execute *after* the course_modules are sorted out
            if (!defined('RESTORE_SILENTLY')) {
                echo "<li>" . get_string("migratinggrades");
            }
            /// force full refresh of grading data before migration == crete all items first
            if (!($status = restore_migrate_old_gradebook($restore, $xml_file))) {
                if (!defined('RESTORE_SILENTLY')) {
                    notify("Could not migrate gradebook!");
                } else {
                    $errorstr = "Could not migrade gradebook!";
                    return false;
                }
            }
            if (!defined('RESTORE_SILENTLY')) {
                echo '</li>';
            }
        }
        /// force full refresh of grading data after all items are created
        grade_force_full_regrading($restore->course_id);
        grade_grab_course_grades($restore->course_id);
    }
    /*******************************************************************************
     ************* Restore of Roles and Capabilities happens here ******************
     *******************************************************************************/
    // try to restore roles even when restore is going to fail - teachers might have
    // at least some role assigned - this is not correct though
    $status = restore_create_roles($restore, $xml_file) && $status;
    $status = restore_roles_settings($restore, $xml_file) && $status;
    //Now if all is OK, update:
    //   - course modinfo field
    //   - categories table
    //   - add user as teacher
    if ($status) {
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("checkingcourse");
        }
        //categories table
        $course = get_record("course", "id", $restore->course_id);
        fix_course_sortorder();
        // Check if the user has course update capability in the newly restored course
        // there is no need to load his capabilities again, because restore_roles_settings
        // would have loaded it anyway, if there is any assignments.
        // fix for MDL-6831
        $newcontext = get_context_instance(CONTEXT_COURSE, $restore->course_id);
        if (!has_capability('moodle/course:manageactivities', $newcontext)) {
            // fix for MDL-9065, use the new config setting if exists
            if ($CFG->creatornewroleid) {
                role_assign($CFG->creatornewroleid, $USER->id, 0, $newcontext->id);
            } else {
                if ($legacyteachers = get_roles_with_capability('moodle/legacy:editingteacher', CAP_ALLOW, get_context_instance(CONTEXT_SYSTEM))) {
                    if ($legacyteacher = array_shift($legacyteachers)) {
                        role_assign($legacyteacher->id, $USER->id, 0, $newcontext->id);
                    }
                } else {
                    notify('Could not find a legacy teacher role. You might need your moodle admin to assign a role with editing privilages to this course.');
                }
            }
        }
        if (!defined('RESTORE_SILENTLY')) {
            echo '</li>';
        }
    }
    //Cleanup temps (files and db)
    if ($status) {
        if (!defined('RESTORE_SILENTLY')) {
            echo "<li>" . get_string("cleaningtempdata");
        }
        if (!($status = clean_temp_data($restore))) {
            if (!defined('RESTORE_SILENTLY')) {
                notify("Could not clean up temporary data from files and database");
            } else {
                $errorstr = "Could not clean up temporary data from files and database";
                return false;
            }
        }
        if (!defined('RESTORE_SILENTLY')) {
            echo '</li>';
        }
    }
    // this is not a critical check - the result can be ignored
    if (restore_close_html($restore)) {
        if (!defined('RESTORE_SILENTLY')) {
            echo '<li>Closing the Restorelog.html file.</li>';
        }
    } else {
        if (!defined('RESTORE_SILENTLY')) {
            notify("Could not close the restorelog.html file");
        }
    }
    if (!defined('RESTORE_SILENTLY')) {
        //End the main ul
        echo "</ul>";
        //End the main table
        echo "</td></tr>";
        echo "</table>";
    }
    return $status;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:101,代码来源:restorelib.php

示例4: cleanupDir

 protected function cleanupDir()
 {
     // クリーンアップ
     if (!clean_temp_data($this->prefs)) {
         throw new SharingCart_Exception('Cleanup failure');
     }
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:7,代码来源:SharingCart_BackupRestoreBase.php


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