Mage_Adminhtml_Extensions_FileController Class Reference

Inheritance diagram for Mage_Adminhtml_Extensions_FileController:

Mage_Adminhtml_Controller_Action Mage_Core_Controller_Varien_Action

List of all members.

Public Member Functions

 indexAction ()
 installAction ()
 upgradeAllAction ()

Protected Member Functions

 _isAllowed ()


Detailed Description

Definition at line 35 of file FileController.php.


Member Function Documentation

_isAllowed (  )  [protected]

Reimplemented from Mage_Adminhtml_Controller_Action.

Definition at line 101 of file FileController.php.

00102     {
00103         return Mage::getSingleton('admin/session')->isAllowed('system/extensions');
00104     }

indexAction (  ) 

Definition at line 37 of file FileController.php.

00038     {
00039         $this->loadLayout();
00040 
00041         $this->_setActiveMenu('system/extensions');
00042 
00043         $this->_addContent($this->getLayout()->createBlock('adminhtml/extensions_file_form')->initForm());
00044 
00045         $this->renderLayout();
00046     }

installAction (  ) 

Definition at line 48 of file FileController.php.

00049     {
00050         $params = array('comment'=>Mage::helper('adminhtml')->__("Pending installation...")."\r\n\r\n");
00051         if ($this->getRequest()->getParam('do')) {
00052             switch ($this->getRequest()->getParam('file_type')) {
00053                 case 'local':
00054                     if (empty($_FILES['local']['tmp_name'])) {
00055                         $params['comment'] = Mage::helper('adminhtml')->__("Error uploading the file")."\r\n\r\n";
00056                         break;
00057                     }
00058                     $tmpDir = Mage::getBaseDir('var').DS.'pear';
00059                     if (!is_dir($tmpDir)) {
00060                         mkdir($tmpDir, 0777, true);
00061                     }
00062                     $pkg = $tmpDir.DS.$_FILES['local']['name'];
00063                     move_uploaded_file($_FILES['local']['tmp_name'], $pkg);
00064 
00065                     break;
00066 
00067                 case 'remote':
00068                     $pkg = $this->getRequest()->getParam('remote');
00069                     if (empty($pkg)) {
00070                         $params['comment'] = Mage::helper('adminhtml')->__("Invalid URL")."\r\n\r\n";
00071                     }
00072                     break;
00073             }
00074             if (!empty($pkg)) {
00075                 $params['comment'] = Mage::helper('adminhtml')->__("Installing $pkg, please wait...")."\r\n\r\n";
00076                 $params['command'] = 'install';
00077                 $params['options'] = array();
00078                 $params['params'] = array($pkg);
00079             }
00080         }
00081         $result = Varien_Pear::getInstance()->runHtmlConsole($params);
00082         if (!$result instanceof PEAR_Error) {
00083             Mage::getModel('adminhtml/extension')->clearAllCache();
00084         }
00085     }

upgradeAllAction (  ) 

Definition at line 87 of file FileController.php.

00088     {
00089         $params = array('comment'=>Mage::helper('adminhtml')->__("Upgrading all packages, please wait...")."\r\n\r\n");
00090         if ($this->getRequest()->getParam('do')) {
00091             $params['command'] = 'upgrade';
00092             $params['options'] = array();
00093             $params['params'] = array($pkg);
00094         }
00095         $result = Varien_Pear::getInstance()->runHtmlConsole($params);
00096         if (!$result instanceof PEAR_Error) {
00097             Mage::app()->cleanCache();
00098         }
00099     }


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