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
61da923e
Commit
61da923e
authored
Sep 08, 2008
by
Penny Leach
Browse files
Fixing bugs in import and added earlier quota check
parent
3778367a
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/api/xmlrpc/lib.php
View file @
61da923e
...
@@ -310,7 +310,8 @@ function send_content_ready($token, $username, $format, $importdata, $fetchnow=f
...
@@ -310,7 +310,8 @@ function send_content_ready($token, $username, $format, $importdata, $fetchnow=f
global
$REMOTEWWWROOT
;
global
$REMOTEWWWROOT
;
require_once
(
'import.php'
);
require_once
(
'import.php'
);
if
(
!
$user
=
find_remote_user
(
$username
,
$REMOTEWWWROOT
))
{
list
(
$user
,
$authinstance
)
=
find_remote_user
(
$username
,
$REMOTEWWWROOT
);
if
(
!
$user
)
{
throw
new
ImportException
(
"Could not find user
$username
for
$REMOTEWWWROOT
"
);
throw
new
ImportException
(
"Could not find user
$username
for
$REMOTEWWWROOT
"
);
}
}
...
@@ -336,6 +337,16 @@ function send_content_ready($token, $username, $format, $importdata, $fetchnow=f
...
@@ -336,6 +337,16 @@ function send_content_ready($token, $username, $format, $importdata, $fetchnow=f
throw
new
ImportException
(
'Invalid importdata: '
.
$e
->
getMessage
());
throw
new
ImportException
(
'Invalid importdata: '
.
$e
->
getMessage
());
}
}
if
(
!
array_key_exists
(
'totalsize'
,
$importdata
))
{
throw
new
ImportException
(
'Invalid importdata: missing totalsize'
);
}
if
(
!
$user
->
quota_allowed
(
$importdata
[
'totalsize'
]))
{
$e
=
new
ImportException
(
'Exceeded user quota'
);
$e
->
set_log_off
();
throw
$e
;
}
$queue
->
data
=
serialize
(
$importdata
);
$queue
->
data
=
serialize
(
$importdata
);
update_record
(
'import_queue'
,
$queue
);
update_record
(
'import_queue'
,
$queue
);
...
...
htdocs/lib/import.php
View file @
61da923e
...
@@ -275,7 +275,7 @@ class FilesImporter extends Importer {
...
@@ -275,7 +275,7 @@ class FilesImporter extends Importer {
$savedfiles
=
array
();
// to put files into so we can delete them should we encounter an exception
$savedfiles
=
array
();
// to put files into so we can delete them should we encounter an exception
foreach
(
$this
->
files
as
$f
)
{
foreach
(
$this
->
files
as
$f
)
{
try
{
try
{
$data
=
array
(
$data
=
(
object
)
array
(
'title'
=>
$f
->
wantsfilename
,
'title'
=>
$f
->
wantsfilename
,
'description'
=>
$f
->
wantsfilename
.
' ('
.
get_string
(
'importedfrom'
,
'mahara'
,
$this
->
get
(
'importertransport'
)
->
get_description
())
.
')'
,
'description'
=>
$f
->
wantsfilename
.
' ('
.
get_string
(
'importedfrom'
,
'mahara'
,
$this
->
get
(
'importertransport'
)
->
get_description
())
.
')'
,
'parent'
=>
$dir
,
'parent'
=>
$dir
,
...
...
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