<?php
///////////////////////////////////////////////////////////////////////////////////////////////////////
// BotBanish 7.1.06
// Randem Systems: https://randemsystems.support
// Exports BotBanish Table Structures
// Date: 04/11/2026
//
// Based on SMF DumpDatabase.php
// 	This file has a single job - database backup.
//
//
//	void BotBanishDumpTables($info = array())
//		- Writes all of the database to file output.
//		- Uses gzip compression.
//		- May possibly time out in some cases.
//		- The data dumped depends on whether "structure", "indexes" and "data" are passed.
//		- How the data is dumped depends on whether "compressed" is passed and if gzip compression routines exist.
//		- The tables that will be dumped will contain "prefix"
//
//	$info = array(
//		'prefix' => 'botbanish',				// Table or partial name to search for
//		'data' => true,							// Include table data
//		'structure' => true,					// Include structure
//		'indexes' => true,						// Include indices
//		'compress' => true,						// Compress the file
//		'full' => false							// True if full database dump
//		'single' => false						// True if one file per table, otherwise all tables in one file
//		'location' => ''						// Full path location of where file should be stored
//		'timestamp' => time()					// String to be appended to the file
//	);
//
// NOTE; When debugging this application, any errors that are generated will be one or all of the
//       following locations: The output file (in HTML format), The php_error.log file or the
//       BotBanish error log in the BotBanish_Logs folder.
///////////////////////////////////////////////////////////////////////////////////////////////////////

	// If we are called via a POST / GET, perform all operations otherwise we were called by an INCLUDE / REQUIRE call
	// in that case we just load the functions so they can be called

	if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], 'BotBanish_DumpDatabase.php') !== false)
		BotBanish_Dump();

function BotBanish_Dump($row = array()) {

	global $BotBanishSettings;

	if (isset($_SERVER['BOTBANISH_SYSTEM']) && ($_SERVER['BOTBANISH_SYSTEM'] == 'SERVER')) {

		$self = substr($_SERVER['PHP_SELF'], strripos($_SERVER['PHP_SELF'], '/') + 1);
		$filename = realpath(str_ireplace($self, '../Include/BotBanish_PreInclude.php', $_SERVER['SCRIPT_FILENAME']));
		require_once $filename;

		if (isset($_POST['root'])) {

			chdir($_POST['root']);
			$boarddir = $_POST['root'];
		}

		if (isset($_POST['include']))
			require_once urldecode($_POST['include']);

	} else {

		if (!isset($BotBanishSettings['BOTBANISH_DIR'])) {

			$self = substr($_SERVER['PHP_SELF'], strripos($_SERVER['PHP_SELF'], '/') + 1);
			$filename = realpath(str_ireplace($self, '../Include/BotBanish_PreInclude.php', $_SERVER['SCRIPT_FILENAME']));

		} else {

			$filename = $BotBanishSettings['BOTBANISH_DIR'] . 'Include/BotBanish_PreInclude.php';
		}

		require_once $filename;
	}

	BotBanishSaveOverrideState();

	$row = empty($row) ? BotBanishGetPassedData() : $row;

	if (isset($row['info'])) {

		$tblinfo = BotBanishSafeUnserialize($row['info']);
		$info = BotBanishGetDumpInfo($tblinfo);

	} else {

		$info = array(
			'prefix' => '*',
			'data' => true,
			'structure' => true,
			'indexes' => true,
			'compress' => true,
			'full' => true,
			'single' => false,
			'location' => $BotBanishSettings['BOTBANISH_STATIC_BACKUPS_SQL_DIR'],
			'timestamp' => time(),
		);
	}

	$arr = BotBanishDumpTables($info);
	$ret = isset($arr['link']) ? $arr['link'] : false;

	BotBanishRestoreOverrideState();

	if (isset($_POST['action']) && ($_POST['action'] = 'botbanish_custom_download'))

		return $ret;
	else
		BotBanishReturnData($ret, true);
}

// Dumps the database or a table to a file.

function BotBanishDumpTables($tblinfo = array()) {

	if (empty($tblinfo)) return array();
	BotBanishSaveOverrideState();

	global $BotBanishSettings;

	$info = BotBanishSafeUnserialize($tblinfo);

	$BotBanish_Location = isset($info['location']) ? $info['location'] : $BotBanishSettings['BOTBANISH_STATIC_BACKUPS_SQL_DIR'];
	$BotBanish_Indexes = isset($info['indexes']) ? $info['indexes'] : false;
	$BotBanish_Structure = isset($info['structure']) ? $info['structure'] : false;
	$BotBanish_Data = isset($info['data']) ? $info['data'] : false;
	$BotBanish_Type = isset($info['full']) && $info['full'] ? 'Full' : 'Single';
	$BotBanish_Timestamp = isset($info['timestamp']) ? $info['timestamp'] : '';
	$GLOBALS['BotBanish_Compress'] = isset($info['compress']) ? $info['compress'] : false;

	// Attempt to stop from dying...
	
//	BotBanishSetMemoryLimit('256M');
	BotBanishSetExecutionLimit(600);	

	// If there is no compression avalible, override!!

	if (!function_exists('gzopen'))
		$GLOBALS['BotBanish_Compress'] = false;

	$extension = ($GLOBALS['BotBanish_Compress'] === true) ? '.sql.gz' : '.sql';
	
	// Need to turn off our error handler for the mkdir not to terminate program

	BotBanishRestoreErrorHandler();
	@mkdir($BotBanish_Location, 0777, true);
	BotBanishSetErrorHandler();
	
	$date = date_create();
	$dbInfo = BotBanishGetDatabaseInfo();

	$GLOBALS['BotBanish_Location'] = $BotBanish_Location;

	$schema_indexes = '';

	// SQL Dump Header.

	$header = '
-- ==========================================================
--
-- Database dump of tables in `' . $dbInfo['database'] . '`
-- Date: ' . BotBanishGetCorrectTime() . '
-- Program: BotBanish_Subs_DumpDatabase.php
-- Author: Randem Systems
-- System: ' . $BotBanishSettings['BOTBANISH_VERSION'] . '
--
-- ==========================================================

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
';

	$table_count = 0;
	$tables = BotBanishGetTableNames($info['prefix'], $info['single']);

	sort($tables);

	// Placing all tables in one file?

	if (!$info['single']) {

		$dbfilename = (empty($GLOBALS['BotBanish_Structure']) ? 'data' : (empty($BotBanish_Data) ? 'structure' : 'complete')) . '_' . date_format($date,'Y-m-d') . '_' . $BotBanish_Type . $extension;
		$GLOBALS['BotBanish_Filename'] = $dbInfo['database'] . '_' . $BotBanish_Timestamp . '_' . $dbfilename;
		BotBanishWriteData($header, false);
	}

	// Dump each table.

	foreach ($tables as $tableName)	{

		// If we are making one file per table

		if ($info['single']) {

			$GLOBALS['BotBanish_Filename'] = $tableName . $extension;
			BotBanishWriteData($header, false);
		}

		BotBanishExtendTime();
		$schema_modify = '';

		// If we are getting structures or indices we must run this routine
		// $schema_indexes is modified in place
		// Are we dumping the structures? Must get structure to prepare Indexes

		if ($BotBanish_Structure)
			BotBanishGetCreateSQL($tableName, $schema_indexes, $schema_modify, $dbInfo);

		// How about the data?

		if ($BotBanish_Data)
			BotBanishGetInsertSQL($tableName);

		if ($BotBanish_Indexes)
			BotBanishGetIndexSQL($tableName, $schema_modify, $schema_indexes);

		if ($info['single'])
			break;
	}

	// Place all indexing at the end to speed up inserts

	if ($BotBanish_Indexes)
		BotBanishGetIndexes($schema_indexes);

	$footer = '
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
';

	BotBanishWriteData($footer, true);

	if ($GLOBALS['BotBanish_Compress'] === true)
		gzclose($GLOBALS['BotBanish_FileHandle']);

	BotBanishCleanOutput();

	$download_link = $BotBanishSettings['BOTBANISH_INSTALL_URL'] . 'BotBanish_Data/Backups/SQL/' . $GLOBALS['BotBanish_Filename'];

	$arr = array(
		'link' => $download_link,
		'file' => $BotBanish_Location . $GLOBALS['BotBanish_Filename'],
	);

	BotBanishRestoreOverrideState();
	restore_error_handler();
	return $arr;
}

