diff --git a/modules/qlocleaner/qlocleaner.php b/modules/qlocleaner/qlocleaner.php
index c934346dd..adfe64e51 100644
--- a/modules/qlocleaner/qlocleaner.php
+++ b/modules/qlocleaner/qlocleaner.php
@@ -50,6 +50,28 @@ class QloCleaner extends Module
$this->secure_key = Tools::encrypt($this->name);
}
+ public function install()
+ {
+ if (!parent::install()
+ || !$this->registerHook('actionAdminControllerSetMedia')
+ ) {
+ return false;
+ }
+ return true;
+ }
+
+ public function hookActionAdminControllerSetMedia()
+ {
+ if (Tools::getValue('controller') == 'AdminModules'
+ && Tools::getValue('configure') == $this->name
+ ) {
+ Media::addJsDef(array(
+ 'confirm_txt' => $this->l('Are you sure, you want to perform the following action?')
+ ));
+ $this->context->controller->addJS($this->_path.'views/js/qlocleaner_config.js');
+ }
+ }
+
public function getContent()
{
$html = '
'.$this->l('Be really careful with this tool - There is no possible rollback!').'
';
@@ -61,6 +83,7 @@ class QloCleaner extends Module
} else {
$conf = $this->l('Nothing that need to be fixed please run database cleaning to clean your database');
}
+ Hook::exec('actionCleanData', array('method' => 'checkAndFix'));
$html .= $this->displayConfirmation($conf);
} elseif (Tools::isSubmit('submitCleanAndOptimize')) {
$logs = self::cleanAndOptimize();
@@ -70,12 +93,15 @@ class QloCleaner extends Module
} else {
$conf = $this->l('Nothing that need to be cleaned');
}
+ Hook::exec('actionCleanData', array('method' => 'cleanAndOptimize'));
$html .= $this->displayConfirmation($conf);
} elseif (Tools::getValue('submitTruncateCatalog') && Tools::getValue('checkTruncateCatalog')) {
self::truncate('catalog');
+ Hook::exec('actionCleanData', array('method' => 'catalog'));
$html .= $this->displayConfirmation($this->l('Catalog truncated successfuly, please run functional Integrity constraints to clean the database.'));
} elseif (Tools::getValue('submitTruncateSales') && Tools::getValue('checkTruncateSales')) {
self::truncate('sales');
+ Hook::exec('actionCleanData', array('method' => 'sales'));
$html .= $this->displayConfirmation($this->l('Orders and customers truncated successfuly, please run functional Integrity constraints to clean the database'));
}
@@ -244,6 +270,11 @@ class QloCleaner extends Module
}
}
+ Image::deleteAllImages(_PS_HOTEL_IMG_DIR_);
+ if (!file_exists(_PS_HOTEL_IMG_DIR_)) {
+ mkdir(_PS_HOTEL_IMG_DIR_);
+ }
+
// Delete qlo modules's images
QcCleanerHelper::deleteFolderImages(
_PS_MODULE_DIR_.'wkabouthotelblock/views/img/hotel_interior/'
@@ -314,21 +345,6 @@ class QloCleaner extends Module
}
}
- // Delete Qlo tables
- $query = 'DELETE FROM `'._DB_PREFIX_.'htl_order_refund_rules`';
- if (Db::getInstance()->Execute($query)) {
- if ($affected_rows = Db::getInstance()->Affected_Rows()) {
- $logs[$query] = $affected_rows;
- }
- }
-
- $query = 'DELETE FROM `'._DB_PREFIX_.'htl_order_refund_rules_lang`';
- if (Db::getInstance()->Execute($query)) {
- if ($affected_rows = Db::getInstance()->Affected_Rows()) {
- $logs[$query] = $affected_rows;
- }
- }
-
$parents = Db::getInstance()->ExecuteS('SELECT DISTINCT id_parent FROM '._DB_PREFIX_.'tab');
foreach ($parents as $parent) {
$children = Db::getInstance()->ExecuteS('SELECT id_tab FROM '._DB_PREFIX_.'tab WHERE id_parent = '.(int)$parent['id_parent'].' ORDER BY IF(class_name IN ("AdminHome", "AdminDashboard"), 1, 2), position ASC');
@@ -753,12 +769,7 @@ class QloCleaner extends Module
'customization_field',
'customization_field_lang',
'customized_data',
- 'feature',
- 'feature_lang',
'feature_product',
- 'feature_shop',
- 'feature_value',
- 'feature_value_lang',
'pack',
'search_index',
'search_word',
@@ -778,8 +789,6 @@ class QloCleaner extends Module
'htl_branch_info_lang',
'htl_image',
'htl_branch_features',
- 'htl_features',
- 'htl_features_lang',
'htl_advance_payment',
'htl_branch_refund_rules',
'htl_order_restrict_date',
@@ -845,6 +854,8 @@ class QloCleaner extends Module
'htl_room_type_service_product_order_detail',
'htl_room_type_service_product_cart_detail',
'htl_hotel_service_product_cart_detail',
+ 'htl_order_refund_rules',
+ 'htl_order_refund_rules_lang',
);
}
}
diff --git a/modules/qlocleaner/views/js/index.php b/modules/qlocleaner/views/js/index.php
new file mode 100644
index 000000000..16488e369
--- /dev/null
+++ b/modules/qlocleaner/views/js/index.php
@@ -0,0 +1,29 @@
+
+* @copyright Since 2010 Webkul IN
+* @license https://store.webkul.com/license.html
+*/
+
+header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
+header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
+
+header('Cache-Control: no-store, no-cache, must-revalidate');
+header('Cache-Control: post-check=0, pre-check=0', false);
+header('Pragma: no-cache');
+
+header('Location: ../');
+exit;
diff --git a/modules/qlocleaner/views/js/qlocleaner_config.js b/modules/qlocleaner/views/js/qlocleaner_config.js
new file mode 100644
index 000000000..ebd5ce3f4
--- /dev/null
+++ b/modules/qlocleaner/views/js/qlocleaner_config.js
@@ -0,0 +1,24 @@
+/**
+* Since 2010 Webkul.
+*
+* NOTICE OF LICENSE
+*
+* All right is reserved,
+* Please go through this link for complete license : https://store.webkul.com/license.html
+*
+* DISCLAIMER
+*
+* Do not edit or add to this file if you wish to upgrade this module to newer
+* versions in the future. If you wish to customize this module for your
+* needs please refer to https://store.webkul.com/customisation-guidelines/ for more information.
+*
+* @author Webkul IN
+* @copyright Since 2010 Webkul IN
+* @license https://store.webkul.com/license.html
+*/
+
+$(document).ready(function () {
+ $('#module_form').on('submit', function() {
+ return confirm(confirm_txt);
+ })
+});
\ No newline at end of file
diff --git a/modules/qlohotelreview/classes/QhrHotelReviewDb.php b/modules/qlohotelreview/classes/QhrHotelReviewDb.php
index de1b60694..d45ec4074 100644
--- a/modules/qlohotelreview/classes/QhrHotelReviewDb.php
+++ b/modules/qlohotelreview/classes/QhrHotelReviewDb.php
@@ -134,6 +134,20 @@ class QhrHotelReviewDb
);
}
+ public static function truncateUserData()
+ {
+ $userTables = array('qhr_hotel_review',
+ 'qhr_review_category_rating',
+ 'qhr_review_usefulness',
+ 'qhr_review_report',
+ 'qhr_review_reply'
+ );
+ foreach ($userTables as $table) {
+ DB::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.bqSQL($table).'`');
+ }
+ QhrHotelReview::cleanImagesDirectory();
+ }
+
public static function getModuleDefaultConfig()
{
return array(
diff --git a/modules/qlohotelreview/qlohotelreview.php b/modules/qlohotelreview/qlohotelreview.php
index 9bd269f98..e20a25ee1 100644
--- a/modules/qlohotelreview/qlohotelreview.php
+++ b/modules/qlohotelreview/qlohotelreview.php
@@ -72,6 +72,7 @@ class QloHotelReview extends Module
'displayBookingAction',
'displayBackOfficeHeader',
'displayAdminAfterHeader',
+ 'actionCleanData',
)
);
}
@@ -279,6 +280,13 @@ class QloHotelReview extends Module
return $this->display(__FILE__, 'product-tab-content.tpl');
}
+ public function hookActionCleanData($params)
+ {
+ if ($params['method'] == 'catalog' || $params['method'] == 'sales') {
+ QhrHotelReviewDb::truncateUserData();
+ }
+ }
+
public function installModuleTabs()
{
$tabs = array(
diff --git a/modules/wkhotelroom/classes/WkHotelRoomDb.php b/modules/wkhotelroom/classes/WkHotelRoomDb.php
index a21f82dae..740811ab9 100644
--- a/modules/wkhotelroom/classes/WkHotelRoomDb.php
+++ b/modules/wkhotelroom/classes/WkHotelRoomDb.php
@@ -56,4 +56,11 @@ class WkHotelRoomDb
`'._DB_PREFIX_.'htl_room_block_data`;
');
}
+
+ public static function truncateTables()
+ {
+ return DB::getInstance()->execute(
+ 'TRUNCATE TABLE `'._DB_PREFIX_.'htl_room_block_data`;
+ ');
+ }
}
diff --git a/modules/wkhotelroom/wkhotelroom.php b/modules/wkhotelroom/wkhotelroom.php
index 2df6101fd..ac5bbcc5c 100644
--- a/modules/wkhotelroom/wkhotelroom.php
+++ b/modules/wkhotelroom/wkhotelroom.php
@@ -141,6 +141,13 @@ class WkHotelRoom extends Module
}
}
+ public function hookActionCleanData($params)
+ {
+ if ($params['method'] == 'catalog') {
+ WkHotelRoomDb::truncateTables();
+ }
+ }
+
public function callInstallTab()
{
//Controllers which are to be used in this modules but we have not to create tab for those controllers...
@@ -198,7 +205,8 @@ class WkHotelRoom extends Module
'actionProductDelete',
'displayFooterExploreSectionHook',
'actionProductSave',
- 'actionObjectLanguageAddAfter'
+ 'actionObjectLanguageAddAfter',
+ 'actionCleanData',
)
);
}
@@ -220,7 +228,7 @@ class WkHotelRoom extends Module
}
return true;
}
-
+
public function deleteConfigKeys()
{
$configVars = array(