简体   繁体   English

Joomla插件数据库表

[英]Joomla plugin database table

I am working on a plugin that handles logs, as such it needs its own database table. 我正在开发一个处理日志的插件,因此它需要自己的数据库表。 However doing the typical manifest does not seem to work and is causing errors. 但是,执行典型的清单似乎无效,并且会导致错误。 Not sure where I may be going wrong as searching this issue has yielded no results. 不知道哪里可能出问题了,因为搜索此问题未产生任何结果。

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

I tested the SQL in phpmyadmin and it works fine. 我在phpmyadmin中测试了SQL,它工作正常。 All it needs to do is create a simple table with 4 columns. 它要做的就是创建一个包含4列的简单表。

I'm not sure it makes sense to do it: if you create a table, you need to provide some management features, at least view and delete / empty, so you typically would want to write a component for that. 我不确定这样做是否有意义:如果创建表,则需要提供一些管理功能,至少要查看和删除/清空,因此通常需要为此编写一个组件。 You could then build a package and distribute them in one file. 然后,您可以构建一个程序包并将其分发到一个文件中。

If you really want to try, another option could be to create the table in a postflight event, you can write a function to be invoked after installation (typically used to enable the plugin) and create the table there. 如果您真的想尝试,另一种选择是在postflight事件中创建表,您可以编写一个在安装后调用的函数(通常用于启用插件)并在那里创建表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM