$fs = get_file_storage();
$status = true;
if ($this->file) {
- return $fs->get_file($this->file)->get_contenthash();
+ return $fs->get_file_by_id($this->file)->get_contenthash();
}
if ($files = $fs->get_area_files($this->assignment->context->id, 'assignment_submission', $this->user->id, '', false)) {
$sha1s = array();
}
if (has_capability('mod/assignment:exportownsubmission', $this->context)) {
- $p['file'] = $filename;
+ $p['file'] = $file->get_id();
$output .= portfolio_add_button('assignment_portfolio_caller', $p, '/mod/assignment/lib.php', false, true);
}
$output .= '<br />';
$prefix = implode('.', $bits);
}
while (true) {
- if (!in_array($newname, $this->accounttree['file_name'])) {
+ if (!array_key_exists('file_name', $this->accounttree) || !in_array($newname, $this->accounttree['file_name'])) {
return $this->boxclient->renameFile($fileid, $newname);
}
$newname = $prefix . '(' . $count . ')' . $suffix;