Skip to content

Instantly share code, notes, and snippets.

View a-ast's full-sized avatar

Andrey Astakhov a-ast

  • Berlin, Germany
View GitHub Profile
@a-ast
a-ast / gist:e7e059eccfae8f04edf0
Created July 14, 2015 10:55
eZ Publish: How to generate url alias form location or location id
$router = $this->container->get('router');
$url = $router->generate(
$targetLocation,
array(
'siteaccess' => ...
), // it is possible to pass another siteaccess here
UrlGeneratorInterface::ABSOLUTE_URL
);
@a-ast
a-ast / MySQL clone database
Created June 1, 2015 14:30
MySQL clone database
# Created database to be cloned
mysql -u [user] -p -e "create database [destination_database] character set utf8;"
# Backup database with compression
mysqldump -h localhost -u [user] -p --quick [source_database] | gzip > [backup_file]
# Uncompress and restore database
gunzip -c [backup_file] | mysql -u [user] -p [destination_database]
@a-ast
a-ast / Symfony-eZPublish: Set permissions for project files
Last active August 29, 2015 14:20
Symfony/eZPublish: Set permissions for project files
# Set permissions for project files
sudo setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX /var/www/project/
sudo setfacl -dR -m u:www-data:rwX -m u:`whoami`:rwX /var/www/project/