//============================================================================
// Get the schema (CREATE) for a table.
//============================================================================

function BotBanishGetCreateSQL($tableName, &$schema_indexes, &$schema_modify, $dbInfo) {

	global $BotBanishSettings;

	$heading =
		PHP_EOL .
		'-- ============================================================================' . PHP_EOL .
		'-- Table structure for table `' . $tableName . '`' . PHP_EOL .
		'-- ============================================================================' . PHP_EOL .
		PHP_EOL;

	BotBanishWriteData($heading, true);

	$updates = array();
	$schema_create = '';
	require_once $BotBanishSettings['BOTBANISH_SUBS_DIR'] . 'BotBanish_Subs_AdjustDatabase.php';

	BotBanishRecreateTable($tableName, $updates, $schema_modify, $dbInfo);

	foreach ($updates as $update)
		$schema_create = $schema_create .= $update . PHP_EOL;

	BotBanishWriteData($schema_create, true);
}

function BotBanishRecreateTable($table, &$updates, &$schema_modify, $dbInfo) {

	$sql = 'show create table `' . $table . '`';
	$rows = BotBanishExecuteSQL($sql, true, true);
	$row = BotBanishLimitReturn($rows);

	$updates = array();
	$updates[] = 'DROP TABLE IF EXISTS `' . $table . '`;';

	$lines = explode("\n", $row['Create Table']);

	// Remove the keys, we will add them later in the file

	$lines = array_filter($lines, 'BotBanishSQLKeyFilter');
	$new_lines = array_values($lines);

	// Find any extraneous data and remove it

	foreach ($new_lines as $key => $line) {

		if (stripos($line, 'ENGINE=') === false) {

			// Remove auto_increment from all other lines. will take care of this in an ALTER statement

			if (stripos($line, 'auto_increment') !== false)
				$new_lines[$key] = str_ireplace('auto_increment', '', $line);
		}

		// remove trailing comma

		if (stripos($line, 'ENGINE=') !== false) {

			$new_lines[$key - 1] = str_ireplace(',', '', $new_lines[$key - 1]);
			$arr = explode(' ', $line);

			// Remove auto_increment from engine line. We will be placing auto_increment in an ALTER statement

			foreach ($arr as $key_1 => $value) {

				if (stripos($value, 'auto_increment') !== false) {

					unset($arr[$key_1]);
					$new_lines[$key] = implode(' ', $arr);
					break;
				}
			}
		}
	}

	$updates[] = implode("\n", $new_lines) . ';';

	$sql = 'SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, COLLATION_NAME, COLUMN_DEFAULT, COLUMN_TYPE,
						DATA_TYPE, IS_NULLABLE, CHARACTER_SET_NAME, NUMERIC_PRECISION, DATETIME_PRECISION, EXTRA
				FROM INFORMATION_SCHEMA.COLUMNS
					WHERE TABLE_SCHEMA = "' . $dbInfo['database'] . '" AND TABLE_NAME = "' . $table . '" AND EXTRA <> ""
						ORDER BY ORDINAL_POSITION';

	$column_status = BotBanishExecuteSQL($sql, true, true);

	$schema_extra = '';

	foreach ($column_status as $row) {

		$arr = explode(' ', $row['COLUMN_TYPE']);
		$defined = isset($arr[1]) && !empty($arr[1]) ? strtoupper($arr[1]) : '';
		$type = trim($arr[0]) . ' ' . trim($defined);
		$collate = !empty($row['COLLATION_NAME']) ? ' COLLATE ' . $row['COLLATION_NAME'] : '';
		$extra = !empty($row['EXTRA']) ? ' ' . $row['EXTRA'] : '';

		$is_nullable = $row['IS_NULLABLE'] === 'YES' ? true : false;

		$default = '';

		$exclude = array('longtext', 'text');

		if (!in_array($row['COLUMN_TYPE'], $exclude) && stripos($row['EXTRA'], 'auto_increment') === false) {

			if ($row['COLUMN_DEFAULT'] === null) {

				if ($is_nullable)
					$default = ' DEFAULT NULL';

			} else {

				if ($row['COLUMN_DEFAULT'] !== null)
					$default = ' DEFAULT \'' . $row['COLUMN_DEFAULT'] . '\'';

				if (!$is_nullable)

					$default .= ' NOT NULL';
				else
					$default .= ' NULL';
			}
		}

		// Add extra indexing such as AUTO_INCREMENT

		if (stripos($extra, 'DEFAULT_GENERATED') === false)
			$schema_extra .= "\t" . 'MODIFY `' . $row['COLUMN_NAME'] . '` ' . $type . $collate . $default . $extra . ',' . PHP_EOL;
	}

	if (!empty($schema_extra))
		$schema_modify .= 'ALTER TABLE `' . $table . '`' . PHP_EOL . rtrim($schema_extra, PHP_EOL . ',') . ';' . PHP_EOL;
}

