Composr Tutorial: Disaster recovery
Written by Chris Graham (ocProducts)The Composr 'error log' screen points to this tutorial (as well as the 'critical error' screen). If you think you have found a bug, please report it. The rest of this tutorial deals with potential disaster situations – an error in the error log does not imply a disaster has happened.
This tutorial will go through some solutions to 'disastrous' scenarios that could happen on an unstable web server configuration. It does not cover all that could go wrong by any means, as there are literally an infinite number of things that could go wrong if Composr is running in an unreliable environment.
I am going to assume that you have access to phpMyAdmin for the purposes of this tutorial. phpMyAdmin is a user-friendly web-based frontend to MySQL, and is available from most hosting control panels. For more information, see the Manually editing your database with phpMyAdmin tutorial.
If you need a quick data rescue, consider using ocProducts support (it will be handled more quickly if you already have support credits in your account). Or, your preferred third-party developer.
Table of contents
Composr Tutorial: Disaster recovery
- Viewing the error log
- Clearing caches
- Repairing a corrupted copy of Composr
- Repairing corrupted MySQL tables
- Fixing a theme
- Changing an account password
- Changing the master password
- Unbanning an IP address
- Resetting page ownerships
- Changing Installation Options
- Removing Facebook from an account
- Problems with addons
- Disabling URL Schemes
- Closing the site
- See also
Viewing the error logYou may view the Composr error log even if Composr won't start. Just look at the contents of the data_custom/errorlog.php file manually (don't run it, open it in a text editor). The error log often contains clues to what is causing a problem.
Clearing cachesChanges in the database or to files may be obscured by cacheing. If you have a problem so severe that you cannot get into the Admin Zone, you can clear cacheing either:
- from the upgrader tool (accessible via http://yourbaseurl/upgrader.php)
- opening up a command prompt to your base directory and running sh decache.sh (Linux/Mac only) – this works if the upgrader won't run; it doesn't immediately clear database cacheing, but it adds a flag for Composr to do that automatically next time the site is loaded
Repairing a corrupted copy of ComposrThe upgrader tool (accessible via http://yourbaseurl/upgrader.php) contains a very useful 'integrity checker' which can find out-dated and corrupt files. You can use this tool at any point, regardless of whether you have recently upgraded or not.
More details on the integrity checker are in the Performing an upgrade tutorial.
Repairing corrupted MySQL tablesInstructions are provided in the Manually editing your database with phpMyAdmin tutorial.
If you don't have phpMyAdmin, whatever database management tool should have an equivalent feature as table repair is a standard MySQL mechanism.
If you don't have any visual database management tool, you should look into getting one. However if you are technical you can use the command line using the MySQL REPAIR TABLE <tablename> command, or the myisamchk program to batch fix all *.MYI files while having the MySQL server temporarily off-line.
Fixing a themeIf you've set up a theme, that is activated, and you've edited it in such a way that you can no longer realistically use the Admin Zone, you'll need to rescue your theme.
If you still are logged in as admin or the default theme is accessible from guest accounts, use the 'Safe mode' link you were asked to bookmark during the Setup Wizard – this will allow you to use your website, using the default theme. If you have forgotten the link, it's any link to your website with &keep_theme=default added to the end of the URL.
If you are not logged in as admin, connect to your web server using FTP, then rename all the folders inside the themes folder except default and admin. For instance, if you have folders my_theme, another_theme, default, and admin, rename the first two to my_theme.old and another_theme.old, but leave default and admin alone. This renaming will essentially temporarily erase your themes and force Composr to use the default theme regardless of permissions. Now change the theme selection on your site back back to default, rename your theme folders back to their prior names (remove the .old suffix you added), fix your theme, and then restore your theme selection.
Changing an account passwordIf you've misset a Composr account password and for whatever reason can't use the 'lost password' feature to reset it (perhaps because of an invalid/non-existent e-mail address for that account, or a faulty/non-existent mail server, or a protected admin account), then you'll want to manually reset it.
Obviously this needs a greater level of access than ordinary members would have. We could either use:
- Database access
- Disk access
Via the databaseFor this, I am assuming that you are using Conversr . If you are using another forum then the method will be similar, but will be done upon the data of that forum.
- Enter phpMyAdmin
- Browse the contents of the Composr f_members table (named cms_f_members if you used the default table prefix).
- You will see rows for all usernames. Click the little edit icon and you'll see an editing screen.
- There are numerous fields, but we only need to change three:
- m_pass_hash_salted should be given the new password. It is essential that you also choose 'MD5' from the list to the left of the input field, so that the password gets 'encrypted' (Composr assumes an encrypted password and if it is not then it will not successfully log in).
- m_pass_salt should be blanked out.
- m_password_compat_scheme should be set to the literal value 'md5'.
- Scroll to the bottom of the form and click 'Go'.
You should now be able to log in to Composr using your new password.
Via the diskIf you need to 'hack' your way in to the site using your FTP access, you can place a temporary backdoor.
Go to myIPaddress.com: What is my IP address? How do I find my IP address? and copy your IP address, then put it into your _config.php file:
$SITE_INFO['backdoor_ip'] = '126.96.36.199'; // Enable to a real IP address to force login from FTP access (if lost admin password)
You will then be logged in as the first admin user there is. Additionally membership bans, probation, and flood control, will not apply when using the backdoor (so it is useful if your account was locked somehow, e.g. by a malicious other staff member).
It should go without saying that you should only use this 'backdoor' for a short space of time and not disclose your IP address to third parties when doing it. The developers make no claims to how secure this backdoor might be and you open it up entirely at your own risk.
Changing the master passwordIf you need to log in to the upgrader, config editor, or code editor, you'll need the master password.
If you have forgotten it, to change it just edit the _config.php file:
$SITE_INFO['master_password'] = '...';
You should then encrypt your password via changing the password within the http://yourbaseurl/config_editor.php script.
Unbanning an IP address
If you don't know your IP address then you can find it out from myIPaddress.com: What is my IP address? How do I find my IP address?.
Resetting page ownershipsIf you delete or demote an admin, you may find lots of pages now show Comcode permission errors (even default ones, which are assigned to the first site admin automatically).
To fix this, edit the Comcode page and assign a new submitter via the edit form.
To do it en-masse, you can run this in Commandr (this example assumes you are reassigning from member #5 to member #2):
Changing Installation OptionsIf your server base configuration has changed (such as your database password, for example) then you need to update Composr's _config.php config file to reflect this. You can either do this directly, or you can do it via launching the http://yourbaseurl/config_editor.php script installed at the base of your website (you will need your master password to do this).
Removing Facebook from an accountIf you have associated an account with Facebook, you can remove it by doing a password reset on that account.
Problems with addonsIf you find an addon is crashing your site, the Safe Mode link (http://yourbaseurl/index.php?keep_safe_mode=1) can help. It should let you into your site to uninstall the addon causing the problem.
The above requires for to be logged in at admin, which you may not be or be able to do. If you can't then you can force Safe Mode on using the http://yourbaseurl/config_editor.php script. Load up the http://yourbaseurl/config_editor.php script, login, look for the "Whether Composr is to be forced into Safe Mode, meaning no custom files will load and most caching will be disabled" option, tick (check) the option, and then save the configuration. Turn the option back off after you've solved your problem.
Disabling URL SchemesURL Schemes are subject to your webhost supporting rewrites and not doing any strange redirects or filter rules. It is possible you could enable them, and then find they don't work and that you can't get back at the configuration to disable them. We try and detect them working before we allow the option to be changed, but the detection may not be perfect. Or, they may work, then your host may change something, causing them to stop working.
You can use the http://yourbaseurl/config_editor.php script in order to turn them off, overriding the main configuration setting. Load up the http://yourbaseurl/config_editor.php script, login, look for the "Whether to block the URL Scheme (mod_rewrite)" option, tick (check) the option, and then save the configuration.
Closing the siteIf you can't access the Admin Zone then the upgrader tool (accessible via http://yourbaseurl/upgrader.php) can close the site while you're working on problems. If that won't work reliably you can create a closed.html file in your base directory which will automatically be displayed to all users accessing Composr.
If failover-mode is configured you can activate it manually from within the http://yourbaseurl/config_editor.php script.
Please rate this tutorial:
Have a suggestion? Report an issue on the tracker.