Feature #701
Fix a Magento Install From The Command Line
Description
I recently had to fix Magento after a hung update happened. After looking around online I found that Magento can be update directly from the command line. This is a guide for doing so.
- Make sure sudo is installed:
pkg install sudo
- Make the mage script executable:
chmod u+x /usr/local/www/sites/magento.example.com/mage
- Change into the magento install directory:
cd /usr/local/www/sites/magento.example.com
- Set the maintenance.flag file:
touch /usr/local/www/sites/magento.example.com/maintenance.flag
- Show the list of installed Magento packages:
sudo -u www sh /usr/local/www/sites/magento.example.com/mage list-installed
- Upgrade any other packages:
sudo -u www sh /usr/local/www/sites/magento.example.com/mage upgrade-all --force
- Force the reinstallation of the Mage_All_Latest package:
sudo -u www sh /usr/local/www/sites/magento.example.com/mage install http://connect20.magentocommerce.com/community Mage_All_Latest --force
- Reindex everything:
php shell/indexer.php reindexall
- Set the correct permissions:
chmod -R 644 /usr/local/www/sites/magento.example.com/* find /usr/local/www/sites/magento.example.com -type d -exec chmod 755 {} \; chmod 550 /usr/local/www/sites/magento.example.com/mage
- Flush all cache and sessions:
rm -rf /usr/local/www/sites/magento.example.com/var/{cache,session}/*
- NOTE: For some reason I also needed to remove the old pkginfo/Mage_All_Latest.txt directory:
rm -rf /usr/local/www/sites/magento.example.com/pkginfo/Mage_All_Latest.txt
- NOTE: For some reason I also needed to remove the old pkginfo/Mage_All_Latest.txt directory:
- Remove the maintenance.flag file:
rm /usr/local/www/sites/magento.example.com/maintenance.flag