15 December 2017 | 42 views | Tags: Documentation
If you are running multiple Tuskfish websites off one hosting account, you may find it convenient to run them all off a single code base. It makes maintenance a lot easier since you only have to apply patches, upgrades and your own hacks once. It also simplifies backups and cuts down time on FTP transfers, etc.
To summarise, each of your sites can use a common trust_path back end, drawing on the code libraries and directory structure in there. However, they do need to keep a unique front end file structure (the files in each site's public_html or web root), as you are likely to customise those. The main issue is that you need to set up separate configuration files for each site, as well as separate file cache and uploads directories, to prevent them overwriting one another.
Here's how to set up multi sites with a single back end code base:
- Install your first Tuskfish website as per usual. No need to do anything different.
- Create subdirectories in your web root (public_html) to house your additional sites.
- In your second (and subsequent) website installation, you only need to upload the front end files (do not upload the trust_path, as you will use the existing one you created for the first site).
- Edit mainfile.php in your second site to set the base file path constants, as usual. However:
- Set the TFISH_TRUST_PATH constant to point at the trust_path of the first website, which will be used for all sites.
- Set the TFISH_CONFIGURATION_PATH to point at a copy of config.php that you have renamed. For example, the configuration path is usually this:
define("TFISH_CONFIGURATION_PATH", TFISH_TRUST_PATH . "configuration/config.php");
If I were setting up a second hypothetical site called flatfish.org, I might change it to something unique like:
define("TFISH_CONFIGURATION_PATH", TFISH_TRUST_PATH . "configuration/flatfish_config.php");
- Upload a corresponding copy of the config file (flatfish_config.php in this example) to the trust_path/configuration directory.
- Edit your new config file (flatfish_config.php) and change the private cache path to be unique:
define ("TFISH_PRIVATE_CACHE_PATH", TFISH_TRUST_PATH . "cache/");
Change it to something like:
define("TFISH_PRIVATE_CACHE_PATH", TFISH_TRUST_PATH . "flatfish_cache/");
- Create a matching subdirectory, eg. trust_path/cache/flatfish_cache in this example.
Edit your custom configuration file for the second site (flatfish_config.php in this example) to specify a separate base uploads directory; this will stop your image and media files getting mixed up:
TFISH_ROOT_PATH . "uploads/flatfish/");
- Create a matching subdirectory, eg. public_html/uploads/flatfish/ in this example.
- Optional: If you wish to customise the language files for a particular site, then you should also make a copy of english.php with a different name (eg. flatfish_english.php) and edit the configuration file path to point at it.
- Run the installation script for the second site, as usual, but make sure you give the database a unique name, so that it does not overwrite the earlier sites.
That's it. All of the databases will be stored in trust_path/database and coexist quite happily. If you ever need to update the Tuskfish library or some other shared component in the trust_path, you only need to do it once and the change will apply across all of your sites.
Copyright, all rights reserved.