Table of Contents

Wolf CMS administration guide

Welcome to the Wolf CMS administration guide. This book is a collection of wiki pages from the wolfcms.org documentation wiki that are gathered together to form a book-like total.

By accessing this book and selecting the “Export to ODT” button, you can generate an Open Office document for your viewing/printing pleasure. You can of course also use Open Office to turn the ODT document into a PDF file.

Installing Wolf CMS

Getting Wolf CMS installed on your server or hosting package involves a number of steps. Fortunately, the steps are fairly simple and are applicable to most hosting providers. (Most of the steps below are illustrated in this 4m45s video, also available on YouTube), which demonstrates how to install Wolf CMS (0.7.3) with mySQL as the database on localhost.)

Create the database

Wolf CMS depends on a database being available. Creating one yourself1) or having one created for you depends on your exact environment or hosting provider and is beyond the scope of this document.

For our installation purposes, we will assume that you can or already have created a database for use by Wolf CMS.

mySQL

If you are using mySQL, it is probably best to have the db prepared before proceeding with the rest of the installation instructions. You will need to know:

  • The database name
  • The database username
  • The database user password

and, if your specific environment differs from what Wolf expects, you may additionally need to know:

  • The database server name or IP address
  • The database server port number

SQLite 3

If you are using SQLite, it is probably best to create the db during the Wolf install process. Wolf's installation screen will suggest a location and filename for your db outside the Wolf directory structure. You will need to create the folder/file that the Wolf install screen recommends, or alternatively, another one of your own choosing.

In any case, this needs to be an absolute path, with full write permissions for Wolf to be able to use it. Ensure this has been done before proceeding to the final “Install” step.

Uploading the Wolf CMS package

After having retrieved the Wolf CMS package from our download pages, you will need to copy it to your webserver. Unzip the package in the appropriate directory on your server.

This will usually be a “www” or “public_html” directory or a subdirectory of that. Wolf CMS is quite happy to work inside a subdirectory.

.htaccess

If you wish to use 'clean' - without '?' - URLs:

  1. rename '_.htaccess' to '.htaccess'
  2. update, if necessary, the RewriteBase parameter in .htaccess - '/' for root install or '/MY-SUB-DIRECTORY/' otherwise
magic_quotes_gpc in .htaccess

It is recommended to switch off 'magic_quotes_gpc' and this is done in the .htaccess file with 'php_flag magic_quotes_gpc off'. However, some servers are configured to not allow this and the install will fail. You will therefore need to comment this out of .htaccess by starting the line with '#'.

Your host may allow use of php.ini to do this by setting 'magic_quotes_gpc off'. If using php.ini produces a blank screen, you may need to provide additional instructions in this file. See this forum discussion for details.

Running the installation routine

After you have copied the files onto your webserver, you will need to run the installation routine.

  • Open your browser and go to the <wolf path>/ page
    • This should redirect to <wolf path>/wolf/install/
  • Answer all the questions after reviewing them carefully.

Your <wolf path> will likely be something like http://www.mysite.com/ if you placed the Wolf CMS files in the root, or http://www.mysite.com/wolfcms/ if you placed Wolf CMS in a subdirectory.

After finishing the installation, you will get a message that includes a link to your <wolf path>/admin/ section. This page also shows you the administrator's username and generated password.

Post installation steps

A number of post installation steps are required and advised for you to do. These will help secure your Wolf CMS installation.

  1. Delete the <wolf path>/install and /docs directories from your webserver.
  2. Remove all of the write permissions for the config.php file.2)
  3. Run the Security check to determine any other steps you might need to take.
  4. Login with the administrator's username and generated password.3)
  5. If you are using SQLite, be sure to enable the “SQLite” plugin in the Administration > Plugins page, otherwise the “Archive” pages will give errors.

You should always change your administrator's password to something private and secure!

Optionally, you may also wish to change the name of the admin folder to further enhance the security of your Wolf site.

Removing the question mark from the url

The default installation of Wolf CMS generates a question mark in the URLs it generates. This is for compatibility purposes, so Wolf CMS will run on almost any HTTP server by default.

However, most people (and search engines) don't really like this question mark. You can disable/remove the question mark after you installed Wolf CMS.