function BotBanishSQLKeyFilter($var) {

	$eliminate = array(' PRIMARY KEY ', ' UNIQUE KEY ', ' KEY ');

	foreach ($eliminate as $key => $value) {

		if (stripos($var, $value) !== false)
			return false;
	}

	return true;
}

//============================================================================
// Get the content (INSERTs) for a table.
//============================================================================

function BotBanishGetInsertSQL($tableName) {

	$heading =
		PHP_EOL .
		'-- ----------------------------------------------------------------------------' . PHP_EOL .
		'--' . PHP_EOL .
		'-- Dumping data in `' . $tableName . '`' . PHP_EOL .
		'--' . PHP_EOL .
		'-- ----------------------------------------------------------------------------' . PHP_EOL .
		PHP_EOL;

	// Write new file

	BotBanishWriteData($heading, true);

	$columns = BotBanishGetTableColumns($tableName);
	$dbInfo = BotBanishGetDatabaseInfo();
	$conn = new mysqli($dbInfo['server'], $dbInfo['username'], $dbInfo['password'], $dbInfo['database']);

	$sql = 'SELECT TABLE_ROWS FROM information_schema.PARTITIONS WHERE TABLE_SCHEMA = "' . $dbInfo['database'] . '" AND TABLE_NAME = "' . $tableName . '"';
	$rows = BotBanishExecuteSQL($sql);
	$row = BotBanishLimitReturn($rows);
	$totalRows = isset($row['TABLE_ROWS']) && !empty($row['TABLE_ROWS']) ? intval($row['TABLE_ROWS']) : 0;

	$sql = 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `' . $tableName . '`';
	$result = $conn->query($sql, MYSQLI_USE_RESULT);
	$current_row = 0;

	$rows_processed = 0;
	$data = '';
	$row = mysqli_fetch_array($result, MYSQLI_ASSOC);

	while (is_array($row)) {

		if (!is_array($row)) break;

		$current_row++;

		$params = BotBanishBuildSQLStatementInsert($row, $tableName, false, false);
		$sql = 'INSERT INTO `' . $tableName . '` (' . $params['columns'] . ') VALUES (' . $params['values'] . ')';
		$start_sql = str_replace(') VALUES (', ') VALUES' . PHP_EOL . '(', $sql);

		// 'Insert' the data.

		if ($current_row === 1) {

			$data = $start_sql;;

		} else {

			$findstr = 'VALUES (';
			$len = strlen($findstr);
			$x = strpos($sql, $findstr);
			$str = substr($sql, $x + $len - 1);
			$data = $str;
		}

		$rows_processed++;
		$row = mysqli_fetch_array($result, MYSQLI_ASSOC);

		if ((!is_array($row)) || ($current_row == 100)) {

			$data .= ';';
			$current_row = 0;

		} else {

			 $data .= ',';
		}

		BotBanishWriteData($data . PHP_EOL, true);
	}
}

//============================================================================
// Get the content (INDEXES) for all tables.
//============================================================================

