I am playing around with module development and getting getting an SQL error.
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘mytestmodule’‘,’‘1.0.0’‘, 1)’ at line 1
Here is a basic module.xml I have
<?xml version="1.0" encoding="UTF-8"?>
<module>
<rawname>mytestmodule</rawname>
<repo>extended</repo>
<name>My Test Module</name>
<version>1.0.0</version>
<publisher>Community</publisher>
<license>GPLv2+</license>
<category>Applications</category>
<description>Just Testing</description>
<depends>
<version>17.0</version>
</depends>
<install>
<script>install.php</script>
</install>
<uninstall>
<script>uninstall.php</script>
</uninstall>
<menuitems>
<mytestmodule>My Test Module</mytestmodule>
</menuitems>
<supported>
<version>17.0</version>
</supported>
</module>
In case it was me doing something wrong, for testing, I can take an .xml file from another module put it in there and I would get a similar result, but with the name of that module, and the version of what is in that module.
Doing more testing, if I modify one of the official modules by adding some of my own code, the install goes fine, but then I get the warning about module not having a valid certificate.
So I tracked down this $sql = "INSERT INTO modules (modulename, version, enabled) … line in
/var/www/html/admin/libraries/modulefunctions.class.php
Before that line I put
error_log("DEBUG_RAWNAME=[" . $modules[$modulename]['rawname'] . "]");
error_log("DEBUG_VERSION=[" . $modules[$modulename]['version'] . "]");
Then ran the following commands
fwconsole ma install mytestmodule
My Test Module module installation started Database tables created successfully My Test Module module installation completed
DEBUG_RAWNAME=[mytestmodule]
DEBUG_VERSION=[1.0.0]
In Database.class.php line 278: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘mytestmodule’‘,’‘1.0.0’‘, 1)’ at line 1