ocPortal Tutorial: Disaster recovery
This tutorial will go through some solutions to 'disasterous' 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 ocPortal 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 (you can submit an emergency ticket, so long as you have some credit in your support account).
Table of contents
- ocPortal Tutorial: Disaster recovery
Repairing a corrupted copy of ocPortalThe upgrader tool (accessible via 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.
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. For instance, if you have folders my_theme and another_theme and default, rename the first two to my_theme.old and another_theme.old, but leave default along. This renaming will essentially temporarily erase your themes and force ocPortal 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 a login passwordIf you've misset a password and for whatever reason can't use the 'lost password' feature to reset it (perhaps because of an invalid/non-existant e-mail address for that account, or a faulty/non-existant mail server), 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 OCF . If you are using another forum then the method will be similar, but will be done upon the data of that forum.
Select to browse the f_members table
Edit the row for the username for which the password should be changed
2) Browse the contents of the ocPortal f_members table (named ocp_f_members if you used the default table prefix).
3) You will see rows for all usernames. Click the little edit icon and you'll see an editing screen.
Change the settings and 'Go'
- 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' (ocPortal 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'.
5) Scroll to the bottom of the form and click 'Go'.
You should now be able to log in to ocPortal 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 info.php file (_config.php in v10+).
$SITE_INFO['backdoor_ip']='22.214.171.124'; // 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. ocProducts makes no claims to how secure this backdoor might be and you open it up entirely at your own risk.
Unbanning an IP
Select to browse the usersubmitban_ip table
Delete the row corresponding to your 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 OcCLE (this example assumes you are reassigning from member #5 to member #2):
Changing base configurationIf your server base configuration has changed (such as your database password, for example) then you need to update ocPortal's info.php config file to reflect this. You can either do this directly, or you can do it via launching the 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://yoursite/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. You can usually also uninstall an addon by examining the raw TAR file from the addon directory. Any files inside it should be deleted manually from your website.
Disabling short URLsShort URLs are subject to your web host 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 config_editor.php script in order to turn them off, overriding the main configuration setting. Load up the config_editor.php script, login, look for the "Whether to block the short-URL (mod_rewrite)" option, set it to 1, and then save the configuration.