# # Helper Makefile SHELL := bash cmdphp = bin/* PHP ?= `which php` PEAR = ./bin/pear DBUSER=gerd DBPASSWD=gerd123 DBNAME=database PROJECT=project SERVER=server.example.com SERVER_PARENT=www dump: @echo -n "Dump table structure" @mysqldump -u $(DBUSER) --no-data $(DBNAME) --password=$(DBPASSWORD) \ | LC_ALL=C sed -E 's/DEFINER[ ]*=[ ]*`[^`]+`@`[^`]+`/DEFINER=CURRENT_USER/g' \ | head -n -1 >doc/table.sql @echo -n " primary data" @mysqldump -u $(DBUSER) --password=$(DBPASSWORD) --ignore-table=$(DBNAME).wbgenericview --ignore-table=$(DBNAME).wbpageview --ignore-table=$(DBNAME).wbsessionview --ignore-table=$(DBNAME).wbvfsfileview $(DBNAME) \ | LC_ALL=C sed -E 's/DEFINER[ ]*=[ ]*`[^`]+`@`[^`]+`/DEFINER=CURRENT_USER/g' \ | head -n -1 >doc/dump.sql @echo " done" @echo -n "Tar VFS ..." @tar zcf vfs.tar.gz var/vfs @echo " done" dumpstat: @echo -n "Dump statistic data ..." @mysqldump -e $(DBNAME) wbtagview wbgenericview wbpageview wbsessionview wbvfsfileview \ | LC_ALL=C sed -E 's/DEFINER[ ]*=[ ]*`[^`]+`@`[^`]+`/DEFINER=CURRENT_USER/g' \ | head -n -1 >doc/dumpstat.sql @echo " done" deploy: @echo "********************************************************************************" git pull make flushcache @echo "********************************************************************************" install: dirs perms installdb: @echo 'SHOW GRANTS FOR `$(DBUSER)`@`localhost`;' @echo 'GRANT USAGE ON *.* TO "$(DBUSER)"@"localhost" IDENTIFIED BY PASSWORD password("$(DBPASSWD)");' @echo 'CREATE DATABASE `$(DBNAME)` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;' @echo 'GRANT ALL PRIVILEGES ON `$(DBNAME)`.* TO `gerd`@`localhost`;' @echo 'FLUSH PRIVILEGES;' @echo 'USE `$(DBNAME)`;' mysql $(DBNAME) <../wombat4/doc/table/base.sql mysql $(DBNAME) <../wombat4/doc/table/blog.sql mysql $(DBNAME) <../wombat4/doc/table/cms.sql mysql $(DBNAME) <../wombat4/doc/table/vfs.sql mysql $(DBNAME) <../wombat4/doc/table/statistic.sql # mysql $(DBNAME) <../valueAce2/doc/table.sql mysqldump -w 'domain IN ("wombat", "patForms")' wombatDE wbnlsmsg | mysql $(DBNAME) for SQL in doc/table/*.sql; do\ mysql $(DBNAME) <$${SQL};\ done dirs: mkdir -p var/tmp mkdir -p var/cache mkdir -p var/cache/sheet mkdir -p var/log mkdir -p var/spool mkdir -p var/lang mkdir -p var/vfs mkdir -p var/valueace mkdir -p var/archive/invoice perms: chmod -R go+w var/vfs chmod -R go+w var/tmp chmod -R go+w var/tmp chmod -R go+w var/cache chmod -R go+w var/log chmod -R go+w var/spool chmod -R go+w var/lang chmod -R go+w var/archive chmod -R go+w var/valueace flushcache: rm -rf var/cache/css rm -rf var/cache/javascript rm -rf var/cache/general rm -rf var/cache/template rm -rf var/tmp/* rm -rf var/cache/sheet/* flushlog: for i in var/log/*.log ; do rm $$i; touch $$i; chmod go+w $$i; done rsync: rsync -v $(SERVER):$(SERVER_PARENT)/$(PROJECT)/doc/dump\*.sql $(SERVER):$(SERVER_PARENT)/$(PROJECT)/doc/table.sql doc/ rsync --delete -av $(SERVER):$(SERVER_PARENT)/$(PROJECT)/var/vfs var/ rsync --delete -av $(SERVER):$(SERVER_PARENT)/$(PROJECT)/var/valueace var/ rsync --delete -av $(SERVER):$(SERVER_PARENT)/$(PROJECT)/var/archive var/