예제 #1
0
?>
"
         aria-valuemin="0" aria-valuemax="100" style="width:<?php 
echo $percent;
?>
%">
        <?php 
echo $percent;
?>
% Completed
    </div>
</div>

<div id="btn-reset">
    <?php 
if (MigrateSteps::model()->count("status =" . MigrateSteps::STATUS_DONE) > 0) {
    $class = "btn btn-danger";
} else {
    $class = "btn btn-danger disabled";
}
?>
    <a href="<?php 
echo Yii::app()->createUrl("migrate/resetAll");
?>
" title="<?php 
echo Yii::t('frontend', 'Click to reset all steps.');
?>
" class="<?php 
echo $class;
?>
"><span class="glyphicon glyphicon-refresh"></span> <?php 
 public static function getMG1Version()
 {
     $ver = NULL;
     $step = MigrateSteps::model()->findByPk(1);
     if ($step) {
         $settings = (object) json_decode($step->migrated_data);
         $ver = $settings->mg1_version;
     }
     return $ver;
 }
 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}"));
 }