Commit 4a2e4ed3 authored by Son Nguyen's avatar Son Nguyen Committed by Gerrit Code Review
Browse files

Merge "Passing in oldextension variable when doing import or zip extraction" into 1.9_STABLE

parents 87ddefc2 feccff40
......@@ -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})");
......
......@@ -2395,6 +2395,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) == '/') {
$this->create_folder($folder);
......@@ -2441,6 +2442,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);
}
......
Supports Markdown
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