Sometimes site changes like installing a new add-on, upgrading your X-Cart core, or rebuilding your store site’s cache may not go as smoothly as planned. A syntax error in the code of a new add-on, an incompatibility of an add-on with the new X-Cart core after an upgrade, or a cache rebuild failure may crash your store website. Hence when you attempt to access the store website, you cannot. For example, you may continuously see a page saying, "The site is temporarily closed for maintenance."
This article describes what you can do if you face this major problem and get your store up and running.
Recover the Store Using Safe Mode (X-Cart below v5.4.x only)
Drop and Re-Create Your Site's Cache
If you suspect the problem originates from an improperly completed site's cache rebuild process, you should try clearing your store's cache and running the cache rebuild process anew. Usually, the cache rebuild process takes place when you apply a core upgrade, install a new add-on, enable/disable an installed add-on, or manually launch the cache rebuild process by selecting the "Re-deploy the store" option on the Cache Management page (System Settings > Cache Management) in your store Admin area. If your store stopped functioning after one of those actions, the chances are high it happened because of problems with the site's cache.
There are several reasons why cache re-generation may go wrong for your site. One of the most popular is closing a page where the cache rebuild process is executed. But no matter what caused the problem, you can try to resolve it using one of the following methods.
METHOD 1
Access your store using a specially crafted URL. As a result, your existing site cache is dropped, and the cache rebuild process is launched automatically.
X-Cart versions 5.3.6.x-5.4.0.0
Use the following URL format: https://www.example.com/x-cart/admin.php?drop_cache&access_key=XXXXXXXXXXXXXX
Replace the https://www.example.com/x-cart/
part in the URL with the actual address of your store website, and the XXXXXXXXXXXXXX
part with your current Safe Mode access key.
You can find the Safe Mode access key in the var/data/.safeModeAccessKey
file in your X-Cart installation folder, or you can copy any of the two reset links sent to your site administrator mailbox after X-Cart installation if you are using an X-Cart version below 5.4.0.0. For X-Cart 5.1.9-5.3.x, the message subject reads "Soft and Hard reset links for your store!". For X-Cart versions 5.1.8 and earlier, the subject is "New safe mode access key has been generated!".
X-Cart versions below 5.4.0.0-5.4.0.5
The feature is not supported.
X-Cart versions below 5.4.0.5 and later
Use the following URL format: https://www.example.com/x-cart/service.php?/rebuild&auth_code=XXXXXXXXXXXXXX
Replace the https://www.example.com/x-cart/
part in the URL with the actual address of your store website, and the XXXXXXXXXXXXXX
part with your current Auth code (See the auth_code value in the file etc/config.php
).
METHOD 2
X-Cart versions below 5.4.0.0
Delete the folder
var/run
and the filevar/.rebuildStarted
in your X-Cart installation folder.Go to your store’s admin area. X-Cart will detect the absence of cache and automatically launch the cache rebuild process.
X-Cart versions 5.4.0.0 and later
Go to
https://www.example.com/x-cart/service.php#/login
. Be sure to replace the parthttps://www.example.com/x-cart/
with your actual site address.Enter the auth_code from the file
etc/config.php
into the Auth code field.Go to
https://www.example.com/x-cart/service.php?/rebuild
. Again, be sure to use your site address.
Contact Your Hosting Team
Good hosting companies back up your entire website (databases and files) every day— excellent ones even more often.
If your website crashed, contact your hosting team and ask them to recover your store from backup.
Recover the Store Using Safe Mode
DISCLAIMER: This method applies to X-Cart versions below 5.4.x only.
It might happen that your hosting provider does not respond to you in time, and you have to deal with the situation by yourself. Another possibility is that you are working in a development environment and need to find out what exactly crashed your store so you would be able to fix it. In this case, you may want to try using Safe Mode. Safe Mode enables you to re-deploy your store with a limited set of add-ons (or without add-ons), which can help you to identify the source of your problem more efficiently.
To run your store in Safe Mode, you need to access your store website using a reset link. X-Cart has several types of reset links.
SOFT RESET
X-Cart versions 5.x-5.2.6: Disables all the custom add-ons uploaded to the store directly via the Upload add-on feature, NOT via the X-Cart App Store.
X-Cart versions 5.2.7-5.3.x (below 5.4.x): Disables all the add-ons except those developed by X-Cart 5 team and Qualiteam.
HARD RESET
X-Cart versions 5.x-5.2.6: Disables ALL add-ons and custom mods, leaving only the core.
X-Cart versions 5.2.7-5.3.x (below 5.4.x): Disables all the add-ons except for the ones developed by X-Cart 5 team.
Any custom modifications uploaded to your store in the form of add-ons via the Upload add-on feature are disabled regardless of the reset link type - no matter who the modification's author is, whether it be X-Cart service departments, X-Cart partners, or 3rd party developers.
After a reset link is used, X-Cart disables the add-ons that need to be disabled according to the type of the link. Then it tries to recover itself. Once the store is back online, it is possible to try enabling the add-ons again one by one to identify the one causing the site to crash. As soon as you know which add-on is causing the problem, you can contact the add-on developer to get it fixed.
In X-Cart versions below 5.4.0.0, you can find your Hard and Soft reset links in your store’s Admin area on the Safe mode page (System Tools > Safe Mode).
You can also find the same links in an email message sent to the administrator mailbox after X-Cart installation. For X-Cart versions 5.1.9 and later, the message subject reads "Soft and Hard reset links for your store!"; for earlier versions - "New safe mode access key has been generated!".
The format of the reset links is as follows:
Hard reset:
https://www.example.com/x-cart/admin.php?target=main&safe_mode=1&access_key=XXXXXXXXXXXXXX
Soft reset:
https://www.example.com/x-cart/admin.php?target=main&safe_mode=1&access_key=XXXXXXXXXXXXXX&mode=soft
If you cannot access your reset links, you can re-create them manually by replacing the part https://www.example.com/x-cart/
with the actual address of your store and the part XXXXXXXXXXXXXX
with your current Safe Mode access key from the var/data/.safeModeAccessKey
file).
In X-Cart versions 5.2.7-5.3.x, the Safe mode section of your store’s Admin area also provides the so-called "Current state" link. This link corresponds to your store's latest snapshot. It may be helpful if you want to capture the current state of your store and bring your store back to this state later. For example, you can copy this link and store it in a separate file before you try to install a new add-on. If the installation goes wrong, you will be able to restore your site by visiting this link. Your store will be re-deployed with only the add-ons active at the time you copied the link.
The format of the "Current state" link is as follows:
Current state:
https://www.example.com/x-cart/admin.php?target=main&safe_mode=1&access_key=XXXXXXXXXXXXXX&date=<restore_date>
You can easily re-create the link manually by replacing the https://www.example.com/x-cart/
part with the actual address of your store, the part XXXXXXXXXXXXXX
with your current Safe Mode access key from the var/data/.safeModeAccessKey
file, and <restore_date>
with the date of the snapshot that needs to be restored.
Related pages: