diff --git a/.phpstorm.meta.php/magento_blocks.meta.php b/.phpstorm.meta.php/magento_blocks.meta.php index e4d9439c59c..f30464e92a9 100644 --- a/.phpstorm.meta.php/magento_blocks.meta.php +++ b/.phpstorm.meta.php/magento_blocks.meta.php @@ -22,9 +22,6 @@ 'adminhtml/api_user_edit_tabs' => \Mage_Adminhtml_Block_Api_User_Edit_Tabs::class, 'adminhtml/api_user_grid' => \Mage_Adminhtml_Block_Api_User_Grid::class, 'adminhtml/api_users' => \Mage_Adminhtml_Block_Api_Users::class, - 'adminhtml/backup' => \Mage_Adminhtml_Block_Backup::class, - 'adminhtml/backup_dialogs' => \Mage_Adminhtml_Block_Backup_Dialogs::class, - 'adminhtml/backup_grid' => \Mage_Adminhtml_Block_Backup_Grid::class, 'adminhtml/cache' => \Mage_Adminhtml_Block_Cache::class, 'adminhtml/cache_additional' => \Mage_Adminhtml_Block_Cache_Additional::class, 'adminhtml/cache_grid' => \Mage_Adminhtml_Block_Cache_Grid::class, diff --git a/.phpstorm.meta.php/magento_blocks_methods.meta.php b/.phpstorm.meta.php/magento_blocks_methods.meta.php index 5770efa0083..33913668d9d 100644 --- a/.phpstorm.meta.php/magento_blocks_methods.meta.php +++ b/.phpstorm.meta.php/magento_blocks_methods.meta.php @@ -22,9 +22,6 @@ 'adminhtml/api_user_edit_tabs' => \Mage_Adminhtml_Block_Api_User_Edit_Tabs::class, 'adminhtml/api_user_grid' => \Mage_Adminhtml_Block_Api_User_Grid::class, 'adminhtml/api_users' => \Mage_Adminhtml_Block_Api_Users::class, - 'adminhtml/backup' => \Mage_Adminhtml_Block_Backup::class, - 'adminhtml/backup_dialogs' => \Mage_Adminhtml_Block_Backup_Dialogs::class, - 'adminhtml/backup_grid' => \Mage_Adminhtml_Block_Backup_Grid::class, 'adminhtml/cache' => \Mage_Adminhtml_Block_Cache::class, 'adminhtml/cache_additional' => \Mage_Adminhtml_Block_Cache_Additional::class, 'adminhtml/cache_grid' => \Mage_Adminhtml_Block_Cache_Grid::class, diff --git a/.phpstorm.meta.php/magento_helpers.meta.php b/.phpstorm.meta.php/magento_helpers.meta.php index 0ccbf726e21..ffbe30c6cbc 100644 --- a/.phpstorm.meta.php/magento_helpers.meta.php +++ b/.phpstorm.meta.php/magento_helpers.meta.php @@ -30,8 +30,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, diff --git a/.phpstorm.meta.php/magento_helpers_methods.meta.php b/.phpstorm.meta.php/magento_helpers_methods.meta.php index 05fa4212d53..3981aa517d1 100644 --- a/.phpstorm.meta.php/magento_helpers_methods.meta.php +++ b/.phpstorm.meta.php/magento_helpers_methods.meta.php @@ -30,8 +30,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, @@ -223,8 +221,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, @@ -416,8 +412,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, @@ -609,8 +603,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, @@ -802,8 +794,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, @@ -995,8 +985,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, @@ -1188,8 +1176,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, @@ -1381,8 +1367,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, @@ -1574,8 +1558,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, @@ -1767,8 +1749,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, @@ -1960,8 +1940,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, @@ -2153,8 +2131,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, @@ -2346,8 +2322,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, @@ -2539,8 +2513,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, @@ -2732,8 +2704,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, @@ -2925,8 +2895,6 @@ 'authorizenet/admin' => \Mage_Authorizenet_Helper_Admin::class, 'authorizenet' => \Mage_Authorizenet_Helper_Data::class, 'authorizenet/data' => \Mage_Authorizenet_Helper_Data::class, - 'backup' => \Mage_Backup_Helper_Data::class, - 'backup/data' => \Mage_Backup_Helper_Data::class, 'bundle/catalog_product_configuration' => \Mage_Bundle_Helper_Catalog_Product_Configuration::class, 'bundle' => \Mage_Bundle_Helper_Data::class, 'bundle/data' => \Mage_Bundle_Helper_Data::class, diff --git a/.phpstorm.meta.php/magento_models.meta.php b/.phpstorm.meta.php/magento_models.meta.php index 1c6a2e33db0..09d93d6ab5f 100644 --- a/.phpstorm.meta.php/magento_models.meta.php +++ b/.phpstorm.meta.php/magento_models.meta.php @@ -366,15 +366,6 @@ 'authorizenet/directpost_request' => \Mage_Authorizenet_Model_Directpost_Request::class, 'authorizenet/directpost_response' => \Mage_Authorizenet_Model_Directpost_Response::class, 'authorizenet/directpost_session' => \Mage_Authorizenet_Model_Directpost_Session::class, - 'backup/backup' => \Mage_Backup_Model_Backup::class, - 'backup/config_backend_cron' => \Mage_Backup_Model_Config_Backend_Cron::class, - 'backup/config_source_type' => \Mage_Backup_Model_Config_Source_Type::class, - 'backup/db' => \Mage_Backup_Model_Db::class, - 'backup/fs_collection' => \Mage_Backup_Model_Fs_Collection::class, - 'backup/mysql4_db' => \Mage_Backup_Model_Mysql4_Db::class, - 'backup/observer' => \Mage_Backup_Model_Observer::class, - 'backup/resource_db' => \Mage_Backup_Model_Resource_Db::class, - 'backup/resource_helper_mysql4' => \Mage_Backup_Model_Resource_Helper_Mysql4::class, 'bundle/catalogIndex_data_bundle' => \Mage_Bundle_Model_CatalogIndex_Data_Bundle::class, 'bundle/mysql4_bundle' => \Mage_Bundle_Model_Mysql4_Bundle::class, 'bundle/mysql4_indexer_price' => \Mage_Bundle_Model_Mysql4_Indexer_Price::class, @@ -3550,15 +3541,6 @@ 'authorizenet/directpost_request' => \Mage_Authorizenet_Model_Directpost_Request::class, 'authorizenet/directpost_response' => \Mage_Authorizenet_Model_Directpost_Response::class, 'authorizenet/directpost_session' => \Mage_Authorizenet_Model_Directpost_Session::class, - 'backup/backup' => \Mage_Backup_Model_Backup::class, - 'backup/config_backend_cron' => \Mage_Backup_Model_Config_Backend_Cron::class, - 'backup/config_source_type' => \Mage_Backup_Model_Config_Source_Type::class, - 'backup/db' => \Mage_Backup_Model_Db::class, - 'backup/fs_collection' => \Mage_Backup_Model_Fs_Collection::class, - 'backup/mysql4_db' => \Mage_Backup_Model_Mysql4_Db::class, - 'backup/observer' => \Mage_Backup_Model_Observer::class, - 'backup/resource_db' => \Mage_Backup_Model_Resource_Db::class, - 'backup/resource_helper_mysql4' => \Mage_Backup_Model_Resource_Helper_Mysql4::class, 'bundle/catalogIndex_data_bundle' => \Mage_Bundle_Model_CatalogIndex_Data_Bundle::class, 'bundle/mysql4_bundle' => \Mage_Bundle_Model_Mysql4_Bundle::class, 'bundle/mysql4_indexer_price' => \Mage_Bundle_Model_Mysql4_Indexer_Price::class, diff --git a/.phpstorm.meta.php/magento_models_methods.meta.php b/.phpstorm.meta.php/magento_models_methods.meta.php index cc6d607fb0e..a623b67ad9e 100644 --- a/.phpstorm.meta.php/magento_models_methods.meta.php +++ b/.phpstorm.meta.php/magento_models_methods.meta.php @@ -366,15 +366,6 @@ 'authorizenet/directpost_request' => \Mage_Authorizenet_Model_Directpost_Request::class, 'authorizenet/directpost_response' => \Mage_Authorizenet_Model_Directpost_Response::class, 'authorizenet/directpost_session' => \Mage_Authorizenet_Model_Directpost_Session::class, - 'backup/backup' => \Mage_Backup_Model_Backup::class, - 'backup/config_backend_cron' => \Mage_Backup_Model_Config_Backend_Cron::class, - 'backup/config_source_type' => \Mage_Backup_Model_Config_Source_Type::class, - 'backup/db' => \Mage_Backup_Model_Db::class, - 'backup/fs_collection' => \Mage_Backup_Model_Fs_Collection::class, - 'backup/mysql4_db' => \Mage_Backup_Model_Mysql4_Db::class, - 'backup/observer' => \Mage_Backup_Model_Observer::class, - 'backup/resource_db' => \Mage_Backup_Model_Resource_Db::class, - 'backup/resource_helper_mysql4' => \Mage_Backup_Model_Resource_Helper_Mysql4::class, 'bundle/catalogIndex_data_bundle' => \Mage_Bundle_Model_CatalogIndex_Data_Bundle::class, 'bundle/mysql4_bundle' => \Mage_Bundle_Model_Mysql4_Bundle::class, 'bundle/mysql4_indexer_price' => \Mage_Bundle_Model_Mysql4_Indexer_Price::class, @@ -3550,15 +3541,6 @@ 'authorizenet/directpost_request' => \Mage_Authorizenet_Model_Directpost_Request::class, 'authorizenet/directpost_response' => \Mage_Authorizenet_Model_Directpost_Response::class, 'authorizenet/directpost_session' => \Mage_Authorizenet_Model_Directpost_Session::class, - 'backup/backup' => \Mage_Backup_Model_Backup::class, - 'backup/config_backend_cron' => \Mage_Backup_Model_Config_Backend_Cron::class, - 'backup/config_source_type' => \Mage_Backup_Model_Config_Source_Type::class, - 'backup/db' => \Mage_Backup_Model_Db::class, - 'backup/fs_collection' => \Mage_Backup_Model_Fs_Collection::class, - 'backup/mysql4_db' => \Mage_Backup_Model_Mysql4_Db::class, - 'backup/observer' => \Mage_Backup_Model_Observer::class, - 'backup/resource_db' => \Mage_Backup_Model_Resource_Db::class, - 'backup/resource_helper_mysql4' => \Mage_Backup_Model_Resource_Helper_Mysql4::class, 'bundle/catalogIndex_data_bundle' => \Mage_Bundle_Model_CatalogIndex_Data_Bundle::class, 'bundle/mysql4_bundle' => \Mage_Bundle_Model_Mysql4_Bundle::class, 'bundle/mysql4_indexer_price' => \Mage_Bundle_Model_Mysql4_Indexer_Price::class, @@ -6734,15 +6716,6 @@ 'authorizenet/directpost_request' => \Mage_Authorizenet_Model_Directpost_Request::class, 'authorizenet/directpost_response' => \Mage_Authorizenet_Model_Directpost_Response::class, 'authorizenet/directpost_session' => \Mage_Authorizenet_Model_Directpost_Session::class, - 'backup/backup' => \Mage_Backup_Model_Backup::class, - 'backup/config_backend_cron' => \Mage_Backup_Model_Config_Backend_Cron::class, - 'backup/config_source_type' => \Mage_Backup_Model_Config_Source_Type::class, - 'backup/db' => \Mage_Backup_Model_Db::class, - 'backup/fs_collection' => \Mage_Backup_Model_Fs_Collection::class, - 'backup/mysql4_db' => \Mage_Backup_Model_Mysql4_Db::class, - 'backup/observer' => \Mage_Backup_Model_Observer::class, - 'backup/resource_db' => \Mage_Backup_Model_Resource_Db::class, - 'backup/resource_helper_mysql4' => \Mage_Backup_Model_Resource_Helper_Mysql4::class, 'bundle/catalogIndex_data_bundle' => \Mage_Bundle_Model_CatalogIndex_Data_Bundle::class, 'bundle/mysql4_bundle' => \Mage_Bundle_Model_Mysql4_Bundle::class, 'bundle/mysql4_indexer_price' => \Mage_Bundle_Model_Mysql4_Indexer_Price::class, @@ -9918,15 +9891,6 @@ 'authorizenet/directpost_request' => \Mage_Authorizenet_Model_Directpost_Request::class, 'authorizenet/directpost_response' => \Mage_Authorizenet_Model_Directpost_Response::class, 'authorizenet/directpost_session' => \Mage_Authorizenet_Model_Directpost_Session::class, - 'backup/backup' => \Mage_Backup_Model_Backup::class, - 'backup/config_backend_cron' => \Mage_Backup_Model_Config_Backend_Cron::class, - 'backup/config_source_type' => \Mage_Backup_Model_Config_Source_Type::class, - 'backup/db' => \Mage_Backup_Model_Db::class, - 'backup/fs_collection' => \Mage_Backup_Model_Fs_Collection::class, - 'backup/mysql4_db' => \Mage_Backup_Model_Mysql4_Db::class, - 'backup/observer' => \Mage_Backup_Model_Observer::class, - 'backup/resource_db' => \Mage_Backup_Model_Resource_Db::class, - 'backup/resource_helper_mysql4' => \Mage_Backup_Model_Resource_Helper_Mysql4::class, 'bundle/catalogIndex_data_bundle' => \Mage_Bundle_Model_CatalogIndex_Data_Bundle::class, 'bundle/mysql4_bundle' => \Mage_Bundle_Model_Mysql4_Bundle::class, 'bundle/mysql4_indexer_price' => \Mage_Bundle_Model_Mysql4_Indexer_Price::class, @@ -13102,15 +13066,6 @@ 'authorizenet/directpost_request' => \Mage_Authorizenet_Model_Directpost_Request::class, 'authorizenet/directpost_response' => \Mage_Authorizenet_Model_Directpost_Response::class, 'authorizenet/directpost_session' => \Mage_Authorizenet_Model_Directpost_Session::class, - 'backup/backup' => \Mage_Backup_Model_Backup::class, - 'backup/config_backend_cron' => \Mage_Backup_Model_Config_Backend_Cron::class, - 'backup/config_source_type' => \Mage_Backup_Model_Config_Source_Type::class, - 'backup/db' => \Mage_Backup_Model_Db::class, - 'backup/fs_collection' => \Mage_Backup_Model_Fs_Collection::class, - 'backup/mysql4_db' => \Mage_Backup_Model_Mysql4_Db::class, - 'backup/observer' => \Mage_Backup_Model_Observer::class, - 'backup/resource_db' => \Mage_Backup_Model_Resource_Db::class, - 'backup/resource_helper_mysql4' => \Mage_Backup_Model_Resource_Helper_Mysql4::class, 'bundle/catalogIndex_data_bundle' => \Mage_Bundle_Model_CatalogIndex_Data_Bundle::class, 'bundle/mysql4_bundle' => \Mage_Bundle_Model_Mysql4_Bundle::class, 'bundle/mysql4_indexer_price' => \Mage_Bundle_Model_Mysql4_Indexer_Price::class, @@ -16286,15 +16241,6 @@ 'authorizenet/directpost_request' => \Mage_Authorizenet_Model_Directpost_Request::class, 'authorizenet/directpost_response' => \Mage_Authorizenet_Model_Directpost_Response::class, 'authorizenet/directpost_session' => \Mage_Authorizenet_Model_Directpost_Session::class, - 'backup/backup' => \Mage_Backup_Model_Backup::class, - 'backup/config_backend_cron' => \Mage_Backup_Model_Config_Backend_Cron::class, - 'backup/config_source_type' => \Mage_Backup_Model_Config_Source_Type::class, - 'backup/db' => \Mage_Backup_Model_Db::class, - 'backup/fs_collection' => \Mage_Backup_Model_Fs_Collection::class, - 'backup/mysql4_db' => \Mage_Backup_Model_Mysql4_Db::class, - 'backup/observer' => \Mage_Backup_Model_Observer::class, - 'backup/resource_db' => \Mage_Backup_Model_Resource_Db::class, - 'backup/resource_helper_mysql4' => \Mage_Backup_Model_Resource_Helper_Mysql4::class, 'bundle/catalogIndex_data_bundle' => \Mage_Bundle_Model_CatalogIndex_Data_Bundle::class, 'bundle/mysql4_bundle' => \Mage_Bundle_Model_Mysql4_Bundle::class, 'bundle/mysql4_indexer_price' => \Mage_Bundle_Model_Mysql4_Indexer_Price::class, @@ -19470,15 +19416,6 @@ 'authorizenet/directpost_request' => \Mage_Authorizenet_Model_Directpost_Request::class, 'authorizenet/directpost_response' => \Mage_Authorizenet_Model_Directpost_Response::class, 'authorizenet/directpost_session' => \Mage_Authorizenet_Model_Directpost_Session::class, - 'backup/backup' => \Mage_Backup_Model_Backup::class, - 'backup/config_backend_cron' => \Mage_Backup_Model_Config_Backend_Cron::class, - 'backup/config_source_type' => \Mage_Backup_Model_Config_Source_Type::class, - 'backup/db' => \Mage_Backup_Model_Db::class, - 'backup/fs_collection' => \Mage_Backup_Model_Fs_Collection::class, - 'backup/mysql4_db' => \Mage_Backup_Model_Mysql4_Db::class, - 'backup/observer' => \Mage_Backup_Model_Observer::class, - 'backup/resource_db' => \Mage_Backup_Model_Resource_Db::class, - 'backup/resource_helper_mysql4' => \Mage_Backup_Model_Resource_Helper_Mysql4::class, 'bundle/catalogIndex_data_bundle' => \Mage_Bundle_Model_CatalogIndex_Data_Bundle::class, 'bundle/mysql4_bundle' => \Mage_Bundle_Model_Mysql4_Bundle::class, 'bundle/mysql4_indexer_price' => \Mage_Bundle_Model_Mysql4_Indexer_Price::class, @@ -22654,15 +22591,6 @@ 'authorizenet/directpost_request' => \Mage_Authorizenet_Model_Directpost_Request::class, 'authorizenet/directpost_response' => \Mage_Authorizenet_Model_Directpost_Response::class, 'authorizenet/directpost_session' => \Mage_Authorizenet_Model_Directpost_Session::class, - 'backup/backup' => \Mage_Backup_Model_Backup::class, - 'backup/config_backend_cron' => \Mage_Backup_Model_Config_Backend_Cron::class, - 'backup/config_source_type' => \Mage_Backup_Model_Config_Source_Type::class, - 'backup/db' => \Mage_Backup_Model_Db::class, - 'backup/fs_collection' => \Mage_Backup_Model_Fs_Collection::class, - 'backup/mysql4_db' => \Mage_Backup_Model_Mysql4_Db::class, - 'backup/observer' => \Mage_Backup_Model_Observer::class, - 'backup/resource_db' => \Mage_Backup_Model_Resource_Db::class, - 'backup/resource_helper_mysql4' => \Mage_Backup_Model_Resource_Helper_Mysql4::class, 'bundle/catalogIndex_data_bundle' => \Mage_Bundle_Model_CatalogIndex_Data_Bundle::class, 'bundle/mysql4_bundle' => \Mage_Bundle_Model_Mysql4_Bundle::class, 'bundle/mysql4_indexer_price' => \Mage_Bundle_Model_Mysql4_Indexer_Price::class, @@ -25838,15 +25766,6 @@ 'authorizenet/directpost_request' => \Mage_Authorizenet_Model_Directpost_Request::class, 'authorizenet/directpost_response' => \Mage_Authorizenet_Model_Directpost_Response::class, 'authorizenet/directpost_session' => \Mage_Authorizenet_Model_Directpost_Session::class, - 'backup/backup' => \Mage_Backup_Model_Backup::class, - 'backup/config_backend_cron' => \Mage_Backup_Model_Config_Backend_Cron::class, - 'backup/config_source_type' => \Mage_Backup_Model_Config_Source_Type::class, - 'backup/db' => \Mage_Backup_Model_Db::class, - 'backup/fs_collection' => \Mage_Backup_Model_Fs_Collection::class, - 'backup/mysql4_db' => \Mage_Backup_Model_Mysql4_Db::class, - 'backup/observer' => \Mage_Backup_Model_Observer::class, - 'backup/resource_db' => \Mage_Backup_Model_Resource_Db::class, - 'backup/resource_helper_mysql4' => \Mage_Backup_Model_Resource_Helper_Mysql4::class, 'bundle/catalogIndex_data_bundle' => \Mage_Bundle_Model_CatalogIndex_Data_Bundle::class, 'bundle/mysql4_bundle' => \Mage_Bundle_Model_Mysql4_Bundle::class, 'bundle/mysql4_indexer_price' => \Mage_Bundle_Model_Mysql4_Indexer_Price::class, diff --git a/README.md b/README.md index 206892f3cfa..121c73f37c3 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,7 @@ Most important changes will be listed here, all other changes since `19.4.0` can - search for "NULL" in backend grids [#1203](https://github.com/OpenMage/magento-lts/pull/1203) - removed lib/flex containing unused ActionScript "file uploader" files [#2271](https://github.com/OpenMage/magento-lts/pull/2271) - removed modules: + - `Mage_Backup` [#2811](https://github.com/OpenMage/magento-lts/pull/2811) - `Mage_Compiler` - `Mage_GoogleBase` - `Mage_PageCache` [#2258](https://github.com/OpenMage/magento-lts/pull/2258) @@ -106,6 +107,7 @@ Most important changes will be listed here, all other changes since `19.4.0` can - `Phoenix_Moneybookers` _If you rely on those modules you can reinstall them with composer:_ +- `Mage_Backup`: `composer require openmage/module-mage-backup` - `Mage_PageCache`: `composer require openmage/module-mage-pagecache` ### Between OpenMage 19.4.18 / 20.0.16 and 19.4.19 / 20.0.17 diff --git a/app/code/core/Mage/Adminhtml/Block/Backup.php b/app/code/core/Mage/Adminhtml/Block/Backup.php deleted file mode 100644 index 9388c1bdeb4..00000000000 --- a/app/code/core/Mage/Adminhtml/Block/Backup.php +++ /dev/null @@ -1,116 +0,0 @@ - - */ -class Mage_Adminhtml_Block_Backup extends Mage_Adminhtml_Block_Template -{ - /** - * Block's template - * - * @var string - */ - protected $_template = 'backup/list.phtml'; - - protected function _prepareLayout() - { - parent::_prepareLayout(); - $this->setChild( - 'createButton', - $this->getLayout()->createBlock('adminhtml/widget_button') - ->setData([ - 'label' => Mage::helper('backup')->__('Database Backup'), - 'onclick' => "return backup.backup('" . Mage_Backup_Helper_Data::TYPE_DB . "')", - 'class' => 'task' - ]) - ); - $this->setChild( - 'createSnapshotButton', - $this->getLayout()->createBlock('adminhtml/widget_button') - ->setData([ - 'label' => Mage::helper('backup')->__('System Backup'), - 'onclick' => "return backup.backup('" . Mage_Backup_Helper_Data::TYPE_SYSTEM_SNAPSHOT . "')", - 'class' => '' - ]) - ); - $this->setChild( - 'createMediaBackupButton', - $this->getLayout()->createBlock('adminhtml/widget_button') - ->setData([ - 'label' => Mage::helper('backup')->__('Database and Media Backup'), - 'onclick' => "return backup.backup('" . Mage_Backup_Helper_Data::TYPE_MEDIA . "')", - 'class' => '' - ]) - ); - $this->setChild( - 'backupsGrid', - $this->getLayout()->createBlock('adminhtml/backup_grid') - ); - - $this->setChild('dialogs', $this->getLayout()->createBlock('adminhtml/backup_dialogs')); - return $this; - } - - public function getCreateButtonHtml() - { - return $this->getChildHtml('createButton'); - } - - /** - * Generate html code for "Create System Snapshot" button - * - * @return string - */ - public function getCreateSnapshotButtonHtml() - { - return $this->getChildHtml('createSnapshotButton'); - } - - /** - * Generate html code for "Create Media Backup" button - * - * @return string - */ - public function getCreateMediaBackupButtonHtml() - { - return $this->getChildHtml('createMediaBackupButton'); - } - - public function getGridHtml() - { - return $this->getChildHtml('backupsGrid'); - } - - /** - * Generate html code for pop-up messages that will appear when user click on "Rollback" link - * - * @return string - */ - public function getDialogsHtml() - { - return $this->getChildHtml('dialogs'); - } -} diff --git a/app/code/core/Mage/Adminhtml/Block/Backup/Dialogs.php b/app/code/core/Mage/Adminhtml/Block/Backup/Dialogs.php deleted file mode 100644 index 4fe84915bd5..00000000000 --- a/app/code/core/Mage/Adminhtml/Block/Backup/Dialogs.php +++ /dev/null @@ -1,50 +0,0 @@ - - */ -class Mage_Adminhtml_Block_Backup_Dialogs extends Mage_Adminhtml_Block_Template -{ - /** - * Block's template - * - * @var string - */ - protected $_template = 'backup/dialogs.phtml'; - - /** - * Include backup.js file in page before rendering - * - * @inheritDoc - */ - protected function _prepareLayout() - { - /** @var Mage_Page_Block_Html_Head $block */ - $block = $this->getLayout()->getBlock('head'); - $block->addJs('mage/adminhtml/backup.js'); - return parent::_prepareLayout(); - } -} diff --git a/app/code/core/Mage/Adminhtml/Block/Backup/Grid.php b/app/code/core/Mage/Adminhtml/Block/Backup/Grid.php deleted file mode 100644 index 7ae2e11a4da..00000000000 --- a/app/code/core/Mage/Adminhtml/Block/Backup/Grid.php +++ /dev/null @@ -1,137 +0,0 @@ - - */ -class Mage_Adminhtml_Block_Backup_Grid extends Mage_Adminhtml_Block_Widget_Grid -{ - protected function _construct() - { - $this->setSaveParametersInSession(true); - $this->setId('backupsGrid'); - $this->setDefaultSort('time'); - $this->setDefaultDir('desc'); - } - - /** - * @inheritDoc - */ - protected function _prepareCollection() - { - $collection = Mage::getSingleton('backup/fs_collection'); - $this->setCollection($collection); - return parent::_prepareCollection(); - } - - /** - * Prepare mass action controls - * - * @return $this - */ - protected function _prepareMassaction() - { - $this->setMassactionIdField('id'); - $this->getMassactionBlock()->setFormFieldName('ids'); - - $this->getMassactionBlock()->addItem(MassAction::DELETE, [ - 'label' => Mage::helper('adminhtml')->__('Delete'), - 'url' => $this->getUrl('*/*/massDelete'), - 'confirm' => Mage::helper('backup')->__('Are you sure you want to delete the selected backup(s)?') - ]); - - return $this; - } - - /** - * Configuration of grid - * - * @return $this - * @throws Exception - */ - protected function _prepareColumns() - { - $url7zip = Mage::helper('adminhtml')->__('The archive can be uncompressed with %s on Windows systems', 'http://www.7-zip.org/', '7-Zip'); - - $this->addColumn('time', [ - 'header' => Mage::helper('backup')->__('Time'), - 'index' => 'date_object', - 'type' => 'datetime', - ]); - - $this->addColumn('display_name', [ - 'header' => Mage::helper('backup')->__('Name'), - 'index' => 'display_name', - 'filter' => false, - 'sortable' => true, - 'width' => 350 - ]); - - $this->addColumn('size', [ - 'header' => Mage::helper('backup')->__('Size, Bytes'), - 'index' => 'size', - 'type' => 'number', - 'sortable' => true, - 'filter' => false - ]); - - $this->addColumn('type', [ - 'header' => Mage::helper('backup')->__('Type'), - 'type' => 'options', - 'options' => Mage::helper('backup')->getBackupTypes(), - 'index' => 'type', - 'width' => 300 - ]); - - $this->addColumn('download', [ - 'header' => Mage::helper('backup')->__('Download'), - 'format' => '$extension   (' . $url7zip . ')', - 'index' => 'type', - 'sortable' => false, - 'filter' => false - ]); - - if (Mage::helper('backup')->isRollbackAllowed()) { - $this->addColumn('action', [ - 'header' => Mage::helper('backup')->__('Action'), - 'type' => 'action', - 'width' => '80px', - 'filter' => false, - 'actions' => [[ - 'url' => '#', - 'caption' => Mage::helper('backup')->__('Rollback'), - 'onclick' => 'return backup.rollback(\'$type\', \'$time\');' - ]], - 'index' => 'type', - 'sortable' => false - ]); - } - - return $this; - } -} diff --git a/app/code/core/Mage/Adminhtml/controllers/System/BackupController.php b/app/code/core/Mage/Adminhtml/controllers/System/BackupController.php deleted file mode 100644 index 7bd6656e22f..00000000000 --- a/app/code/core/Mage/Adminhtml/controllers/System/BackupController.php +++ /dev/null @@ -1,377 +0,0 @@ - - */ -class Mage_Adminhtml_System_BackupController extends Mage_Adminhtml_Controller_Action -{ - /** - * Controller pre-dispatch method - * - * @return Mage_Adminhtml_Controller_Action - */ - public function preDispatch() - { - $this->_setForcedFormKeyActions(['create', 'massDelete']); - return parent::preDispatch(); - } - - /** - * Backup list action - */ - public function indexAction() - { - $this->_title($this->__('System'))->_title($this->__('Tools'))->_title($this->__('Backups')); - - if ($this->getRequest()->getParam('ajax')) { - $this->_forward('grid'); - return; - } - - $this->loadLayout(); - $this->_setActiveMenu('system'); - $this->_addBreadcrumb(Mage::helper('adminhtml')->__('System'), Mage::helper('adminhtml')->__('System')); - $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Tools'), Mage::helper('adminhtml')->__('Tools')); - $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Backups'), Mage::helper('adminhtml')->__('Backup')); - - $this->_addContent($this->getLayout()->createBlock('adminhtml/backup', 'backup')); - - $this->renderLayout(); - } - - /** - * Backup list action - */ - public function gridAction() - { - $this->getResponse()->setBody($this->getLayout()->createBlock('adminhtml/backup_grid')->toHtml()); - } - - /** - * Create backup action - * - * @return Mage_Adminhtml_Controller_Action - */ - public function createAction() - { - if (!$this->getRequest()->isAjax()) { - return $this->getUrl('*/*/index'); - } - - $response = new Varien_Object(); - - /** - * @var Mage_Backup_Helper_Data $helper - */ - $helper = Mage::helper('backup'); - - try { - $type = $this->getRequest()->getParam('type'); - - if ($type == Mage_Backup_Helper_Data::TYPE_SYSTEM_SNAPSHOT - && $this->getRequest()->getParam('exclude_media') - ) { - $type = Mage_Backup_Helper_Data::TYPE_SNAPSHOT_WITHOUT_MEDIA; - } - - $backupManager = Mage_Backup::getBackupInstance($type) - ->setBackupExtension($helper->getExtensionByType($type)) - ->setTime(time()) - ->setBackupsDir($helper->getBackupsDir()); - - $backupManager->setName($this->getRequest()->getParam('backup_name')); - - Mage::register('backup_manager', $backupManager); - - if ($this->getRequest()->getParam('maintenance_mode')) { - $turnedOn = $helper->turnOnMaintenanceMode(); - - if (!$turnedOn) { - $response->setError( - Mage::helper('backup')->__('You do not have sufficient permissions to enable Maintenance Mode during this operation.') - . ' ' . Mage::helper('backup')->__('Please either unselect the "Put store on the maintenance mode" checkbox or update your permissions to proceed with the backup."') - ); - $backupManager->setErrorMessage(Mage::helper('backup')->__("System couldn't put store on the maintenance mode")); - return $this->getResponse()->setBody($response->toJson()); - } - } - - if ($type != Mage_Backup_Helper_Data::TYPE_DB) { - $backupManager->setRootDir(Mage::getBaseDir()) - ->addIgnorePaths($helper->getBackupIgnorePaths()); - } - - $successMessage = $helper->getCreateSuccessMessageByType($type); - - $backupManager->create(); - - $this->_getSession()->addSuccess($successMessage); - - $response->setRedirectUrl($this->getUrl('*/*/index')); - } catch (Mage_Backup_Exception_NotEnoughFreeSpace $e) { - $errorMessage = Mage::helper('backup')->__('Not enough free space to create backup.'); - } catch (Mage_Backup_Exception_NotEnoughPermissions $e) { - Mage::log($e->getMessage()); - $errorMessage = Mage::helper('backup')->__('Not enough permissions to create backup.'); - } catch (Exception $e) { - Mage::log($e->getMessage()); - $errorMessage = Mage::helper('backup')->__('An error occurred while creating the backup.'); - } - - if (!empty($errorMessage)) { - $response->setError($errorMessage); - $backupManager->setErrorMessage($errorMessage); - } - - if ($this->getRequest()->getParam('maintenance_mode')) { - $helper->turnOffMaintenanceMode(); - } - - $this->getResponse()->setBody($response->toJson()); - } - - /** - * Download backup action - * - * @return Mage_Adminhtml_Controller_Action - */ - public function downloadAction() - { - /** @var Mage_Backup_Model_Backup $backup */ - $backup = Mage::getModel('backup/backup')->loadByTimeAndType( - $this->getRequest()->getParam('time'), - $this->getRequest()->getParam('type') - ); - - if (!$backup->getTime() || !$backup->exists()) { - return $this->_redirect('*/*'); - } - - $fileName = Mage::helper('backup')->generateBackupDownloadName($backup); - - $this->_prepareDownloadResponse($fileName, null, 'application/octet-stream', $backup->getSize()); - - $this->getResponse()->sendHeaders(); - - $backup->output(); - exit(); - } - - /** - * Rollback Action - * - * @return Mage_Adminhtml_Controller_Action - */ - public function rollbackAction() - { - if (!Mage::helper('backup')->isRollbackAllowed()) { - return $this->_forward('denied'); - } - - if (!$this->getRequest()->isAjax()) { - return $this->getUrl('*/*/index'); - } - - $helper = Mage::helper('backup'); - $response = new Varien_Object(); - - try { - /** @var Mage_Backup_Model_Backup $backup */ - $backup = Mage::getModel('backup/backup')->loadByTimeAndType( - $this->getRequest()->getParam('time'), - $this->getRequest()->getParam('type') - ); - - if (!$backup->getTime() || !$backup->exists()) { - return $this->_redirect('*/*'); - } - - if (!$backup->getTime()) { - throw new Mage_Backup_Exception_CantLoadSnapshot(); - } - - $type = $backup->getType(); - - $backupManager = Mage_Backup::getBackupInstance($type) - ->setBackupExtension($helper->getExtensionByType($type)) - ->setTime($backup->getTime()) - ->setBackupsDir($helper->getBackupsDir()) - ->setName($backup->getName(), false) - ->setResourceModel(Mage::getResourceModel('backup/db')); - - Mage::register('backup_manager', $backupManager); - - $passwordValid = Mage::getModel('backup/backup')->validateUserPassword( - $this->getRequest()->getParam('password') - ); - - if (!$passwordValid) { - $response->setError(Mage::helper('backup')->__('Invalid Password.')); - $backupManager->setErrorMessage(Mage::helper('backup')->__('Invalid Password.')); - return $this->getResponse()->setBody($response->toJson()); - } - - if ($this->getRequest()->getParam('maintenance_mode')) { - $turnedOn = $helper->turnOnMaintenanceMode(); - - if (!$turnedOn) { - $response->setError( - Mage::helper('backup')->__('You do not have sufficient permissions to enable Maintenance Mode during this operation.') - . ' ' . Mage::helper('backup')->__('Please either unselect the "Put store on the maintenance mode" checkbox or update your permissions to proceed with the rollback."') - ); - $backupManager->setErrorMessage(Mage::helper('backup')->__("System couldn't put store on the maintenance mode")); - return $this->getResponse()->setBody($response->toJson()); - } - } - - if ($type != Mage_Backup_Helper_Data::TYPE_DB) { - $backupManager->setRootDir(Mage::getBaseDir()) - ->addIgnorePaths($helper->getRollbackIgnorePaths()); - - if ($this->getRequest()->getParam('use_ftp', false)) { - $backupManager->setUseFtp( - $this->getRequest()->getParam('ftp_host', ''), - $this->getRequest()->getParam('ftp_user', ''), - $this->getRequest()->getParam('ftp_pass', ''), - $this->getRequest()->getParam('ftp_path', '') - ); - } - } - - $backupManager->rollback(); - - $helper->invalidateCache()->invalidateIndexer(); - - $adminSession = $this->_getSession(); - $adminSession->unsetAll(); - $adminSession->getCookie()->delete($adminSession->getSessionName()); - - $response->setRedirectUrl($this->getUrl('*')); - } catch (Mage_Backup_Exception_CantLoadSnapshot $e) { - $errorMsg = Mage::helper('backup')->__('Backup file not found'); - } catch (Mage_Backup_Exception_FtpConnectionFailed $e) { - $errorMsg = Mage::helper('backup')->__('Failed to connect to FTP'); - } catch (Mage_Backup_Exception_FtpValidationFailed $e) { - $errorMsg = Mage::helper('backup')->__('Failed to validate FTP'); - } catch (Mage_Backup_Exception_NotEnoughPermissions $e) { - Mage::log($e->getMessage()); - $errorMsg = Mage::helper('backup')->__('Not enough permissions to perform rollback'); - } catch (Exception $e) { - Mage::log($e->getMessage()); - $errorMsg = Mage::helper('backup')->__('Failed to rollback'); - } - - if (!empty($errorMsg)) { - $response->setError($errorMsg); - $backupManager->setErrorMessage($errorMsg); - } - - if ($this->getRequest()->getParam('maintenance_mode')) { - $helper->turnOffMaintenanceMode(); - } - - $this->getResponse()->setBody($response->toJson()); - } - - /** - * Delete backups mass action - * - * @return Mage_Adminhtml_Controller_Action - */ - public function massDeleteAction() - { - $backupIds = $this->getRequest()->getParam('ids', []); - - if (!is_array($backupIds) || !count($backupIds)) { - return $this->_redirect('*/*/index'); - } - - /** @var Mage_Backup_Model_Backup $backupModel */ - $backupModel = Mage::getModel('backup/backup'); - $resultData = new Varien_Object(); - $resultData->setIsSuccess(false); - $resultData->setDeleteResult([]); - Mage::register('backup_manager', $resultData); - - $deleteFailMessage = Mage::helper('backup')->__('Failed to delete one or several backups.'); - - try { - $allBackupsDeleted = true; - - foreach ($backupIds as $id) { - list($time, $type) = explode('_', $id); - $backupModel - ->loadByTimeAndType($time, $type) - ->deleteFile(); - - if ($backupModel->exists()) { - $allBackupsDeleted = false; - $result = Mage::helper('adminhtml')->__('failed'); - } else { - $result = Mage::helper('adminhtml')->__('successful'); - } - - $resultData->setDeleteResult( - array_merge($resultData->getDeleteResult(), [$backupModel->getFileName() . ' ' . $result]) - ); - } - - $resultData->setIsSuccess(true); - if ($allBackupsDeleted) { - $this->_getSession()->addSuccess( - Mage::helper('backup')->__('The selected backup(s) has been deleted.') - ); - } else { - throw new Exception($deleteFailMessage); - } - } catch (Exception $e) { - $resultData->setIsSuccess(false); - $this->_getSession()->addError($deleteFailMessage); - } - - return $this->_redirect('*/*/index'); - } - - /** - * @inheritDoc - */ - protected function _isAllowed() - { - return Mage::getSingleton('admin/session')->isAllowed('system/tools/backup') - && Mage::helper('core')->isModuleEnabled('Mage_Backup') - && !Mage::getStoreConfigFlag('advanced/modules_disable_output/Mage_Backup'); - } - - /** - * Retrieve adminhtml session model - * - * @return Mage_Adminhtml_Model_Session - */ - protected function _getSession() - { - return Mage::getSingleton('adminhtml/session'); - } -} diff --git a/app/code/core/Mage/Adminhtml/controllers/System/StoreController.php b/app/code/core/Mage/Adminhtml/controllers/System/StoreController.php index 7fde1c22ac1..0e974a36c33 100644 --- a/app/code/core/Mage/Adminhtml/controllers/System/StoreController.php +++ b/app/code/core/Mage/Adminhtml/controllers/System/StoreController.php @@ -453,6 +453,13 @@ public function deleteStorePostAction() */ 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; } diff --git a/app/code/core/Mage/Backup/Exception.php b/app/code/core/Mage/Backup/Exception.php deleted file mode 100644 index 7da3d3f93af..00000000000 --- a/app/code/core/Mage/Backup/Exception.php +++ /dev/null @@ -1,29 +0,0 @@ - - */ -class Mage_Backup_Exception extends Zend_Exception -{ -} diff --git a/app/code/core/Mage/Backup/Helper/Data.php b/app/code/core/Mage/Backup/Helper/Data.php deleted file mode 100644 index efb2d23a301..00000000000 --- a/app/code/core/Mage/Backup/Helper/Data.php +++ /dev/null @@ -1,327 +0,0 @@ - - */ -class Mage_Backup_Helper_Data extends Mage_Core_Helper_Abstract -{ - /** - * Backup type constant for database backup - */ - public const TYPE_DB = 'db'; - - /** - * Backup type constant for filesystem backup - */ - public const TYPE_FILESYSTEM = 'filesystem'; - - /** - * Backup type constant for full system backup(database + filesystem) - */ - public const TYPE_SYSTEM_SNAPSHOT = 'snapshot'; - - /** - * Backup type constant for media and database backup - */ - public const TYPE_MEDIA = 'media'; - - /** - * Backup type constant for full system backup excluding media folder - */ - public const TYPE_SNAPSHOT_WITHOUT_MEDIA = 'nomedia'; - - protected $_moduleName = 'Mage_Backup'; - - /** - * Get all possible backup type values with descriptive title - * - * @return array - */ - public function getBackupTypes() - { - return [ - self::TYPE_DB => $this->__('Database'), - self::TYPE_MEDIA => $this->__('Database and Media'), - self::TYPE_SYSTEM_SNAPSHOT => $this->__('System'), - self::TYPE_SNAPSHOT_WITHOUT_MEDIA => $this->__('System (excluding Media)') - ]; - } - - /** - * Get all possible backup type values - * - * @return array - */ - public function getBackupTypesList() - { - return [ - self::TYPE_DB, - self::TYPE_SYSTEM_SNAPSHOT, - self::TYPE_SNAPSHOT_WITHOUT_MEDIA, - self::TYPE_MEDIA - ]; - } - - /** - * Get default backup type value - * - * @return string - */ - public function getDefaultBackupType() - { - return self::TYPE_DB; - } - - /** - * Get directory path where backups stored - * - * @return string - */ - public function getBackupsDir() - { - return Mage::getBaseDir('var') . DS . 'backups'; - } - - /** - * Get backup file extension by backup type - * - * @param string $type - * @return string - */ - public function getExtensionByType($type) - { - $extensions = $this->getExtensions(); - return $extensions[$type] ?? ''; - } - - /** - * Get all types to extensions map - * - * @return array - */ - public function getExtensions() - { - return [ - self::TYPE_SYSTEM_SNAPSHOT => 'tgz', - self::TYPE_SNAPSHOT_WITHOUT_MEDIA => 'tgz', - self::TYPE_MEDIA => 'tgz', - self::TYPE_DB => 'gz' - ]; - } - - /** - * Generate backup download name - * - * @param Mage_Backup_Model_Backup $backup - * @return string - */ - public function generateBackupDownloadName(Mage_Backup_Model_Backup $backup) - { - $additionalExtension = $backup->getType() == self::TYPE_DB ? '.sql' : ''; - return $backup->getType() . '-' . date('YmdHis', $backup->getTime()) . $additionalExtension . '.' - . $this->getExtensionByType($backup->getType()); - } - - /** - * Check Permission for Rollback - * - * @return bool - */ - public function isRollbackAllowed() - { - return Mage::getSingleton('admin/session')->isAllowed('system/tools/backup/rollback'); - } - - /** - * Get paths that should be ignored when creating system snapshots - * - * @return array - */ - public function getBackupIgnorePaths() - { - return [ - '.svn', - 'maintenance.flag', - Mage::getBaseDir('var') . DS . 'session', - Mage::getBaseDir('var') . DS . 'cache', - Mage::getBaseDir('var') . DS . 'full_page_cache', - Mage::getBaseDir('var') . DS . 'locks', - Mage::getBaseDir('var') . DS . 'log', - Mage::getBaseDir('var') . DS . 'report' - ]; - } - - /** - * Get paths that should be ignored when rolling back system snapshots - * - * @return array - */ - public function getRollbackIgnorePaths() - { - return [ - '.svn', - 'maintenance.flag', - Mage::getBaseDir('var') . DS . 'session', - Mage::getBaseDir('var') . DS . 'locks', - Mage::getBaseDir('var') . DS . 'log', - Mage::getBaseDir('var') . DS . 'report', - Mage::getBaseDir('app') . DS . 'Mage.php', - Mage::getBaseDir() . DS . 'errors', - Mage::getBaseDir() . DS . 'index.php' - ]; - } - - /** - * Put store into maintenance mode - * - * @return bool - */ - public function turnOnMaintenanceMode() - { - $maintenanceFlagFile = $this->getMaintenanceFlagFilePath(); - $result = file_put_contents($maintenanceFlagFile, 'maintenance'); - - return $result !== false; - } - - /** - * Turn off store maintenance mode - * - * @SuppressWarnings(PHPMD.ErrorControlOperator) - */ - public function turnOffMaintenanceMode() - { - $maintenanceFlagFile = $this->getMaintenanceFlagFilePath(); - @unlink($maintenanceFlagFile); - } - - /** - * Get backup create success message by backup type - * - * @param string $type - * @return string - */ - public function getCreateSuccessMessageByType($type) - { - $messagesMap = [ - self::TYPE_SYSTEM_SNAPSHOT => $this->__('The system backup has been created.'), - self::TYPE_SNAPSHOT_WITHOUT_MEDIA => $this->__('The system (excluding Media) backup has been created.'), - self::TYPE_MEDIA => $this->__('The database and media backup has been created.'), - self::TYPE_DB => $this->__('The database backup has been created.') - ]; - - if (!isset($messagesMap[$type])) { - return; - } - - return $messagesMap[$type]; - } - - /** - * Get path to maintenance flag file - * - * @return string - */ - protected function getMaintenanceFlagFilePath() - { - return Mage::getBaseDir() . DS . 'maintenance.flag'; - } - - /** - * Invalidate Cache - * @return $this - */ - public function invalidateCache() - { - if ($cacheTypesNode = Mage::getConfig()->getNode(Mage_Core_Model_Cache::XML_PATH_TYPES)) { - $cacheTypesList = array_keys($cacheTypesNode->asArray()); - Mage::app()->getCacheInstance()->invalidateType($cacheTypesList); - } - return $this; - } - - /** - * Invalidate Indexer - * - * @return $this - */ - public function invalidateIndexer() - { - foreach (Mage::getResourceModel('index/process_collection') as $process) { - $process->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX); - } - return $this; - } - - /** - * Creates backup's display name from it's name - * - * @param string $name - * @return string - */ - public function nameToDisplayName($name) - { - return str_replace('_', ' ', $name); - } - - /** - * Extracts information from backup's filename - * - * @param string $filename - * @return Varien_Object - */ - public function extractDataFromFilename($filename) - { - $extensions = $this->getExtensions(); - - $filenameWithoutExtension = $filename; - - foreach ($extensions as $extension) { - $filenameWithoutExtension = preg_replace( - '/' . preg_quote($extension, '/') . '$/', - '', - $filenameWithoutExtension - ); - } - - $filenameWithoutExtension = substr($filenameWithoutExtension, 0, strrpos($filenameWithoutExtension, ".")); - - list($time, $type) = explode("_", $filenameWithoutExtension); - - $name = str_replace($time . '_' . $type, '', $filenameWithoutExtension); - - if (!empty($name)) { - $name = substr($name, 1); - } - - $result = new Varien_Object(); - $result->addData([ - 'name' => $name, - 'type' => $type, - 'time' => $time - ]); - - return $result; - } -} diff --git a/app/code/core/Mage/Backup/Model/Backup.php b/app/code/core/Mage/Backup/Model/Backup.php deleted file mode 100644 index 31f67d6a9b5..00000000000 --- a/app/code/core/Mage/Backup/Model/Backup.php +++ /dev/null @@ -1,400 +0,0 @@ - - */ -class Mage_Backup_Model_Backup extends Varien_Object -{ - /* internal constants */ - public const COMPRESS_RATE = 9; - - /** - * Type of backup file - * - * @var string - */ - private $_type = 'db'; - - /** - * Gz file pointer - * - * @var resource - */ - protected $_handler = null; - - /** - * Load backup file info - * - * @param string $fileName - * @param string $filePath - * @return $this - */ - public function load($fileName, $filePath) - { - $backupData = Mage::helper('backup')->extractDataFromFilename($fileName); - - $this->addData([ - 'id' => $filePath . DS . $fileName, - 'time' => (int)$backupData->getTime(), - 'path' => $filePath, - 'extension' => Mage::helper('backup')->getExtensionByType($backupData->getType()), - 'display_name' => Mage::helper('backup')->nameToDisplayName($backupData->getName()), - 'name' => $backupData->getName(), - 'date_object' => new Zend_Date((int)$backupData->getTime(), Mage::app()->getLocale()->getLocaleCode()) - ]); - - $this->setType($backupData->getType()); - return $this; - } - - /** - * Checks backup file exists. - * - * @return bool - */ - public function exists() - { - return is_file($this->getPath() . DS . $this->getFileName()); - } - - /** - * Return file name of backup file - * - * @return string - */ - public function getFileName() - { - $filename = $this->getTime() . "_" . $this->getType(); - $backupName = $this->getName(); - - if (!empty($backupName)) { - $filename .= '_' . $backupName; - } - - $filename .= '.' . Mage::helper('backup')->getExtensionByType($this->getType()); - - return $filename; - } - - /** - * Sets type of file - * - * @param string $value - * @return $this - */ - public function setType($value = 'db') - { - $possibleTypes = Mage::helper('backup')->getBackupTypesList(); - if (!in_array($value, $possibleTypes)) { - $value = Mage::helper('backup')->getDefaultBackupType(); - } - - $this->_type = $value; - $this->setData('type', $this->_type); - - return $this; - } - - /** - * Returns type of backup file - * - * @return string - */ - public function getType() - { - return $this->_type; - } - - /** - * Set the backup file content - * - * @param string $content - * @return $this - * @throws Mage_Backup_Exception - */ - public function setFile(&$content) - { - if (!$this->hasData('time') || !$this->hasData('type') || !$this->hasData('path')) { - Mage::throwException(Mage::helper('backup')->__('Wrong order of creation for new backup.')); - } - - $ioProxy = new Varien_Io_File(); - $ioProxy->setAllowCreateFolders(true); - $ioProxy->open(['path' => $this->getPath()]); - - $compress = 0; - if (extension_loaded("zlib")) { - $compress = 1; - } - - $rawContent = ''; - if ($compress) { - $rawContent = gzcompress($content, self::COMPRESS_RATE); - } else { - $rawContent = $content; - } - - $fileHeaders = pack("ll", $compress, strlen($rawContent)); - $ioProxy->write($this->getFileName(), $fileHeaders . $rawContent); - return $this; - } - - /** - * Return content of backup file - * - * @todo rewrite to Varien_IO, but there no possibility read part of files. - * @return string - * @throws Mage_Backup_Exception - * - * @SuppressWarnings(PHPMD.ErrorControlOperator) - */ - public function &getFile() - { - if (!$this->exists()) { - Mage::throwException(Mage::helper('backup')->__("Backup file does not exist.")); - } - - $fResource = @fopen($this->getPath() . DS . $this->getFileName(), "rb"); - if (!$fResource) { - Mage::throwException(Mage::helper('backup')->__("Cannot read backup file.")); - } - - $content = ''; - $compressed = 0; - - $info = unpack("lcompress/llength", fread($fResource, 8)); - if ($info['compress']) { // If file compressed by zlib - $compressed = 1; - } - - if ($compressed && !extension_loaded("zlib")) { - fclose($fResource); - Mage::throwException(Mage::helper('backup')->__('The file was compressed with Zlib, but this extension is not installed on server.')); - } - - if ($compressed) { - $content = gzuncompress(fread($fResource, $info['length'])); - } else { - $content = fread($fResource, $info['length']); - } - - fclose($fResource); - - return $content; - } - - /** - * Delete backup file - * - * @throws Mage_Backup_Exception - * @return $this - */ - public function deleteFile() - { - if (!$this->exists()) { - Mage::throwException(Mage::helper('backup')->__("Backup file does not exist.")); - } - - $ioProxy = new Varien_Io_File(); - $ioProxy->open(['path' => $this->getPath()]); - $ioProxy->rm($this->getFileName()); - return $this; - } - - /** - * Open backup file (write or read mode) - * - * @param bool $write - * @return $this - * - * @SuppressWarnings(PHPMD.ErrorControlOperator) - */ - public function open($write = false) - { - if (is_null($this->getPath())) { - Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file path was not specified.')); - } - - $ioAdapter = new Varien_Io_File(); - try { - $path = $ioAdapter->getCleanPath($this->getPath()); - $ioAdapter->checkAndCreateFolder($path); - $filePath = $path . DS . $this->getFileName(); - } catch (Exception $e) { - Mage::exception('Mage_Backup', $e->getMessage()); - } - - if ($write && $ioAdapter->fileExists($filePath)) { - $ioAdapter->rm($filePath); - } - if (!$write && !$ioAdapter->fileExists($filePath)) { - Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file "%s" does not exist.', $this->getFileName())); - } - - $mode = $write ? 'wb' . self::COMPRESS_RATE : 'rb'; - - $this->_handler = @gzopen($filePath, $mode); - - if (!$this->_handler) { - throw new Mage_Backup_Exception_NotEnoughPermissions( - Mage::helper('backup')->__('Backup file "%s" cannot be read from or written to.', $this->getFileName()) - ); - } - - return $this; - } - - /** - * Read backup uncomressed data - * - * @param int $length - * @return string - */ - public function read($length) - { - if (is_null($this->_handler)) { - Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file handler was unspecified.')); - } - - return gzread($this->_handler, $length); - } - - public function eof() - { - if (is_null($this->_handler)) { - Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file handler was unspecified.')); - } - - return gzeof($this->_handler); - } - - /** - * Write to backup file - * - * @param string $string - * @return $this - */ - public function write($string) - { - if (is_null($this->_handler)) { - Mage::exception('Mage_Backup', Mage::helper('backup')->__('Backup file handler was unspecified.')); - } - - try { - gzwrite($this->_handler, $string); - } catch (Exception $e) { - Mage::exception('Mage_Backup', Mage::helper('backup')->__('An error occurred while writing to the backup file "%s".', $this->getFileName())); - } - - return $this; - } - - /** - * Close open backup file - * - * @return $this - * - * @SuppressWarnings(PHPMD.ErrorControlOperator) - */ - public function close() - { - @gzclose($this->_handler); - $this->_handler = null; - - return $this; - } - - /** - * Print output - * - */ - public function output() - { - if (!$this->exists()) { - return ; - } - - $ioAdapter = new Varien_Io_File(); - $ioAdapter->open(['path' => $this->getPath()]); - - $ioAdapter->streamOpen($this->getFileName(), 'r'); - while ($buffer = $ioAdapter->streamRead()) { - echo $buffer; - } - $ioAdapter->streamClose(); - } - - public function getSize() - { - if (!is_null($this->getData('size'))) { - return $this->getData('size'); - } - - if ($this->exists()) { - $this->setData('size', filesize($this->getPath() . DS . $this->getFileName())); - return $this->getData('size'); - } - - return 0; - } - - /** - * Validate user password - * - * @param string $password - * @return bool - */ - public function validateUserPassword($password) - { - $userPasswordHash = Mage::getModel('admin/session')->getUser()->getPassword(); - return Mage::helper('core')->validateHash($password, $userPasswordHash); - } - - /** - * Load backup by it's type and creation timestamp - * - * @param int $timestamp - * @param string $type - * @return $this - */ - public function loadByTimeAndType($timestamp, $type) - { - $backupsCollection = Mage::getSingleton('backup/fs_collection'); - $backupId = $timestamp . '_' . $type; - - foreach ($backupsCollection as $backup) { - if ($backup->getId() == $backupId) { - $this->setType($backup->getType()) - ->setTime($backup->getTime()) - ->setName($backup->getName()) - ->setPath($backup->getPath()); - break; - } - } - - return $this; - } -} diff --git a/app/code/core/Mage/Backup/Model/Config/Backend/Cron.php b/app/code/core/Mage/Backup/Model/Config/Backend/Cron.php deleted file mode 100644 index e80a8bb9b24..00000000000 --- a/app/code/core/Mage/Backup/Model/Config/Backend/Cron.php +++ /dev/null @@ -1,82 +0,0 @@ - - */ -class Mage_Backup_Model_Config_Backend_Cron extends Mage_Core_Model_Config_Data -{ - public const CRON_STRING_PATH = 'crontab/jobs/system_backup/schedule/cron_expr'; - public const CRON_MODEL_PATH = 'crontab/jobs/system_backup/run/model'; - - public const XML_PATH_BACKUP_ENABLED = 'groups/backup/fields/enabled/value'; - public const XML_PATH_BACKUP_TIME = 'groups/backup/fields/time/value'; - public const XML_PATH_BACKUP_FREQUENCY = 'groups/backup/fields/frequency/value'; - - /** - * Cron settings after save - * - * @return $this - */ - protected function _afterSave() - { - $enabled = $this->getData(self::XML_PATH_BACKUP_ENABLED); - $time = $this->getData(self::XML_PATH_BACKUP_TIME); - $frequency = $this->getData(self::XML_PATH_BACKUP_FREQUENCY); - - $frequencyWeekly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_WEEKLY; - $frequencyMonthly = Mage_Adminhtml_Model_System_Config_Source_Cron_Frequency::CRON_MONTHLY; - - if ($enabled) { - $cronExprArray = [ - (int) $time[1], # Minute - (int) $time[0], # Hour - ($frequency == $frequencyMonthly) ? '1' : '*', # Day of the Month - '*', # Month of the Year - ($frequency == $frequencyWeekly) ? '1' : '*', # Day of the Week - ]; - $cronExprString = implode(' ', $cronExprArray); - } else { - $cronExprString = ''; - } - - try { - Mage::getModel('core/config_data') - ->load(self::CRON_STRING_PATH, 'path') - ->setValue($cronExprString) - ->setPath(self::CRON_STRING_PATH) - ->save(); - - Mage::getModel('core/config_data') - ->load(self::CRON_MODEL_PATH, 'path') - ->setValue((string) Mage::getConfig()->getNode(self::CRON_MODEL_PATH)) - ->setPath(self::CRON_MODEL_PATH) - ->save(); - } catch (Exception $e) { - Mage::throwException(Mage::helper('backup')->__('Unable to save the cron expression.')); - } - return $this; - } -} diff --git a/app/code/core/Mage/Backup/Model/Config/Source/Type.php b/app/code/core/Mage/Backup/Model/Config/Source/Type.php deleted file mode 100644 index 7018a2ddfff..00000000000 --- a/app/code/core/Mage/Backup/Model/Config/Source/Type.php +++ /dev/null @@ -1,47 +0,0 @@ - - */ -class Mage_Backup_Model_Config_Source_Type -{ - /** - * return possible options - * - * @return array - */ - public function toOptionArray() - { - $backupTypes = []; - foreach (Mage::helper('backup')->getBackupTypes() as $type => $label) { - $backupTypes[] = [ - 'label' => $label, - 'value' => $type, - ]; - } - return $backupTypes; - } -} diff --git a/app/code/core/Mage/Backup/Model/Db.php b/app/code/core/Mage/Backup/Model/Db.php deleted file mode 100644 index 2cca471514a..00000000000 --- a/app/code/core/Mage/Backup/Model/Db.php +++ /dev/null @@ -1,178 +0,0 @@ - - */ -class Mage_Backup_Model_Db -{ - /** - * Buffer length for multi rows - * default 100 Kb - * - */ - public const BUFFER_LENGTH = 102400; - - /** - * List of tables which data should not be backed up - * - * @var array - */ - protected $_ignoreDataTablesList = [ - 'importexport/importdata' - ]; - - /** - * Retrieve resource model - * - * @return Mage_Backup_Model_Resource_Db - */ - public function getResource() - { - return Mage::getResourceSingleton('backup/db'); - } - - public function getTables() - { - return $this->getResource()->getTables(); - } - - public function getTableCreateScript($tableName, $addDropIfExists = false) - { - return $this->getResource()->getTableCreateScript($tableName, $addDropIfExists); - } - - public function getTableDataDump($tableName) - { - return $this->getResource()->getTableDataDump($tableName); - } - - public function getHeader() - { - return $this->getResource()->getHeader(); - } - - public function getFooter() - { - return $this->getResource()->getFooter(); - } - - public function renderSql() - { - ini_set('max_execution_time', 0); - $sql = $this->getHeader(); - - $tables = $this->getTables(); - foreach ($tables as $tableName) { - $sql .= $this->getTableCreateScript($tableName, true); - $sql .= $this->getTableDataDump($tableName); - } - - $sql .= $this->getFooter(); - return $sql; - } - - /** - * Create backup and stream write to adapter - * - * @param Mage_Backup_Model_Backup $backup - * @return $this - */ - public function createBackup(Mage_Backup_Model_Backup $backup) - { - $backup->open(true); - - $this->getResource()->beginTransaction(); - try { - $tables = $this->getResource()->getTables(); - - $backup->write($this->getResource()->getHeader()); - - $ignoreDataTablesList = $this->getIgnoreDataTablesList(); - - foreach ($tables as $table) { - $backup->write($this->getResource()->getTableHeader($table) - . $this->getResource()->getTableDropSql($table) . "\n"); - $backup->write($this->getResource()->getTableCreateSql($table, false) . "\n"); - - $tableStatus = $this->getResource()->getTableStatus($table); - - if ($tableStatus->getRows() && !in_array($table, $ignoreDataTablesList)) { - $backup->write($this->getResource()->getTableDataBeforeSql($table)); - - if ($tableStatus->getDataLength() > self::BUFFER_LENGTH) { - if ($tableStatus->getAvgRowLength() > 0 && $tableStatus->getAvgRowLength() < self::BUFFER_LENGTH) { - // Process rows in batches - $limit = floor(self::BUFFER_LENGTH / $tableStatus->getAvgRowLength()); - $multiRowsLength = ceil($tableStatus->getRows() / $limit); - } else { - // Process rows one by one - $limit = 1; - $multiRowsLength = $tableStatus->getRows(); - } - } else { - // Process all rows at once - $limit = $tableStatus->getRows(); - $multiRowsLength = 1; - } - - for ($i = 0; $i < $multiRowsLength; $i++) { - $backup->write($this->getResource()->getTableDataSql($table, $limit, $i * $limit)); - } - - $backup->write($this->getResource()->getTableDataAfterSql($table)); - } - } - $backup->write($this->getResource()->getTableForeignKeysSql()); - $backup->write($this->getResource()->getFooter()); - - $this->getResource()->commitTransaction(); - } catch (Exception $e) { - $this->getResource()->rollBackTransaction(); - throw $e; - } - - $backup->close(); - - return $this; - } - - /**. - * Returns the list of tables which data should not be backed up - * - * @return array - */ - public function getIgnoreDataTablesList() - { - $result = []; - $resource = Mage::getSingleton('core/resource'); - - foreach ($this->_ignoreDataTablesList as $table) { - $result[] = $resource->getTableName($table); - } - - return $result; - } -} diff --git a/app/code/core/Mage/Backup/Model/Fs/Collection.php b/app/code/core/Mage/Backup/Model/Fs/Collection.php deleted file mode 100644 index fa3818932fe..00000000000 --- a/app/code/core/Mage/Backup/Model/Fs/Collection.php +++ /dev/null @@ -1,88 +0,0 @@ - - */ -class Mage_Backup_Model_Fs_Collection extends Varien_Data_Collection_Filesystem -{ - /** - * Folder, where all backups are stored - * - * @var string - */ - protected $_baseDir; - - /** - * Set collection specific parameters and make sure backups folder will exist - */ - public function __construct() - { - parent::__construct(); - - $this->_baseDir = Mage::getBaseDir('var') . DS . 'backups'; - - // check for valid base dir - $ioProxy = new Varien_Io_File(); - $ioProxy->mkdir($this->_baseDir); - if (!is_file($this->_baseDir . DS . '.htaccess')) { - $ioProxy->open(['path' => $this->_baseDir]); - $ioProxy->write('.htaccess', 'deny from all', 0644); - } - - // set collection specific params - $extensions = Mage::helper('backup')->getExtensions(); - - foreach ($extensions as $key => $value) { - $extensions[] = '(' . preg_quote($value, '/') . ')'; - } - $extensions = implode('|', $extensions); - - $this - ->setOrder('time', self::SORT_ORDER_DESC) - ->addTargetDir($this->_baseDir) - ->setFilesFilter('/^[a-z0-9\-\_]+\.' . $extensions . '$/') - ->setCollectRecursively(false); - } - - /** - * Get backup-specific data from model for each row - * - * @param string $filename - * @return array - */ - protected function _generateRow($filename) - { - $row = parent::_generateRow($filename); - foreach (Mage::getSingleton('backup/backup')->load($row['basename'], $this->_baseDir) - ->getData() as $key => $value - ) { - $row[$key] = $value; - } - $row['size'] = filesize($filename); - $row['id'] = $row['time'] . '_' . $row['type']; - return $row; - } -} diff --git a/app/code/core/Mage/Backup/Model/Mysql4/Db.php b/app/code/core/Mage/Backup/Model/Mysql4/Db.php deleted file mode 100644 index 44015d1782d..00000000000 --- a/app/code/core/Mage/Backup/Model/Mysql4/Db.php +++ /dev/null @@ -1,32 +0,0 @@ - - * @deprecated - */ -class Mage_Backup_Model_Mysql4_Db extends Mage_Backup_Model_Resource_Db -{ -} diff --git a/app/code/core/Mage/Backup/Model/Observer.php b/app/code/core/Mage/Backup/Model/Observer.php deleted file mode 100644 index b8597d2cecc..00000000000 --- a/app/code/core/Mage/Backup/Model/Observer.php +++ /dev/null @@ -1,88 +0,0 @@ - - */ -class Mage_Backup_Model_Observer -{ - public const XML_PATH_BACKUP_ENABLED = 'system/backup/enabled'; - public const XML_PATH_BACKUP_TYPE = 'system/backup/type'; - public const XML_PATH_BACKUP_MAINTENANCE_MODE = 'system/backup/maintenance'; - - /** - * Error messages - * - * @var array - */ - protected $_errors = []; - - /** - * Create Backup - * - * @return $this - */ - public function scheduledBackup() - { - if (!Mage::getStoreConfigFlag(self::XML_PATH_BACKUP_ENABLED)) { - return $this; - } - - if (Mage::getStoreConfigFlag(self::XML_PATH_BACKUP_MAINTENANCE_MODE)) { - Mage::helper('backup')->turnOnMaintenanceMode(); - } - - $type = Mage::getStoreConfig(self::XML_PATH_BACKUP_TYPE); - - $this->_errors = []; - try { - $backupManager = Mage_Backup::getBackupInstance($type) - ->setBackupExtension(Mage::helper('backup')->getExtensionByType($type)) - ->setTime(time()) - ->setBackupsDir(Mage::helper('backup')->getBackupsDir()); - - Mage::register('backup_manager', $backupManager); - - if ($type != Mage_Backup_Helper_Data::TYPE_DB) { - $backupManager->setRootDir(Mage::getBaseDir()) - ->addIgnorePaths(Mage::helper('backup')->getBackupIgnorePaths()); - } - - $backupManager->create(); - Mage::log(Mage::helper('backup')->getCreateSuccessMessageByType($type)); - } catch (Exception $e) { - $this->_errors[] = $e->getMessage(); - $this->_errors[] = $e->getTrace(); - Mage::log($e->getMessage(), Zend_Log::ERR); - Mage::logException($e); - } - - if (Mage::getStoreConfigFlag(self::XML_PATH_BACKUP_MAINTENANCE_MODE)) { - Mage::helper('backup')->turnOffMaintenanceMode(); - } - - return $this; - } -} diff --git a/app/code/core/Mage/Backup/Model/Resource/Db.php b/app/code/core/Mage/Backup/Model/Resource/Db.php deleted file mode 100644 index d024ce5afd8..00000000000 --- a/app/code/core/Mage/Backup/Model/Resource/Db.php +++ /dev/null @@ -1,330 +0,0 @@ - - */ -class Mage_Backup_Model_Resource_Db -{ - /** - * Database connection adapter - * - * @var Varien_Db_Adapter_Pdo_Mysql - */ - protected $_write; - - /** - * tables Foreign key data array - * [tbl_name] = array(create foreign key strings) - * - * @var array - */ - protected $_foreignKeys = []; - - /** - * Initialize Backup DB resource model - * - */ - public function __construct() - { - $this->_write = Mage::getSingleton('core/resource')->getConnection('backup_write'); - } - - /** - * @deprecated after 1.4.0.0-alpha2 - * - */ - public function crear() - { - $this->clear(); - } - - /** - * Clear data - * - */ - public function clear() - { - $this->_foreignKeys = []; - } - - /** - * Retrieve table list - * - * @return array - */ - public function getTables() - { - return $this->_write->listTables(); - } - - /** - * Retrieve SQL fragment for drop table - * - * @param string $tableName - * @return string - */ - public function getTableDropSql($tableName) - { - /** @var Mage_Backup_Model_Resource_Helper_Mysql4 $helper */ - $helper = Mage::getResourceHelper('backup'); - return $helper->getTableDropSql($tableName); - } - - /** - * Retrieve SQL fragment for create table - * - * @param string $tableName - * @param bool $withForeignKeys - * @return string - */ - public function getTableCreateSql($tableName, $withForeignKeys = false) - { - /** @var Mage_Backup_Model_Resource_Helper_Mysql4 $helper */ - $helper = Mage::getResourceHelper('backup'); - return $helper->getTableCreateSql($tableName, $withForeignKeys = false); - } - - /** - * Retrieve foreign keys for table(s) - * - * @param string|null $tableName - * @return string - */ - public function getTableForeignKeysSql($tableName = null) - { - $fkScript = ''; - if (!$tableName) { - $tables = $this->getTables(); - /** @var Mage_Backup_Model_Resource_Helper_Mysql4 $helper */ - $helper = Mage::getResourceHelper('backup'); - foreach ($tables as $table) { - $tableFkScript = $helper->getTableForeignKeysSql($table); - if (!empty($tableFkScript)) { - $fkScript .= "\n" . $tableFkScript; - } - } - } else { - $fkScript = $this->getTableForeignKeysSql($tableName); - } - return $fkScript; - } - - /** - * Retrieve table status - * - * @param string $tableName - * @return Varien_Object|false - */ - public function getTableStatus($tableName) - { - $row = $this->_write->showTableStatus($tableName); - - if ($row) { - $statusObject = new Varien_Object(); - $statusObject->setIdFieldName('name'); - foreach ($row as $field => $value) { - $statusObject->setData(strtolower($field), $value); - } - - $cntRow = $this->_write->fetchRow( - $this->_write->select()->from($tableName, 'COUNT(1) as rows') - ); - $statusObject->setRows($cntRow['rows']); - - return $statusObject; - } - - return false; - } - - /** - * Quote Table Row - * - * @deprecated - * - * @param string $tableName - * @param array $row - * @return array - */ - protected function _quoteRow($tableName, array $row) - { - return $row; - } - - /** - * Retrieve table partical data SQL insert - * - * @param string $tableName - * @param int $count - * @param int $offset - * @return string - */ - public function getTableDataSql($tableName, $count = null, $offset = null) - { - /** @var Mage_Backup_Model_Resource_Helper_Mysql4 $helper */ - $helper = Mage::getResourceHelper('backup'); - return $helper->getPartInsertSql($tableName, $count, $offset); - } - - /** - * @param string $tableName - * @param bool $addDropIfExists - * @return string - */ - public function getTableCreateScript($tableName, $addDropIfExists = false) - { - /** @var Mage_Backup_Model_Resource_Helper_Mysql4 $helper */ - $helper = Mage::getResourceHelper('backup'); - return $helper->getTableCreateScript($tableName, $addDropIfExists); - } - - /** - * Retrieve table header comment - * - * @param string $tableName - * @return string - */ - public function getTableHeader($tableName) - { - $quotedTableName = $this->_write->quoteIdentifier($tableName); - return "\n--\n" - . "-- Table structure for table {$quotedTableName}\n" - . "--\n\n"; - } - - /** - * Return table data dump - * - * @param string $tableName - * @param bool $step - * @return string - */ - public function getTableDataDump($tableName, $step = false) - { - return $this->getTableDataSql($tableName); - } - - /** - * Returns SQL header data - * - * @return string - */ - public function getHeader() - { - /** @var Mage_Backup_Model_Resource_Helper_Mysql4 $helper */ - $helper = Mage::getResourceHelper('backup'); - return $helper->getHeader(); - } - - /** - * Returns SQL footer data - * - * @return string - */ - public function getFooter() - { - /** @var Mage_Backup_Model_Resource_Helper_Mysql4 $helper */ - $helper = Mage::getResourceHelper('backup'); - return $helper->getFooter(); - } - - /** - * Retrieve before insert data SQL fragment - * - * @param string $tableName - * @return string - */ - public function getTableDataBeforeSql($tableName) - { - /** @var Mage_Backup_Model_Resource_Helper_Mysql4 $helper */ - $helper = Mage::getResourceHelper('backup'); - return $helper->getTableDataBeforeSql($tableName); - } - - /** - * Retrieve after insert data SQL fragment - * - * @param string $tableName - * @return string - */ - public function getTableDataAfterSql($tableName) - { - /** @var Mage_Backup_Model_Resource_Helper_Mysql4 $helper */ - $helper = Mage::getResourceHelper('backup'); - return $helper->getTableDataAfterSql($tableName); - } - - /** - * Start transaction mode - * - * @return $this - */ - public function beginTransaction() - { - /** @var Mage_Backup_Model_Resource_Helper_Mysql4 $helper */ - $helper = Mage::getResourceHelper('backup'); - $helper->turnOnSerializableMode(); - $this->_write->beginTransaction(); - return $this; - } - - /** - * Commit transaction - * - * @return $this - */ - public function commitTransaction() - { - $this->_write->commit(); - /** @var Mage_Backup_Model_Resource_Helper_Mysql4 $helper */ - $helper = Mage::getResourceHelper('backup'); - $helper->turnOnReadCommittedMode(); - return $this; - } - - /** - * Rollback transaction - * - * @return $this - */ - public function rollBackTransaction() - { - $this->_write->rollBack(); - return $this; - } - - /** - * Run sql code - * - * @param string|Zend_Db_Select $command - * @return $this - */ - public function runCommand($command) - { - $this->_write->query($command); - return $this; - } -} diff --git a/app/code/core/Mage/Backup/Model/Resource/Helper/Mysql4.php b/app/code/core/Mage/Backup/Model/Resource/Helper/Mysql4.php deleted file mode 100644 index 0087c9653df..00000000000 --- a/app/code/core/Mage/Backup/Model/Resource/Helper/Mysql4.php +++ /dev/null @@ -1,320 +0,0 @@ - - */ -class Mage_Backup_Model_Resource_Helper_Mysql4 extends Mage_Core_Model_Resource_Helper_Mysql4 -{ - /** - * Tables foreign key data array - * [tbl_name] = array(create foreign key strings) - * - * @var array - */ - protected $_foreignKeys = []; - - /** - * Retrieve SQL fragment for drop table - * - * @param string $tableName - * @return string - */ - public function getTableDropSql($tableName) - { - $quotedTableName = $this->_getReadAdapter()->quoteIdentifier($tableName); - return sprintf('DROP TABLE IF EXISTS %s;', $quotedTableName); - } - - /** - * Retrieve foreign keys for table(s) - * - * @param string|null $tableName - * @return string|false - */ - public function getTableForeignKeysSql($tableName = null) - { - $sql = false; - - if ($tableName === null) { - $sql = ''; - foreach ($this->_foreignKeys as $table => $foreignKeys) { - $sql .= $this->_buildForeignKeysAlterTableSql($table, $foreignKeys); - } - } elseif (isset($this->_foreignKeys[$tableName])) { - $foreignKeys = $this->_foreignKeys[$tableName]; - $sql = $this->_buildForeignKeysAlterTableSql($tableName, $foreignKeys); - } - - return $sql; - } - - /** - * Build sql that will add foreign keys to it - * - * @param string $tableName - * @param array $foreignKeys - * @return string - */ - protected function _buildForeignKeysAlterTableSql($tableName, $foreignKeys) - { - if (!is_array($foreignKeys) || empty($foreignKeys)) { - return ''; - } - - return sprintf( - "ALTER TABLE %s\n %s;\n", - $this->_getReadAdapter()->quoteIdentifier($tableName), - implode(",\n ", $foreignKeys) - ); - } - - /** - * Get create script for table - * - * @param string $tableName - * @param bool $addDropIfExists - * @return string - */ - public function getTableCreateScript($tableName, $addDropIfExists = false) - { - $script = ''; - $quotedTableName = $this->_getReadAdapter()->quoteIdentifier($tableName); - - if ($addDropIfExists) { - $script .= 'DROP TABLE IF EXISTS ' . $quotedTableName . ";\n"; - } - //TODO fix me - $sql = 'SHOW CREATE TABLE ' . $quotedTableName; - $data = $this->_getReadAdapter()->fetchRow($sql); - $script .= isset($data['Create Table']) ? $data['Create Table'] . ";\n" : ''; - - return $script; - } - /** - * Retrieve SQL fragment for create table - * - * @param string $tableName - * @param bool $withForeignKeys - * @return false|string - */ - public function getTableCreateSql($tableName, $withForeignKeys = false) - { - $adapter = $this->_getReadAdapter(); - $quotedTableName = $adapter->quoteIdentifier($tableName); - $query = 'SHOW CREATE TABLE ' . $quotedTableName; - $row = $adapter->fetchRow($query); - - if (!$row || !isset($row['Table']) || !isset($row['Create Table'])) { - return false; - } - - $regExp = '/,\s+CONSTRAINT `([^`]*)` FOREIGN KEY \(`([^`]*)`\) ' - . 'REFERENCES `([^`]*)` \(`([^`]*)`\)' - . '( ON DELETE (RESTRICT|CASCADE|SET NULL|NO ACTION))?' - . '( ON UPDATE (RESTRICT|CASCADE|SET NULL|NO ACTION))?/'; - $matches = []; - preg_match_all($regExp, $row['Create Table'], $matches, PREG_SET_ORDER); - - if (is_array($matches)) { - foreach ($matches as $match) { - $this->_foreignKeys[$tableName][] = sprintf( - 'ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s (%s)%s%s', - $adapter->quoteIdentifier($match[1]), - $adapter->quoteIdentifier($match[2]), - $adapter->quoteIdentifier($match[3]), - $adapter->quoteIdentifier($match[4]), - $match[5] ?? '', - $match[7] ?? '' - ); - } - } - - if ($withForeignKeys) { - $sql = $row['Create Table']; - } else { - $sql = preg_replace($regExp, '', $row['Create Table']); - } - - return $sql . ';'; - } - /** - * Returns SQL header data, move from original resource model - * - * @return string - */ - public function getHeader() - { - $dbConfig = $this->_getReadAdapter()->getConfig(); - - $versionRow = $this->_getReadAdapter()->fetchRow('SHOW VARIABLES LIKE \'version\''); - $hostName = !empty($dbConfig['unix_socket']) ? $dbConfig['unix_socket'] - : (!empty($dbConfig['host']) ? $dbConfig['host'] : 'localhost'); - - return "-- Magento DB backup\n" - . "--\n" - . "-- Host: {$hostName} Database: {$dbConfig['dbname']}\n" - . "-- ------------------------------------------------------\n" - . "-- Server version: {$versionRow['Value']}\n\n" - . "/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;\n" - . "/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;\n" - . "/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;\n" - . "/*!40101 SET NAMES utf8 */;\n" - . "/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;\n" - . "/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;\n" - . "/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;\n" - . "/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;\n"; - } - - /** - * Returns SQL footer data, move from original resource model - * - * @return string - */ - public function getFooter() - { - return "\n/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;\n" - . "/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; \n" - . "/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;\n" - . "/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;\n" - . "/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;\n" - . "/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;\n" - . "/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;\n" - . "\n-- Dump completed on " . Mage::getSingleton('core/date')->gmtDate() . " GMT"; - } - - /** - * Retrieve before insert data SQL fragment - * - * @param string $tableName - * @return string - */ - public function getTableDataBeforeSql($tableName) - { - $quotedTableName = $this->_getReadAdapter()->quoteIdentifier($tableName); - return "\n--\n" - . "-- Dumping data for table {$quotedTableName}\n" - . "--\n\n" - . "LOCK TABLES {$quotedTableName} WRITE;\n" - . "/*!40000 ALTER TABLE {$quotedTableName} DISABLE KEYS */;\n"; - } - - /** - * Retrieve after insert data SQL fragment - * - * @param string $tableName - * @return string - */ - public function getTableDataAfterSql($tableName) - { - $quotedTableName = $this->_getReadAdapter()->quoteIdentifier($tableName); - return "/*!40000 ALTER TABLE {$quotedTableName} ENABLE KEYS */;\n" - . "UNLOCK TABLES;\n"; - } - - /** - * Return table part data SQL insert - * - * @param string $tableName - * @param int $count - * @param int $offset - * @return string - */ - public function getPartInsertSql($tableName, $count = null, $offset = null) - { - $sql = null; - $adapter = $this->_getWriteAdapter(); - $select = $adapter->select() - ->from($tableName) - ->limit($count, $offset); - $query = $adapter->query($select); - - while ($row = $query->fetch()) { - if ($sql === null) { - $sql = sprintf('INSERT INTO %s VALUES ', $adapter->quoteIdentifier($tableName)); - } else { - $sql .= ','; - } - - $sql .= $this->_quoteRow($tableName, $row); - } - - if ($sql !== null) { - $sql .= ';' . "\n"; - } - - return $sql; - } - /** - * Return table data SQL insert - * - * @param string $tableName - * @return string - */ - public function getInsertSql($tableName) - { - return $this->getPartInsertSql($tableName); - } - /** - * Quote Table Row - * - * @param string $tableName - * @param array $row - * @return string - */ - protected function _quoteRow($tableName, array $row) - { - $adapter = $this->_getReadAdapter(); - $describe = $adapter->describeTable($tableName); - $dataTypes = ['bigint', 'mediumint', 'smallint', 'tinyint']; - $rowData = []; - foreach ($row as $k => $v) { - if ($v === null) { - $value = 'NULL'; - } elseif (in_array(strtolower($describe[$k]['DATA_TYPE']), $dataTypes)) { - $value = $v; - } else { - $value = $adapter->quoteInto('?', $v); - } - $rowData[] = $value; - } - - return sprintf('(%s)', implode(',', $rowData)); - } - - /** - * Turn on serializable mode - */ - public function turnOnSerializableMode() - { - $this->_getReadAdapter()->query("SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE"); - } - - /** - * Turn on read committed mode - */ - public function turnOnReadCommittedMode() - { - $this->_getReadAdapter()->query("SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED"); - } -} diff --git a/app/code/core/Mage/Backup/etc/adminhtml.xml b/app/code/core/Mage/Backup/etc/adminhtml.xml deleted file mode 100644 index a4a09edfb29..00000000000 --- a/app/code/core/Mage/Backup/etc/adminhtml.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - Backups - adminhtml/system_backup - - - - - - - - - - - - - - - - Backups - - - Rollback - - - - - - - - - - - - diff --git a/app/code/core/Mage/Backup/etc/config.xml b/app/code/core/Mage/Backup/etc/config.xml deleted file mode 100644 index 43bac442572..00000000000 --- a/app/code/core/Mage/Backup/etc/config.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - 1.6.0.0 - - - - - - Mage_Backup_Model - backup_resource - - - Mage_Backup_Model_Resource - backup_mysql4 - - - - - - Mage_Backup - - - - - - - - - - Mage_Backup.csv - - - - - - - - - - backup/observer::scheduledBackup - - - - - diff --git a/app/code/core/Mage/Backup/etc/system.xml b/app/code/core/Mage/Backup/etc/system.xml deleted file mode 100644 index 5292dcecf8d..00000000000 --- a/app/code/core/Mage/Backup/etc/system.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - - - 500 - 1 - 0 - 0 - - - - select - adminhtml/system_config_source_yesno - 10 - 1 - 0 - 0 - - - - select - 1 - backup/config_source_type - 20 - 1 - 0 - 0 - - - - - select - 1 - adminhtml/system_config_source_cron_frequency - backup/config_backend_cron - 40 - 1 - 0 - 0 - - - - Put store on the maintenance mode while backup's creation - select - 1 - adminhtml/system_config_source_yesno - 50 - 1 - 0 - 0 - - - - - - - diff --git a/app/code/core/Mage/Core/Model/Config.php b/app/code/core/Mage/Core/Model/Config.php index 317a699bddd..d30c18fdd41 100644 --- a/app/code/core/Mage/Core/Model/Config.php +++ b/app/code/core/Mage/Core/Model/Config.php @@ -55,7 +55,7 @@ class Mage_Core_Model_Config extends Mage_Core_Model_Config_Base 'Mage_SalesRule' => 23, 'Mage_Usa' => 24, 'Mage_Paygate' => 25, - 'Mage_Backup' => 26, + 'Mage_Backup' => 26, # removed 'Mage_Checkout' => 27, 'Mage_Paypal' => 28, 'Mage_GoogleCheckout' => 29, diff --git a/app/design/adminhtml/default/default/template/backup/dialogs.phtml b/app/design/adminhtml/default/default/template/backup/dialogs.phtml deleted file mode 100644 index 1bf7b56ba0c..00000000000 --- a/app/design/adminhtml/default/default/template/backup/dialogs.phtml +++ /dev/null @@ -1,192 +0,0 @@ - - - - - - - - - - - -getUrl('*/*/rollback'); - $backupUrl = $this->getUrl('*/*/create'); -?> - - diff --git a/app/design/adminhtml/default/default/template/backup/left.phtml b/app/design/adminhtml/default/default/template/backup/left.phtml deleted file mode 100644 index 0bfbe241721..00000000000 --- a/app/design/adminhtml/default/default/template/backup/left.phtml +++ /dev/null @@ -1,21 +0,0 @@ - -

__('Create Backup') ?>

diff --git a/app/design/adminhtml/default/default/template/backup/list.phtml b/app/design/adminhtml/default/default/template/backup/list.phtml deleted file mode 100644 index e7843164858..00000000000 --- a/app/design/adminhtml/default/default/template/backup/list.phtml +++ /dev/null @@ -1,34 +0,0 @@ - -
- - - - - -

__('Backups') ?>

- getCreateSnapshotButtonHtml(); ?> - getCreateMediaBackupButtonHtml(); ?> - getCreateButtonHtml(); ?> -
-
-getGridHtml() ?> -getDialogsHtml() ?> diff --git a/app/etc/modules/Mage_Backup.xml b/app/etc/modules/Mage_Backup.xml deleted file mode 100644 index 5c059d2aa73..00000000000 --- a/app/etc/modules/Mage_Backup.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - false - core - - - - - - diff --git a/app/locale/en_US/Mage_Backup.csv b/app/locale/en_US/Mage_Backup.csv deleted file mode 100644 index be22b2b719d..00000000000 --- a/app/locale/en_US/Mage_Backup.csv +++ /dev/null @@ -1,55 +0,0 @@ -"Action","Action" -"An error occurred while creating the backup.","An error occurred while creating the backup." -"An error occurred while writing to the backup file ""%s"".","An error occurred while writing to the backup file ""%s""." -"Are you sure you want to delete the selected backup(s)?","Are you sure you want to delete the selected backup(s)?" -"Backup Type","Backup Type" -"Backup file ""%s"" cannot be read from or written to.","Backup file ""%s"" cannot be read from or written to." -"Backup file ""%s"" does not exist.","Backup file ""%s"" does not exist." -"Backup file does not exist.","Backup file does not exist." -"Backup file handler was unspecified.","Backup file handler was unspecified." -"Backup file not found","Backup file not found" -"Backup file path was not specified.","Backup file path was not specified." -"Backups","Backups" -"Cannot read backup file.","Cannot read backup file." -"Create Backup","Create Backup" -"Database","Database" -"Database Backup","Database Backup" -"Database and Media","Database and Media" -"Database and Media Backup","Database and Media Backup" -"Database was successfuly backed up.","Database was successfuly backed up." -"Download","Download" -"Enable Scheduled Backup","Enable Scheduled Backup" -"Failed to connect to FTP","Failed to connect to FTP" -"Failed to delete one or several backups.","Failed to delete one or several backups." -"Failed to rollback","Failed to rollback" -"Failed to validate FTP","Failed to validate FTP" -"Frequency","Frequency" -"Invalid Password.","Invalid Password." -"Maintenance Mode","Maintenance Mode" -"Name","Name" -"Not enough free space to create backup.","Not enough free space to create backup." -"Not enough permissions to create backup.","Not enough permissions to create backup." -"Not enough permissions to perform rollback","Not enough permissions to perform rollback" -"Please either unselect the ""Put store on the maintenance mode"" checkbox or update your permissions to proceed with the backup.""","Please either unselect the ""Put store on the maintenance mode"" checkbox or update your permissions to proceed with the backup.""" -"Please either unselect the ""Put store on the maintenance mode"" checkbox or update your permissions to proceed with the rollback.""","Please either unselect the ""Put store on the maintenance mode"" checkbox or update your permissions to proceed with the rollback.""" -"Put store on the maintenance mode while backup's creation","Put store on the maintenance mode while backup's creation" -"Rollback","Rollback" -"Scheduled Backup Settings","Scheduled Backup Settings" -"Size, Bytes","Size, Bytes" -"Start Time","Start Time" -"System","System" -"System (excluding Media)","System (excluding Media)" -"System Backup","System Backup" -"System couldn't put store on the maintenance mode","System couldn't put store on the maintenance mode" -"The database and media backup has been created.","The database and media backup has been created." -"The database backup has been created.","The database backup has been created." -"The file was compressed with Zlib, but this extension is not installed on server.","The file was compressed with Zlib, but this extension is not installed on server." -"The selected backup(s) has been deleted.","The selected backup(s) has been deleted." -"The system (excluding Media) backup has been created.","The system (excluding Media) backup has been created." -"The system backup has been created.","The system backup has been created." -"Time","Time" -"Type","Type" -"Unable to create backup. Please, try again later.","Unable to create backup. Please, try again later." -"Unable to save the cron expression.","Unable to save the cron expression." -"Wrong order of creation for new backup.","Wrong order of creation for new backup." -"You do not have sufficient permissions to enable Maintenance Mode during this operation.","You do not have sufficient permissions to enable Maintenance Mode during this operation." diff --git a/lib/Mage/Backup.php b/lib/Mage/Backup.php deleted file mode 100644 index 35e5f1f9bca..00000000000 --- a/lib/Mage/Backup.php +++ /dev/null @@ -1,54 +0,0 @@ - - */ -class Mage_Backup -{ - /** - * List of supported a backup types - * - * @var array - */ - protected static $_allowedBackupTypes = ['db', 'snapshot', 'filesystem', 'media', 'nomedia']; - - /** - * get Backup Instance By File Name - * - * @param string $type - * @return Mage_Backup_Db|Mage_Backup_Interface - */ - public static function getBackupInstance($type) - { - $class = 'Mage_Backup_' . ucfirst($type); - - if (!in_array($type, self::$_allowedBackupTypes) || !class_exists($class, true)) { - throw new Mage_Exception('Current implementation not supported this type (' . $type . ') of backup.'); - } - - return new $class(); - } -} diff --git a/lib/Mage/Backup/Abstract.php b/lib/Mage/Backup/Abstract.php deleted file mode 100644 index 28aedc371d6..00000000000 --- a/lib/Mage/Backup/Abstract.php +++ /dev/null @@ -1,311 +0,0 @@ - - */ -abstract class Mage_Backup_Abstract implements Mage_Backup_Interface -{ - /** - * Backup name - * - * @var string - */ - protected $_name; - - /** - * Backup creation date - * - * @var int - */ - protected $_time; - - /** - * Backup file extension - * - * @var string - */ - protected $_backupExtension; - - /** - * Resource model - * - * @var object - */ - protected $_resourceModel; - - /** - * Magento's root directory - * - * @var string - */ - protected $_rootDir; - - /** - * Path to directory where backups stored - * - * @var string - */ - protected $_backupsDir; - - /** - * Is last operation completed successfully - * - * @var bool - */ - protected $_lastOperationSucceed = false; - - /** - * Last failed operation error message - * - * @var string - */ - protected $_lastErrorMessage; - - /** - * Set Backup Extension - * - * @param string $backupExtension - * @return Mage_Backup_Interface - */ - public function setBackupExtension($backupExtension) - { - $this->_backupExtension = $backupExtension; - return $this; - } - - /** - * Get Backup Extension - * - * @return string - */ - public function getBackupExtension() - { - return $this->_backupExtension; - } - - /** - * Set Resource Model - * - * @param object $resourceModel - * @return Mage_Backup_Interface - */ - public function setResourceModel($resourceModel) - { - $this->_resourceModel = $resourceModel; - return $this; - } - - /** - * Get Resource Model - * - * @return object - */ - public function getResourceModel() - { - return $this->_resourceModel; - } - - /** - * Set Time - * - * @param int $time - * @return Mage_Backup_Interface - */ - public function setTime($time) - { - $this->_time = $time; - return $this; - } - - /** - * Get Time - * - * @return int - */ - public function getTime() - { - return $this->_time; - } - - /** - * Set root directory of Magento installation - * - * @param string $rootDir - * @throws Mage_Exception - * @return Mage_Backup_Interface - */ - public function setRootDir($rootDir) - { - if (!is_dir($rootDir)) { - throw new Mage_Exception('Bad root directory'); - } - - $this->_rootDir = $rootDir; - return $this; - } - - /** - * Get Magento's root directory - * @return string - */ - public function getRootDir() - { - return $this->_rootDir; - } - - /** - * Set path to directory where backups stored - * - * @param string $backupsDir - * @return Mage_Backup_Interface - */ - public function setBackupsDir($backupsDir) - { - $this->_backupsDir = $backupsDir; - return $this; - } - - /** - * Get path to directory where backups stored - * - * @return string - */ - public function getBackupsDir() - { - return $this->_backupsDir; - } - - /** - * Get path to backup - * - * @return string - */ - public function getBackupPath() - { - return $this->getBackupsDir() . DS . $this->getBackupFilename(); - } - - /** - * Get backup file name - * - * @return string - */ - public function getBackupFilename() - { - $filename = $this->getTime() . '_' . $this->getType(); - - $name = $this->getName(); - - if (!empty($name)) { - $filename .= '_' . $name; - } - - $filename .= '.' . $this->getBackupExtension(); - - return $filename; - } - - /** - * Check whether last operation completed successfully - * - * @return bool - */ - public function getIsSuccess() - { - return $this->_lastOperationSucceed; - } - - /** - * Get last error message - * - * @return string - */ - public function getErrorMessage() - { - return $this->_lastErrorMessage; - } - - /** - * Set error message - * - * @param string $errorMessage - */ - public function setErrorMessage($errorMessage) - { - $this->_lastErrorMessage = $errorMessage; - } - - /** - * Set backup name - * - * @param string $name - * @param bool $applyFilter - * @return Mage_Backup_Interface - */ - public function setName($name, $applyFilter = true) - { - if ($applyFilter) { - $name = $this->_filterName($name); - } - $this->_name = $name; - return $this; - } - - /** - * Get backup name - * - * @return string - */ - public function getName() - { - return $this->_name; - } - - /** - * Get backup display name - * - * @return string - */ - public function getDisplayName() - { - return str_replace('_', ' ', $this->_name); - } - - /** - * Removes disallowed characters and replaces spaces with underscores - * - * @param string $name - * @return string - */ - protected function _filterName($name) - { - $name = trim(preg_replace('/[^\da-zA-Z ]/', '', $name)); - $name = preg_replace('/\s{2,}/', ' ', $name); - $name = str_replace(' ', '_', $name); - - return $name; - } -} diff --git a/lib/Mage/Backup/Archive/Tar.php b/lib/Mage/Backup/Archive/Tar.php deleted file mode 100644 index 04a0748d157..00000000000 --- a/lib/Mage/Backup/Archive/Tar.php +++ /dev/null @@ -1,78 +0,0 @@ - - */ -class Mage_Backup_Archive_Tar extends Mage_Archive_Tar -{ - /** - * Filenames or filename parts that are used for filtering files - * - * @var array() - */ - protected $_skipFiles = []; - - /** - * Overridden Mage_Archive_Tar::_createTar method that does the same actions as it's parent but filters - * files using Mage_Backup_Filesystem_Iterator_Filter - * - * @see Mage_Archive_Tar::_createTar() - * @param bool $skipRoot - * @param bool $finalize - */ - protected function _createTar($skipRoot = false, $finalize = false) - { - $path = $this->_getCurrentFile(); - - $filesystemIterator = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($path), - RecursiveIteratorIterator::SELF_FIRST - ); - - $iterator = new Mage_Backup_Filesystem_Iterator_Filter($filesystemIterator, $this->_skipFiles); - - foreach ($iterator as $item) { - $this->_setCurrentFile($item->getPathname()); - $this->_packAndWriteCurrentFile(); - } - - if ($finalize) { - $this->_getWriter()->write(str_repeat("\0", self::TAR_BLOCK_SIZE * 12)); - } - } - - /** - * Set files that shouldn't be added to tarball - * - * @param array $skipFiles - * @return $this - */ - public function setSkipFiles(array $skipFiles) - { - $this->_skipFiles = $skipFiles; - return $this; - } -} diff --git a/lib/Mage/Backup/Db.php b/lib/Mage/Backup/Db.php deleted file mode 100644 index 9b2d60e592c..00000000000 --- a/lib/Mage/Backup/Db.php +++ /dev/null @@ -1,116 +0,0 @@ - - */ -class Mage_Backup_Db extends Mage_Backup_Abstract -{ - /** - * Implements Rollback functionality for Db - * - * @return bool - * - * @SuppressWarnings(PHPMD.ErrorControlOperator) - */ - public function rollback() - { - set_time_limit(0); - ignore_user_abort(true); - - $this->_lastOperationSucceed = false; - - $archiveManager = new Mage_Archive(); - $source = $archiveManager->unpack($this->getBackupPath(), $this->getBackupsDir()); - - $file = new Mage_Backup_Filesystem_Iterator_File($source); - foreach ($file as $statement) { - $this->getResourceModel()->runCommand($statement); - } - @unlink($source); - - $this->_lastOperationSucceed = true; - - return true; - } - - /** - * Checks whether the line is last in sql command - * - * @param $line - * @return bool - */ - protected function _isLineLastInCommand($line) - { - $cleanLine = trim($line); - $lineLength = strlen($cleanLine); - - $returnResult = false; - if ($lineLength > 0) { - $lastSymbolIndex = $lineLength - 1; - if ($cleanLine[$lastSymbolIndex] == ';') { - $returnResult = true; - } - } - - return $returnResult; - } - - /** - * Implements Create Backup functionality for Db - * - * @return bool - */ - public function create() - { - set_time_limit(0); - ignore_user_abort(true); - - $this->_lastOperationSucceed = false; - - $backup = Mage::getModel('backup/backup') - ->setTime($this->getTime()) - ->setType($this->getType()) - ->setPath($this->getBackupsDir()) - ->setName($this->getName()); - - $backupDb = Mage::getModel('backup/db'); - $backupDb->createBackup($backup); - - $this->_lastOperationSucceed = true; - - return true; - } - - /** - * Get Backup Type - * - * @return string - */ - public function getType() - { - return 'db'; - } -} diff --git a/lib/Mage/Backup/Exception.php b/lib/Mage/Backup/Exception.php deleted file mode 100644 index 0f28bd0be7e..00000000000 --- a/lib/Mage/Backup/Exception.php +++ /dev/null @@ -1,31 +0,0 @@ - - */ -class Mage_Backup_Exception extends Mage_Exception -{ -} diff --git a/lib/Mage/Backup/Exception/CantLoadSnapshot.php b/lib/Mage/Backup/Exception/CantLoadSnapshot.php deleted file mode 100644 index 6166df9c92b..00000000000 --- a/lib/Mage/Backup/Exception/CantLoadSnapshot.php +++ /dev/null @@ -1,31 +0,0 @@ - - */ -class Mage_Backup_Exception_CantLoadSnapshot extends Mage_Backup_Exception -{ -} diff --git a/lib/Mage/Backup/Exception/FtpConnectionFailed.php b/lib/Mage/Backup/Exception/FtpConnectionFailed.php deleted file mode 100644 index 03bc65a66a6..00000000000 --- a/lib/Mage/Backup/Exception/FtpConnectionFailed.php +++ /dev/null @@ -1,31 +0,0 @@ - - */ -class Mage_Backup_Exception_FtpConnectionFailed extends Mage_Backup_Exception -{ -} diff --git a/lib/Mage/Backup/Exception/FtpValidationFailed.php b/lib/Mage/Backup/Exception/FtpValidationFailed.php deleted file mode 100644 index 2c74749bbbe..00000000000 --- a/lib/Mage/Backup/Exception/FtpValidationFailed.php +++ /dev/null @@ -1,31 +0,0 @@ - - */ -class Mage_Backup_Exception_FtpValidationFailed extends Mage_Backup_Exception -{ -} diff --git a/lib/Mage/Backup/Exception/NotEnoughFreeSpace.php b/lib/Mage/Backup/Exception/NotEnoughFreeSpace.php deleted file mode 100644 index f4083cf8d61..00000000000 --- a/lib/Mage/Backup/Exception/NotEnoughFreeSpace.php +++ /dev/null @@ -1,31 +0,0 @@ - - */ -class Mage_Backup_Exception_NotEnoughFreeSpace extends Mage_Backup_Exception -{ -} diff --git a/lib/Mage/Backup/Exception/NotEnoughPermissions.php b/lib/Mage/Backup/Exception/NotEnoughPermissions.php deleted file mode 100644 index 28074cf0452..00000000000 --- a/lib/Mage/Backup/Exception/NotEnoughPermissions.php +++ /dev/null @@ -1,31 +0,0 @@ - - */ -class Mage_Backup_Exception_NotEnoughPermissions extends Mage_Backup_Exception -{ -} diff --git a/lib/Mage/Backup/Filesystem.php b/lib/Mage/Backup/Filesystem.php deleted file mode 100644 index 478a13b3e7c..00000000000 --- a/lib/Mage/Backup/Filesystem.php +++ /dev/null @@ -1,279 +0,0 @@ - - */ -class Mage_Backup_Filesystem extends Mage_Backup_Abstract -{ - /** - * Paths that ignored when creating or rolling back snapshot - * - * @var array - */ - protected $_ignorePaths = []; - - /** - * Whether use ftp account for rollback procedure - * - * @var bool - */ - protected $_useFtp = false; - - /** - * Ftp host - * - * @var string - */ - protected $_ftpHost; - - /** - * Ftp username - * - * @var string - */ - protected $_ftpUser; - - /** - * Password to ftp account - * - * @var string - */ - protected $_ftpPass; - - /** - * Ftp path to Magento installation - * - * @var string - */ - protected $_ftpPath; - - /** - * Implementation Rollback functionality for Filesystem - * - * @throws Mage_Exception - */ - public function rollback() - { - $this->_lastOperationSucceed = false; - - set_time_limit(0); - ignore_user_abort(true); - - $rollbackWorker = $this->_useFtp ? new Mage_Backup_Filesystem_Rollback_Ftp($this) - : new Mage_Backup_Filesystem_Rollback_Fs($this); - $rollbackWorker->run(); - - $this->_lastOperationSucceed = true; - } - - /** - * Implementation Create Backup functionality for Filesystem - * - * @throws Mage_Exception - * @return boolean - * - * @SuppressWarnings(PHPMD.ErrorControlOperator) - */ - public function create() - { - set_time_limit(0); - ignore_user_abort(true); - - $this->_lastOperationSucceed = false; - - $this->_checkBackupsDir(); - - $fsHelper = new Mage_Backup_Filesystem_Helper(); - - $filesInfo = $fsHelper->getInfo( - $this->getRootDir(), - Mage_Backup_Filesystem_Helper::INFO_READABLE | Mage_Backup_Filesystem_Helper::INFO_SIZE, - $this->getIgnorePaths() - ); - - if (!$filesInfo['readable']) { - throw new Mage_Backup_Exception_NotEnoughPermissions('Not enough permissions to read files for backup'); - } - - $freeSpace = disk_free_space($this->getBackupsDir()); - - if (2 * $filesInfo['size'] > $freeSpace) { - throw new Mage_Backup_Exception_NotEnoughFreeSpace('Not enough free space to create backup'); - } - - $tarTmpPath = $this->_getTarTmpPath(); - - $tarPacker = new Mage_Backup_Archive_Tar(); - $tarPacker->setSkipFiles($this->getIgnorePaths()) - ->pack($this->getRootDir(), $tarTmpPath, true); - - if (!is_file($tarTmpPath) || filesize($tarTmpPath) == 0) { - throw new Mage_Exception('Failed to create backup'); - } - - $backupPath = $this->getBackupPath(); - - $gzPacker = new Mage_Archive_Gz(); - $gzPacker->pack($tarTmpPath, $backupPath); - - if (!is_file($backupPath) || filesize($backupPath) == 0) { - throw new Mage_Exception('Failed to create backup'); - } - - @unlink($tarTmpPath); - - $this->_lastOperationSucceed = true; - } - - /** - * Force class to use ftp for rollback procedure - * - * @param string $host - * @param string $username - * @param string $password - * @param string $path - * @return Mage_Backup_Filesystem - */ - public function setUseFtp($host, $username, $password, $path) - { - $this->_useFtp = true; - $this->_ftpHost = $host; - $this->_ftpUser = $username; - $this->_ftpPass = $password; - $this->_ftpPath = $path; - return $this; - } - - /** - * Get backup type - * - * @see Mage_Backup_Interface::getType() - * @return string - */ - public function getType() - { - return 'filesystem'; - } - - /** - * Add path that should be ignoring when creating or rolling back backup - * - * @param string|array $paths - * @return Mage_Backup_Filesystem - */ - public function addIgnorePaths($paths) - { - if (is_string($paths)) { - if (!in_array($paths, $this->_ignorePaths)) { - $this->_ignorePaths[] = $paths; - } - } elseif (is_array($paths)) { - foreach ($paths as $path) { - $this->addIgnorePaths($path); - } - } - - return $this; - } - - /** - * Get paths that should be ignored while creating or rolling back backup procedure - * - * @return array - */ - public function getIgnorePaths() - { - return $this->_ignorePaths; - } - - /** - * Set directory where backups saved and add it to ignore paths - * - * @see Mage_Backup_Abstract::setBackupsDir() - * @param string $backupsDir - * @return Mage_Backup_Filesystem - */ - public function setBackupsDir($backupsDir) - { - parent::setBackupsDir($backupsDir); - $this->addIgnorePaths($backupsDir); - return $this; - } - - /** - * getter for $_ftpPath variable - * - * @return string - */ - public function getFtpPath() - { - return $this->_ftpPath; - } - - /** - * Get ftp connection string - * - * @return string - */ - public function getFtpConnectString() - { - return 'ftp://' . $this->_ftpUser . ':' . $this->_ftpPass . '@' . $this->_ftpHost . $this->_ftpPath; - } - - /** - * Check backups directory existance and whether it's writeable - * - * @throws Mage_Exception - */ - protected function _checkBackupsDir() - { - $backupsDir = $this->getBackupsDir(); - - if (!is_dir($backupsDir)) { - $backupsDirParentDirectory = basename($backupsDir); - - if (!is_writeable($backupsDirParentDirectory)) { - throw new Mage_Backup_Exception_NotEnoughPermissions('Cant create backups directory'); - } - - mkdir($backupsDir); - chmod($backupsDir, 0777); - } - - if (!is_writable($backupsDir)) { - throw new Mage_Backup_Exception_NotEnoughPermissions('Backups directory is not writeable'); - } - } - - /** - * Generate tmp name for tarball - */ - protected function _getTarTmpPath() - { - $tmpName = '~tmp-' . microtime(true) . '.tar'; - return $this->getBackupsDir() . DS . $tmpName; - } -} diff --git a/lib/Mage/Backup/Filesystem/Helper.php b/lib/Mage/Backup/Filesystem/Helper.php deleted file mode 100644 index befdbf54ba5..00000000000 --- a/lib/Mage/Backup/Filesystem/Helper.php +++ /dev/null @@ -1,140 +0,0 @@ - - */ -class Mage_Backup_Filesystem_Helper -{ - /** - * Constant can be used in getInfo() function as second parameter. - * Check whether directory and all files/sub directories are writable - * - * @const int - */ - public const INFO_WRITABLE = 1; - - /** - * Constant can be used in getInfo() function as second parameter. - * Check whether directory and all files/sub directories are readable - * - * @const int - */ - public const INFO_READABLE = 2; - - /** - * Constant can be used in getInfo() function as second parameter. - * Get directory size - * - * @const int - */ - public const INFO_SIZE = 4; - - /** - * Constant can be used in getInfo() function as second parameter. - * Combination of INFO_WRITABLE, INFO_READABLE, INFO_SIZE - * - * @const int - */ - public const INFO_ALL = 7; - - /** - * Recursively delete $path - * - * @param string $path - * @param array $skipPaths - * @param bool $removeRoot - * @throws Mage_Exception - * - * @SuppressWarnings(PHPMD.ErrorControlOperator) - */ - public function rm($path, $skipPaths = [], $removeRoot = false) - { - $filesystemIterator = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($path), - RecursiveIteratorIterator::CHILD_FIRST - ); - - $iterator = new Mage_Backup_Filesystem_Iterator_Filter($filesystemIterator, $skipPaths); - - foreach ($iterator as $item) { - $item->isDir() ? @rmdir($item->__toString()) : @unlink($item->__toString()); - } - - if ($removeRoot && is_dir($path)) { - @rmdir($path); - } - } - - /** - * Get information (readable, writable, size) about $path - * - * @param string $path - * @param int $infoOptions - * @param array $skipFiles - */ - public function getInfo($path, $infoOptions = self::INFO_ALL, $skipFiles = []) - { - $info = []; - if ($infoOptions & self::INFO_READABLE) { - $info['readable'] = true; - } - - if ($infoOptions & self::INFO_WRITABLE) { - $info['writable'] = true; - } - - if ($infoOptions & self::INFO_SIZE) { - $info['size'] = 0; - } - - $filesystemIterator = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($path), - RecursiveIteratorIterator::CHILD_FIRST - ); - - $iterator = new Mage_Backup_Filesystem_Iterator_Filter($filesystemIterator, $skipFiles); - - foreach ($iterator as $item) { - if ($item->isLink()) { - continue; - } - - if (($infoOptions & self::INFO_WRITABLE) && !$item->isWritable()) { - $info['writable'] = false; - } - - if (($infoOptions & self::INFO_READABLE) && !$item->isReadable()) { - $info['readable'] = false; - } - - if ($infoOptions & self::INFO_SIZE && !$item->isDir()) { - $info['size'] += $item->getSize(); - } - } - - return $info; - } -} diff --git a/lib/Mage/Backup/Filesystem/Iterator/File.php b/lib/Mage/Backup/Filesystem/Iterator/File.php deleted file mode 100644 index 08fce42e543..00000000000 --- a/lib/Mage/Backup/Filesystem/Iterator/File.php +++ /dev/null @@ -1,109 +0,0 @@ - - */ -class Mage_Backup_Filesystem_Iterator_File extends SplFileObject -{ - /** - * The statement that was last read during iteration - * - * @var string - */ - protected $_currentStatement = ''; - - /** - * Return current sql statement - * - * @return string - */ - #[ReturnTypeWillChange] - public function current() - { - return $this->_currentStatement; - } - - /** - * Iterate to next sql statement in file - */ - #[ReturnTypeWillChange] - public function next() - { - $this->_currentStatement = ''; - while (!$this->eof()) { - $line = $this->fgets(); - if (strlen(trim($line))) { - $this->_currentStatement .= $line; - if ($this->_isLineLastInCommand($line)) { - break; - } - } - } - } - - /** - * Return to first statement - */ - #[ReturnTypeWillChange] - public function rewind() - { - parent::rewind(); - $this->next(); - } - - /** - * Check whether provided string is comment - * - * @param string $line - * @return bool - */ - protected function _isComment($line) - { - return $line[0] == '#' || substr($line, 0, 2) == '--'; - } - - /** - * Check is line a last in sql command - * - * @param string $line - * @return bool - */ - protected function _isLineLastInCommand($line) - { - $cleanLine = trim($line); - $lineLength = strlen($cleanLine); - - $returnResult = false; - if ($lineLength > 0) { - $lastSymbolIndex = $lineLength - 1; - if ($cleanLine[$lastSymbolIndex] == ';') { - $returnResult = true; - } - } - - return $returnResult; - } -} diff --git a/lib/Mage/Backup/Filesystem/Iterator/Filter.php b/lib/Mage/Backup/Filesystem/Iterator/Filter.php deleted file mode 100644 index 03355c96607..00000000000 --- a/lib/Mage/Backup/Filesystem/Iterator/Filter.php +++ /dev/null @@ -1,73 +0,0 @@ - - */ -class Mage_Backup_Filesystem_Iterator_Filter extends FilterIterator -{ - /** - * Array that is used for filtering - * - * @var array - */ - protected $_filters; - - /** - * Constructor - * - * @param Iterator $iterator - * @param array $filters list of files to skip - */ - public function __construct(Iterator $iterator, array $filters) - { - parent::__construct($iterator); - $this->_filters = $filters; - } - - /** - * Check whether the current element of the iterator is acceptable - * - * @return bool - */ - #[ReturnTypeWillChange] - public function accept() - { - $current = $this->current()->__toString(); - $currentFilename = $this->current()->getFilename(); - - if ($currentFilename == '.' || $currentFilename == '..') { - return false; - } - - foreach ($this->_filters as $filter) { - if (false !== strpos($current, $filter)) { - return false; - } - } - - return true; - } -} diff --git a/lib/Mage/Backup/Filesystem/Rollback/Abstract.php b/lib/Mage/Backup/Filesystem/Rollback/Abstract.php deleted file mode 100644 index aa5e13d6c48..00000000000 --- a/lib/Mage/Backup/Filesystem/Rollback/Abstract.php +++ /dev/null @@ -1,52 +0,0 @@ - - */ -abstract class Mage_Backup_Filesystem_Rollback_Abstract -{ - /** - * Snapshot object - * - * @var Mage_Backup_Filesystem - */ - protected $_snapshot; - - /** - * Default worker constructor - * - * @param Mage_Backup_Filesystem $snapshotObject - */ - public function __construct(Mage_Backup_Filesystem $snapshotObject) - { - $this->_snapshot = $snapshotObject; - } - - /** - * Main worker's function that makes files rollback - */ - abstract public function run(); -} diff --git a/lib/Mage/Backup/Filesystem/Rollback/Fs.php b/lib/Mage/Backup/Filesystem/Rollback/Fs.php deleted file mode 100644 index f262d3bcbd3..00000000000 --- a/lib/Mage/Backup/Filesystem/Rollback/Fs.php +++ /dev/null @@ -1,73 +0,0 @@ - - */ -class Mage_Backup_Filesystem_Rollback_Fs extends Mage_Backup_Filesystem_Rollback_Abstract -{ - /** - * Files rollback implementation via local filesystem - * - * @see Mage_Backup_Filesystem_Rollback_Abstract::run() - * @throws Mage_Exception - */ - public function run() - { - $snapshotPath = $this->_snapshot->getBackupPath(); - - if (!is_file($snapshotPath) || !is_readable($snapshotPath)) { - throw new Mage_Backup_Exception_CantLoadSnapshot('Cant load snapshot archive'); - } - - $fsHelper = new Mage_Backup_Filesystem_Helper(); - - $filesInfo = $fsHelper->getInfo( - $this->_snapshot->getRootDir(), - Mage_Backup_Filesystem_Helper::INFO_WRITABLE, - $this->_snapshot->getIgnorePaths() - ); - - if (!$filesInfo['writable']) { - throw new Mage_Backup_Exception_NotEnoughPermissions( - 'Unable to make rollback because not all files are writable' - ); - } - - $archiver = new Mage_Archive(); - - /** - * we need these fake initializations because all magento's files in filesystem will be deleted and autoloader - * wont be able to load classes that we need for unpacking - */ - new Mage_Archive_Tar(); - new Mage_Archive_Gz(); - new Mage_Archive_Helper_File(''); - new Mage_Archive_Helper_File_Gz(''); - - $fsHelper->rm($this->_snapshot->getRootDir(), $this->_snapshot->getIgnorePaths()); - $archiver->unpack($snapshotPath, $this->_snapshot->getRootDir()); - } -} diff --git a/lib/Mage/Backup/Filesystem/Rollback/Ftp.php b/lib/Mage/Backup/Filesystem/Rollback/Ftp.php deleted file mode 100644 index 60d3f266bef..00000000000 --- a/lib/Mage/Backup/Filesystem/Rollback/Ftp.php +++ /dev/null @@ -1,199 +0,0 @@ - - */ -class Mage_Backup_Filesystem_Rollback_Ftp extends Mage_Backup_Filesystem_Rollback_Abstract -{ - /** - * Ftp client - * - * @var Mage_System_Ftp - */ - protected $_ftpClient; - - /** - * Files rollback implementation via ftp - * - * @see Mage_Backup_Filesystem_Rollback_Abstract::run() - * @throws Mage_Exception - */ - public function run() - { - $snapshotPath = $this->_snapshot->getBackupPath(); - - if (!is_file($snapshotPath) || !is_readable($snapshotPath)) { - throw new Mage_Backup_Exception_CantLoadSnapshot('Cant load snapshot archive'); - } - - $this->_initFtpClient(); - $this->_validateFtp(); - - $tmpDir = $this->_createTmpDir(); - $this->_unpackSnapshot($tmpDir); - - $fsHelper = new Mage_Backup_Filesystem_Helper(); - - $this->_cleanupFtp(); - $this->_uploadBackupToFtp($tmpDir); - - $fsHelper->rm($tmpDir, [], true); - } - - /** - * Initialize ftp client and connect to ftp - * - * @throws Mage_Backup_Exception_FtpConnectionFailed - */ - protected function _initFtpClient() - { - try { - $this->_ftpClient = new Mage_System_Ftp(); - $this->_ftpClient->connect($this->_snapshot->getFtpConnectString()); - } catch (Exception $e) { - throw new Mage_Backup_Exception_FtpConnectionFailed($e->getMessage()); - } - } - - /** - * Perform ftp validation. Check whether ftp account provided points to current magento installation - * - * @throws Mage_Exception - * - * @SuppressWarnings(PHPMD.ErrorControlOperator) - */ - protected function _validateFtp() - { - $validationFilename = '~validation-' . microtime(true) . '.tmp'; - $validationFilePath = $this->_snapshot->getBackupsDir() . DS . $validationFilename; - - $fh = @fopen($validationFilePath, 'w'); - @fclose($fh); - - if (!is_file($validationFilePath)) { - throw new Mage_Exception('Unable to validate ftp account'); - } - - $rootDir = $this->_snapshot->getRootDir(); - $ftpPath = $this->_snapshot->getFtpPath() . DS . str_replace($rootDir, '', $validationFilePath); - - $fileExistsOnFtp = $this->_ftpClient->fileExists($ftpPath); - @unlink($validationFilePath); - - if (!$fileExistsOnFtp) { - throw new Mage_Backup_Exception_FtpValidationFailed('Failed to validate ftp account'); - } - } - - /** - * Unpack snapshot - * - * @param string $tmpDir - */ - protected function _unpackSnapshot($tmpDir) - { - $snapshotPath = $this->_snapshot->getBackupPath(); - - $archiver = new Mage_Archive(); - $archiver->unpack($snapshotPath, $tmpDir); - } - - /** - * @throws Mage_Exception - * @return string - * - * @SuppressWarnings(PHPMD.ErrorControlOperator) - */ - protected function _createTmpDir() - { - $tmpDir = $this->_snapshot->getBackupsDir() . DS . '~tmp-' . microtime(true); - - $result = @mkdir($tmpDir); - - if (false === $result) { - throw new Mage_Backup_Exception_NotEnoughPermissions('Failed to create directory ' . $tmpDir); - } - - return $tmpDir; - } - - /** - * Delete magento and all files from ftp - */ - protected function _cleanupFtp() - { - $rootDir = $this->_snapshot->getRootDir(); - - $filesystemIterator = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($rootDir), - RecursiveIteratorIterator::CHILD_FIRST - ); - - $iterator = new Mage_Backup_Filesystem_Iterator_Filter($filesystemIterator, $this->_snapshot->getIgnorePaths()); - - foreach ($iterator as $item) { - $ftpPath = $this->_snapshot->getFtpPath() . DS . str_replace($rootDir, '', $item->__toString()); - $ftpPath = str_replace(DS, '/', $ftpPath); - - $this->_ftpClient->delete($ftpPath); - } - } - - /** - * Perform files rollback - * - * @param string $tmpDir - * @throws Mage_Exception - */ - protected function _uploadBackupToFtp($tmpDir) - { - $filesystemIterator = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($tmpDir), - RecursiveIteratorIterator::SELF_FIRST - ); - - $iterator = new Mage_Backup_Filesystem_Iterator_Filter($filesystemIterator, $this->_snapshot->getIgnorePaths()); - - foreach ($filesystemIterator as $item) { - $ftpPath = $this->_snapshot->getFtpPath() . DS . str_replace($tmpDir, '', $item->__toString()); - $ftpPath = str_replace(DS, '/', $ftpPath); - - if ($item->isLink()) { - continue; - } - - if ($item->isDir()) { - $this->_ftpClient->mkdirRecursive($ftpPath); - } else { - $result = $this->_ftpClient->put($ftpPath, $item->__toString()); - if (false === $result) { - throw new Mage_Backup_Exception_NotEnoughPermissions('Failed to upload file ' - . $item->__toString() . ' to ftp'); - } - } - } - } -} diff --git a/lib/Mage/Backup/Interface.php b/lib/Mage/Backup/Interface.php deleted file mode 100644 index ce83bb48207..00000000000 --- a/lib/Mage/Backup/Interface.php +++ /dev/null @@ -1,83 +0,0 @@ - - */ -interface Mage_Backup_Interface -{ - /** - * Create Backup - * - * @return boolean - */ - public function create(); - - /** - * Rollback Backup - * - * @return bool - */ - public function rollback(); - - /** - * Set Backup Extension - * - * @param string $backupExtension - * @return Mage_Backup_Interface - */ - public function setBackupExtension($backupExtension); - - /** - * Set Resource Model - * - * @param object $resourceModel - * @return Mage_Backup_Interface - */ - public function setResourceModel($resourceModel); - - /** - * Set Time - * - * @param int $time - * @return Mage_Backup_Interface - */ - public function setTime($time); - - /** - * Get Backup Type - * - * @return string - */ - public function getType(); - - /** - * Set path to directory where backups stored - * - * @param string $backupsDir - * @return Mage_Backup_Interface - */ - public function setBackupsDir($backupsDir); -} diff --git a/lib/Mage/Backup/Media.php b/lib/Mage/Backup/Media.php deleted file mode 100644 index 20aa5df08d2..00000000000 --- a/lib/Mage/Backup/Media.php +++ /dev/null @@ -1,94 +0,0 @@ - - */ -class Mage_Backup_Media extends Mage_Backup_Snapshot -{ - /** - * Implementation Rollback functionality for Snapshot - * - * @throws Mage_Exception - * @return bool - */ - public function rollback() - { - $this->_prepareIgnoreList(); - return parent::rollback(); - } - - /** - * Implementation Create Backup functionality for Snapshot - * - * @throws Mage_Exception - * @return bool - */ - public function create() - { - $this->_prepareIgnoreList(); - return parent::create(); - } - - /** - * Overlap getType - * - * @return string - * @see Mage_Backup_Interface::getType() - */ - public function getType() - { - return 'media'; - } - - /** - * Add all folders and files except media and db backup to ignore list - * - * @return Mage_Backup_Media - */ - protected function _prepareIgnoreList() - { - $iterator = new DirectoryIterator($this->getRootDir()); - - foreach ($iterator as $item) { - $filename = $item->getFilename(); - if (!in_array($filename, ['media', 'var'])) { - $this->addIgnorePaths($item->getPathname()); - } - } - - $iterator = new DirectoryIterator($this->getRootDir() . DS . 'var'); - $dbBackupFilename = $this->_getDbBackupManager()->getBackupFilename(); - - foreach ($iterator as $item) { - $filename = $item->getFilename(); - if ($filename != $dbBackupFilename) { - $this->addIgnorePaths($item->getPathname()); - } - } - - return $this; - } -} diff --git a/lib/Mage/Backup/Nomedia.php b/lib/Mage/Backup/Nomedia.php deleted file mode 100644 index 5d99190828c..00000000000 --- a/lib/Mage/Backup/Nomedia.php +++ /dev/null @@ -1,77 +0,0 @@ - - */ -class Mage_Backup_Nomedia extends Mage_Backup_Snapshot -{ - /** - * Implementation Rollback functionality for Snapshot - * - * @throws Mage_Exception - * @return bool - */ - public function rollback() - { - $this->_prepareIgnoreList(); - return parent::rollback(); - } - - /** - * Implementation Create Backup functionality for Snapshot - * - * @throws Mage_Exception - * @return bool - */ - public function create() - { - $this->_prepareIgnoreList(); - return parent::create(); - } - - /** - * Overlap getType - * - * @return string - * @see Mage_Backup_Interface::getType() - */ - public function getType() - { - return 'nomedia'; - } - - /** - * Add media folder to ignore list - * - * @return $this - */ - protected function _prepareIgnoreList() - { - $this->addIgnorePaths($this->getRootDir() . DS . 'media'); - - return $this; - } -} diff --git a/lib/Mage/Backup/Snapshot.php b/lib/Mage/Backup/Snapshot.php deleted file mode 100644 index c5dad888bd1..00000000000 --- a/lib/Mage/Backup/Snapshot.php +++ /dev/null @@ -1,138 +0,0 @@ - - */ -class Mage_Backup_Snapshot extends Mage_Backup_Filesystem -{ - /** - * Database backup manager - * - * @var Mage_Backup_Interface|Mage_Backup_Db|null - */ - protected $_dbBackupManager; - - /** - * Implementation Rollback functionality for Snapshot - * - * @throws Mage_Exception - * @return bool - */ - public function rollback() - { - $result = parent::rollback(); - - $this->_lastOperationSucceed = false; - - try { - $this->_getDbBackupManager()->rollback(); - } catch (Exception $e) { - $this->_removeDbBackup(); - throw $e; - } - - $this->_removeDbBackup(); - $this->_lastOperationSucceed = true; - - return $result; - } - - /** - * Implementation Create Backup functionality for Snapshot - * - * @throws Mage_Exception - * @return bool - */ - public function create() - { - $this->_getDbBackupManager()->create(); - - try { - $result = parent::create(); - } catch (Exception $e) { - $this->_removeDbBackup(); - throw $e; - } - - $this->_lastOperationSucceed = false; - $this->_removeDbBackup(); - $this->_lastOperationSucceed = true; - - return $result; - } - - /** - * Overlap getType - * - * @return string - * @see Mage_Backup_Interface::getType() - */ - public function getType() - { - return 'snapshot'; - } - - /** - * Create Db Instance - * - * @return Mage_Backup_Interface - */ - protected function _createDbBackupInstance() - { - return Mage_Backup::getBackupInstance(Mage_Backup_Helper_Data::TYPE_DB) - ->setBackupExtension(Mage::helper('backup')->getExtensionByType(Mage_Backup_Helper_Data::TYPE_DB)) - ->setTime($this->getTime()) - ->setBackupsDir(Mage::getBaseDir("var")) - ->setResourceModel($this->getResourceModel()); - } - - /** - * Get database backup manager - * - * @return Mage_Backup_Interface - */ - protected function _getDbBackupManager() - { - if (is_null($this->_dbBackupManager)) { - $this->_dbBackupManager = $this->_createDbBackupInstance(); - } - - return $this->_dbBackupManager; - } - - /** - * Remove Db backup after added it to the snapshot - * - * @return $this - * - * @SuppressWarnings(PHPMD.ErrorControlOperator) - */ - protected function _removeDbBackup() - { - @unlink($this->_getDbBackupManager()->getBackupPath()); - return $this; - } -} diff --git a/phpstan.dist.baseline.neon b/phpstan.dist.baseline.neon index b9afaa45e42..40a5dd17c06 100644 --- a/phpstan.dist.baseline.neon +++ b/phpstan.dist.baseline.neon @@ -7285,26 +7285,6 @@ parameters: count: 1 path: lib/Mage/Archive/Helper/File.php - - - message: "#^Method Mage_Backup_Filesystem\\:\\:create\\(\\) should return bool but return statement is missing\\.$#" - count: 1 - path: lib/Mage/Backup/Filesystem.php - - - - message: "#^Method Mage_Backup_Filesystem\\:\\:rollback\\(\\) should return bool but return statement is missing\\.$#" - count: 1 - path: lib/Mage/Backup/Filesystem.php - - - - message: "#^Call to an undefined method Mage_Backup_Interface\\:\\:getBackupFilename\\(\\)\\.$#" - count: 1 - path: lib/Mage/Backup/Media.php - - - - message: "#^Call to an undefined method Mage_Backup_Interface\\:\\:getBackupPath\\(\\)\\.$#" - count: 1 - path: lib/Mage/Backup/Snapshot.php - - message: "#^Negated boolean expression is always true\\.$#" count: 1