Feature #701
Updated by Daniel Curtis almost 9 years ago
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:
<pre>
pkg install sudo
</pre>
* Make the mage script executable:
<pre>
chmod u+x /usr/local/www/sites/magento.example.com/mage
</pre>
* Change into the magento install directory:
<pre>
cd /usr/local/www/sites/magento.example.com
</pre>
* Set the maintenance.flag file:
<pre>
touch /usr/local/www/sites/magento.example.com/maintenance.flag
</pre>
* Show the list of installed Magento packages:
<pre>
sudo -u www sh /usr/local/www/sites/magento.example.com/mage list-installed
</pre>
* Upgrade any other packages:
<pre>
sudo -u www sh /usr/local/www/sites/magento.example.com/mage upgrade-all --force
</pre>
* Force the reinstallation of the Mage_All_Latest package:
<pre>
sudo -u www sh /usr/local/www/sites/magento.example.com/mage install http://connect20.magentocommerce.com/community Mage_All_Latest --force
</pre>
* Reindex everything:
<pre>
php shell/indexer.php reindexall
</pre>
* Set the correct permissions:
<pre>
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
</pre>
* Flush all cache and sessions:
<pre>
rm -rf /usr/local/www/sites/magento.example.com/var/{cache,session}/*
</pre>
#* NOTE: For some reason I also needed to remove the old pkginfo/Mage_All_Latest.txt directory:
<pre>
rm -rf /usr/local/www/sites/magento.example.com/pkginfo/Mage_All_Latest.txt
</pre>
* Remove the maintenance.flag file:
<pre>
rm /usr/local/www/sites/magento.example.com/maintenance.flag
</pre>
h2. Resources
* https://community.magento.com/t5/Version-Upgrades/CE-1-9-2-update-via-SSH/td-p/10562
* https://firebearstudio.com/blog/upgrade-to-magento-community-1-9-by-ssh.html