MDL-28701 Change uses of make_upload_directory(temp) to make_temp_directory().
authorTom Lanyon <tom@netspot.com.au>
Sat, 10 Sep 2011 08:43:49 +0000 (10:43 +0200)
committerPetr Skoda <commits@skodak.org>
Sat, 10 Sep 2011 08:43:49 +0000 (10:43 +0200)
20 files changed:
admin/langimport.php
blocks/community/locallib.php
enrol/authorize/uploadcsv.php
files/externallib.php
filter/tex/latex.php
grade/edit/outcome/import.php
grade/export/xml/grade_export_xml.php
grade/import/csv/index.php
lib/componentlib.class.php
lib/csvlib.class.php
lib/excellib.class.php
lib/formslib.php
lib/odslib.class.php
lib/textlib.class.php
mod/data/lib.php
mod/lesson/import.php
mod/scorm/lib.php
mod/scorm/mod_form.php
question/format/qti_two/format.php
question/import.php

index 713f608..476dbaf 100644 (file)
@@ -58,7 +58,7 @@ $notice_error = array();
 
 if (($mode == INSTALLATION_OF_SELECTED_LANG) and confirm_sesskey() and !empty($pack)) {
     set_time_limit(0);
-    make_upload_directory('temp');
+    make_temp_directory('');
     make_upload_directory('lang');
 
     $installer = new lang_installer($pack);
@@ -149,7 +149,7 @@ if ($mode == UPDATE_ALL_LANG) {
         }
     }
 
-    make_upload_directory('temp');
+    make_temp_directory('');
     make_upload_directory('lang');
 
     // clean-up currently installed versions of the packs