By default, Wolf CMS supports Apache. Other HTTP servers are supported based on user input.

Updated to reflect Wolf CMS 0.6.0

You must carry out both the “General actions” and the additional instructions for your specific webserver (Apache, Lighttpd, etc.).

General actions

The following actions should always be executed in order for Wolf CMS to use clean urls.

  1. Temporarily add write permissions to the config.php file.4)
  2. Edit the config.php file
  3. Change the value of “USE_MOD_REWRITE” to “true”.
  4. Save the config.php file.
  5. Remove the write permissions from the config.php file. Don't forget or skip this step!5)
  6. Apply the directions for your specific HTTP server. See below.
  7. After applying the directions, test out the change by going to the root of your website. You should no longer see the question mark.

Apache HTTP server actions

  1. Edit the _.htaccess file located in the Wolf CMS root directory.
  2. Find the line starting with RewriteBase /wolfcms/.
    If Wolf CMS lives in the root of your site6), delete the “wolfcms/” part so the line equals: RewriteBase /.
    If Wolf CMS lives in a subdirectory of your site7), change the ”/wolfcms/” part so the line equals: RewriteBase /mywolf/.
  3. Save the _.htaccess file.
  4. Rename the _.htaccess file into .htaccess (i.e. remove the underscore).

Lighttpd server actions

The paths used in the rewrite code below assume that your Wolf CMS installation lives at the root of the site, i.e. http://www.example.com.

Since Lighttpd does not have an equivalent of Apache's RewriteBase command, you will have to manually alter the paths below to conform to your Wolf CMS root.

# 
# Wolf CMS mod_rewrite rules for lighttpd
#
# If your Wolf CMS install lives in a sub-directory like: http://www.example.com/mywolf/
# you should add the subdirectory between ^ and / in the rules below and in the
replacement
# value, for example: "^/mywolf/admin(.*)$" => "/mywolf/admin/index.php?$1",
#
url.rewrite-once = (

    "^/install/index.html$" => "/install/index.php?rewrite=1",
    "^/install/index.php$" => "/install/index.php?rewrite=1",
    "^/install/$" => "/install/index.php?rewrite=1",
    "^/install/(.*)$" => "/install/$1",

    "^/admin/(images|javascripts|stylesheets|themes)/(.*)" => "/admin/$1/$2",
    "^/admin/index.php\?(.*)$" => "/admin/index.php?$1",
    "^/admin(.*)$" => "/admin/index.php?$1",

    "^/favicon\.ico$" => "$0",
    "^/(public|wolf)/(.*)$" => "/$1/$2",

    "^(?:(?!/admin/))/([^?]*)(\?(.*))$" => "/index.php?WOLFPAGE=$1&$2",
    "^/(.*)$" => "/index.php?WOLFPAGE=$1"

)

If you are using Wolf CMS 0.7.x, the location of some of the pages has changed. You will need to use the following instead. Since this uses url.rewrite-if-not-file, you will need at least version 1.4.24 of lighttpd.

url.rewrite-once = (

    "^/wolf/install/index.html$" => "/wolf/install/index.php?rewrite=1",
    "^/wolf/install/index.php$" => "/wolf/install/index.php?rewrite=1",
    "^/wolf/install/$" => "/wolf/install/index.php?rewrite=1",
    "^/wolf/install/(.*)$" => "/wolf/install/$1",
)

url.rewrite-if-not-file = (
    "^/([^\?]+)(\?(.*)$)?" => "/index.php?WOLFPAGE=$1&$3"
)

Hiawatha server actions

The paths used in the rewrite code below assume that your Wolf CMS installation lives in a “site” directory below the root of the system, i.e. http://www.example.com/site.

Since Hiawatha does not have an equivalent of Apache's RewriteBase command, you will have to manually alter the paths below to conform to your Wolf CMS root.

You will need an UrlToolkit similar to this where 'site' is the folder in the web root where Wolf CMS is unpacked.

UrlToolkit {
    ToolkitID = wolfcms
    Match ^/site/install/index.html$ Rewrite /site/install/index.php?rewrite=1
    Match ^/site/install/index.php$ Rewrite /site/install/index.php?rewrite=1
    Match ^/site/install/$ Rewrite /site/install/index.php?rewrite=1
    RequestURI exists Return
    Match ^/site/admin(.*)$ Rewrite /site/admin/index.php?$1
    Match ^/site(.*)$ Rewrite /site/index.php?WOLFPAGE=$1
}

