• Join Now
  • Sign In
  • Cart
  • Instant Setup
  • Download
Logo
  • About
    • Try it Out
    • For Developers
    • For Agencies
    • For Designers
    • For Anyone
    • Testimonials
    • Showcase
    • History
    • Our Philosophy
    • Credits
    • What does free mean?
    • Blog
  • Community
    • Members
    • Forums
    • Chat
    • Karma
    • International
    • Jobs
    • eNewsletters
  • Developers
    • Download concrete5
    • Join Beta Team
    • Translate concrete5
    • Bug Tracker
    • Submit to Marketplace
    • Code Submissions
    • News
    • Community Leaders
  • Marketplace
    • Add-Ons
    • Themes
    • Add-on Installation
    • Deal Of The Day
    • Swag
    • Theme Contest 2012
  • Services
    • Hosting
    • Support Options
    • Consulting
    • Training
    • Enterprise
  • Documentation
    • Getting Started
    • Editor's Guide
    • Developers Guide
    • How-Tos
  • How-Tos

concrete5 Add-On Developers: Create Your Own Demo (5.5.0 and Up)

Posted byandrew in Developers on Jan 28, 2012.
6 people like this.

This is a how-to geared especially toward our add-on developers, but it'll be useful to anyone who wants to create a cycling concrete5 demo that automatically resets. In this how-to I'll explain how to prepare a database for the demo, setup special demo-specific permissions overrides, create a demo administrative user, install one or more add-ons along with the demo, and provide a script that can be run at any time to reset the demo.

Note: This requires concrete5 5.5.0 and greater. Another how-to is available for older versions of concrete5.

Code

This how-to references a reset script and permissions overrides. You can download these files here:

Download Reset Script and Permissions Overrides

First I create the database:

CREATE DATABASE concretedemo;

Then I grant permissions to the user on the database:

GRANT ALL ON concretedemo.* TO concretedemo@localhost IDENTIFIED BY 'concretedemo';

Install concrete5

Download the latest version of concrete5, unzip it to the web directory that will house your demo, and install it.

Lockdown Dashboard

We want our demo user to be added to the Administrators group, so they can access the dashboard, but we don't want to give out full and complete access. We don't want sitewide settings to be looked at, or file access permissions to change, for example. Fortunately there's a little-used feature that allows us to lock down single page permissions at the time of their creation: access.xml files. These files live in the specific controllers/ directory for the given single page.

A sample access.xml file looks like this:

<access>
<node handle="dashboard/files/access">
  <guests canRead="0" ></guests>
  <registered canRead="0" ></registered>
  <administrators canRead="0" canWrite="0" canAdmin="0" ></administrators>
</node>
</access>

This locks the admnistrators group out of accessing the /dashboard/files/access page.

In the .zip file above, you'll see a controllers/ directory. Copy the contents of this controllers/ directory into your root controllers/ directory. The next time your demo site is reset, these access restrictions will be in place.

Install "Reset" Script

Also contained within the .zip file above is a reset script. When run, this script does the following:

  1. Removes config/site.php
  2. Removes all files in the files/ directory
  3. Removes all tables in the demo database
  4. Reinstalls concrete5 with the values specified in the reset script, and the database information that you originally installed concrete5 with. Permission overrides described in "Lockdown Dashboard" are applied
  5. Creates a second administrative user in the Administrators group
  6. Locks down file permissions
  7. Disables site emails Installs specified add-ons into the site.

Before you install

Please, rename the reset script! Anyone who hits the URL of the reset script will be able to reset your demo.

Configure Reset Script

There are a number of values at the beginning of the script that deserve explanation.

  • DEMO_SETUP_SITE: This constant will determine the name of your site.
  • DEMO_DB_SERVER: Your demo's MySQL server. Typically "localhost".
  • DEMO_DB_USERNAME: The username for your demo's MySQL user. e.g. "concretedemo".
  • DEMO_DB_PASSWORD: The password for your demo's MySQL user. e.g. "concretedemo".
  • DEMO_DB_DATABASE: Your demo's MySQL database. e.g. "concretedemo".
  • DEMO_STARTING_POINT: A starting point (sample_content, blank, a custom one) that will be installed as the sample content for this site.
  • DEMO_ADMIN_EMAIL: An email address for the admin account that will be created when your site is reset.
  • DEMO_ADMIN_PASSWORD: The password for your "admin" user account.
  • DEMO_USER_USERNAME: The username for your "demo" account. This is the account you will give out to users who wish to demo your software.
  • DEMO_USER_EMAIL: The email address for your "demo" account.
  • DEMO_USER_PASSWORD: The password for the "demo" user.
  • DEMO_PASSWORD_SALT: A long string that needs to be in place in this script.
  • PACKAGES_TO_INSTALL: A comma-separated list of package handles of all add-ons in the local packages/ directory you wish to install every time the demo site is reset.

Scheduling this Script

It is easy to cron this script so that it will clean out data every hour. Something like this can be entered into a crontab on a Linux server. For example, if your reset script is

http://www.yoursite.com/reset_128273282.php

You can can make it run every hour on the hour with

0 * * * * /usr/bin/wget -T 0 -q http://www.yoursite.com/reset_128273282.php

in your crontab file.

Finished

That's it! Now you should have a fully functional concrete5 demo with a full admin account, a limited admin account, and any add-ons preinstalled that you wish to demonstrate.

How-To Tags

Marketplace, add-ons, add-on developers

Related How-Tos

  • concrete5 Add-On Developers: Create Your Own concrete5 Demo (5.4.2.2 and earlier)
  • Documentation
  • How-Tos
  • Developers
  • concrete5 Add-On Developers: Create Your Own Demo (5.5.0 and Up)

Do you have questions

  • What are users saying?
  • Who is using concrete5?
  • What makes concrete5 easy?
  • Why develop on concrete5?
 

We’re on “The Twitter”

管理画面のJobsはどこにいったかか分かりますか ( #concrete5 live at http://t.co/W3tCUvlA)

Follow concrete5

About

  • Try it Out
  • For Developers
  • For Agencies
  • For Designers
  • For Anyone
  • Testimonials
  • Showcase
  • History
  • Our Philosophy
  • Credits
  • What does free mean?
  • Blog

Community

  • Members
  • Forums
  • Chat
  • International
  • Jobs
  • eNewsletters

Developers

  • Download concrete5
  • Join Beta Team
  • Translate concrete5
  • Bug Tracker
  • Beta
  • Submit to Marketplace
  • Code Submissions
  • News
  • Community Leaders
  • User Doc Group

Marketplace

  • Add-Ons
  • Themes
  • Add-on Installation
  • Deal Of The Day
  • Swag

Services

  • Hosting
  • Support Options
  • Consulting
  • Training
  • Enterprise

Documentation

  • Getting Started
  • Editor's Guide
  • Developers Guide
  • How-Tos

Legal

  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Contact Us
© 2008 to 2012 Concrete CMS Inc. All Rights Reserved.

Sign In?

You must have a user account and be signed to perform this action.

  • Sign In
  • Register