Focus on the core

Avatar

By CaerCam 21 April 2015 23:34

Member · 54 comments

Maybe we should start brainstorming about the heavy developments that would be welcomed in the core? I'm thinking about introducing some OO, cleaning the SQL-riddled files, etc.

I've been playing with Luna for a while and while a huge lot has been done on improving about anything worth improving, there's still a tremendous work to be done to make it easy to build themes, not to mention the possibility of writing plugins. Currently there's SQL queries in almost every file, maybe a good start would be to develop a small API for content (posts, topics and forums) that would merge recurrent SQL queries or at least group them together instead of puzzling them; then we could achieve a proper state of separation between data and views, limit the proportion of work in templates, and simplifying the theme building process.

Is there any kind of roadmap for this, did you plan some parts, and most of all, do you need any help?

Last edited by CaerCam (27 April 2015 10:42)

Avatar

By Yannick 22 April 2015 12:10

Administrator · 1,453 comments

Help is always needed! 🙂

And well, there are ideas to do this, but it kind of ends there for now. There is a roadmap through. For Luna 1.2, I planned to rewrite the installer and updater to be more OO and easier to maintain. Luna 2.0 is supposed to be a major revamp of prety much everything else.


You can do anything

Avatar

By ninjagolloyd 27 April 2015 10:28

Member · 62 comments
CaerCam wrote

introducing some POO

Introduce poo?????? 😋

Yannick wrote

rewrite the installer to be more OO

Um? Seems OO enough?

Yannick wrote

Luna 2.0 is supposed to be a major revamp of everything else.

Nice. Do you mean the code, design, or both? 😋

Last edited by ninjagolloyd (27 April 2015 10:29)

Avatar

By Yannick 27 April 2015 17:32

Administrator · 1,453 comments

It's mainly set to be a major release of both the code and design.


You can do anything

Avatar

By CaerCam 5 August 2015 06:32

Member · 54 comments

Okay, so I started working on a massive (I should say monstrous) rewriting of Luna's code, a lot of things are going to change. The more I commit, the more it takes the shape of a fork, because it is strongly affected by personal choices as I mostly code things the way I want (need) them for the next version of my 200k posts forum; but still, there surely is some stuff that could profit Luna.

I mainly focus on introducing a somewhat MVC logic, clearly separating code from view. Themes will be absolutely powerful, managing about 95 % of the display, the core providing only very basic views. This comes with a lot of new classes to manipulate data, a very basic controller/templating system and very basic route module. The fact that you clearly separated the backstage from the frontend is close to genius and will allow the development of very different themes without need to handle moderation parts. Really well thought!

Concretely what I've done (or working on) or plan to do:

  • Use objects for most data: posts, topics, forums, users, groups, … As mentioned here
  • Implement routes and URL rewriting, basically replace the current per-file logic (viewtopic.php, viewforum.php) with a controller/view logic
  • Implement a new Database layer, I think I'll go with PHP Database like mentioned here
  • Reboot the database structure

Not sure to what extend I'll be able to implement hooks and plugin stuff, I guess I'll see when I get there 🙂

Note: don't be afraid by the "fork" mentioned above. I've no intention of releasing anything. My work is public and I'll happily share it, but I've no pretension to launch a concurrent to Luna. This implies that whoever try and use "my" code are on their own; I'm not providing any support, ever. Just use Lnua. It's a great piece of software, my needs are just too specific to rely on the official version, hence the decision to run my own, strongly customized version on parallel.

Last edited by CaerCam (5 August 2015 06:48)

Avatar

By Yannick 6 August 2015 08:50

Administrator · 1,453 comments

Honestly, I don't care how different it is from the current system. My part we make something that is 100% different, as long as there is an easy migration, it's good. I would love to see the work you've done/you're doing. Sadly, I do not have much time on Luna 2.0 right now, as I'm quiet buzzy with ModernBB 4, and all supported and to be released Luna 1.x.x versions.


You can do anything

Avatar

By CaerCam 6 August 2015 14:36

Member · 54 comments

It could be a nice base for Luna 2.0, now that you mention it, although there will still be a lot of work: since I'll be building my forum myself I don't plan to adapt the installer, nor will I be migrating from an existing installation of Luna or ModernBB (or FluxBB, for that matter)…

And one thing to consider is PHP version : I'm using PHP 5.6, so there's no way the code will be compatible with obsolete versions. It shouldn't be hard to port to PHP 5.4 or 5.5, but older versions are completely out of question.


That being said, I'm quite happy with what I'm doing. It's not quite ready for even basic testing, but it's promising. Using objects for users, forums, topics, etc. means we can validate data when populate (like using booleans for closed/sticky/soft topics properties), use generic method to use these values:

  • $topic->title(): echo the topic's subject with automatic escaping
  • $topic->get_title(): return the unescaped subject
  • $topic->get_url(): return automatically generated topic URL
  • $topic->is_closed(): return the topic's closed status, true of false

Etc. Lots and lots of very useful possibilities for themes!

Last edited by CaerCam (6 August 2015 19:00)

Avatar

By Yannick 6 August 2015 16:25

Administrator · 1,453 comments

Mmmm... In general, I'm good with PHP 5.4+ as supported base. PHP 5.3 will then have to go with Luna 1.x. If a large amount of users can't upgrade due to these kind of things, I'm willing to support Luna 1.x for the future like we're doing now with ModernBB 4.0. So in general, PHP support is not going to be an issue.

Also, something I forgot to ask, are you following any code conventions (not from this project, but from others). The WordPress-ish conventions for example?


You can do anything

Avatar

By CaerCam 7 August 2015 06:27

Member · 54 comments

Yep, I'm pretty used to the WordPress coding style, that would the convention I'm using for this project for the most part. I try to stick to the Luna conventions when I'm coding directly for Luna, though.

Avatar

By Yannick 7 August 2015 08:32

Administrator · 1,453 comments
CaerCam wrote

Yep, I'm pretty used to the WordPress coding style, that would the convention I'm using for this project for the most part. I try to stick to the Luna conventions when I'm coding directly for Luna, though.

Don't. We're going to adopt the WordPress conventions for Luna 2.0.


You can do anything

Avatar

By CaerCam 8 August 2015 11:09

Member · 54 comments

Ok. Good choice, clearer code reading :-)