Remember to enable this toolkit in your Virtual Host.

The 3 regex above RequestURI are used for clean url validation during installation only. They must be above RequestURI and can be commented out after installation.

You must have PreventSQLi disabled (is also the default I think).

Nginx server actions

The paths used in the rewrite code below assume that your Wolf CMS installation lives at the root of the site, i.e. http://www.example.com.

Since Nginx does not have an equivalent of Apache's RewriteBase command, you will have to manually alter the paths below to conform to your Wolf CMS root.

Put this in your server block:

if (!-e $request_filename) {
    rewrite  ^/(.*)$ /index.php?WOLFPAGE=$1  last;
    break;
}

You may also have to set the URL suffix to be blank

define('URL_SUFFIX', '');

in config.php

Zeus server actions

map path into SCRATCH:path from %{URL}           
look for file at %{SCRATCH:path}           
if exists then goto END           
look for dir at %{SCRATCH:path}           
if exists then goto END           

match URL into $ with ^/(.*)$
if matched
    look for file at $1
    if not exists
        set URL=/index.php?WOLFPAGE=$1
        goto END
    endif
endif

Enabling cron jobs

Available from Wolf CMS release: 0.6.0 (optional)

Cron is a daemon that executes commands at specified intervals. These commands are called “cron jobs.” Cron is available on Unix, Linux and Mac servers. Windows servers use a Scheduled Task to execute commands.

Wolf CMS itself does not require cron, but cron.php provides a cron_run event that can be used by plugins.

The cron command

In the following example, the crontab command shown below will activate the cron tasks automatically on the hour:

0 * * * * wget -O - -q -t 1 http://www.example.com/wolf/app/cron.php

The above sample assumes you've installed Wolf CMS to the root of your site.

In the above sample, the 0 * * * * represents when the task should happen. The first figure represents minutes – in this case, on the “zero” minute, or top of the hour. (If the number were, say, 10, then the action would take place at 10 minutes past the hour.) The other figures represent, respectively, hour, day, month and day of the week. A * is a wildcard, meaning “every time.”

The rest of the line basically tells the server to “ping” the url http://www.example.com/wolf/app/cron.php.

Here is a diagram of the general crontab syntax, for illustration:

# +---------------- minute (0 - 59)
# | +------------- hour (0 - 23)
# | | +---------- day of month (1 - 31)
# | | | +------- month (1 - 12)
# | | | | +---- day of week (0 - 7) (Sunday=0 or 7)
# | | | | |
* * * * * command to be executed

Thus, the cron command example above means “ping http://www.example.com/wolf/app/cron.php at the zero minute on every hour of every day of every month of every day of the week.”

How to set up a cron job

Cron jobs are scheduled by setting up a “crontab.” A crontab is a text file that contains the commands to be run. This file can be created and edited either through the command line interface, or, if you manage your website through a web-based control panel such as cpanel or Plesk, you will use the web interface. Check with your hosting company for detailed instructions if you are using a web-based control panel.

To edit a crontab through the command line, type:

crontab -e

If this fails, see the Troubleshooting Cron Jobs section below.

Add ONE of the following lines:

45 * * * *  /usr/bin/lynx -source http://example.com/wolf/app/cron.php
45 * * * * /usr/bin/wget -O - -q -t 1 http://www.example.com/wolf/app/cron.php
45 * * * * curl --silent --compressed http://example.com/wolf/app/cron.php

This would have a lynx, wget, or curl visit your cron page 45 minutes after every hour.

Three options are provided in case either wget, lynx or curl are not installed on the server. Any will do the job well.

Learn more about the crontab file syntax here to set up the cron job to run more or less often.

There are many ways to configure a cron job. If you have full access to crontab features, you should be able to simply paste in one of the above example commands – be sure to replace “example.com” with your own web domain or docroot.

If you're on shared hosting, you should be able to find cron job configuration somewhere in your hosting control panel. Some hosts even have cron “wizards” that walk you through the cron configuration, making it much easier if cron is new to you. On a Windows system you can accomplish the same thing with scheduled tasks to launch Internet Explorer pointed to the URL.

