Single DB vs Multiple Files

Welcome to the WonderCMS community. Anything goes, except for support requests.
Post Reply
rnd1530
Posts: 7
Joined: Wed Mar 15, 2017 10:14 am

Single DB vs Multiple Files

Post by rnd1530 »

Hello, just wondering, why moving from "one page - one file" to "all website on single file (database.js) ?
Pros and cons?

User avatar
wiz
Admin
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: Single DB vs Multiple Files

Post by wiz »

Hey rnd, the problems we had when we used the one page one file functionality looked like this:
- password file had to be defined like any other file and was thus accessible anywhere on the site (mysite.com/password) -> fetched the password and displayed it as content, which was a huge no-no
- once we figured we'd love to just block the "password" request, it seemed "passWord" and "pasSword" and all other variations simply bypassed out password request block
- you couldn't have a page named password, now you can
- the menu was a file of its own, which meant other pages like (loginURL, password, menu, page) -> couldn't exist as they would fetch either the loginUrl, password, menu or page), so you could not have a page named password, menu, page or any other system function name.

Having this in one single file makes more sense, so we can cover what we couldn't before described above. Another great thing that comes with this database.js it that we can actually have a versioning system for the db itself, enabling us to control who gets what update (1.0.0 user needs XY update, 1.2.0 needs XZ update). Database.js is also easier to edit once you understand the simplicity of it.

The latest version is highly optimized, which would probably bring the next question - what does this mean for speed. The answer to that is relative, as it all depends on the size of your database.js, while fetching one file for one page might seem faster it really depends how huge your site is.

Interested to hear your thoughts on this?

rnd1530
Posts: 7
Joined: Wed Mar 15, 2017 10:14 am

Re: Single DB vs Multiple Files

Post by rnd1530 »

I see, well, all is about personal preferences, for me makes more sense "one page - one file" so i can edit directly from ftp if i want instead of messing with "one line file/website" but your point of view is valid too of course.
Regarding password filenames: i used hashed filename, something like: $password_file = md5("my_random_seed").'.pwd';

Regards.

User avatar
wiz
Admin
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: Single DB vs Multiple Files

Post by wiz »

It would be even easier if you had an editor for database.js show up once you're logged in. That way you can fully control your website in one place without the need of connecting to your FTP and avoid the one line one website problem.

astrit
Posts: 2
Joined: Sat Apr 01, 2017 8:45 am

Re: Single DB vs Multiple Files

Post by astrit »

I also think the same in my opinion one page one file is way better, I was planing to convert my current wordpress site on to Wonder CMS and I am afraid that it will become pretty messy when there are a lot of blog posts plus knowing that blog post tend to be a bit long.

Is there any way to combine new features and keep the "one page - one file " system.

Post Reply