XF 2.2 How to commit DB changes for addons?

alexAlToader

New member
Hi,

I created an addon on my local env, I committed the code but for my colleague the addon is not called.
I think it has to do with the fact that I have saved stuff regarding the addon in the db?
How do I commit this pls?
Laravel has migrations and seeders.. anything similar for addons in xenforo pls?
In addons pannel I see install from archive. Is this something... useful?

Thanks
 
You need to create the addon on the command line with php cmd.php xf-addon:create, and set up either class extensions or listeners in the Developer section of the ACP so your code is called. It won't be loaded and run without being set up first. XF handles importing class extensions, listeners, options, templates, phrases etc, any other database work would be done in the Setup.php file

 
You need to create the addon on the command line with php cmd.php xf-addon:create, and set up either class extensions or listeners in the Developer section of the ACP so your code is called. It won't be loaded and run without being set up first. XF handles importing class extensions, listeners, options, templates, phrases etc, any other database work would be done in the Setup.php file

I did that.

I ran the php cmd.php xf-addon:create and added them in the Development section.
What another team member needs to do to make it work - this is the question pls?
He pulled the addon PHP code from Git but the content of the addons table - how do team members share that? We just send SQL files to each other?
 
You don't need to send SQL files around. Either build a release zip if they just need to install it, or they'll need to install it via the CLI if they want to continue developing it.
 
What other data are you expecting to have to give to other people exactly? Anything set up within the ACP will be packaged with the addon as long as you selected the addon when adding things, and any other database tables or changes you make can be put in Setup.php.
 
I am talking about the addon itself - nothing else.
It seems you say there is a way to transfer the addon completely from one developer to another through git commit?
The content of the xf_addon is not required to make it run?
 
We usually install/upgrade via CLI (if an install/upgrade is required) or just just import the development files via xf-dev:import otherwise.

If all files including _output and up-to-date Setup.php are in your VCS (Git, Subversion, whatever) this is all that is required to install the Add-on and continue development (and/or build it for redistribution).
 
Last edited:
I am talking about the addon itself - nothing else.
It seems you say there is a way to transfer the addon completely from one developer to another through git commit?
The content of the xf_addon is not required to make it run?
XF inserts a row there when the addon is installed, that's not something you need to handle, it's just part of what XF does when installing an addon.
 
XF inserts a row there when the addon is installed, that's not something you need to handle, it's just part of what XF does when installing an addon.
Ok so I created the addon, committed in git, a team member pulled the code.
What does he need to do to make it work pls?
How does he install it?
 
Top Bottom