function BotBanishGetIndexSQL($tableName, $schema_modify, &$schema_indexes) {

	$schema_alter1 = 'ALTER TABLE `' . $tableName . '`' . PHP_EOL ;
	$schema_alter2 = '	ADD %s (%s)%s' . PHP_EOL ;

	// Find the keys.
	$rows = BotBanishExecuteSQL('SHOW KEYS FROM `'. $tableName . '`', true);
	$indexes = array();

	if (empty($rows))
		return;

	foreach ($rows as $row)	{

		// Is this a primary key, unique index, or regular index?
		$row['Key_name'] = $row['Key_name'] == 'PRIMARY' ? 'PRIMARY KEY' : (empty($row['Non_unique']) ? 'UNIQUE KEY' : ($row['Comment'] == 'FULLTEXT' || (isset($row['Index_type']) && $row['Index_type'] == 'FULLTEXT') ? 'FULLTEXT ' : 'KEY ')) . '`' . $row['Key_name'] . '`';

		// Is this the first column in the index?
		if (empty($indexes[$row['Key_name']]))
			$indexes[$row['Key_name']] = array();

		// A sub part, like only indexing 15 characters of a varchar.
		if (!empty($row['Sub_part']))
			$indexes[$row['Key_name']][$row['Seq_in_index']] = '`' . $row['Column_name'] . '`(' . $row['Sub_part'] . ')';
		else
			$indexes[$row['Key_name']][$row['Seq_in_index']] = '`' . $row['Column_name'] . '`';
	}

	// Build the ALTER statement for the keys.

	$num_indexes = count($indexes);
	$j = 1;

	if ($num_indexes > 0)
		$schema_indexes .= sprintf($schema_alter1, $tableName);

	foreach ($indexes as $keyname => $columns) {

		// Ensure the columns are in proper order.
		ksort($columns);
		$schema_indexes .= sprintf($schema_alter2, $keyname, implode(',', $columns), $j == $num_indexes ? ';' : ',');
		$j++;
	}

	if (!empty($schema_modify))
		$schema_indexes .= PHP_EOL . $schema_modify . PHP_EOL;

	$schema_indexes .= PHP_EOL;
}

function BotBanishGetIndexes($schema_indexes) {

	$data = BotBanishGetDatabaseInfo();

	// No indexes to get - skip it.
	if (!empty($schema_indexes)) {

		$heading =
		PHP_EOL .
		'-- ----------------------------------------------------------------------------' . PHP_EOL .
		'--' . PHP_EOL .
		'-- Dumping indexes in `' . $data['database'] . '`' . PHP_EOL .
		'--' . PHP_EOL .
		'-- ----------------------------------------------------------------------------' . PHP_EOL .
		PHP_EOL;

		BotBanishWriteData($heading . $schema_indexes, true);
	}
}

function BotBanishWriteData($data, $append = false) {

	if ($GLOBALS['BotBanish_Compress'] === true) {

		if (!$append)
			$GLOBALS['BotBanish_FileHandle'] = gzopen($GLOBALS['BotBanish_Location'] . $GLOBALS['BotBanish_Filename'], 'w');

		gzwrite($GLOBALS['BotBanish_FileHandle'], $data);

	} else {

		BotBanishWriteFile($GLOBALS['BotBanish_Location'] . $GLOBALS['BotBanish_Filename'], $data, $append);
	}
}

function BotBanishDumpDatabase($tblinfo = array()) {

	global $BotBanishText;

	$info = BotBanishGetDumpInfo($tblinfo);

	$arr = BotBanishDumpTables($info);
	$str = $BotBanishText['BotBanishDumpTablesComplete'] . ' File - ' . $arr['file'];
	BotBanishAlert($str);
}

function BotBanishBackupTables($tableName, $compress = false, $timestamp = null) {

	if (empty($tableName))
		return;

	global $BotBanishSettings;

	$tblinfo = array(
		'prefix' => $tableName,
		'data' => true,
		'structure' => true,
		'indexes' => true,
		'compress' => $compress,
		'full' => false,
		'location' => $BotBanishSettings['BOTBANISH_STATIC_BACKUPS_SQL_DIR'],
		'filename' => true,
		'single' => true,
		'timestamp' => $timestamp,
	);

	BotBanishDumpTables($tblinfo);
}

