Notice: CMSB v2.53 Beta 1 (Mar 27th)
1 posts by 1 authors in: Forums > CMS Builder
Last Post: March 27, 2013 (RSS)
By Dave - March 27, 2013
Hi everyone,
We've just released CMSB v2.53 beta 1 (beta list members will get an email with a download link shortly).
The major new features are easier server moves and a sample cron plugin. Here's some details:
Development Servers
This update is mostly about development servers (also called staging servers) and making it easier to move files between development and live servers. If you're not already using a development server you should set one up, you'll save a lot of time not having to upload files after every change to see the result, and you will avoid breaking your clients live sites while developing features. We use the free package from http://www.wampserver.com/ on a Windows PC. It's a combo Apache, MySQL, PHP package that installs in one click. Mac users can google for "MAMP" and if you're running Linux, you probably don't need any tips setting up a web server. ;)
Domain-based Settings Files
You've probably already found that sometimes you'll have to maintain files on a few servers while developing a site. You might develop on your internal server: http://yourBigClient.yourWebCo.com/, then have to upload to the clients beta site: http://beta.yourBigClient.com/, then finally upload to their live site when you're done: http://www.yourBigClient.com/. Normally you can just copy files from one server to another and everything will just work. But if these sites have different MySQL details (as they often do), and you copy a settings file from one site to another you'll take down the whole site with an "Invalid MySQL Password" error.
The fix? We've added support for domain-based settings files so you can create a custom settings file that specifies the domain name like this: /data/settings.yourbigclient.yourwebco.com.php and it will automatically use that settings file for that domain only. This ensures you never overwrite live-server settings with dev-server settings (since they are stored in a separate file) and you can copy files from server to server without fear. We actually added this feature over 3 years ago in v2.02 but many people still don't use it (even some who work at interactivetools!) so for this version we added a checkbox to the install screen for development servers. It looks like this:
Use Custom Settings File [X] For this domain name only (localhost) use this setting file: /data/settings.localhost.php.
Using a separate settings file for development servers ensures you never accidentally overwrite your live server settings when uploading CMS /data/ files. Always use custom settings files for development servers only, not your live servers.
So if you're running on a non-live server (development, staging, beta, etc) make sure to check that box and you'll be much safer.
Website Prefix URL
Next up, the other thing we see a lot of is development servers that host websites under existing sub-folders. This could look like any of the following:
- http://yourWebCo.com/clients/2013/yourBigClient/ - developing client sites in a subfolder under your own website
- http://localhost/clients/2013/yourBigClient/ - developing client sites on your own PC or an internal development server
- http://yourBigClient.com/beta2013/ - when your client has setup a beta folder for the new site
- http://1.1.1.1/~bigclie/ - When DNS hasn't moved yet and you have to use a /~username/ preview url
If you've ever had to work with a site like this, you might have found yourself hardcoding /~bigclie/ or a similar folder prefix into the HTML, only to have to go back later and remove it when you moved the files to the live server that didn't need that prefix.
Our fix in 2.53 for this is a new field available on both the install page and under: Admin > General. It looks like this:
Website Prefix URL [________________________________________________] eg: /~username or /development/client-name
If your development server uses a different URL prefix than your live server you can specify it here. This prefix can be changed in the Admin Menu and will be automatically added to Viewer URLs and can be displayed with <?php echo PREFIX_URL ?>. This will allow you to easily move files between a development and live server, even if they have different URL prefixes.
So if you've ever been stuck search and replacing URL prefixes before, now you can just use the above feature.
Example Cron Plugin (for programmers)
For the programmers, we've included a sample plugin in /plugins/cron-example.php that shows how to run a background task at a set interval such as once a day or once an minute. This is really useful if you need to build a custom site that sends out email updates once a night, expires auctions, imports or backs up data, sends out reminders or marketing emails once a month, etc.
We've built cron support into CMS Builder now, so it's way easier and more powerful then the standard cron/scheduled task features you get with hosting accounts. CMSB automatically shows you when all the scheduled tasks last run, when they're scheduled to run next, keeps a log of every task, and even records errors (even if your script/plugin dies or crashes) and emails you to tell you when there is a problem. And all you need to do to set it up is add a single line of code to your plugin telling it what function you want to run and how often. Like this: addCronJob('emailSubscribers', "Send daily email updates", "how often to run");
Try setting up cron and enabling the example plugin. You can find the Background Tasks menu here with instructions: admin.php?menu=admin&action=general#background-tasks
And that's it! If you're not already on the beta tester email list and you'd like to help beta test (you must own at least 1 CMSB license) please email dave@interactivetools.com to be added to the list.
Please post any feedback, questions, or bugs you find! Thanks!
Thanks! :)
interactivetools.com