Errors found in XMLDB file: Missing TABLES section

Errors found in XMLDB file: Missing TABLES section

by Brett van de Sande -
Number of replies: 5

I am trying to create an activity plugin that does not need any new database tables.  According to https://docs.moodle.org/dev/Activity_modules#install.xml you do not need to create an install.xml file.

However, looking at the code in /lib/ddl/database_manager.php, it is pretty clear that the file is actually required.  (So the documentation is wrong.) 

This would be OK, since one could include an install.xml file with no tables, like this:

<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="mod/listquiz/db" VERSION="20120122" COMMENT="XMLDB file for listquiz module"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd">
</XMLDB>

However, I still get the error:  "Errors found in XMLDB file: Missing TABLES section" 

It seems that, looking at the schema definition lib/xmldb/xmldb.xsd, this should work.

Any ideas?

Thanks,

Brett

Average of ratings: -
In reply to Brett van de Sande

Re: Errors found in XMLDB file: Missing TABLES section

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I'd say the docs are wrong in this case - for most plugins the install.xml file is optional, but for activity modules it is always needed. You must always, at the very least, define a single table for your activity, with the same name as the activity (e.g. the 'forum' module defines a table called 'forum' [mdl_forum]) and with the fields:

id (as needed by all Moodle tables), course, name

And preferably also:

intro, introformat

Preferably, use the built-in xmldb editor to create this file https://docs.moodle.org/dev/XMLDB_editor


In reply to Brett van de Sande

Re: Errors found in XMLDB file: Missing TABLES section

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Don't try to create the file yourself.

Instead go to the XMLDB editor, and click the [Create] link for your plugin.

If [Create] is not a link, then you probably have a file permissions error which means that Moodle cannot write the necessary file. Make sure that the plugin folder is writable by Apache.

In reply to Tim Hunt

Re: Errors found in XMLDB file: Missing TABLES section

by Brett van de Sande -

Thanks, I added a bug report for this:  https://tracker.moodle.org/browse/MDL-50760.

In reply to Brett van de Sande

Re: Errors found in XMLDB file: Missing TABLES section

by Davo Smith -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Instead of filing a bug report, why not click on the 'login' link at the top of the documentation page (you may need to create an account), click on 'Edit' and then update the page with the correct information?

(If you're unsure about any changes you make to the docs, you can always post a link in the forums and ask for feedback).

In reply to Davo Smith

Re: Errors found in XMLDB file: Missing TABLES section

by Brett van de Sande -

Thanks!  I didn't notice they were editable ...  I am new to Moodle.

Brett