Hi, we have a few commercially bought IMS Packages. Some small which work fine but some with large video files and lots of them (1 is 1.6 GB is size!)
So PHP runs out of memory pretty quickly when trying to deploy them.
I can:
1) start the deploy process within moodle so it gets an entry in: mdl_resource
2) Manually Unzip the files
At which point I'm stuck. I don't know if I need to create the following files manually and if so how:
moodle_hash.ser
moodle_inx.ser
Or add some entry in into the database somewhere. Anyone got any ideas?
Hosting setup in case it helps:
================================
Local network
Win Server 2003
Apache 2.2.14
PHP 5.2.10
MySQL 5.0
Moodle 1.9.4+
Hi all,
I came up with a workaround. What I ended up doing was:
1) Deploy as normal
This creates the DB entry and moves the zip file into the correct folder - ie:
\moodledata\392\moddata\resource\21587
It fails at unzipping as the file is huge so go in and manually unzip the file
Then go to the deploy file at:
\moodle\mod\resource\type\ims\deploy.php
And comment out lines 87-115
/*
/// Create directories
if (!$resourcedir = make_upload_directory($courseid.'/'.$CFG->moddata.'/resource/'.$resource->id)) {
error (get_string('errorcreatingdirectory', 'error', $CFG->moddata.'/resource/'.$resource->id));
}
/// Ensure it's empty
if (!delete_dir_contents($resourcedir)) {
error (get_string('errorcleaningdirectory', 'error', $resourcedir));
}
/// Copy files
$origin = $CFG->dataroot.'/'.$courseid.'/'.$file;
if (!is_file($origin)) {
error (get_string('filenotfound' , 'error', $file));
}
$mimetype = mimeinfo("type", $file);
if ($mimetype != "application/zip") {
error (get_string('invalidfiletype', 'error', $file));
}
$resourcefile = $resourcedir.'/'.basename($origin);
if (!backup_copy_file($origin, $resourcefile)) {
error (get_string('errorcopyingfiles', 'error'));
}
/// Unzip files
if (!unzip_file($resourcefile, '', false)) {
error (get_string('errorunzippingfiles', 'error'));
}
*/
And add in the following below
/// Create directories
if (!$resourcedir = make_upload_directory($courseid.'/'.$CFG->moddata.'/resource/'.$resource->id)) {
error (get_string('errorcreatingdirectory', 'error', $CFG->moddata.'/resource/'.$resource->id));
}
/// Copy files
$origin = $CFG->dataroot.'/'.$courseid.'/'.$file;
$mimetype = mimeinfo("type", $file);
$resourcefile = $resourcedir.'/'.basename($origin);
Go back to your course and go into the resource and click deploy - it bypasses the moving and unzipping bit but follows the rest of the process.
Once done go back and change the \moodle\mod\resource\type\ims\deploy.php file back to normal!
A little long winded but it works!
I came up with a workaround. What I ended up doing was:
1) Deploy as normal
This creates the DB entry and moves the zip file into the correct folder - ie:
\moodledata\392\moddata\resource\21587
It fails at unzipping as the file is huge so go in and manually unzip the file
Then go to the deploy file at:
\moodle\mod\resource\type\ims\deploy.php
And comment out lines 87-115
/*
/// Create directories
if (!$resourcedir = make_upload_directory($courseid.'/'.$CFG->moddata.'/resource/'.$resource->id)) {
error (get_string('errorcreatingdirectory', 'error', $CFG->moddata.'/resource/'.$resource->id));
}
/// Ensure it's empty
if (!delete_dir_contents($resourcedir)) {
error (get_string('errorcleaningdirectory', 'error', $resourcedir));
}
/// Copy files
$origin = $CFG->dataroot.'/'.$courseid.'/'.$file;
if (!is_file($origin)) {
error (get_string('filenotfound' , 'error', $file));
}
$mimetype = mimeinfo("type", $file);
if ($mimetype != "application/zip") {
error (get_string('invalidfiletype', 'error', $file));
}
$resourcefile = $resourcedir.'/'.basename($origin);
if (!backup_copy_file($origin, $resourcefile)) {
error (get_string('errorcopyingfiles', 'error'));
}
/// Unzip files
if (!unzip_file($resourcefile, '', false)) {
error (get_string('errorunzippingfiles', 'error'));
}
*/
And add in the following below
/// Create directories
if (!$resourcedir = make_upload_directory($courseid.'/'.$CFG->moddata.'/resource/'.$resource->id)) {
error (get_string('errorcreatingdirectory', 'error', $CFG->moddata.'/resource/'.$resource->id));
}
/// Copy files
$origin = $CFG->dataroot.'/'.$courseid.'/'.$file;
$mimetype = mimeinfo("type", $file);
$resourcefile = $resourcedir.'/'.basename($origin);
Go back to your course and go into the resource and click deploy - it bypasses the moving and unzipping bit but follows the rest of the process.
Once done go back and change the \moodle\mod\resource\type\ims\deploy.php file back to normal!
A little long winded but it works!
Hi Rob,
Thanks for this info.
Have tried it though and the package deploys but returns a blank screen still. Is there something I'm missing? Have attached my deploy.php file to see if you can see any probs? Any help would be fantastic
Thanks
James