<?php
///////////////////////////////////////////////////////////////////////////////////////////////////////
// BotBanish 7.0.00
// Randem Systems: https://randemsystems.support
// BotBanish Database / Table Backup Routines
// Date: 09/05/2025
//
///////////////////////////////////////////////////////////////////////////////////////////////////////

function BotBanish_BackupDatabase() {

	global $BotBanishSettings;
	
	$url = $BotBanishSettings['BOTBANISH_INSTALL_URL'] . 'Subs/BotBanish_DumpDatabase.php';

	$download_link_Before = BotBanishGetCorrectTime() . ' - ' . BotBanishSendPostData($url, $info . $include . $root);

	return $download_link_Before;
}

function BotBanish_BackupTables() {

	// Backup some tables, if needed

	if (defined('SMF')) {

		$type = defined('SMF') ? 'SMF' : '';
		$type = empty($type) && defined('ABSPATH') ? 'WORDPRESS' : $type;
		$tables = array();

		switch ($type) {

			case 'SMF':

				global $db_prefix;
				$tables = array($db_prefix . 'settings', $db_prefix . 'log_packages');
				break;

			case 'WORDPRESS':

				global $table_prefix;
				$tables = array($table_prefix . 'options');
				break;
		}

		foreach ($tables as $table)
			BotBanish_DumpSingleTable($table);
	}
}
?>