Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
ea7d7b35
Commit
ea7d7b35
authored
Mar 01, 2009
by
Penny Leach
Browse files
Cherry picking a cherry picked commit... unziptempdir
very manual cherry of
f5c4ed7b
reworked to live in new import/file plugin
parent
8b6dfe7c
Changes
1
Hide whitespace changes
Inline
Side-by-side
htdocs/import/lib.php
View file @
ea7d7b35
...
@@ -272,13 +272,18 @@ class MnetImporterTransport extends ImporterTransport {
...
@@ -272,13 +272,18 @@ class MnetImporterTransport extends ImporterTransport {
}
}
$this
->
relativepath
=
'temp/import/'
.
$this
->
importer
->
get
(
'id'
)
.
'/'
;
$this
->
relativepath
=
'temp/import/'
.
$this
->
importer
->
get
(
'id'
)
.
'/'
;
$this
->
tempdir
=
get_config
(
'dataroot'
)
.
$this
->
relativepath
;
if
(
$tmpdir
=
get_config
(
'unziptempdir'
))
{
$this
->
tempdir
=
$tmpdir
.
$this
->
relativepath
;
}
else
{
$this
->
tempdir
=
get_config
(
'dataroot'
)
.
$this
->
relativepath
;
}
if
(
!
check_dir_exists
(
$this
->
tempdir
))
{
if
(
!
check_dir_exists
(
$this
->
tempdir
))
{
throw
new
ImportException
(
'Failed to create the temporary directories to work in'
);
throw
new
ImportException
(
'Failed to create the temporary directories to work in'
);
}
}
$this
->
zipfilename
=
'import.zip'
;
$this
->
zipfilename
=
'import.zip'
;
if
(
!
file_put_contents
(
$this
->
tempdir
.
'/'
.
$this
->
zipfilename
,
$filecontents
))
{
if
(
!
file_put_contents
(
$this
->
tempdir
.
$this
->
zipfilename
,
$filecontents
))
{
throw
new
ImportException
(
'Failed to write out the zipfile to local temporary storage'
);
throw
new
ImportException
(
'Failed to write out the zipfile to local temporary storage'
);
}
}
}
}
...
@@ -286,6 +291,7 @@ class MnetImporterTransport extends ImporterTransport {
...
@@ -286,6 +291,7 @@ class MnetImporterTransport extends ImporterTransport {
public
function
files_info
()
{
public
function
files_info
()
{
return
array
(
return
array
(
'zipfile'
=>
$this
->
zipfilename
,
'zipfile'
=>
$this
->
zipfilename
,
'tempdir'
=>
$this
->
tempdir
,
'relativepath'
=>
$this
->
relativepath
,
'relativepath'
=>
$this
->
relativepath
,
);
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment