public function actionReset() { $stepIndex = Yii::app()->request->getParam('step', 1); $step = MigrateSteps::model()->findByPk($stepIndex); if ($step) { $dataPath = Yii::app()->basePath . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR; $resetSQLFile = $dataPath . "step{$stepIndex}_reset.sql"; if (file_exists($resetSQLFile)) { $rs = MigrateSteps::executeFile($resetSQLFile); if ($rs) { if ($stepIndex == 4) { //delete url related data in url_rewrite table and catalog_url_rewrite_product_category table Mage2UrlRewrite::model()->deleteAll("entity_type = 'category'"); } if ($stepIndex == 5) { //delete url related data in url_rewrite table and catalog_url_rewrite_product_category table Mage2UrlRewrite::model()->deleteAll("entity_type = 'product'"); } //reset step status $step->status = MigrateSteps::STATUS_NOT_DONE; $step->migrated_data = null; $step->update(); } } } $this->redirect(array("step{$stepIndex}")); }