Commit 72683904 authored by Robert Lyon's avatar Robert Lyon
Browse files

Passing in oldextension variable when doing import or zip extraction



Bug 1318995

Change-Id: I3ab1c23cb5fcd188436224508cf5b9127e7fb290
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent d694da1a
......@@ -420,6 +420,7 @@ class LeapImportBlog extends LeapImportArtefactPlugin {
'title' => (string)$blogpostentry->title . ' ' . get_string('attachment', 'artefact.blog'),
'owner' => $importer->get('usr'),
);
$data->oldextension = end(explode('.', $data->title));
return ArtefactTypeFile::save_file($pathname, $data, $importer->get('usrobj'), true);
}
......
......@@ -459,7 +459,7 @@ class LeapImportFile extends LeapImportArtefactPlugin {
else {
$usr = $importer->get('usrobj');
}
$data->oldextension = end(explode('.', $data->title));
// This API sucks, but that's not my problem
if (!$id = ArtefactTypeFile::save_file($data->pathname, $data, $usr, true)) {
$importer->trace("WARNING: the file for entry $entryid does not exist in the import (path={$data->pathname})");
......
......@@ -2653,6 +2653,7 @@ class ArtefactTypeArchive extends ArtefactTypeFile {
// set the file extension for later use (eg by flowplayer)
$this->data['template']->extension = pathinfo($this->data['template']->title, PATHINFO_EXTENSION);
$this->data['template']->oldextension = $this->data['template']->extension;
if (substr($name, -1) != '/') {
$h = fopen($tempfile, 'w');
......
......@@ -99,6 +99,7 @@ class PluginImportFile extends PluginImport {
try {
$data = (object)array(
'title' => $f->wantsfilename,
'oldextension' => end(explode('.', $f->wantsfilename)),
'description' => $f->wantsfilename . ' (' . get_string('importedfrom', 'mahara', $this->get('importertransport')->get_description()) . ')',
'parent' => $this->importdir,
'owner' => $this->get('usr'),
......
......@@ -1977,6 +1977,7 @@ class PluginImportLeap extends PluginImport {
'title' => (string)$entry->title . ' ' . get_string('attachment'),
'owner' => $this->get('usr'),
);
$data->oldextension = end(explode('.', $data->title));
return ArtefactTypeFile::save_file($pathname, $data, $this->get('usrobj'), true);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment