Skip to content

Commit

Permalink
Removed last bits of Mage_Backup
Browse files Browse the repository at this point in the history
  • Loading branch information
fballiano committed Sep 15, 2024
1 parent 98c7f5f commit 1f3aadf
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 60 deletions.
5 changes: 0 additions & 5 deletions .phpstan.baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -640,11 +640,6 @@ parameters:
count: 1
path: app/code/core/Mage/Adminhtml/controllers/System/CurrencyController.php

-
message: "#^Method Mage_Adminhtml_System_StoreController\\:\\:_backupDatabase\\(\\) should return \\$this\\(Mage_Adminhtml_System_StoreController\\) but empty return statement found\\.$#"
count: 2
path: app/code/core/Mage/Adminhtml/controllers/System/StoreController.php

-
message: "#^Variable \\$codeBase might not be defined\\.$#"
count: 1
Expand Down
10 changes: 3 additions & 7 deletions app/code/core/Mage/Adminhtml/Block/System/Store/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,24 @@ class Mage_Adminhtml_Block_System_Store_Edit extends Mage_Adminhtml_Block_Widget
{
public function __construct()
{
$backupAvailable =
Mage::getSingleton('admin/session')->isAllowed('system/tools/backup')
&& Mage::helper('core')->isModuleEnabled('Mage_Backup')
&& !Mage::getStoreConfigFlag('advanced/modules_disable_output/Mage_Backup');
switch (Mage::registry('store_type')) {
case 'website':
$this->_objectId = 'website_id';
$saveLabel = Mage::helper('core')->__('Save Website');
$deleteLabel = Mage::helper('core')->__('Delete Website');
$deleteUrl = $this->_getDeleteUrl(Mage::registry('store_type'), $backupAvailable);
$deleteUrl = $this->_getDeleteUrl(Mage::registry('store_type'));
break;
case 'group':
$this->_objectId = 'group_id';
$saveLabel = Mage::helper('core')->__('Save Store');
$deleteLabel = Mage::helper('core')->__('Delete Store');
$deleteUrl = $this->_getDeleteUrl(Mage::registry('store_type'), $backupAvailable);
$deleteUrl = $this->_getDeleteUrl(Mage::registry('store_type'));
break;
case 'store':
$this->_objectId = 'store_id';
$saveLabel = Mage::helper('core')->__('Save Store View');
$deleteLabel = Mage::helper('core')->__('Delete Store View');
$deleteUrl = $this->_getDeleteUrl(Mage::registry('store_type'), $backupAvailable);
$deleteUrl = $this->_getDeleteUrl(Mage::registry('store_type'));
break;
}
$this->_controller = 'system_store';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,6 @@ public function deleteWebsitePostAction()
return ;
}

$this->_backupDatabase('*/*/editWebsite', ['website_id' => $itemId]);

try {
$model->delete();
$this->_getSession()->addSuccess(Mage::helper('core')->__('The website has been deleted.'));
Expand Down Expand Up @@ -383,8 +381,6 @@ public function deleteGroupPostAction()
return ;
}

$this->_backupDatabase('*/*/editGroup', ['group_id' => $itemId]);

try {
$model->delete();
$this->_getSession()->addSuccess(Mage::helper('core')->__('The store has been deleted.'));
Expand Down Expand Up @@ -417,8 +413,6 @@ public function deleteStorePostAction()
return ;
}

$this->_backupDatabase('*/*/editStore', ['store_id' => $itemId]);

try {
$model->delete();

Expand All @@ -435,46 +429,6 @@ public function deleteStorePostAction()
$this->_redirect('*/*/editStore', ['store_id' => $itemId]);
}

/**
* Backup database
*
* @param string $failPath redirect path if backup failed
* @param array $arguments
* @return $this
*/
protected function _backupDatabase($failPath, $arguments = [])
{
if (!class_exists('Mage_Backup_Model_Backup')
|| !class_exists('Mage_Backup_Model_Db')
|| !class_exists('Mage_Backup_Helper_Data')
) {
return $this;
}

if (!$this->getRequest()->getParam('create_backup')) {
return $this;
}
try {
$backupDb = Mage::getModel('backup/db');
$backup = Mage::getModel('backup/backup')
->setTime(time())
->setType('db')
->setPath(Mage::getBaseDir('var') . DS . 'backups');

$backupDb->createBackup($backup);
$this->_getSession()->addSuccess(Mage::helper('backup')->__('Database was successfuly backed up.'));
} catch (Mage_Core_Exception $e) {
$this->_getSession()->addError($e->getMessage());
$this->_redirect($failPath, $arguments);
return ;
} catch (Exception $e) {
$this->_getSession()->addException($e, Mage::helper('backup')->__('Unable to create backup. Please, try again later.'));
$this->_redirect($failPath, $arguments);
return ;
}
return $this;
}

/**
* Add notification on deleting store / store view / website
*
Expand Down
1 change: 0 additions & 1 deletion app/code/core/Mage/Core/Model/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ class Mage_Core_Model_Config extends Mage_Core_Model_Config_Base
'Mage_SalesRule' => 23,
'Mage_Usa' => 24,
'Mage_Paygate' => 25,
'Mage_Backup' => 26, # removed
'Mage_Checkout' => 27,
'Mage_Paypal' => 28,
'Mage_GoogleCheckout' => 29,
Expand Down
1 change: 0 additions & 1 deletion lib/MahoCLI/Commands/LegacyRenameMysql4Classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
'Mage_Api_Model_Mysql4_Rules_Collection' => 'Mage_Api_Model_Resource_Rules_Collection',
'Mage_Api_Model_Mysql4_User' => 'Mage_Api_Model_Resource_User',
'Mage_Api_Model_Mysql4_User_Collection' => 'Mage_Api_Model_Resource_User_Collection',
'Mage_Backup_Model_Mysql4_Db' => 'Mage_Backup_Model_Resource_Db',
'Mage_Bundle_Model_Mysql4_Bundle' => 'Mage_Bundle_Model_Resource_Bundle',
'Mage_Bundle_Model_Mysql4_Indexer_Price' => 'Mage_Bundle_Model_Resource_Indexer_Price',
'Mage_Bundle_Model_Mysql4_Indexer_Stock' => 'Mage_Bundle_Model_Resource_Indexer_Stock',
Expand Down

0 comments on commit 1f3aadf

Please sign in to comment.