MDL-33550 Set default status for file =0 and correct setting user in phpunit test
This commit is contained in:
@@ -1033,6 +1033,7 @@ class file_storage {
|
||||
$newrecord->source = empty($filerecord->source) ? null : $filerecord->source;
|
||||
$newrecord->author = empty($filerecord->author) ? null : $filerecord->author;
|
||||
$newrecord->license = empty($filerecord->license) ? null : $filerecord->license;
|
||||
$newrecord->status = empty($filerecord->status) ? 0 : $filerecord->status;
|
||||
$newrecord->sortorder = $filerecord->sortorder;
|
||||
|
||||
list($newrecord->contenthash, $newrecord->filesize, $newfile) = $this->add_file_to_pool($pathname);
|
||||
@@ -1149,6 +1150,7 @@ class file_storage {
|
||||
$newrecord->source = empty($filerecord->source) ? null : $filerecord->source;
|
||||
$newrecord->author = empty($filerecord->author) ? null : $filerecord->author;
|
||||
$newrecord->license = empty($filerecord->license) ? null : $filerecord->license;
|
||||
$newrecord->status = empty($filerecord->status) ? 0 : $filerecord->status;
|
||||
$newrecord->sortorder = $filerecord->sortorder;
|
||||
|
||||
list($newrecord->contenthash, $newrecord->filesize, $newfile) = $this->add_string_to_pool($content);
|
||||
@@ -1223,6 +1225,7 @@ class file_storage {
|
||||
$filerecord->source = empty($filerecord->source) ? null : $filerecord->source;
|
||||
$filerecord->author = empty($filerecord->author) ? null : $filerecord->author;
|
||||
$filerecord->license = empty($filerecord->license) ? null : $filerecord->license;
|
||||
$filerecord->status = empty($filerecord->status) ? 0 : $filerecord->status;
|
||||
$filerecord->filepath = clean_param($filerecord->filepath, PARAM_PATH);
|
||||
if (strpos($filerecord->filepath, '/') !== 0 or strrpos($filerecord->filepath, '/') !== strlen($filerecord->filepath)-1) {
|
||||
// Path must start and end with '/'.
|
||||
|
||||
@@ -159,9 +159,9 @@ class filestoragelib_testcase extends advanced_testcase {
|
||||
// create user
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$usercontext = context_user::instance($user->id);
|
||||
$syscontext = context_system::instance();
|
||||
$USER = $DB->get_record('user', array('id'=>$user->id));
|
||||
|
||||
$fs = get_file_storage();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user