index e54ed2c..f76088f 100644 (file)
@@ -86,7 +86,7 @@ class block_community_manager {
         $params['courseid'] = $course->id;
         $params['filetype'] = HUB_BACKUP_FILE_TYPE;
 
-        make_upload_directory('temp/backup');
+        make_temp_directory('backup');
 
         $filename = md5(time() . '-' . $course->id . '-'. $USER->id . '-'. random_string(20));
 
index 7693824..697d354 100644 (file)
@@ -55,7 +55,7 @@ if (!$form->get_data()) {
     $form->display();
 } else {
     $filename = $CFG->tempdir . '/enrolauthorize/importedfile_'.time().'.csv';
-    make_upload_directory('temp/enrolauthorize');
+    make_temp_directory('enrolauthorize');
     // Fix mac/dos newlines
     $text = $form->get_file_content('csvfile');
     $text = preg_replace('!\r\n?!', "\n", $text);
index eba388b..a6e3235 100644 (file)
@@ -207,7 +207,7 @@ class moodle_file_external extends external_api {
             throw new moodle_exception('nofile');
         }
         // saving file
-        $dir = make_upload_directory('temp/wsupload');
+        $dir = make_temp_directory('wsupload');
 
         if (empty($fileinfo['filename'])) {
             $filename = uniqid('wsupload').'_'.time().'.tmp';
index b3bd4b9..2f84bc2 100644 (file)
@@ -20,7 +20,7 @@
 
             // construct directory structure
             $this->temp_dir = $CFG->tempdir . "/latex";
-            make_upload_directory('temp/latex');
+            make_temp_directory('latex');
         }
 
         /**
index f189f73..6e62867 100644 (file)
@@ -61,7 +61,7 @@ if (!$upload_form->get_data()) {
 print_grade_page_head($courseid, 'outcome', 'import', get_string('importoutcomes', 'grades'));
 
 $imported_file = $CFG->tempdir . '/outcomeimport/importedfile_'.time().'.csv';
-make_upload_directory('temp/outcomeimport');
+make_temp_directory('outcomeimport');
 
 // copying imported file
 if (!$upload_form->save_file('userfile', $imported_file, true)) {
index 48fdf40..38cb353 100644 (file)
@@ -40,7 +40,7 @@ class grade_export_xml extends grade_export {
         /// Calculate file name
         $downloadfilename = clean_filename("{$this->course->shortname} $strgrades.xml");
 
-        make_upload_directory('temp/gradeexport');
+        make_temp_directory('gradeexport');
         $tempfilename = $CFG->tempdir .'/gradeexport/'. md5(sesskey().microtime().$downloadfilename);
         if (!$handle = fopen($tempfilename, 'w+b')) {
             print_error('cannotcreatetempdir');
index caca05e..886bf43 100644 (file)
@@ -111,7 +111,7 @@ if ($formdata = $mform->get_data()) {
 
     // use current (non-conflicting) time stamp
     $importcode = get_new_importcode();
-    $filename = make_upload_directory('temp/gradeimport/cvs/'.$USER->id);
+    $filename = make_temp_directory('gradeimport/cvs/'.$USER->id);
     $filename = $filename.'/'.$importcode;
 
     $text = $mform->get_file_content('userfile');
index 11abf63..0bb7c71 100644 (file)
@@ -281,7 +281,7 @@ class component_installer {
             return COMPONENT_UPTODATE;
         }
     /// Create temp directory if necesary
-        if (!make_upload_directory('temp', false)) {
+        if (!make_temp_directory('', false)) {
              $this->errorstring='cannotcreatetempdir';
              return COMPONENT_ERROR;
         }
index 8d2d3ea..2eb9df3 100644 (file)
@@ -310,7 +310,7 @@ class csv_import_reader {
     function get_new_iid($type) {
         global $USER;
 
-        $filename = make_upload_directory('temp/csvimport/'.$type.'/'.$USER->id);
+        $filename = make_temp_directory('csvimport/'.$type.'/'.$USER->id);
 
         // use current (non-conflicting) time stamp
         $iiid = time();
index 53c2150..8b1262d 100644 (file)
@@ -64,7 +64,7 @@ class MoodleExcelWorkbook {
             $this->latin_output = true;
         }
     /// Choose our temporary directory - see MDL-7176, found by paulo.matos
-        make_upload_directory('temp/excel');
+        make_temp_directory('excel');
         $this->pear_excel_workbook->setTempDir($CFG->tempdir.'/excel');
     }
 
index aadc8a0..d579b87 100644 (file)
@@ -652,7 +652,7 @@ abstract class moodleform {
         if (!$this->get_new_filename($elname)) {
             return false;
         }
-        if (!$dir = make_upload_directory('temp/forms')) {
+        if (!$dir = make_temp_directory('forms')) {
             return false;
         }
         if (!$tempfile = tempnam($dir, 'tempup_')) {
index db2837f..be1a5d9 100644 (file)
@@ -74,10 +74,10 @@ class MoodleODSWorkbook {
         global $CFG;
         require_once($CFG->libdir.'/filelib.php');
 
-        $dir = 'temp/ods/'.time();
-        make_upload_directory($dir);
-        make_upload_directory($dir.'/META-INF');
-        $dir = "$CFG->dataroot/$dir";
+        $dir = 'ods/'.time();
+        make_temp_directory($dir);
+        make_temp_directory($dir.'/META-INF');
+        $dir = "$CFG->tempdir/$dir";
         $files = array();
 
         $handle = fopen("$dir/mimetype", 'w');
index 37dfa10..1f67f99 100644 (file)
@@ -83,7 +83,7 @@ class textlib {
 
         // And this directory must exist to allow Typo to cache conversion
         // tables when using internal functions
-        make_upload_directory('temp/typo3temp/cs');
+        make_temp_directory('typo3temp/cs');
 
         // Make sure typo is using our dir permissions
         $GLOBALS['TYPO3_CONF_VARS']['BE']['folderCreateMask'] = decoct($CFG->directorypermissions);
index 47a5c5b..2bee85b 100644 (file)
@@ -3142,8 +3142,8 @@ function data_presets_export($course, $cm, $data, $tostorage=false) {
     global $CFG, $DB;
 
     $presetname = clean_filename($data->name) . '-preset-' . gmdate("Ymd_Hi");
-    $exportsubdir = "temp/mod_data/presetexport/$presetname";
-    make_upload_directory($exportsubdir);
+    $exportsubdir = "mod_data/presetexport/$presetname";
+    make_temp_directory($exportsubdir);
     $exportdir = "$CFG->dataroot/$exportsubdir";
 
     // Assemble "preset.xml":
index 0b00e20..71af931 100644 (file)
@@ -69,7 +69,7 @@ if ($data = $mform->get_data()) {
     $realfilename = $mform->get_new_filename('questionfile');
     //TODO: Leave all imported questions in Questionimport for now.
     $importfile = "{$CFG->dataroot}/temp/questionimport/{$realfilename}";
-    make_upload_directory('temp/questionimport');
+    make_temp_directory('questionimport');
     if (!$result = $mform->save_file('questionfile', $importfile, true)) {
         throw new moodle_exception('uploadproblem');
     }
index a6e4e26..16fcb32 100644 (file)
@@ -994,7 +994,7 @@ function scorm_debug_log_write($type, $text, $scoid) {
     if (!$debugenablelog || empty($text)) {
         return;
     }
-    if (make_upload_directory('temp/scormlogs/')) {
+    if (make_temp_directory('scormlogs/')) {
         $logfile = scorm_debug_log_filename($type, $scoid);
         @file_put_contents($logfile, date('Y/m/d H:i:s O')." DEBUG $text\r\n", FILE_APPEND);
     }
index 11118f7..98dda8b 100644 (file)
@@ -329,7 +329,7 @@ class mod_scorm_mod_form extends moodleform_mod {
                 }
                 $file = reset($files);
                 $filename = $CFG->tempdir.'/scormimport/scrom_'.time();
-                make_upload_directory('temp/scormimport');
+                make_temp_directory('scormimport');
                 $file->copy_content_to($filename);
 
                 $packer = get_file_packer('application/zip');
index 88cdcbb..d0688bd 100644 (file)
@@ -263,9 +263,9 @@ function handle_questions_media(&$questions, $path, $courseid) {
         global $CFG, $OUTPUT, $USER;
         $courseid = $this->course->id;
 
-        $path = 'temp/qformat_qti_two/' . $USER->id . '/' . $this->filename;
+        $path = 'qformat_qti_two/' . $USER->id . '/' . $this->filename;
         // create a directory for the exports (if not already existing)
-        if (!make_upload_directory($path)) {
+        if (!make_temp_directory($path)) {
               throw new moodle_exception('cannotcreatepath', 'question', '', $path);
         }
         $path = $CFG->dataroot . '/' . $path;
index 0001e1a..3750e75 100644 (file)
@@ -84,7 +84,7 @@ if ($form = $import_form->get_data()) {
     $realfilename = $import_form->get_new_filename('newfile');
 
     $importfile = "{$CFG->dataroot}/temp/questionimport/{$realfilename}";
-    make_upload_directory('temp/questionimport');
+    make_temp_directory('questionimport');
     if (!$result = $import_form->save_file('newfile', $importfile, true)) {
         throw new moodle_exception('uploadproblem');
     }