XF 2.0 Learning making addons - SchemaManager does not create columns

Hi!

I've been trying to follow:
https://xenforo.com/xf2-docs/dev/lets-build-an-add-on/

But I cannot make XenForo make any alterations to my MySQL tables. I've been trying install-addon and uninstall-addon through php cmd.php several times, and then check my MySQL database. But it never creates any new columns to any of the tables there (e.g. xf_forum and xf_thread).

I am running XAMPP on Windows 10 with Apache, PHP 7.2 and a remote MySQL database (5.7).
Installing the addon (via php cmd.php) always says:
InstallingThe site is currently being upgraded. Please check back later.XenForo 2.0.5

I do not know how to tackle with this error.

The site is working properly on localhost:8080.
Why does it say that "The site is currently being upgraded," when I try to install my development addon (Demo/Portal)?

Sorry about being a bit lost here.

Best regards,
Tommi
 
I did some testing and PHP fails in schemaManager()->alterTable xf_forum.
installStep1 executes.
installStep2 does not execute after the failure.
The ALTER TABLE command does not reach MySQL. I checked it from MySQL logs.

My database user has all possible priviledges and administrative roles.

I am running Xenforo in the development mode.

The weird "InstallingThe site is currently being upgraded. Please check back later.XenForo 2.0.5 " message appears each time, but I do not know if it has anything to do with this problem.

Best regards,
Tommi
 
I finally found the problem.
My PHP script had wrong "use" statements, which I had left there, because xf-addon:create created a different skeleton than in the example.
When I put all exactly as in the example, it started to work.

xf-addon:install-step was finally able to give the right error messages.

I would recommend that you would change the example so that it says

Run
Code:
php cmd.php xf-addon:install-step Demo/Portal 1
php cmd.php xf-addon:install-step Demo/Portal 2
php cmd.php xf-addon:install-step Demo/Portal 3
to execute the steps to the database rather than
Note
Don't forget to execute the queries yourself!

Which doesn't say so much.
 
At @Tommi Gustafsson I had this same exact problem when following the tutorial and even posted a thread about it months ago. I since stopped trying as I've been busy with other things but now that you brought this up this is definitely some nice information to know. I'm brand new to php but this is quite interesting as when it says "don't forget to execute the queries yourself" I did not know what that meant either.. Now I see it's as simple as running the commands you've given.

Some people would think it's common knowledge to know how to do that but when your new to it "Don't forget to execute the queries yourself" doesn't seem to make much sense. I'm a fast learner when I have the right resources so I plan to get into this soon.

How's it going at this point? Have you been able to grasp the concept of Xenforo 2 add-ons? It seems simple enough using the finder system to locate tables in the database and fetch them. Seems like anyone could do it that understood the principles of programming which I do myself I can at least say that. I've studied many books that explain how it works but I just lack experience is what it is at this point. Great job posting this though.

+Like
 
Some people would think it's common knowledge to know how to do that but when your new to it "Don't forget to execute the queries yourself" doesn't seem to make much sense. I'm a fast learner when I have the right resources so I plan to get into this soon.
To be fair, the documentation was written before the Schema Manager was even a thing, and the documentation literally did have the queries displayed so it was pretty clear what that meant, then. In fact, I think it even pre-dated our CLI commands to run install steps :)

But I can certainly see, now, how it can be confusing.

BTW, anyone who has an opinion on anything related to the documentation may feel free to open issues on GitHub, where the documentation source is hosted.

Alternatively, if you're brave enough to contribute yourself, then you can edit the pages directly on GitHub:
https://github.com/xenforo-ltd/docs/edit/master/docs/lets-build-an-add-on.md

More details on how to contribute here:
https://xenforo.com/community/threads/contribute-to-our-xf2-developer-documentation.145585/
 
To be fair, the documentation was written before the Schema Manager was even a thing, and the documentation literally did have the queries displayed so it was pretty clear what that meant, then. In fact, I think it even pre-dated our CLI commands to run install steps :)

But I can certainly see, now, how it can be confusing.

BTW, anyone who has an opinion on anything related to the documentation may feel free to open issues on GitHub, where the documentation source is hosted.

Alternatively, if you're brave enough to contribute yourself, then you can edit the pages directly on GitHub:
https://github.com/xenforo-ltd/docs/edit/master/docs/lets-build-an-add-on.md

More details on how to contribute here:
https://xenforo.com/community/threads/contribute-to-our-xf2-developer-documentation.145585/

I appreciate the solid response. I'm going to look into this soon. I'm tired of using phpstorm for only html and css. I'd like to go a bit beyond that now. I got the Xenforo 2 on local host and have it opened in my phpstorm as we speak along with about 10 different add-ons where I'm trying to study code for them. I'd like to get some php use out of it. It seems much easier than any procedural stuff (wordpress as an example). It will take some time but I'll be sure to get the hang of it eventually. I was actually considering making styles soon and selling them and probably am fixing to purchase another license for a demo forum I wanted to set up. So thank you and I appreciate that.

But this is all good info to know either way. :)
 
At @Tommi GustafssonHow's it going at this point? Have you been able to grasp the concept of Xenforo 2 add-ons? It seems simple enough using the finder system to locate tables in the database and fetch them. Seems like anyone could do it that understood the principles of programming which I do myself I can at least say that. I've studied many books that explain how it works but I just lack experience is what it is at this point. Great job posting this though.
I just finished creating the example add-on and I did not have too many problems. However, there are quite many things going on, and it surely takes a lot of time to understand which controllers or classes you need to extend and how to write template modifications, because the documentation is next to nothing. So I guess, when I am going to create my own add-on, I need to post a lot of questions on these forums.

I am using Visual Studio Code as my editor and I liked it much more than PhpStorm, and it's also free. I also am not familiar with PHP but I have developed different kinds of ASP.NET applications for over 10 years, so I think am able to grasp most concepts quite quickly.
 
Back
Top Bottom