Some hosting companies don’t allow access to cron

If your hosting company restricts access to cron you have many options.

  • Ask the company to give you access, or to set up a cron job for you
  • Ask someone else with access to a server to set up a cron job for you. Any Unix, Linux, or Mac server with access to the internet can have a cron job to regularly visit your site. There are also some companies that offer cron services.
  • Use the Poor Man's Cron option.

Cron doesn't guarantee your commands will run at the specified interval. But Wolf CMS will try its best to come as close as possible. The more you visit cron.php, the more accurate cron will be.

Poor Man's Cron

Since not everyone has access to cron or Scheduled Tasks on their system, we’ve also added “poormans cron” support. This allows a cron job to be started at certain intervals and works on the basis of visits you get to your site.

To use poormans cron, edit config.php and set:

define('USE_POORMANSCRON', true);
define('POORMANSCRON_INTERVAL', 3600);

This will enable the poorman's cron support and set the run interval to once every hour.

Please note that this works based on the visits to your site. This means if you have few visitors, the mechanism will be increasingly inaccurate. With more visitors, it will be more accurate. A normal cron job or sheduled task should always be preferred to the poorman's cron option!

Troubleshooting cron jobs

If you receive a permission denied error after starting crontab -e, you may need to use sudo:

sudo crontab -e

You may need to adjust the path to wget, lynx or curl in your crontab. For example, the cron example listed above contains the line:

45 * * * *  /usr/bin/lynx -source http://example.com/wolf/app/cron.php

However, Lynx may be in a different location on your server, or not installed at all. To find out where Lynx is installed, enter:

whereis lynx

or

which lynx

If it is not located at /usr/bin/lynx, adjust the path as needed. The same applies for wget and curl. If none are installed ask a server administrator for help.

It may be necessary to change http://example.com/wolf/app/cron.php to the location of your Wolf CMS installation. For example, if you have Wolf CMS installed in a subdirectory, for example “wolfcms”, it will be http://www.example.com/wolfcms/wolf/app/cron.php).

Security notes

Taking this approach allows cron.php to be blocked to prevent remote access.

To block remote access to cron.php, in the server, .htaccess or vhost configuration file add this section:

    <Files "cron.php">
        Order Deny,Allow
        Deny from all
        Allow from localhost
        Allow from 127.0.0.1
        Allow from xx.xx.xx.xx <-- your IP address
    </Files>

If you take this approach to call cron.php, it is probably best not to use the root user to run the cron job. A non-privileged user account, or the Apache account user, for example http-service or www-data, is a better choice. To do so, call crontab -e when logged in as a non-privileged user, or for the Apache account on a Debian server, for example, you can add a user parameter:

sudo crontab -e -u www-data

Scheduled Tasks on Windows

To setup a Windows machine to run cron.php at a specific time follow the specific instructions below. This can be useful if you are not familiar with Linux/Unix, or if your web host does not offer the ability to run cron jobs; you can run them remotely from your own computer.

Note: These instructions were written for Windows XP but should be similar in other versions of Windows.

