Mage_Adminhtml_Model_Extension_Remote_Collection Class Reference

Inheritance diagram for Mage_Adminhtml_Model_Extension_Remote_Collection:

Mage_Adminhtml_Model_Extension_Collection_Abstract Varien_Data_Collection

List of all members.

Protected Member Functions

 _fetchPackages ()


Detailed Description

Definition at line 3 of file Collection.php.


Member Function Documentation

_fetchPackages (  )  [protected]

Reimplemented from Mage_Adminhtml_Model_Extension_Collection_Abstract.

Definition at line 5 of file Collection.php.

00006     {
00007         // fetch installed packages
00008         $pear = Varien_Pear::getInstance();
00009 
00010         $channels = Mage::getModel('adminhtml/extension')->getKnownChannels();
00011         $channelData = array();
00012         foreach ($channels as $channel=>$name) {
00013             $data = array();
00014             if (Mage::app()->useCache('pear')) {
00015                 $channelKey = 'PEAR_channel_packages_'.preg_replace('#[^a-z0-9]+#', '_', $channel);
00016                 $data = unserialize(Mage::app()->loadCache($channelKey));
00017             }
00018             if (empty($data)) {
00019                 $pear->getFrontend()->clear();
00020                 $pear->run('list-all', array('channel'=>$channel));
00021                 $output = $pear->getOutput();
00022                 if (empty($output)) {
00023                     continue;
00024                 }
00025                 $data = $output[0]['output'];
00026                 if (Mage::app()->useCache('pear')) {
00027                     Mage::app()->saveCache(serialize($data), $channelKey, array('pear'), 3600);
00028                 }
00029             }
00030             $channelData[$channel] = $data;
00031         }
00032 
00033         // load available packages into array
00034         $packages = array();
00035         foreach ($channelData as $channel) {
00036             if (!isset($channel['headline'])) {
00037                 continue;
00038             }
00039             if (!empty($channel['data'])) {
00040                 foreach ($channel['data'] as $category=>$pkglist) {
00041                     foreach ($pkglist as $pkg) {
00042                         $pkgNameArr = explode('/', $pkg[0]);
00043                         $pkgName = isset($pkgNameArr[1]) ? $pkgNameArr[1] : $pkgNameArr[0];
00044                         $packages[] = array(
00045                             'id'=>$channel['channel'].'|'.$pkgName,
00046                             'category'=>$category,
00047                             'channel'=>$channel['channel'],
00048                             'name'=>$pkgName,
00049                             'remote_version'=>isset($pkg[1]) ? $pkg[1] : '',
00050                             'local_version'=>isset($pkg[2]) ? $pkg[2] : '',
00051                             'summary'=>isset($pkg[3]) ? $pkg[3] : '',
00052                         );
00053                     }
00054                 }
00055             }
00056         }
00057 
00058         return $packages;
00059     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:12 2009 for Magento by  doxygen 1.5.8