lear2a/HTML export broken
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?
Re: lear2a/HTML export broken
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?
Re: lear2a/HTML export broken
Just to connect the dots for a moment, this is the previous report.
leap2a/HTML export broken
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?
Re: leap2a/HTML export broken
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?
--> $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
Re: leap2a/HTML export broken
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.,
Re: leap2a/HTML export broken
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
Re: leap2a/HTML export broken
Hi Robert,
I reproduced this on my dev server which is running 7.4.23.
Cheers
Re: leap2a/HTML export broken
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 ;-)
Re: leap2a/HTML export broken
Hi Howard,
I've encountered the same issue as you. May I know how to add the comments blocktype?