Creating a Scheduled Task

  1. Open Scheduler
  2. Go to Start > Programs > Accessories > System Tools > Scheduled Tasks
  3. Double-click Add Scheduled Task
  4. The Scheduled Task Wizard will appear. Click Next.
  5. Select the program to run. Choose your browser from the list (for example, Internet Explorer or Mozilla Firefox). Click Next.
  6. Give the task a Name, such as Wolf CMS Cron Job, and choose the Frequency with which to perform the task (for example, Daily)). Click Next.
  7. Choose specific date and time options (this step will vary, depending on the option selected in the previous step). When finished, click Next.
  8. Enter your password if prompted. Change the username if required (for example, you'd like the task to run under a user with fewer privileges security reasons). Click Next.
  9. On the final page, select the checkbox Open advanced properties for this task when I click Finish and click Finish.

Configuring the task

  1. Go to the task's setting page either by checking the checkbox at the end of the last step, or by double-clicking on the task.
  2. In the Run box, after the text that is there now (for example, C:\PROGRA~1\MOZILL~1\firefox.exe), enter a space and then type the address to your website's cron.php page in double quotations (for example, C:\PROGRA~1\MOZILL~1\firefox.exe http://www.example.com/wolf/app/cron.php
  3. To set a frequency more often than Daily (for example, hourly), click the Schedule tab, then click Advanced. Here you can set options such as Repeat task, every 1 hour for 23 hours. Click Ok when finished.
  4. Change the start time on the task to one minute from the current time. This will allow you to test the task and make sure that it is working.
  5. When all settings have been configured to your liking, click Apply and OK (note: you may be prompted for your password)

Command-line version

Another way to perform the above commands is by using the schtasks (or at in Windows 2000) command from the command line. To duplicate the example above, which runs Firefox hourly to execute http://www.example.com/wolf/app/cron.php, open a command prompt (Start > Programs > Accessories > Command Prompt) and enter:

schtasks /create /tn "Wolf CMS Cron Job" /tr "C:\PROGRA~1\MOZILL~1\firefox.exe http://www.example.com/wolf/app/cron.php" /sc hourly

Enter your password if prompted.

Using wget for Windows to run cron

If for whatever reason you'd rather not deal with a browser window popping up on the machine, you can use wget, the Windows port of which works more or less the same as it does in UNIX. curl and lynx also have windows ports but wget is probably the easiest to set up and use.

Grab a copy of wget from your choice of either the author's site or from SourceForge. Install it to the location of your choice.

Follow the steps for Creating A Scheduled Task above, except select wget.exe as the program to run (you may need to click the Browse button to locate it if you installed from a .zip file, for example). When you get to the Advanced Properties dialog, paste in the following after the program path:

-O - -q -t 1 http://www.example.com/wolf/app/cron.php

Adjust the rest of the options as described above and test it.

Upgrading to newer versions

Every stable release of Wolf CMS includes upgrading instructions from the preceding version. Look in docs/upgrading.txt for full information.

General tips on upgrading

There are some general tips you may want to follow in upgrading to new Wolf CMS versions. Please be aware though that these tips and this document cannot take into account any customizations you may have done on the Wolf CMS core or plugins code.

  • Always make a full backup of both the database and filesystem.
  • Turn off any non-core plugins before starting to migrate.

Please be aware that we only support single version upgrades.

Suggested update scenario

This is a suggested update scenario. Please be aware that we cannot take any responsibility for any possible data loss that may occur. Also please be aware that this scenario does not take into account any possible customizations you may have done to the database structure, Wolf CMS core code or Wolf CMS plugins.

First

  1. Make a backup of your entire database.
  2. Make a backup of your entire Wolf CMS installation's directory.

Only then

  1. Turn off any non-core plugins in Wolf's administration area.
  2. Delete your entire Wolf installation. Make sure you have a complete(!) backup
  3. Rename the database if desired/possible/necessary.
  4. Install Wolf CMS from scratch and point it to the old database and the old tables.
  5. Copy back the old ”/public” directory from your backup.
  6. Update the settings in config.php and .htaccess where necessary. Use your backups as reference material.
  7. Try to login to Wolf CMS.
  8. Turn each non-core plugin on again one by one. Test each plugin before turning on the next one.

This upgrade scenarios re-uses the old database and its contents. This should work flawlessly, however, it does mean you will not have any new default data available to you.

Should re-using the database not work or if you want to have all of the data that comes with Wolf CMS by default, you will need to remove the old database, install from scratch using a clean database and then carefully copy over the contents of the old database for each table.

For obvious reasons, this is a much more time-consuming and risky scenario. Post 0.6.0 update methods of Wolf CMS include a BackupRestore plugin to aid you and help simplify this scenario.

Making backups of Wolf CMS

As all administrators are aware, having correct backups of your machines and software is extremely important in the event of a calamity.

This section describes the best way to make a backup for disaster recovery purposes and documents the various methods used to create database backups.

DISCLAIMER - While we make every effort to give you correct and useful backup techniques, we are not responsible for any damage or loss of information that might occur.

General tips on making backups

  • Always backup the Wolf CMS directory and the Wolf CMS database at the same time8) to prevent inconsistencies between the filesystem and database contents.
  • Create independent backups. Even if your hosting provider makes regular backup, always do so yourself too. This could save you a lot of trouble if you ever have a conflict with your hosting provider for example.

Backing up the filesystem

