Mage_Adminhtml_System_BackupController Class Reference

Inheritance diagram for Mage_Adminhtml_System_BackupController:

Mage_Adminhtml_Controller_Action Mage_Core_Controller_Varien_Action

List of all members.

Public Member Functions

 indexAction ()
 gridAction ()
 createAction ()
 downloadAction ()
 deleteAction ()

Protected Member Functions

 _isAllowed ()
 _getSession ()


Detailed Description

Definition at line 34 of file BackupController.php.


Member Function Documentation

_getSession (  )  [protected]

Retrive adminhtml session model

Returns:
Mage_Adminhtml_Model_Session

Reimplemented from Mage_Adminhtml_Controller_Action.

Definition at line 143 of file BackupController.php.

00144     {
00145         return Mage::getSingleton('adminhtml/session');
00146     }

_isAllowed (  )  [protected]

Reimplemented from Mage_Adminhtml_Controller_Action.

Definition at line 133 of file BackupController.php.

00134     {
00135         return Mage::getSingleton('admin/session')->isAllowed('system/tools/backup');
00136     }

createAction (  ) 

Create backup action

Definition at line 68 of file BackupController.php.

00069     {
00070         try {
00071             $backupDb = Mage::getModel('backup/db');
00072             $backup   = Mage::getModel('backup/backup')
00073                 ->setTime(time())
00074                 ->setType('db')
00075                 ->setPath(Mage::getBaseDir("var") . DS . "backups");
00076 
00077             $backupDb->createBackup($backup);
00078             $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__('Backup successfully created'));
00079         }
00080         catch (Exception  $e) {
00081             $this->_getSession()->addException($e, Mage::helper('adminhtml')->__('Error while create backup. Please try again later'));
00082         }
00083         $this->_redirect('*/*');
00084     }

deleteAction (  ) 

Delete backup action

Definition at line 114 of file BackupController.php.

00115     {
00116         try {
00117             $backup = Mage::getModel('backup/backup')
00118                 ->setTime((int)$this->getRequest()->getParam('time'))
00119                 ->setType($this->getRequest()->getParam('type'))
00120                 ->setPath(Mage::getBaseDir("var") . DS . "backups")
00121                 ->deleteFile();
00122 
00123             $this->_getSession()->addSuccess(Mage::helper('adminhtml')->__('Backup record was deleted'));
00124         }
00125         catch (Exception $e) {
00126                 // Nothing
00127         }
00128 
00129         $this->_redirect('*/*/');
00130 
00131     }

downloadAction (  ) 

Download backup action

Definition at line 89 of file BackupController.php.

00090     {
00091         $backup = Mage::getModel('backup/backup')
00092             ->setTime((int)$this->getRequest()->getParam('time'))
00093             ->setType($this->getRequest()->getParam('type'))
00094             ->setPath(Mage::getBaseDir("var") . DS . "backups");
00095         /* @var $backup Mage_Backup_Model_Backup */
00096 
00097         if (!$backup->exists()) {
00098             $this->_redirect('*/*');
00099         }
00100 
00101         $fileName = 'backup-' . date('YmdHis', $backup->getTime()) . '.sql.gz';
00102 
00103         $this->_prepareDownloadResponse($fileName, null, 'application/octet-stream', $backup->getSize());
00104 
00105         $this->getResponse()->sendHeaders();
00106 
00107         $backup->output();
00108         exit();
00109     }

gridAction (  ) 

Backup list action

Definition at line 60 of file BackupController.php.

00061     {
00062         $this->getResponse()->setBody($this->getLayout()->createBlock('adminhtml/backup_grid')->toHtml());
00063     }

indexAction (  ) 

Backup list action

Definition at line 39 of file BackupController.php.

00040     {
00041         if($this->getRequest()->getParam('ajax')) {
00042             $this->_forward('grid');
00043             return;
00044         }
00045 
00046         $this->loadLayout();
00047         $this->_setActiveMenu('system');
00048         $this->_addBreadcrumb(Mage::helper('adminhtml')->__('System'), Mage::helper('adminhtml')->__('System'));
00049         $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Tools'), Mage::helper('adminhtml')->__('Tools'));
00050         $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Backups'), Mage::helper('adminhtml')->__('Backup'));
00051 
00052         $this->_addContent($this->getLayout()->createBlock('adminhtml/backup', 'backup'));
00053 
00054         $this->renderLayout();
00055     }


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

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