Member
Member
wongm   29-01-2018, 00:30
#1

Some of the Zenphoto plugins I have created require additional database tables to be added to the existing Zenphoto DB, or add additional columns to existing tables.

I'm fine with the SQL code itself to create the tables / columns, as well as the checks that ensure they are not created if they already exist.

My problem - is there an 'install' callback so that a Zenphoto plugin can only complete the above tasks on installation, instead of on every page load?

Administrator
Administrator
acrylian   29-01-2018, 00:46
#2

Generally you should try to use the general plugin_storage table if you need extra data stores.

If that is not enough, best create custom tables. Adding fields to existing tables may cause trouble because core Zenphoto does not know about them.

Generally the constructor of the plugin's options class is used to create defaults. Otherwise you need to store some option or check if all is already in place.

Administrator
Administrator
acrylian   29-01-2018, 10:30
#3

If the option class constructor is not fitting your purpose, you can also consinder to create a utility button/url so people have to run a setup routine to create necessary extra tables.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.