From 7d2fe3fe2d1c7935de74ba75a5e273d8b4c7892b Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sat, 22 Jun 2013 19:55:24 +0300 Subject: [PATCH] pack command --- composer.json | 1 + composer.lock | 51 +++++++++++++++++++++++++++++++++++++++++- ipf/cli.php | 1 + ipf/command/dbdump.php | 3 ++- ipf/command/pack.php | 34 ++++++++++++++++++++++++++++ 5 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 ipf/command/pack.php diff --git a/composer.json b/composer.json index 6983e78..ab1f0ce 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,7 @@ "classmap" : ["."] }, "require": { + "pear/archive_tar": "1.3.*", "andy128k/routeexpression": "dev-master" }, "require-dev": { diff --git a/composer.lock b/composer.lock index adb9fdc..61ec8b9 100644 --- a/composer.lock +++ b/composer.lock @@ -3,7 +3,7 @@ "This file locks the dependencies of your project to a known state", "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" ], - "hash": "20bffa57e6d8564e8b9bf75a6d2f70af", + "hash": "09e63866555a75f0b04932883319a5f1", "packages": [ { "name": "andy128k/routeexpression", @@ -43,6 +43,55 @@ "issues": "https://github.com/andy128k/routeexpression/issues" }, "time": "2013-06-22 08:01:38" + }, + { + "name": "pear/archive_tar", + "version": "1.3.11", + "source": { + "type": "git", + "url": "https://github.com/pear/Archive_Tar", + "reference": "1.3.11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pear/Archive_Tar/zipball/1.3.11", + "reference": "1.3.11", + "shasum": "" + }, + "require": { + "php": ">=4.3.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Archive_Tar": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Michiel Rook", + "email": "mrook@php.net" + }, + { + "name": "Vincent Blavet", + "email": "vincent@phpconcept.net" + }, + { + "name": "Greg Beaver", + "email": "greg@chiaraquartet.net" + } + ], + "description": "Tar file management class", + "homepage": "https://github.com/pear/Archive_Tar", + "keywords": [ + "archive", + "tar" + ], + "time": "2013-02-09 11:44:32" } ], "packages-dev": [ diff --git a/ipf/cli.php b/ipf/cli.php index 39b97ba..dd0efea 100644 --- a/ipf/cli.php +++ b/ipf/cli.php @@ -16,6 +16,7 @@ class IPF_Cli new IPF_Command_Fixtures, new IPF_Command_DB, new IPF_Command_DBDump, + new IPF_Command_Pack, new IPF_Command_CreateSuperUser, new IPF_Command_SyncPerms, ); diff --git a/ipf/command/dbdump.php b/ipf/command/dbdump.php index 2072389..04d8d92 100644 --- a/ipf/command/dbdump.php +++ b/ipf/command/dbdump.php @@ -9,7 +9,8 @@ class IPF_Command_DBDump { $output = 'dump.sql'; - print "Dumping database to file $output\n"; + if (!in_array('quiet', $args)) + print "Dumping database to file $output\n"; $db = IPF_ORM_Manager::getInstance()->connectionParameters(IPF::get('database', IPF::get('dsn'))); diff --git a/ipf/command/pack.php b/ipf/command/pack.php new file mode 100644 index 0000000..74cc899 --- /dev/null +++ b/ipf/command/pack.php @@ -0,0 +1,34 @@ +setErrorHandling(PEAR_ERROR_PRINT); + $tar_object->create('upload'); + chdir($workingDirectory); + } + + (new IPF_Command_DBDump)->run(array('quiet')); + + unlink($outputFileName); + + $tar_object = new Archive_Tar($outputFileName); + $tar_object->setErrorHandling(PEAR_ERROR_PRINT); + $tar_object->create('upload.tar dump.sql'); + + unlink('upload.tar'); + unlink('dump.sql'); + } +} + -- 2.49.0