<commit_before><?php

namespace App\Controller;
use App\Model\CharacterModel;
use App\Model\UserModel;
use Dero\Data\Factory;
use Dero\Core\BaseController;
use Dero\Core\Timing;

/**
 * Version controller
 * @author <NAME>
 * @package PennyAuction
 * @namespace App\Controller
 * @since 2014-10-08
 */

class VersionController extends BaseController
{
    public function __construct() {
        if( PHP_SAPI !== 'cli' )
        {
            header('Location: ' . $_SERVER[''] . '/error/404');
            exit;
        }
    }

    public function install()
    {
        $db = Factory::GetDataInterface('default');
        $oUserModel = new UserModel($db);

        echo "Creating tables...\n";
        try
        {
            Timing::start('user');
            $oRet = $oUserModel->CreateTable();
            if( $oRet->HasFailure() )
            {
                echo "Error on user table\n";
                var_dump($oRet);
                return;
            }
            Timing::end('user');

            if( !$oRet->HasFailure() )
            {
                echo "Tables created successfully.\n";
            }
        } catch (\Exception $e) {
            echo "Problem creating tables.\n";
            var_dump($e);
        }
    }

    public function upgrade()
    {
        $db = Factory::GetDataInterface('default');

        try {
            Timing::start('user');
            $oUserModel = new UserModel($db);
            $oRet = $oUserModel->VerifyTableDefinition();
            if( $oRet->HasFailure() )
            {
                echo "Error on user table\n";
                var_dump($oRet);
                return;
            }
            Timing::end('user');

            if( !$oRet->HasFailure() )
            {
                echo "Tables updated successfully.\n";
            }
        } catch (\Exception $e) {
            echo "Problem creating tables.\n";
            var_dump($e);
        }
    }
}<commit_msg>Updated version controller with auction and bid<commit_after><?php

namespace App\Controller;
use App\Model\AuctionModel;
use App\Model\UserModel;
use App\Model\BidModel;
use Dero\Data\Factory;
use Dero\Core\BaseController;
use Dero\Core\Timing;

/**
 * Version controller
 * @author <NAME>
 * @package PennyAuction
 * @namespace App\Controller
 * @since 2014-10-08
 */

class VersionController extends BaseController
{
    public function __construct() {
        if( PHP_SAPI !== 'cli' )
        {
            header('Location: ' . $_SERVER[''] . '/error/404');
            exit;
        }
    }

    public function install()
    {
        $db = Factory::GetDataInterface('default');

        echo "Creating tables...\n";
        try
        {
            Timing::start('user');
            $oUserModel = new UserModel($db);
            $oRet = $oUserModel->CreateTable();
            if( $oRet->HasFailure() )
            {
                echo "Error on user table\n";
                var_dump($oRet);
                return;
            }
            Timing::end('user');

            Timing::start('auction');
            $oAuctionModel = new AuctionModel($db);
            $oRet = $oAuctionModel->CreateTable();
            if( $oRet->HasFailure() )
            {
                echo "Error on auction table\n";
                var_dump($oRet);
                return;
            }
            Timing::end('auction');

            Timing::start('bid');
            $oBidModel = new BidModel($db);
            $oRet = $oBidModel->CreateTable();
            if( $oRet->HasFailure() )
            {
                echo "Error on bid table\n";
                var_dump($oRet);
                return;
            }
            Timing::end('bid');

            if( !$oRet->HasFailure() )
            {
                echo "Tables created successfully.\n";
            }
        } catch (\Exception $e) {
            echo "Problem creating tables.\n";
            var_dump($e);
        }
    }

    public function upgrade()
    {
        $db = Factory::GetDataInterface('default');

        try {
            Timing::start('user');
            $oUserModel = new UserModel($db);
            $oRet = $oUserModel->VerifyTableDefinition();
            if( $oRet->HasFailure() )
            {
                echo "Error on user table\n";
                var_dump($oRet);
                return;
            }
            Timing::end('user');

            Timing::start('auction');
            $oAuctionModel = new AuctionModel($db);
            $oRet = $oAuctionModel->VerifyTableDefinition();
            if( $oRet->HasFailure() )
            {
                echo "Error on auction table\n";
                var_dump($oRet);
                return;
            }
            Timing::end('auction');

            Timing::start('bid');
            $oBidModel = new BidModel($db);
            $oRet = $oBidModel->VerifyTableDefinition();
            if( $oRet->HasFailure() )
            {
                echo "Error on bid table\n";
                var_dump($oRet);
                return;
            }
            Timing::end('bid');

            if( !$oRet->HasFailure() )
            {
                echo "Tables updated successfully.\n";
            }
        } catch (\Exception $e) {
            echo "Problem creating tables.\n";
            var_dump($e);
        }
    }
}
{'fraction_non_alphanumeric': 0.1334706102583302, 'fraction_numerical': 0.0041183077499064025, 'mean_word_length': 1.4078413699864805, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4536667', 'n_tokens_mistral': 1514, 'n_tokens_neox': 1448, 'n_words': 296}