本文整理汇总了PHP中fulldelete函数的典型用法代码示例。如果您正苦于以下问题:PHP fulldelete函数的具体用法?PHP fulldelete怎么用?PHP fulldelete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fulldelete函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: tearDown
public function tearDown()
{
global $CFG;
if (empty($CFG->keeptempdirectoriesonbackup)) {
fulldelete("{$CFG->dataroot}/temp/backup/{$this->tempdir}");
}
}
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:7,代码来源:testlib.php
示例2: importpostprocess
/**
* Does any post-processing that may be desired
* Clean the temporary directory if a zip file was imported
* @return bool success
*/
public function importpostprocess()
{
if ($this->tempdir != '') {
fulldelete($this->tempdir);
}
return true;
}
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:12,代码来源:formatbase.php
示例3: theme_reset_all_caches
/**
* Invalidate all server and client side caches.
* @return void
*/
function theme_reset_all_caches() {
global $CFG;
require_once("$CFG->libdir/filelib.php");
set_config('themerev', empty($CFG->themerev) ? 1 : $CFG->themerev+1);
fulldelete("$CFG->dataroot/cache/theme");
}
开发者ID:nikita777,项目名称:moodle,代码行数:11,代码来源:outputlib.php
示例4: 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
示例5: tearDown
protected function tearDown()
{
global $CFG;
if (empty($CFG->keeptempdirectoriesonbackup)) {
fulldelete("{$CFG->tempdir}/backup/{$this->tempdir}");
}
}
开发者ID:JP-Git,项目名称:moodle,代码行数:7,代码来源:lib_test.php
示例6: delete_certificate_files
function delete_certificate_files($certificate = '')
{
global $CFG;
require_once $CFG->libdir . '/filelib.php';
$dir = $CFG->dataroot . '/' . $certificate->course . '/' . $CFG->moddata . '/certificate/' . $certificate->id . '/' . $user->id;
if ($certificateid) {
$dir .= '/' . $certificateid;
}
return fulldelete($dir);
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:10,代码来源:lib.php
示例7: theme_reset_all_caches
/**
* Invalidate all server and client side caches.
*
* This method deletes the physical directory that is used to cache the theme
* files used for serving.
* Because it deletes the main theme cache directory all themes are reset by
* this function.
*/
function theme_reset_all_caches()
{
global $CFG;
require_once "{$CFG->libdir}/filelib.php";
$next = time();
if (isset($CFG->themerev) and $next <= $CFG->themerev and $CFG->themerev - $next < 60 * 60) {
// This resolves problems when reset is requested repeatedly within 1s,
// the < 1h condition prevents accidental switching to future dates
// because we might not recover from it.
$next = $CFG->themerev + 1;
}
set_config('themerev', $next);
// time is unique even when you reset/switch database
fulldelete("{$CFG->cachedir}/theme");
}
开发者ID:nicusX,项目名称:moodle,代码行数:23,代码来源:outputlib.php
示例8: webquest_delete_instance
function webquest_delete_instance($id)
{
/// Given an ID of an instance of this module,
/// delete the instance and any data that depends on it.
global $CFG;
if (!($webquest = get_record("webquest", "id", "{$id}"))) {
return false;
}
$result = true;
if (!delete_records("webquest", "id", "{$webquest->id}")) {
$result = false;
}
if (!delete_records("webquest_resources", "webquestid", "{$webquest->id}")) {
$result = false;
}
if (!delete_records("webquest_tasks", "webquestid", "{$webquest->id}")) {
$result = false;
}
if (!delete_records("webquest_rubrics", "webquestid", "{$webquest->id}")) {
$result = false;
}
if (!delete_records("webquest_grades", "webquestid", "{$webquest->id}")) {
$result = false;
}
if (!delete_records("webquest_teams", "webquestid", "{$webquest->id}")) {
$result = false;
}
if (!delete_records("webquest_team_members", "webquestid", "{$webquest->id}")) {
$result = false;
}
if ($submissions = get_records("webquest_submissions", "webquestid", "{$webquest->id}")) {
foreach ($submissions as $submission) {
$dirpath = "{$CFG->dataroot}/{$webquest->course}/{$CFG->moddata}/webquest/{$submission->id}";
fulldelete($dirpath);
}
}
if (!delete_records("webquest_submissions", "webquestid", "{$webquest->id}")) {
$result = false;
}
return $result;
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:41,代码来源:lib.php
示例9: execute
public function execute()
{
global $CFG, $DB;
if ($this->expandedOptions['flush']) {
if (isset($CFG->trashdir)) {
$trashdir = $CFG->trashdir;
} else {
$trashdir = $CFG->dataroot . '/trashdir';
}
require_once $CFG->libdir . '/filelib.php';
fulldelete($trashdir);
exit(0);
}
if ($this->expandedOptions['stdin']) {
while ($line = fgets(STDIN)) {
$this->fileDelete($line);
}
} else {
foreach ($this->arguments as $argument) {
$this->fileDelete($argument);
}
}
}
开发者ID:dariogs,项目名称:moosh,代码行数:23,代码来源:FileDelete.php
示例10: delete_instance
/**
* Deletes an assignment activity
*
* Deletes all database records, files and calendar events for this assignment.
* @param $assignment object The assignment to be deleted
* @return boolean False indicates error
*/
function delete_instance($assignment)
{
global $CFG;
$assignment->courseid = $assignment->course;
$result = true;
if (!delete_records('assignment_submissions', 'assignment', $assignment->id)) {
$result = false;
}
if (!delete_records('assignment', 'id', $assignment->id)) {
$result = false;
}
if (!delete_records('event', 'modulename', 'assignment', 'instance', $assignment->id)) {
$result = false;
}
// delete file area with all attachments - ignore errors
require_once $CFG->libdir . '/filelib.php';
fulldelete($CFG->dataroot . '/' . $assignment->course . '/' . $CFG->moddata . '/assignment/' . $assignment->id);
assignment_grade_item_delete($assignment);
return $result;
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:27,代码来源:lib.php
示例11: foreach
// restored copy of the module
$newcmid = null;
$tasks = $rc->get_plan()->get_tasks();
foreach ($tasks as $task) {
if (is_subclass_of($task, 'restore_activity_task')) {
if ($task->get_old_contextid() == $cmcontext->id) {
$newcmid = $task->get_moduleid();
break;
}
}
}
// if we know the cmid of the new course module, let us move it
// right below the original one. otherwise it will stay at the
// end of the section
if ($newcmid) {
$newcm = get_coursemodule_from_id('', $newcmid, $course->id, true, MUST_EXIST);
moveto_module($newcm, $section, $cm);
moveto_module($cm, $section, $newcm);
}
$rc->destroy();
if (empty($CFG->keeptempdirectoriesonbackup)) {
fulldelete($backupbasepath);
}
echo $output->header();
if ($newcmid) {
echo $output->confirm(get_string('duplicatesuccess', 'core', $a), new single_button(new moodle_url('/course/modedit.php', array('update' => $newcmid, 'sr' => $sectionreturn)), get_string('duplicatecontedit'), 'get'), new single_button(course_get_url($course, $cm->sectionnum, array('sr' => $sectionreturn)), get_string('duplicatecontcourse'), 'get'));
} else {
echo $output->notification(get_string('duplicatesuccess', 'core', $a), 'notifysuccess');
echo $output->continue_button(course_get_url($course, $cm->sectionnum, array('sr' => $sectionreturn)));
}
echo $output->footer();
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:31,代码来源:modduplicate.php
示例12: html_footer
echo "<form action=\"coursefiles.php\" method=\"get\">\n";
echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n";
echo " <input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />\n";
echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />\n";
echo " <input type=\"submit\" value=\"{$strcancel}\" />\n";
echo "</form>\n";
echo "</td>\n</tr>\n</table>\n";
}
html_footer();
break;
case "delete":
if ($confirm and confirm_sesskey()) {
html_header($course, $wdir);
foreach ($USER->filelist as $file) {
$fullfile = $basedir . $file;
if (!fulldelete($fullfile)) {
echo "<br />Error: Could not delete: {$fullfile}";
}
}
clearfilelist();
displaydir($wdir);
html_footer();
} else {
html_header($course, $wdir);
if (setfilelist($_POST)) {
echo "<p align=center>" . get_string("deletecheckwarning") . ":</p>";
print_simple_box_start("center");
printfilelist($USER->filelist);
print_simple_box_end();
echo "<br />";
$frameold = $CFG->framename;
开发者ID:r007,项目名称:PMoodle,代码行数:31,代码来源:coursefiles.php
示例13: cleanup
public function cleanup() {
return fulldelete($this->directory);
}
开发者ID:nottmoo,项目名称:moodle,代码行数:3,代码来源:lib.php
示例14: process
/**
* Processes this restore stage
* @return bool
* @throws restore_ui_exception
*/
public function process()
{
global $CFG;
if ($this->filename) {
$archivepath = $CFG->tempdir . '/backup/' . $this->filename;
if (!file_exists($archivepath)) {
throw new restore_ui_exception('invalidrestorefile');
}
$outcome = $this->extract_file_to_dir($archivepath);
if ($outcome) {
fulldelete($archivepath);
}
} else {
$fs = get_file_storage();
$storedfile = $fs->get_file_by_hash($this->pathnamehash);
if (!$storedfile || $storedfile->get_contenthash() !== $this->contenthash) {
throw new restore_ui_exception('invalidrestorefile');
}
$outcome = $this->extract_file_to_dir($storedfile);
}
return $outcome;
}
开发者ID:educakanchay,项目名称:campus,代码行数:27,代码来源:restore_ui_stage.class.php
示例15: js_reset_all_caches
/**
* Invalidate all server and client side JS caches.
* @return void
*/
function js_reset_all_caches()
{
global $CFG;
require_once "{$CFG->libdir}/filelib.php";
set_config('jsrev', empty($CFG->jsrev) ? 1 : $CFG->jsrev + 1);
fulldelete("{$CFG->dataroot}/cache/js");
}
开发者ID:richheath,项目名称:moodle,代码行数:11,代码来源:outputrequirementslib.php
示例16: generate_feedback_document
/**
* This function takes the combined pdf and embeds all the comments and annotations.
* @param int|\assign $assignment
* @param int $userid
* @param int $attemptnumber (-1 means latest attempt)
* @return stored_file
*/
public static function generate_feedback_document($assignment, $userid, $attemptnumber)
{
$assignment = self::get_assignment_from_param($assignment);
if (!$assignment->can_view_submission($userid)) {
\print_error('nopermission');
}
if (!$assignment->can_grade()) {
\print_error('nopermission');
}
// Need to generate the page images - first get a combined pdf.
$file = self::get_combined_pdf_for_attempt($assignment, $userid, $attemptnumber);
if (!$file) {
throw new \moodle_exception('Could not generate combined pdf.');
}
$tmpdir = \make_temp_directory('assignfeedback_editpdf/final/' . self::hash($assignment, $userid, $attemptnumber));
$combined = $tmpdir . '/' . self::COMBINED_PDF_FILENAME;
$file->copy_content_to($combined);
// Copy the file.
$pdf = new pdf();
$fs = \get_file_storage();
$stamptmpdir = \make_temp_directory('assignfeedback_editpdf/stamps/' . self::hash($assignment, $userid, $attemptnumber));
$grade = $assignment->get_user_grade($userid, true, $attemptnumber);
// Copy any new stamps to this instance.
if ($files = $fs->get_area_files($assignment->get_context()->id, 'assignfeedback_editpdf', 'stamps', $grade->id, "filename", false)) {
foreach ($files as $file) {
$filename = $stamptmpdir . '/' . $file->get_filename();
$file->copy_content_to($filename);
// Copy the file.
}
}
$pagecount = $pdf->set_pdf($combined);
$grade = $assignment->get_user_grade($userid, true, $attemptnumber);
page_editor::release_drafts($grade->id);
for ($i = 0; $i < $pagecount; $i++) {
$pdf->copy_page();
$comments = page_editor::get_comments($grade->id, $i, false);
$annotations = page_editor::get_annotations($grade->id, $i, false);
foreach ($comments as $comment) {
$pdf->add_comment($comment->rawtext, $comment->x, $comment->y, $comment->width, $comment->colour);
}
foreach ($annotations as $annotation) {
$pdf->add_annotation($annotation->x, $annotation->y, $annotation->endx, $annotation->endy, $annotation->colour, $annotation->type, $annotation->path, $stamptmpdir);
}
}
fulldelete($stamptmpdir);
$filename = self::get_downloadable_feedback_filename($assignment, $userid, $attemptnumber);
$filename = clean_param($filename, PARAM_FILE);
$generatedpdf = $tmpdir . '/' . $filename;
$pdf->save_pdf($generatedpdf);
$record = new \stdClass();
$record->contextid = $assignment->get_context()->id;
$record->component = 'assignfeedback_editpdf';
$record->filearea = self::FINAL_PDF_FILEAREA;
$record->itemid = $grade->id;
$record->filepath = '/';
$record->filename = $filename;
// Only keep one current version of the generated pdf.
$fs->delete_area_files($record->contextid, $record->component, $record->filearea, $record->itemid);
$file = $fs->create_file_from_pathname($record, $generatedpdf);
// Cleanup.
@unlink($generatedpdf);
@unlink($combined);
@rmdir($tmpdir);
return $file;
}
开发者ID:covex-nn,项目名称:moodle,代码行数:72,代码来源:document_services.php
示例17: remove_course_contents
//.........这里部分代码省略.........
foreach ($cleanuplugintypes as $type) {
if (!empty($callbacks[$type])) {
foreach ($callbacks[$type] as $pluginfunction) {
debugging("Callback delete_course is deprecated. Function {$pluginfunction} should be converted " . 'to observer of event \\core\\event\\course_content_deleted', DEBUG_DEVELOPER);
$pluginfunction($course->id, $showfeedback);
}
if ($showfeedback) {
echo $OUTPUT->notification($strdeleted . get_string('type_' . $type . '_plural', 'plugin'), 'notifysuccess');
}
}
}
// Delete questions and question categories.
question_delete_course($course, $showfeedback);
if ($showfeedback) {
echo $OUTPUT->notification($strdeleted . get_string('questions', 'question'), 'notifysuccess');
}
// Make sure there are no subcontexts left - all valid blocks and modules should be already gone.
$childcontexts = $coursecontext->get_child_contexts();
// Returns all subcontexts since 2.2.
foreach ($childcontexts as $childcontext) {
$childcontext->delete();
}
unset($childcontexts);
// Remove all roles and enrolments by default.
if (empty($options['keep_roles_and_enrolments'])) {
// This hack is used in restore when deleting contents of existing course.
role_unassign_all(array('contextid' => $coursecontext->id, 'component' => ''), true);
enrol_course_delete($course);
if ($showfeedback) {
echo $OUTPUT->notification($strdeleted . get_string('type_enrol_plural', 'plugin'), 'notifysuccess');
}
}
// Delete any groups, removing members and grouping/course links first.
if (empty($options['keep_groups_and_groupings'])) {
groups_delete_groupings($course->id, $showfeedback);
groups_delete_groups($course->id, $showfeedback);
}
// Filters be gone!
filter_delete_all_for_context($coursecontext->id);
// Notes, you shall not pass!
note_delete_all($course->id);
// Die comments!
comment::delete_comments($coursecontext->id);
// Ratings are history too.
$delopt = new stdclass();
$delopt->contextid = $coursecontext->id;
$rm = new rating_manager();
$rm->delete_ratings($delopt);
// Delete course tags.
core_tag_tag::remove_all_item_tags('core', 'course', $course->id);
// Notify the competency subsystem.
\core_competency\api::hook_course_deleted($course);
// Delete calendar events.
$DB->delete_records('event', array('courseid' => $course->id));
$fs->delete_area_files($coursecontext->id, 'calendar');
// Delete all related records in other core tables that may have a courseid
// This array stores the tables that need to be cleared, as
// table_name => column_name that contains the course id.
$tablestoclear = array('backup_courses' => 'courseid', 'user_lastaccess' => 'courseid');
foreach ($tablestoclear as $table => $col) {
$DB->delete_records($table, array($col => $course->id));
}
// Delete all course backup files.
$fs->delete_area_files($coursecontext->id, 'backup');
// Cleanup course record - remove links to deleted stuff.
$oldcourse = new stdClass();
$oldcourse->id = $course->id;
$oldcourse->summary = '';
$oldcourse->cacherev = 0;
$oldcourse->legacyfiles = 0;
if (!empty($options['keep_groups_and_groupings'])) {
$oldcourse->defaultgroupingid = 0;
}
$DB->update_record('course', $oldcourse);
// Delete course sections.
$DB->delete_records('course_sections', array('course' => $course->id));
// Delete legacy, section and any other course files.
$fs->delete_area_files($coursecontext->id, 'course');
// Files from summary and section.
// Delete all remaining stuff linked to context such as files, comments, ratings, etc.
if (empty($options['keep_roles_and_enrolments']) and empty($options['keep_groups_and_groupings'])) {
// Easy, do not delete the context itself...
$coursecontext->delete_content();
} else {
// Hack alert!!!!
// We can not drop all context stuff because it would bork enrolments and roles,
// there might be also files used by enrol plugins...
}
// Delete legacy files - just in case some files are still left there after conversion to new file api,
// also some non-standard unsupported plugins may try to store something there.
fulldelete($CFG->dataroot . '/' . $course->id);
// Delete from cache to reduce the cache size especially makes sense in case of bulk course deletion.
$cachemodinfo = cache::make('core', 'coursemodinfo');
$cachemodinfo->delete($courseid);
// Trigger a course content deleted event.
$event = \core\event\course_content_deleted::create(array('objectid' => $course->id, 'context' => $coursecontext, 'other' => array('shortname' => $course->shortname, 'fullname' => $course->fullname, 'options' => $options)));
$event->add_record_snapshot('course', $course);
$event->trigger();
return true;
}
开发者ID:lucaboesch,项目名称:moodle,代码行数:101,代码来源:moodlelib.php
示例18: readdata
/**
* Return content of all files containing questions,
* as an array one element for each file found,
* For each file, the corresponding element is an array of lines.
* @param string filename name of file
* @return mixed contents array or false on failure
*/
public function readdata($filename)
{
// Find if we are importing a .txt file.
if (strtolower(pathinfo($filename, PATHINFO_EXTENSION)) == 'txt') {
if (!is_readable($filename)) {
$this->error(get_string('filenotreadable', 'error'));
return false;
}
return file($filename);
}
// We are importing a zip file.
// Create name for temporary directory.
$uniquecode = time();
$this->tempdir = make_temp_directory('webct_import/' . $uniquecode);
if (is_readable($filename)) {
if (!copy($filename, $this->tempdir . '/webct.zip')) {
$this->error(get_string('cannotcopybackup', 'question'));
fulldelete($this->tempdir);
return false;
}
if (unzip_file($this->tempdir . '/webct.zip', '', false)) {
$dir = $this->tempdir;
if (($handle = opendir($dir)) == false) {
// The directory could not be opened.
fulldelete($this->tempdir);
return false;
}
// Create arrays to store files and directories.
$dirfiles = array();
$dirsubdirs = array();
$slash = '/';
// Loop through all directory entries, and construct two temporary arrays containing files and sub directories.
while (false !== ($entry = readdir($handle))) {
if (is_dir($dir . $slash . $entry) && $entry != '..' && $entry != '.') {
$dirsubdirs[] = $dir . $slash . $entry;
} else {
if ($entry != '..' && $entry != '.') {
$dirfiles[] = $dir . $slash . $entry;
}
}
}
if (($handle = opendir($dirsubdirs[0])) == false) {
// The directory could not be opened.
fulldelete($this->tempdir);
return false;
}
while (false !== ($entry = readdir($handle))) {
if (is_dir($dirsubdirs[0] . $slash . $entry) && $entry != '..' && $entry != '.') {
$dirsubdirs[] = $dirsubdirs[0] . $slash . $entry;
} else {
if ($entry != '..' && $entry != '.') {
$dirfiles[] = $dirsubdirs[0] . $slash . $entry;
}
}
}
return file($dirfiles[1]);
} else {
$this->error(get_string('cannotunzip', 'question'));
fulldelete($this->temp_dir);
}
} else {
$this->error(get_string('cannotreaduploadfile', 'error'));
fulldelete($this->tempdir);
}
return false;
}
开发者ID:miguelangelUvirtual,项目名称:uEducon,代码行数:73,代码来源:format.php
示例19: destroy
/**
* Cleans up stuff after the execution
*
* Note that we do not know if the execution was successful or not.
* An exception might have been thrown.
*/
protected function destroy()
{
global $CFG;
if (empty($CFG->keeptempdirectoriesonbackup)) {
fulldelete($this->get_workdir_path());
}
}
开发者ID:evltuma,项目名称:moodle,代码行数:13,代码来源:convertlib.php
示例20: xmldb_main_upgrade
//.........这里部分代码省略.........
if ($userpref->value > 14 and $userpref->value < 21) {
$newvalue = 21;
} else {
if ($userpref->value > 7 and $userpref->value < 14) {
$newvalue = 14;
} else {
$newvalue = $userpref->value;
}
}
}
}
}
}
$DB->set_field('user_preferences', 'value', $newvalue, array('id' => $userpref->id));
// Update progress.
$i++;
$pbar->update($i, $total, "Upgrading user preference settings - {$i}/{$total}.");
}
$rs->close();
$transaction->allow_commit();
upgrade_main_savepoint(true, 2016011901.0);
}
if ($oldversion < 2016020200.0) {
// Define field isstandard to be added to tag.
$table = new xmldb_table('tag');
$field = new xmldb_field('isstandard', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'rawname');
// Conditionally launch add field isstandard.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Define index tagcolltype (not unique) to be dropped form tag.
$index = new xmldb_index('tagcolltype', XMLDB_INDEX_NOTUNIQUE, array('tagcollid', 'tagtype'));
// Conditionally launch drop index tagcolltype.
if ($dbman->index_exists($table, $index)) {
$dbman->drop_index($table, $index);
}
// Define index tagcolltype (not unique) to be added to tag.
$index = new xmldb_index('tagcolltype', XMLDB_INDEX_NOTUNIQUE, array('tagcollid', 'isstandard'));
// Conditionally launch add index tagcolltype.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Define field tagtype to be dropped from tag.
$field = new xmldb_field('tagtype');
// Conditionally launch drop field tagtype and update isstandard.
if ($dbman->field_exists($table, $field)) {
$DB->execute("UPDATE {tag} SET isstandard=(CASE WHEN (tagtype = ?) THEN 1 ELSE 0 END)", array('official'));
$dbman->drop_field($table, $field);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2016020200.0);
}
if ($oldversion < 2016020201.0) {
// Define field showstandard to be added to tag_area.
$table = new xmldb_table('tag_area');
$field = new xmldb_field('showstandard', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'callbackfile');
// Conditionally launch add field showstandard.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// By default set user area to hide standard tags. 2 = core_tag_tag::HIDE_STANDARD (can not use constant here).
$DB->execute("UPDATE {tag_area} SET showstandard = ? WHERE itemtype = ? AND component = ?", array(2, 'user', 'core'));
// Changing precision of field enabled on table tag_area to (1).
$table = new xmldb_table('tag_area');
$field = new xmldb_field('enabled', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1', 'itemtype');
// Launch change of precision for field enabled.
$dbman->change_field_precision($table, $field);
// Main savepoint reached.
upgrade_main_savepoint(true, 2016020201.0);
}
if ($oldversion < 2016021500.0) {
$root = $CFG->tempdir . '/download';
if (is_dir($root)) {
// Fetch each repository type - include all repos, not just enabled.
$repositories = $DB->get_records('repository', array(), '', 'type');
foreach ($repositories as $id => $repository) {
$directory = $root . '/repository_' . $repository->type;
if (is_dir($directory)) {
fulldelete($directory);
}
}
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2016021500.0);
}
if ($oldversion < 2016021501.0) {
// This could take a long time. Unfortunately, no way to know how long, and no way to do progress, so setting for 1 hour.
upgrade_set_timeout(3600);
// Define index userid-itemid (not unique) to be added to grade_grades_history.
$table = new xmldb_table('grade_grades_history');
$index = new xmldb_index('userid-itemid-timemodified', XMLDB_INDEX_NOTUNIQUE, array('userid', 'itemid', 'timemodified'));
// Conditionally launch add index userid-itemid.
if (!$dbman->index_exists($table, $index)) {
$dbman->add_index($table, $index);
}
// Main savepoint reached.
upgrade_main_savepoint(true, 2016021501.0);
}
return true;
}
开发者ID:isuruAb,项目名称:moodle,代码行数:101,代码来源:upgrade.php
注:本文中的fulldelete函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论