Commit 8241aca4 authored by Penny Leach's avatar Penny Leach
Browse files

leap import: fix a few oddities with import filenames (maybe a php 5.3 problem)


Signed-off-by: default avatarPenny Leach <penny@mjollnir.org>
parent 24f12a18
...@@ -218,8 +218,7 @@ class LeapImportFile extends LeapImportArtefactPlugin { ...@@ -218,8 +218,7 @@ class LeapImportFile extends LeapImportArtefactPlugin {
// UTF8 characters // UTF8 characters
$pathname = urldecode((string)$entry->content['src']); $pathname = urldecode((string)$entry->content['src']);
// TODO: might want to make it easier to get at the directory where the import files are // TODO: might want to make it easier to get at the directory where the import files are
$data = $importer->get('data'); $dir = dirname($importer->get('filename'));
$dir = dirname($data['filename']);
// Note: this data is passed (eventually) to ArtefactType->__construct, // Note: this data is passed (eventually) to ArtefactType->__construct,
// which calls strtotime on the dates for us // which calls strtotime on the dates for us
......
...@@ -41,6 +41,7 @@ class PluginImportLeap extends PluginImport { ...@@ -41,6 +41,7 @@ class PluginImportLeap extends PluginImport {
private $loadmapping = array(); private $loadmapping = array();
private $coreloadmapping = array(); private $coreloadmapping = array();
private $artefactids = array(); private $artefactids = array();
protected $filename;
protected $persondataid = null; protected $persondataid = null;
...@@ -97,16 +98,16 @@ class PluginImportLeap extends PluginImport { ...@@ -97,16 +98,16 @@ class PluginImportLeap extends PluginImport {
public function process() { public function process() {
db_begin(); db_begin();
$filename = self::find_file($this->get('importertransport')->files_info()); $this->filename = self::find_file($this->get('importertransport')->files_info());
$this->logfile = dirname($filename) . '/import.log'; $this->logfile = dirname($this->filename) . '/import.log';
$this->trace('Loading import from ' . $filename); $this->trace('Loading import from ' . $this->filename);
$this->snapshot('begin'); $this->snapshot('begin');
$options = $options =
LIBXML_COMPACT | // Reported to greatly speed XML parsing LIBXML_COMPACT | // Reported to greatly speed XML parsing
LIBXML_NONET // Disable network access - security check LIBXML_NONET // Disable network access - security check
; ;
if (!$this->xml = simplexml_load_file($filename, 'SimpleXMLElement', $options)) { if (!$this->xml = simplexml_load_file($this->filename, 'SimpleXMLElement', $options)) {
// TODO: bail out in a much nicer way... // TODO: bail out in a much nicer way...
throw new ImportException($this, "FATAL: XML file is not well formed! Please consult Mahara's error log for more information"); throw new ImportException($this, "FATAL: XML file is not well formed! Please consult Mahara's error log for more information");
} }
......
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