function BotBanishGetDumpInfo($tblinfo) {

	global $BotBanishSettings;



	if (empty($tblinfo)) {

		$info = array(
			'prefix' => 'botbanish',
			'data' => true,
			'structure' => true,
			'indexes' => true,
			'compress' => true,
			'full' => true,
			'single' => false,
			'location' => $BotBanishSettings['BOTBANISH_STATIC_BACKUPS_SQL_DIR'],
			'filename' => true,
			'timestamp' => null,
		);

	} else {

		$info = array();
		$info['prefix'] = isset($tblinfo['prefix']) ? $tblinfo['prefix'] : 'botbanish';
		$info['data'] = isset($tblinfo['data']) ? $tblinfo['data'] : true;
		$info['structure'] = isset($tblinfo['structure']) ? $tblinfo['structure'] : true;
		$info['indexes'] = isset($tblinfo['indexes']) ? $tblinfo['indexes'] : true;
		$info['compress'] = isset($tblinfo['compress']) ? $tblinfo['compress'] : true;
		$info['full'] = isset($tblinfo['full']) ? $tblinfo['full'] : $false;
		$info['single'] = isset($tblinfo['single']) ? $tblinfo['single'] : $false;
		$info['location'] = isset($tblinfo['location']) ? $tblinfo['location'] : $BotBanishSettings['BOTBANISH_STATIC_BACKUP_SQL_DIR'];
		$info['filename'] = isset($tblinfo['filename']) ? $tblinfo['filename'] : true;
		$info['timestamp'] = isset($tblinfo['timestamp']) ? $tblinfo['timestamp'] : null;
	}

	return $info;
}

function BotBanishDumpMySQLDatabase($info) {

	global $BotBanishSettings;

	$date = date_create();
	$dbInfo = BotBanishGetDatabaseInfo();

	$BotBanish_Timestamp = isset($info['timestamp']) ? $info['timestamp'] : time();

	$gzip = isset($info['compress']) && ($info['compress'] === true) ? ' | gzip' : '';
	$extension = $gzip === true ? '.sql.gz' : '.zip';

	$temp_location = rtrim(realpath($_SERVER['DOCUMENT_ROOT'] . '/../tmp/') , '/') . '/';
	$location = (!isset($info['location']) || empty($info['location'])) ? $BotBanishSettings['BOTBANISH_STATIC_BACKUPS_SQL_DIR'] : rtrim($info['location'], '/') . '/';
	$dbfilename = $dbInfo['database'] . '_' . $BotBanish_Timestamp . '_' . '_FULL_' . date_format($date,'Y-m-d') . $extension;
	$filename_sql = $temp_location . $dbfilename;
	$suppress = ' 2>&1';

	$export = 'mysqldump -u ' . $dbInfo['username'] . ' -p ' . $dbInfo['password'] . ' -h ' . $dbInfo['server'] . ' ' . $dbInfo['database'] . $gzip . ' > ' . $filename_sql;
	$flag = exec($export);
}

function BotBanishBackupDatabase() {

	//////////////////////////////////////////////////////////////////////////////////////////////
	// Let's backup the database or table before we start; just in case of
	// install failure. If BotBanish installation fails for ANY reason you can take the backed up
	// tables and restore them to their original location to restore the system to it's prior state.
	// Now backup the database!!!
	// We must allow user to be able to completely recover from an installation failure
	//////////////////////////////////////////////////////////////////////////////////////////////

	global $BotBanishSettings;

	// If we already backed up the database today, don't do it again

	$date = date_create();
	$databaseFiles = glob($BotBanishSettings['BOTBANISH_STATIC_BACKUPS_SQL_DIR'] . '*' . date_format($date,'Y-m-d') . '*');
	if (($databaseFiles !== false) && !empty($databaseFiles)) return;

	require_once $BotBanishSettings['BOTBANISH_SUBS_DIR'] . 'BotBanish_Subs_AdjustDatabase.php';
	require_once $BotBanishSettings['BOTBANISH_SUBS_DIR'] . 'BotBanish_DumpDatabase.php';

	$tblinfo = array(
		'prefix' => '*',
		'data' => true,
		'structure' => true,
		'indexes' => true,
		'compress' => true,
		'full' => true,
		'single' => false,
		'location' => $BotBanishSettings['BOTBANISH_STATIC_BACKUPS_SQL_DIR'],
		'filename' => true,
		'timestamp' => time(),
	);

	BotBanishDumpTables($tblinfo);
}
?>