<?php
$xml = simplexml_load_file('./app/etc/local.xml', NULL, LIBXML_NOCDATA);
$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();
function clean_log_tables() {
global $db;
$tables = array(
'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',
'index_event',
'report_event',
'report_compared_product_index',
'report_viewed_product_index',
'catalog_compare_item',
'catalogindex_aggregation',
'catalogindex_aggregation_tag',
'catalogindex_aggregation_to_tag'
);
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.'`');
}
}
function clean_var_directory() {
$dirs = array(
'downloader/.cache/*',
'downloader/pearlib/cache/*',
'downloader/pearlib/download/*',
'var/cache/',
'var/locks/',
'var/log/',
'var/report/',
'var/session/',
'var/tmp/'
);
foreach($dirs as $v => $k) {
exec('rm -rf '.$k);
}
}
Wednesday, 17 April 2013
Log Clearing Script Magento
Sunday, 14 April 2013
Magento send emails using SMTP
In order to allow magento to use SMTP instead of the usual mail function, you need to take the below steps.
- Login to magento admin and go to. System->Configuration->Advanced->System->Mail Sending Settings
- Now here set the host value to your smtp host name like
mail.domain.com
- And then the default port is 25.
- Now you need to change magento file. Do not edit the core file as you will loose your change in an upgrade.
- So copy this file app/code/core/Mage/core/Model/Email/Template.php in to your local, by creating the same folder structure.
- Enable that module.
- Then in Template.php you will have to change the getMail() function as below.
public function getMail()
{
if (is_null($this->_mail)) {
/* changes begin */
$my_smtp_host = Mage::getStoreConfig('system/smtp/host');
$my_smtp_port = Mage::getStoreConfig('system/smtp/port');
$config = array(
'port' => $my_smtp_port,
'auth' => 'login',
'username' => 'email@domain.com',
'password' => 'yourpassword'
);
$transport = new Zend_Mail_Transport_Smtp($my_smtp_host, $config);
Zend_Mail::setDefaultTransport($transport);
/* Changes End */
$this->_mail = new Zend_Mail('utf-8');
}
return $this->_mail;
}
- After this clear your cache.
- Now magento will be able to send emails for you.
- Login to magento admin and go to. System->Configuration->Advanced->System->Mail Sending Settings
- Now here set the host value to your smtp host name like
mail.domain.com
- And then the default port is 25.
- Now you need to change magento file. Do not edit the core file as you will loose your change in an upgrade.
- So copy this file app/code/core/Mage/core/Model/Email/Template.php in to your local, by creating the same folder structure.
- Enable that module.
- Then in Template.php you will have to change the getMail() function as below.
public function getMail()
{
if (is_null($this->_mail)) {
/* changes begin */
$my_smtp_host = Mage::getStoreConfig('system/smtp/host');
$my_smtp_port = Mage::getStoreConfig('system/smtp/port');
$config = array(
'port' => $my_smtp_port,
'auth' => 'login',
'username' => 'email@domain.com',
'password' => 'yourpassword'
);
$transport = new Zend_Mail_Transport_Smtp($my_smtp_host, $config);
Zend_Mail::setDefaultTransport($transport);
/* Changes End */
$this->_mail = new Zend_Mail('utf-8');
}
return $this->_mail;
}
- After this clear your cache.
- Now magento will be able to send emails for you.
Friday, 12 April 2013
Thursday, 11 April 2013
Magento Community Edition (CE) 1.8 and Enterprise Edition (EE) 1.13 Released
Highlights
- Major overhaul of tax calculation formulas, correction of rounding errors, and additional assistance with configuration
- Most indexing processes now run only to update products, categories, URL redirects, and so on that have changed—eliminating the need for manual full reindexing
- Additional option of using Redis NoSQL for cache and session storage in multi-host deployments (recommended for new deployments)
- Full page caching now invalidates only pages that are affected by product or category changes
- Optimized cache adapters for single-server systems
- Elimination of many types of database deadlocks
http://www.magentocommerce.com/knowledge-base/entry/ce-18-and-ee-113-documentation-home
Tuesday, 9 April 2013
Friday, 5 April 2013
Disable Author pages in Wordpress
Open your theme’s functions.php and put this in:
/* Kill attachment, search, author, daily archive pages */ add_action('template_redirect', 'bwp_template_redirect'); function bwp_template_redirect() { global $wp_query, $post; if (is_author() || is_attachment() || is_day() || is_search()) { $wp_query->set_404(); } if (is_feed()) { $author = get_query_var('author_name'); $attachment = get_query_var('attachment'); $attachment = (empty($attachment)) ? get_query_var('attachment_id') : $attachment; $day = get_query_var('day'); $search = get_query_var('s'); if (!empty($author) || !empty($attachment) || !empty($day) || !empty($search)) { $wp_query->set_404(); $wp_query->is_feed = false; } } }
The snippet above will effectively disable attachment pages, search page, author pages and daily archive pages. Automatically generated feeds for those pages will also be disabled.
You can find more conditional tags at: http://codex.wordpress.org/Conditional_Tags
Source: http://betterwp.net/wordpress-tips/disable-some-wordpress-pages/
Wednesday, 3 April 2013
Subscribe to:
Posts (Atom)