After to get some problems with the move of the magento installation folder and the management of the extension installed through Magento Connect and Pear. I shared my information into this post. You’ll find here the solution to regenerate the correct data for pear.
The pear files are serialized, so need to unserialize, replace the content with the new path of your installation.
Like that you can use this script to change an installed Module via pear of your installation folder and update the pear files for your new installation folder. The cache files (file.reg) are in this folder : /pearlib/php/.registry/.channel.connect.magentocommerce.com_community (for example)
In attachment a PHP-CLI script to do scan the entire folder desired to fix the path of every module installed with pear.
You have to provide in arguments:
1) the complete path of the ‘shop/downloader/pearlib/’ folder
2) The text to find (normally the path of your previous installation)
3) The text to replace (normally the path of your new installation)
php -f un/serialize-pear-reg-files.php ‘/the_path_to_magento_installation/downloader/pearlib/php/.registry’ ‘/old_path/shop’ ‘/new_path/shop’
The results are stored in the different sub-folders inside a folder ‘new_serialized’. The files and folders in the .registry are hidden in linux system.The script provided has been tested on Magento versions 22.214.171.124 et 126.96.36.199. You can use this script from your browser but you have to comment and uncomment some code and provide the above information directly into the script.
Files : unserialize-pear-reg-files.php.zip (2.9 Ko)