For clean log, shell script already exist in path-to-magento/shell directory:
php log.php Usage: php -f log.php -- [options] php -f log.php -- clean --days 1
php log.php Usage: php -f log.php -- [options] php -f log.php -- clean --days 1 clean Clean Logs --days Save log, days. (Minimum 1 day, if defined - ignoring system value) status Display statistics per log tables help This help
For clean Clean Logs --days Save log, days. (Minimum 1 daycache, if defined - ignoring system value) status Display statistics per log tables help Thisfollowing methods will help you to make a shell script:
// Clean js and css Mage::getModel('core/design_package')->cleanMergedJsCss(); Mage::dispatchEvent('clean_media_cache_after'); // product image Mage::getModel('catalog/product_image')->clearCache(); Mage::dispatchEvent('clean_catalog_images_cache_after'); // Get cache types Mage::app()->getCacheInstance()->getTypes() // Clean specific tags Mage::app()->cleanCache($tags); // dispatch event if you flush all cache tags Mage::app()->cleanCache($alltags); Mage::dispatchEvent('adminhtml_cache_flush_system');
For clean cache, following methods will help you to make a shell script: