JavaForAndroid
JavaForAndroid

Reputation: 1179

Joomla module - SQL not found?

I have a problem installing my first own module. I followed the tutorial at joomla.org. Almost everything seems to work fine. But I get an error with my sql file.

The part in the mod_helloworld.xml for the sql file is this:

<install>
    <sql>
        <file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
    </sql>
</install>

Joomla shows this error when I try to upload the module (as a zip file):

JInstaller: :Install: SQL-File „pathTo Modules/modules/mod_helloworld/sql/install.mysql.utf8.sql“ not found (message translated to English).

What might be the reason? All files use UTF8 without BOM.

The file is inside mod_helloworld/sql/

Upvotes: 2

Views: 464

Answers (1)

itoctopus
itoctopus

Reputation: 4251

This is a good question and let me explain.

The install XML tag contains instructions to execute commands and not to copy files over. So, when Joomla executed the XML manifest file (the mod_helloworld.xml file) and reached the install XML tag, it assumed that sql/install.mysql.utf8.sql file already existed on the server and tried to execute it - but that file wasn't copied over to the server because we didn't tell Joomla to copy it to the server earlier in the XML file.

What you should do is add the following to your XML file:

<files>
    <folder>sql</folder>
</files>

The above will ensure that the sql folder is copied over to the server, and thus will allow Joomla to proceed with the SQL install command.

I really hope that I explained the issue clearly as Joomla's documentation does not mention this (as far as I know).

Upvotes: 3

Related Questions