<?php
/********************************************************************************
 * (c)1337 aheadware.com - All rights reserved
 ********************************************************************************/
include_once 'build_inc.php';

require_once __DIR__ . '/../../src/server/config/boot_global.php';
require_once __DIR__ . '/../../src/server/config/boot_local.php';

function task_truncateDBLocal() {

    // Array of DBs
    $dbs = array(
        TB_Shared_Db_Core::get(),
        TB_Shared_Db_TeamData::get()
    );

    foreach( $dbs as $db ) {
        debug( "Processing " . $db->name . "..." );
        $result = $db->query( 'SHOW TABLES' );
        $tables = array();
        while ( $row = $result->fetch( PDO::FETCH_NUM ) ) {
            debug( 'Truncate table ' . $row[0] . '...' );
            $sql = 'TRUNCATE TABLE ' . $row[0];
            $db->query( $sql );
        }
    }
}

task_truncateDBLocal();