Forums | Mahara Community

Support /
lear2a/HTML export broken


Howard Miller's profile picture
Posts: 191

21 August 2021, 2:04

Mahara 21.04.

I posted about this before but now have more information. Export does not work at all on my site. It gets so far and then fails. The error in the logs is always...

 

[20-Aug-2021 14:44:45 Europe/London] [WAR] 65 (lib/errors.php:530) [Dwoo\Exception]: Template "comment.tpl" could not be found in any of your include path(s) at /var/www/html/mahara/htdocs/lib/dwoo/dwoo/Dwoo/Template/File.php:160

However, I definitely do have that file (or maybe I do)...   (from htdocs directory)

$ find . -name comment.tpl
./theme/raw/plugintype/artefact/comment/blocktype/comment/templates/comment.tpl

So picking up on the 'include paths' bit, I had a dig into the Dwoo Template stuff to see what paths it is looking in. When the TemplateFile object is created the paths are passed in an array. I added a debugging line to write this data to the log. Immediate before the error message, the array passed looks like...

[20-Aug-2021 14:44:45 Europe/London] INCLUDE PATH Array
(
    [0] => /var/www/html/mahara/htdocs/local/theme/plugintype/blocktype/comment/templates
    [1] => /var/www/html/mahara/htdocs/theme/default/plugintype/blocktype/comment/templates
    [2] => /var/www/html/mahara/htdocs/theme/raw/plugintype/blocktype/comment/templates
    [3] => /var/www/html/mahara/htdocs/blocktype/comment/theme/default/templates
    [4] => /var/www/html/mahara/htdocs/blocktype/comment/theme/default
    [5] => /var/www/html/mahara/htdocs/blocktype/comment/theme/raw/templates
    [6] => /var/www/html/mahara/htdocs/blocktype/comment/theme/raw
)

You will notice that there are no paths in that list that correspond to the actual location of the comment.tpl file.

Thoughts?

 

Howard Miller's profile picture
Posts: 191

25 August 2021, 20:03

Please excuse the "bump" but this is causing us some significant problems.

Any ideas what might be going on or where I should focus further investigations?

Kristina Hoeppner's profile picture
Posts: 4731

27 August 2021, 10:21

Just to connect the dots for a moment, this is the previous report.

Howard Miller's profile picture
Posts: 191

27 August 2021, 19:19

Ok - can anybody who understands templates better than me (which is pretty much not at all) explain how the templates hierarchy works?

The place where comments.tpl exists does not seem directly related to a theme? Is this expected and definitely not a bug?

Doris ⚡'s profile picture
Posts: 84

28 August 2021, 14:16

Hi Howard,

On exporting a page with a comment block while debugging on a successful export, this is what I get. Are yours the same?

 

$html = $smarty->fetch('blocktype:comment:comment.tpl');

--> $template = $this->templateFactory($type, $file);  > type="blocktype", $file="comment:comment.tpl"

--> return new Dwoo_Template_Mahara("{$resourceName}:{$resourceId}", $cacheTime, $cacheId, $compileId, $this->template_dir);

      > where $resourceName="blocktype", $resourceId="comment:comment.tpl", other variables=null

--> parent::__construct($file, null, null, null, $includePath); > $file="comment.tpl", $includePath=array(

1:".../mahara/htdocs/theme/raw/plugintype/artefact/comment/blocktype/comment/templates"
0:".../mahara/htdocs/local/theme/plugintype/artefact/comment/blocktype/comment/templates"
2:".../mahara/htdocs/artefact/comment/blocktype/comment/theme/raw/templates"
3:".../mahara/htdocs/artefact/comment/blocktype/comment/theme/raw"

) from Mahara\Dwoo_Template_Mahara->__construct (.../mahara/htdocs/lib/dwoo/mahara/Dwoo_Template_Mahara.php:90)

 

At this point, if you don't have $pluginpath = "artefact/comment/blocktype/comment";

and it's just an empty string, then your other paths are incorrect as the ones in yours log show:

".../plugin/skipping_ artefact_comment_folder/.../blocktype". Looks like the wrong paths are being passed into the $includePath argument.

 

Hope this can help you debug some more.

You could always check your files against the one in core.

 

Doris

Howard Miller's profile picture
Posts: 191

29 August 2021, 1:53

Hi Doris,

Really appreciate your reply. 

I have debugging n... but... I don't understand where you got that output from. I'm not seeing anything like that in logs or otherwise. Can you enlighten me?

This all started when we upgraded to 21.04. The code is 21.04.1 as downloaded from this site. Just to make sure, I installed a new version with fresh code on a dev box and copied the data over from the live site. Same (bad) result. 

It's 100% "vanilla" Mahara. No changes or addons. 

Debugging was as far as I got before my cry for help. I was getting very lost in the depths of the template system.,

Robert Lyon's profile picture
Posts: 757

30 August 2021, 12:56

Hi Howard,

I notice that if I go to the blocktype/lib.php file and in the get_theme_path() function (line 215) and I force it to do the 'else' part it returns the error that you see.

So I'm thinking the blocktype_artefactplugin($pluginname) part is not returning the correct value for some reason during export - like it thinks the artefact 'comment' blocktype 'comment' is not installed

Why that is happening on your system and not mine I'm not sure.

What version of PHP are you using on your server, maybe that is causing an issue?

I'm testing with PHP7.4.3

Cheers

Robert

 

Howard Miller's profile picture
Posts: 191

30 August 2021, 20:52

Hi Robert,

I reproduced this on my dev server which is running 7.4.23. 

Cheers

Howard Miller's profile picture
Posts: 191

31 August 2021, 2:33

Sorted it. You gave me a big clue. 

It turns out that the 'comments' blocktype was not installed on the Extensions page. I have no idea why. It may have been disabled in error at some point. Anyway, reinstalling it solved the problem. 

If there's a bug here it's that the error handling is a bit... disappointing... the export form even asks you if you want to include comments when comments are disabled ;-)

A.Emily's profile picture
Posts: 23

11 September 2021, 16:18

Hi Howard,

I've encountered the same issue as you. May I know how to add the comments blocktype? 

12 results