<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}

/**
 * Upgrade ciext module to version 3.5.7
 *
 * @author Igor Ratsun
 */
class Ciext_upgrade_3_3_3 extends \Ciext\Migration\AbstractUpgrade
{

    public function up()
    {
        $ci = & get_instance();
        $ci->load->library('ciext/configurator');
        $system = new configurator('system');
        $s_data = $system->get_config();
        if (!empty($s_data['email_from'])) {
            $emailmng = new configurator('emailmng');
            $emailmng->set_config(array_merge($emailmng->get_config(), [
                'sender_email' => $s_data['email_from'],
            ]));
        }

        return '3.5.7';
    }

    public function down()
    {
        return '3.3.3';
    }

}
