<?php

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

/**
 * Upgrade ciext module to version 3.0.0
 *
 * @author Igor Ratsun
 */
class Ciext_upgrade_1_1_13 extends Abstract_upgrade
{

    public function up()
    {
        $exception = APPPATH . 'core' . DIRECTORY_SEPARATOR . 'RT_Exceptions.php';
        if (!file_exists($exception)) {
            file_put_contents($exception, $this->get_exception_data());
        }

        return file_exists($exception) ? '3.0.0' : '1.1.13';
    }

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

    protected function get_exception_data()
    {
        return "<?php

(defined('BASEPATH')) OR exit('No direct script access allowed');

require_once 'vendor/ciext/ciext/third_party/application/core/RT_Exceptions.php';";
    }

}
