search
Homephp教程PHP源码Magento 的文件和数据库维护脚本


global->resources->default_setup->connection->host;
	$db['name'] = $xml->global->resources->default_setup->connection->dbname;
	$db['user'] = $xml->global->resources->default_setup->connection->username;
	$db['pass'] = $xml->global->resources->default_setup->connection->password;
	$db['pref'] = $xml->global->resources->db->table_prefix;
 
	if($_GET['clean'] == 'log') clean_log_tables();
	if($_GET['clean'] == 'var') clean_var_directory();
 
	function clean_log_tables() 
	{
		global $db;
 
		$tables = array(
		'catalogindex_aggregation',
		'catalogindex_aggregation_tag',
		'catalogindex_aggregation_to_tag',
		'dataflow_batch_export',
		'dataflow_batch_import',
		'log_customer',
		'log_quote',
		'log_summary',
		'log_summary_type',
		'log_url',
		'log_url_info',
		'log_visitor',
		'log_visitor_info',
		'log_visitor_online',
		'report_event'
		);
 
		mysql_connect($db['host'], $db['user'], $db['pass']) or die(mysql_error());
		mysql_select_db($db['name']) or die(mysql_error());
 
		foreach($tables as $v => $k) {
			mysql_query('TRUNCATE `'.$db['pref'].$k.'`') or die(mysql_error());
		}
	}
 
	function clean_var_directory() 
	{
		$dirs = array(
		'downloader/pearlib/cache/*',
		'downloader/pearlib/download/*',
		'var/cache/',
		'var/log/',
		'var/report/',
		'var/session/',
		'var/tmp/'
		);
 
		foreach($dirs as $v => $k) {
			exec('rm -rf '.$k);
		}
	}
	clean_log_tables();
	clean_var_directory();
?>

                   

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools