Merge branch 'm28_MDL-29708_Typo_Extra_Slashes' of https://github.com/scara/moodle

This commit is contained in:
Eloy Lafuente (stronk7)
2014-06-11 01:32:24 +02:00
3 changed files with 13 additions and 5 deletions
+1 -1
View File
@@ -489,7 +489,7 @@ $string['statsnodata'] = 'There is no available data for that combination of cou
$string['storedfilecannotcreatefile'] = 'Can not create local file pool file, please verify permissions in dataroot and available disk space.';
$string['storedfilecannotcreatefiledirs'] = 'Can not create local file pool directories, please verify permissions in dataroot.';
$string['storedfilecannotread'] = 'Can not read file, either file does not exist or there are permission problems';
$string['storedfilenotcreated'] = 'Can not create file "{$a->contextid}/{$a->component}/{$a->filearea}/{$a->itemid}/{$a->filepath}/{$a->filename}"';
$string['storedfilenotcreated'] = 'Can not create file "{$a->contextid}/{$a->component}/{$a->filearea}/{$a->itemid}{$a->filepath}{$a->filename}"';
$string['storedfileproblem'] = 'Unknown exception related to local files ({$a})';
$string['tagdisabled'] = 'Tags are disabled!';
$string['tagnotfound'] = 'The specified tag was not found in the database';
+8 -1
View File
@@ -205,7 +205,14 @@ class stored_file {
*/
public function rename($filepath, $filename) {
if ($this->fs->file_exists($this->get_contextid(), $this->get_component(), $this->get_filearea(), $this->get_itemid(), $filepath, $filename)) {
throw new file_exception('storedfilenotcreated', '', 'file exists, cannot rename');
$a = new stdClass();
$a->contextid = $this->get_contextid();
$a->component = $this->get_component();
$a->filearea = $this->get_filearea();
$a->itemid = $this->get_itemid();
$a->filepath = $filepath;
$a->filename = $filename;
throw new file_exception('storedfilenotcreated', $a, 'file exists, cannot rename');
}
$filerecord = new stdClass;
$filerecord->filepath = $filepath;
+4 -3
View File
@@ -300,7 +300,8 @@ class core_files_file_storage_testcase extends advanced_testcase {
$this->assertEquals($contenthash, $file->get_contenthash());
// Try break it.
$this->setExpectedException('file_exception');
$this->setExpectedException('file_exception',
'Can not create file "1/core/unittest/0/test/newtest.txt" (file exists, cannot rename)');
// This shall throw exception.
$originalfile->rename($newpath, $newname);
}
@@ -1146,7 +1147,7 @@ class core_files_file_storage_testcase extends advanced_testcase {
$this->assertInstanceOf('stored_file', $file1);
// Creating a file validating unique constraint.
$this->setExpectedException('stored_file_creation_exception');
$this->setExpectedException('stored_file_creation_exception', 'Can not create file "1/core/phpunit/0/testfile.txt"');
$fs->create_file_from_storedfile($filerecord, $file1->get_id());
}
@@ -1426,7 +1427,7 @@ class core_files_file_storage_testcase extends advanced_testcase {
$this->assertInstanceOf('stored_file', $file1);
// Creating a file validating unique constraint.
$this->setExpectedException('stored_file_creation_exception');
$this->setExpectedException('stored_file_creation_exception', 'Can not create file "1/core/phpunit/0/testfile.txt"');
$file2 = $fs->create_file_from_pathname($filerecord, $path);
}