#!/usr/bin/make -f 

DATE=$(shell date -I)

CURDIR=$(pwd)

PHP=php5.5-cli

ARCHIVE=00_Archive-$(DATE).tar 
EXTENSIONS=00_Extensions-$(DATE).tar

default: composer configuration

configuration:
	cat ./LocalSettings.php | grep ^\$$wg  | sort > ./conf

outdated:
	$(PHP) ./composer.phar outdated

composer:
	$(PHP) ./composer.phar info > composer-$(DATE).info	
	awk '{print $$1"="$$2}' composer-$(DATE).info > info.composer
	@rm composer.info
	ln -s composer-$(DATE).info composer.info

clean:
	-rm $(ARCHIVE) $(EXTENSIONS)

archivage: composer $(ARCHIVE) $(EXTENSIONS)
	-ls -lh $(ARCHIVE) $(EXTENSIONS)


$(ARCHIVE):

	-tar cvf ./$(ARCHIVE) --exclude='./images/*' --exclude='*.tar' ./
	-chmod a-w ./$(ARCHIVE)

$(EXTENSIONS):
	-tar cvf ./$(EXTENSIONS) --exclude='./images/*' ./extensions
	-chmod a-w ./$(EXTENSIONS)

maint:
	$(PHP) ./maintenance/runJobs.php



