Web based family history software

Question Core classes extensions

  • jon48
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
13 years 1 day ago #1 by jon48
Core classes extensions was created by jon48
Hello, and in particular to the developers,

I am currently in the process of adapting the previous personal customisations I have done in my PGV, hence I am currently looking at the code and the changes introduced by the new architecture.

At the first glance, I reckon that the module structure is going to ease some of my work, keeping my modifications clean an separated from the official code. I prefer to warn you immediately, I will be happy to share these personal developments if somebody is interested or even better if it is judged worth being part of the official release, but this is not my initial goal, as I am not expert enough to provide quality code and I will not have time to support it, and some developments answer to personal requirements/habits which might not be shared by other people (I have learnt in my years of PGV then webtrees forums that each user has a different approach of genealogy and his own way of working and handling data, so I appreciate the flexibility offered by webtrees and I hope it will remain this way).

The first question I have is about the possibility to extend WT Library classes. With PGV, it was possible to extend the controllers by adding a file *_user.php (individual_ctrl_user.php for instance) which allowed adding methods to the class without modifying the main code. It seems to have disappeared from WT.
So, is there an alternative way for extending the controller classes, maybe as part of modules? If so, does it apply only to controllers, or also to the logical classes (Person, Family...), which would allow really taking advantage of the OO model?

Thanks.

Jonathan
genea.jaubart.com - Famille Jaubart-Rousset en Lozère - webtrees 2.1.18 (modifié - GitHub repo , thème Rural)
Local: Ubuntu 22.04 - Apache 2.4 - PHP 8.1 - MySQL 8.0 / Public: FastComet

Please Log in or Create an account to join the conversation.

More
13 years 1 day ago #2 by fisharebest
Replied by fisharebest on topic Re: Core classes extensions
You're right. We switched to using class auto-loading, which gives performance benefits. We were not aware that anyone actually exended the classes in this way, and we haven't added in any equivalent "hooks".

Also, once you publish an "official API" like this, you are stuck with it, and we'd like to keep the flexibility to change the internal design. For example, I'd like to move to a full MVC (model-view-controller) architecture with a "front controller" or "dispatcher". This would be a major change, and I'd probably deploy it incrementally. Any API would be likely to change with every release.

Also, the current module structure is very limited and restrictive. We use it because it was already mostly written (by John Finlay, for PGV). We simply finished it and got it to work. Without it, we would not have been able to get our first stable release out so quickly.

But I don't see it as the long term future. I envisage a module system that allows modules to "register an interest" in a partcular action, and is then called whenever that action occurs. Actions may be "get a list of reports", "get the home menu", "draw an image", etc. This would make it easy to allow modules to interact with the core code in a much wider range of circumstances. So, I don't plan to put much effort into maintaing a system that I hope to replace.

So, to answer your specific question <<is there an alternative way for extending the controller classes>>, the answer is no - not at the moment. But long term, the links between URL and a specific PHP script will be data defined, so you'd be able to plug in your own page controllers then.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • jon48
  • Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
13 years 1 day ago #3 by jon48
Replied by jon48 on topic Re: Core classes extensions
OK, it makes sense, and I cannot but approve every effort made in the direction of a better architecture of the application. I think your vision is a good one Greg, and I wish you good luck in implementing it, especially on an incremental basis!

We were not aware that anyone actually exended the classes in this way, and we haven't added in any equivalent "hooks".

No worries. I did not really publicize it in PGV, and I understand that you aim to remove what you think useless. Anyway, I already know how to work around it, I just asked my question to be sure that I had not missed anything in the code.

So, on that basis, I just add my question to the long-term wishlist. :)

Kind regards.

Jonathan
genea.jaubart.com - Famille Jaubart-Rousset en Lozère - webtrees 2.1.18 (modifié - GitHub repo , thème Rural)
Local: Ubuntu 22.04 - Apache 2.4 - PHP 8.1 - MySQL 8.0 / Public: FastComet

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum
}