Forums | Mahara Community

Support /
Export failing for some users

Howard Miller's profile picture
Posts: 137

23 July 2014, 21:13

When trying to export (to HTML, haven't tried LEAP2A yet), for certain users it fails. The progress bar gets some way in the just stops. 

I have stuck debugging on and get the following in connection with this. Any thoughts appreciated. 

Mahara 1.9 btw...


[Tue Jul 22 14:29:41.883129 2014] [:error] [pid 18582] [client] [WAR] 6a (lib/errors.php:451) An exception was thrown of class InvalidArgumentException. , referer:
[Tue Jul 22 14:29:41.883166 2014] [:error] [pid 18582] [client] [WAR] 6a (lib/errors.php:451) THIS IS BAD and should be changed to something extending MaharaException,, referer:
[Tue Jul 22 14:29:41.883175 2014] [:error] [pid 18582] [client] [WAR] 6a (lib/errors.php:451) unless the exception is from a third party library., referer:
[Tue Jul 22 14:29:41.883183 2014] [:error] [pid 18582] [client] [WAR] 6a (lib/errors.php:451) Original trace follows, referer:
[Tue Jul 22 14:29:41.883460 2014] [:error] [pid 18582] [client] [WAR] 6a (artefact/lib.php:425) Field filetype wasn't found in class ArtefactTypeBlogPost, referer:
[Tue Jul 22 14:29:41.883480 2014] [:error] [pid 18582] [client] Call stack (most recent first):, referer:
[Tue Jul 22 14:29:41.883488 2014] [:error] [pid 18582] [client]   * ArtefactType->get("filetype") at /var/www/html/mahara/artefact/file/blocktype/internalmedia/lib.php:53, referer:
[Tue Jul 22 14:29:41.883495 2014] [:error] [pid 18582] [client]   * PluginBlocktypeInternalmedia::render_instance(object(BlockInstance)) at Unknown:0, referer:
[Tue Jul 22 14:29:41.883502 2014] [:error] [pid 18582] [client]   * call_user_func_array(array(size 2), array(size 1)) at /var/www/html/mahara/lib/mahara.php:1562, referer:
[Tue Jul 22 14:29:41.883510 2014] [:error] [pid 18582] [client]   * call_static_method("PluginBlocktypeInternalmedia", "render_instance", object(BlockInstance)) at /var/www/html/mahara/blocktype/lib.php:763, referer:
[Tue Jul 22 14:29:41.883517 2014] [:error] [pid 18582] [client]   * BlockInstance->render_viewing() at /var/www/html/mahara/lib/view.php:2009, referer:
[Tue Jul 22 14:29:41.883524 2014] [:error] [pid 18582] [client]   * View->build_column(1, 1, false) at /var/www/html/mahara/lib/view.php:1966, referer:
[Tue Jul 22 14:29:41.883531 2014] [:error] [pid 18582] [client]   * View->build_columns(1, false) at /var/www/html/mahara/lib/view.php:1951, referer:
[Tue Jul 22 14:29:41.883538 2014] [:error] [pid 18582] [client]   * View->build_rows() at /var/www/html/mahara/export/html/lib.php:392, referer:
[Tue Jul 22 14:29:41.883544 2014] [:error] [pid 18582] [client]   * PluginExportHtml->dump_view_export_data() at /var/www/html/mahara/export/html/lib.php:183, referer:
[Tue Jul 22 14:29:41.883551 2014] [:error] [pid 18582] [client]   * PluginExportHtml->export() at /var/www/html/mahara/export/download.php:92, referer:
[Tue Jul 22 14:29:41.883558 2014] [:error] [pid 18582] [client] , referer:
Tobias Zeuch's profile picture
Posts: 101

24 July 2014, 0:04

Hi Howard,

from the error logs it looks like there's an "embedded media" block that is associated with a blog post artefact. I have no idea how that could have happened, it should only let you choose file type artefacts. 

Can those users view all their pages? If one of the affected users doesn't have a lot of pages, maybe you can try to identify the page (or pages) that doesn't/don't work and if it can be displayed/edited, maybe you find the block element that is causing the issue. The block seems to be the first one in the first column, from what I see on build_column(1, 1, false). 

Hope that helps,


Howard Miller's profile picture
Posts: 137

24 July 2014, 0:49

They have not reported any problems but I'll ask. 

Is there any digging around in the database that I could do to pin it down?

Tobias Zeuch's profile picture
Posts: 101

24 July 2014, 2:53

The artefactid that is probably causing the problem is referenced in the configdata which makes it a little difficult to query, because the configdata is stored as a serialized array. If there's not too many of it, you could start searching in the table block_instance for blocktype "internalmedia". There should be something like this in the config-data-column: 


Where the last number marks the artefact-id. If there's just a few internalmedia-blocks, you could search manually for the artefact-ids in the artefacttable and see if one of them is of artefacttype:blogpost. 

Or you could try the view_artefact table, that might hold the same artefact-id as is related in the configdata of the block_instance (assuming you use mysql and no table-prefix):

SELECT block_instance.* FROM block_instance
INNER JOIN view_artefact ON block_instance.blocktype = 'internalmedia' AND = view_artefact.block
INNER JOIN artefact ON = view_artefact.artefact AND artefact.artefacttype IN ('blogpost')

If that query finds something, you can follow the view-id from block_instance and identify the name of the view that is causing the problem - and ignore it in the output. 

Good luck,


Howard Miller's profile picture
Posts: 137

24 July 2014, 22:35

Ok - thanks. 

On further investigation, it seems that (since an upgrade from 1.6 to 1.9) blog posts with embedded images no longer display. They result in the 'Site unavailable' error. 

What I'll probably do is to clone our production site so that I can some proper digging. 

Something definitely seems to have broken after (or because of) the upgrade :(


Tobias Zeuch's profile picture
Posts: 101

25 July 2014, 0:24

How did you/your students embed those images? Does that apply to old posts from before the upgrade or (also) to new posts since the upgrade, with images embedded? 

Howard Miller's profile picture
Posts: 137

25 July 2014, 1:27

I'm not sure... I don't use it myself. I just have to keep it running!

The only thing that strikes me is that we recently switched the site from http to https (due to a security audit!) and this gave us a few browser problems with mixed security content. 

Is it possible that older embedded images from http:// days are causing problems? I can't reproduce it (by manually changing the html to http, as the server just rewrites them.

Basically, I can't reproduce this with new content having tried all sorts of devious things.

PS... this is the error log from simply trying to view one of the broken pages. Looks very similar to the export one (not surprisingly)
[Thu Jul 24 14:13:43.340951 2014] [:error] [pid 7112] [client] [WAR] 0f (lib/errors.php:451) An exception was thrown of
class InvalidArgumentException.
[Thu Jul 24 14:13:43.341004 2014] [:error] [pid 7112] [client] [WAR] 0f (lib/errors.php:451) THIS IS BAD and should be
changed to something extending MaharaException,
[Thu Jul 24 14:13:43.341013 2014] [:error] [pid 7112] [client] [WAR] 0f (lib/errors.php:451) unless the 
exception is from
a third party library.
[Thu Jul 24 14:13:43.341021 2014] [:error] [pid 7112] [client] [WAR] 0f (lib/errors.php:451) Original trace follows
[Thu Jul 24 14:13:43.341246 2014] [:error] [pid 7112] [client] [WAR] 0f (artefact/lib.php:425) Field filetype wasn't
found in class ArtefactTypeBlogPost
[Thu Jul 24 14:13:43.341264 2014] [:error] [pid 7112] [client] Call stack (most recent first):
[Thu Jul 24 14:13:43.341271 2014] [:error] [pid 7112] [client]   * ArtefactType->get("filetype") at
[Thu Jul 24 14:13:43.341278 2014] [:error] [pid 7112] [client]   *
PluginBlocktypeInternalmedia::render_instance(object(BlockInstance)) at
[Thu Jul 24 14:13:43.341284 2014] [:error] [pid 7112] [client]   * call_user_func_array(array(size 2), 
array(size 1)) at
[Thu Jul 24 14:13:43.341291 2014] [:error] [pid 7112] [client]   * call_static_method("PluginBlocktypeInternalmedia",
"render_instance", object(BlockInstance)) at
[Thu Jul 24 14:13:43.341297 2014] [:error] [pid 7112] [client]   * BlockInstance->render_viewing() at
[Thu Jul 24 14:13:43.341304 2014] [:error] [pid 7112] [client]   * View->build_column(1, 2, false) at
[Thu Jul 24 14:13:43.341310 2014] [:error] [pid 7112] [client]   * View->build_columns(1, false) at
[Thu Jul 24 14:13:43.341316 2014] [:error] [pid 7112] [client]   * View->build_rows() at
Tobias Zeuch's profile picture
Posts: 101

25 July 2014, 3:16

Do you use any 3rd party plugins?

Else I'm lost. It totally makes sense that the output below is very similar, in both cases Mahara tries to render the content and thats where the error occurs. 

It doesn't look like a https/http-problem to me. Those problems don't really appear on server-side, but only on browser side, when the browser refuses to load references from a non-https source. 

You say that people have problems, displaying a page with a blogpost with an embedded image. I tested that, I can embedd an image to a blog and it appears in the config-data, but what I see from the logs is, that the error occurs when rendering an internalmedia-block. So if the problems below occur with exactly those views/block-types, the blocktype-reference in the database would have been changed from blogpost to internalmedia. Can't imagine how that would happen.

I tried, btw, with a fresh 1.6-installation to embedd a picture in a blogtype, displaying that with a blogpost-block type, and upgrading to a recent 1.9-stable - and everything works fine. 

Are there many students with that problem? Can they edit the pages and remove the blocks displaying that particular view?


One thing you could do to cope with that error for the moment would be, adding this line to the file artefact/file/blocktype/internalmedia/lib.php on line 47 (after the creation of the variable $artefact in the function render_instance()):

if (!$artefact instanceof ArtefactTypeFile) {return '';}

That skips the rendering of invalid objects for those blocks. If that solves your problem, as a next step you could output debug information about the view and block type, to narrow down the problem or to count, how many views are affected. 

8 results