/ Published in: PHP
Save the file to the directory where Magento resides.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php # To use run with a url query string of clean=var (files) or clean=log (db tables) to clean. $db['host'] = $xml->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(); if(empty($_GET)) echo "To use run with a url query string of clean=var (files) or clean=log (db tables) to clean."; function clean_log_tables() { global $db; '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' ); foreach($tables as $v => $k) { } echo "All log tables have been cleaned."; } function clean_var_directory() { 'downloader/pearlib/cache/*', 'downloader/pearlib/download/*', 'var/cache/', 'var/log/', 'var/report/', 'var/session/', 'var/tmp/' ); foreach($dirs as $v => $k) { } echo "All log files have been cleaned."; } ?>
URL: http://www.crucialwebhost.com/kb/article/log-cache-maintenance-script/