sNews Unplugged: Making a Small CMS Smaller

sNews is known for being one of the smallest CMS's. This is a great accomplishment because it's also known for being powerful enough to implement dynamic websites with all the common features expected from today's content management systems. Still, as light as the standard distribution of sNews is, it can always be made smaller, faster and more secure. In my mind, these should be the prevailing directives that influence the future of the sNews project.
The "bloat" of sNews is due mostly to the fact that all the administrative functions are being implemented within a single core file and while this is rather impressive and seemingly convenient to do everything it does with only one 100k file, this accounts for over half of the code used. That means every time a non-administrative user visits your sNews site, about half the memory is wasted on unnecessary code which is never executed, but is none the less loaded in memory. To make matters worse, all admin functions are now in memory and theoretically accessible to the end user session; obviously presenting a potential security nightmare.
The most apparent solution to this problem is to break up the single file into admin and user files, but to some sNews purists, splitting the core is considered sacrilegious. Fortunately, I have three good reasons that outweigh the stubborn attitude that the core should remain a single file:
- It's not just the core. Many of the popular modifications to sNews only affect the administrator. Advanced text editors, category and article management, file management… just to name a few. All this code should not have to be loaded if it does not directly affect the end user experience in real time.
- It's more secure. Having a separate admin file means that the administrator can rename the admin backend, hide it in any directory, and even password protect that directory. This adds an important layer of security to the site.
- I've done it for you. Yes, thanks to my expertise and mastery of the "delete" key, I've managed to slim down sNews to half its normal size in just a few minutes of careful editing so that you don’t have to.
Installation Instructions:
- Copy your current site to a directory you create off your root install where it will be accessed only by you (naming it something less obvious than /admin would be a good idea). Change the .htaccess and snews.php files to reflect the directory change.
- Edit the configuration data in the stripped down version of snews.php and copy it to your installation root.
- Give it a go…
Professionals who skip 642-436 or 1Y0-259 in favor of 70-536 and 70-642 save a lot more time on the advanced 642-642 exam.
Added by Ken 04.08.2008. 02:26
Jimmy Sword on 26.08.2008. 02:52I've just started using sNews and tweaking it to my liking as version 1.6 is far from perfect. Thanks very much for this I can't wait to get it implemented as security was one of my main worries (such as the human readable password in the config file). I gave the 1.7 releasse candidate a go and binned it pretty much straight away. Seems a step backwards in some aspects and is definitely not ready for mainstream use without a fair bit of hacking that I'm not prepared to do. No offense to anyone from sNews if you ready this; 1.6 is wonderful!


Write a comment
* = required field