Skip to content

Instantly share code, notes, and snippets.

erfanimani / prepare-magento-deployment
Last active Jun 5, 2016
Prepare Magento deployment hook for (Install Composer Dependencies - After)
View prepare-magento-deployment
cd {{project}}
mkdir -p storage/media
mkdir -p storage/var
chmod -fR g+w storage || true
cp -rTv {{release}}/docroot/media/ storage/media/
cp -rTv {{release}}/docroot/var/ storage/var/
rm -r {{release}}/docroot/media
View table_size.sql
TABLE_NAME, table_rows, data_length, index_length,
round(((data_length + index_length) / 1024 / 1024),2) 'Size in MB'
FROM information_schema.TABLES
WHERE table_schema = 'yourSchemaName' and TABLE_TYPE='BASE TABLE'
ORDER BY data_length DESC;
erfanimani / MyResourceModel.php
Created Dec 29, 2014
Magento: Setting update and creation date for resource models
View MyResourceModel.php
protected function _prepareDataForSave(Mage_Core_Model_Abstract $object)
$currentTime = Varien_Date::now();
if ((!$object->getId() || $object->isObjectNew()) && !$object->getCreatedAt()) {
$data = parent::_prepareDataForSave($object);
return $data;
erfanimani / all.conf
Created Apr 20, 2014
Simple Apache2.2 configuration that allows you to use deployments through git for very basic sites.
View all.conf
<Directory /var/www>
Order Deny,Allow
Allow from all
AllowOverride All
<Directorymatch "^/.*/\.git/">
Order deny,allow
Deny from all
erfanimani / .gitignore
Last active Jun 1, 2019
A refactored and modern .gitignore for Magento. Compatible for Git versions 2.7.0+. See this revision to use it for versions lower than 2.7.0:
View .gitignore
# Ignore everything in media, except for the htaccess files
# Also include the Lazy Catalog Images (LCI) .htaccess if that's installed
# (
You can’t perform that action at this time.