Magento 1.2 Update failes and MagentoConnect is unusable now

There are two differend methods to fix this issues. A softer way and a more "brutal" way. I would suggest to try it the "soft" way, cause all changes are easy to undo, if you get more error's

The Soft way (doesn't need console access):

1. Edit /downloader/Maged/Controller.php Line: 384
2. replace "return Mage::isInstalled(); " with "return true;"
3. Save and Close the file
4. Edit /downloader/Maged/Session.php Line: 33
5. replace "if (class_exists('Mage') && Mage::isInstalled()) {" with "return true;"
6. MagentoConnect should now open again, and you can install: "magento-core/Mage_All_Latest"

thats it.

The Hard way (need console access):

If you have wrong filepermissions while updateing your Magento you can destroy your Magento Connect (which is the last chance to get your updates working again without loosing data).

If you connect to your Magento Connect you should get a Error message like this:

Fatal error: Call to undefined method Mage::isinstalled() in /var/www/downloader/Maged/Controller.php on line 384

to get rid of this you can try this steps:
1. BACKUP BACKUP BACKUP this is unclean an should be the last solution if you really Need to Update
2. got the backup? Redo! :)
3. now visit your page by SSH or FTP and check the "


directory. This is one part which fails to install.
4. Copy this by

cp * /var/www/ -r

your MagentoConnect should now work again, otherwise you can use your Backup.
5. go to your base Magento directory and fix the filepermissions (if your webservice runs with default settings on a Apache Webserver (how is using a MS Server is alone now :) ) a

chown www-data:www-data * -R

should set full write permissions to the webserver (this should be replaced after the update, to a more secure level)
6. goto your MagentoConnect console and reinstall the


(this is the extension key.
7. correct your Server permissions again:

find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;

your system should be okay now.

Warning: This is not a save way, which leaks the normal way you should update your Magento. Its really the LAST solution if everthing else failes.
Care about a Filebased Backup and a Database Backup (Magento has got a good tool for creating Database Backups in the System->Backup section) USE IT!!!

Using PEAR to upgrade instead of MagentoConnect

another possible way is to use the PEAR console directly.
You need a SSH account for your service to do so:

./pear install -f --alldeps magento-core/Mage_All_Latest-stable

but dont forget to set the permissions correct, or you get the same error.