Creating a filesystem backup is very easy in both a Unix/Linux and a Windows environment assuming you have the right tools available. We expect you to have:

  • SSH access in case of a remote server
  • An (un)zip tool like TAR/GZIP or WinZip.

We will describe the Unix/Linux and Windows procedures separately.

Unix/Linux

  1. Access your webserver, remotely if applicable.
  2. Change directories to your Wolf CMS root9).
  3. Use the tar & gzip commands to create a backup.

An example set of commands assuming Wolf CMS lives in a “wolf” subdirectory would be:

cd /home/myuser/www/wolf
tar -cf /home/myuser/wolf-filebackup-20090325.tar *
gzip /home/myuser/wolf-filebackup-20090325.tar
  1. Move the resultant backup file10) to a safe location like a special backup CD in a fire proof container.
  2. Do not forget to remove the backup from your webserver afterwards to prevent unauthorized users from getting your entire site.

Windows

  1. Access your webserver, remotely if applicable.
  2. Go to your Wolf CMS root folder11).
  3. Use your favourite zip tool to create a zipfile containing the entire contents of the Wolf CMS root folder.
  4. Give the zipfile a logical name like wolf-filesbackup-20090315.zip12)
  5. Move the resultant backup file to a safe location like a special backup CD in a fire proof container.
  6. Do not forget to remove the backup from your webserver afterwards to prevent unauthorized users from getting your entire site.

Backing up the database

Your Wolf CMS database contains most of your site. It includes the layouts, snippets, users, plugin configurations and actual site contents. It is therefore crucial to have a complete and working backup.

Since each database system has its own unique backup techniques, we will describe the generally accepted methods to create a correct backup for each database type.

MySQL

Generally speaking, you can create backups of a MySQL database with web-based tools like phpMyAdmin or the commandline tool mysqldump.

If you have an account with a hosting provider, you will need to check with them on how you can make a database backup. Some hosting provider provide you with backup options in the control panel that belongs to your site's account.

If you have commandline/ssh access to your account and want to use the mysqldump command:

# mysqldump --opt -u username -p databasename > database_backup_file.sql

For more detailed information on backup and recovery of MySQL databases, please see the following resources:

MySQL version Webpage
MySQL 6.0 http://dev.mysql.com/doc/refman/6.0/en/backup-and-recovery.html
MySQL 5.4 http://dev.mysql.com/doc/refman/5.4/en/backup-and-recovery.html
MySQL 5.1 http://dev.mysql.com/doc/refman/5.1/en/backup-and-recovery.html
MySQL 5.0 http://dev.mysql.com/doc/refman/5.0/en/backup-and-recovery.html
MySQL 4.1 http://dev.mysql.com/doc/refman/4.1/en/backup-and-recovery.html

SQLite

Nothing yet..

Final word

This administration book is an experimental product and consists of dynamically generated content consisting of other wolfcms.org wiki pages. We hope you like it!

If you enjoy and use Wolf CMS, consider donating to the project.

License applicable to this content

This content is licensed under the Creative Commons Attribution Non-Commercial Share Alike license.

That license lets others remix, tweak, and build upon this work non-commercially, as long as they credit the original author and license their new creations under the identical terms. Others can download and redistribute this work just like the by-nc-nd license, but they can also translate, make remixes, and produce new stories based on this work. All new work based on this work will carry the same license, so any derivatives will also be non-commercial in nature.

For the full license details, please see the original license text at:

http://creativecommons.org/licenses/by-nc-sa/3.0/ (Human readable)

http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode (Full legal text)

1) If you are using mySQL for your db, phpMyAdmin is a good tool for this.
2) This is a security measure and Wolf CMS will refuse to execute until you do this.
3) This was displayed on the installation's result page.
4) In Unix/Linux: chmod 666 config.php
5) In Unix/Linux: chmod 444 config.php
6) For example: www.mypage.com
7) For example: www.mypage.com/mywolf
8) Or almost the same time.
9) This is the directory in which you placed all of the Wolf CMS files during installation.
10) In this case: /home/myuser/wolf-filebackup-20090325.tar.gz.
11) This is the folder in which you placed all of the Wolf CMS files during installation.
12) Date is in ISO 8601 standard YYYYMMDD.