From d5ab4efd0f3b54883e9e0cbbfa33ce4fd1899fb0 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 4 Apr 2017 19:48:16 +0000 Subject: [PATCH] create share file AFTER create them in init phase in Yii2 advanced --- recipe/deploy/shared.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/recipe/deploy/shared.php b/recipe/deploy/shared.php index 16b35f70..ba90bbee 100644 --- a/recipe/deploy/shared.php +++ b/recipe/deploy/shared.php @@ -47,15 +47,22 @@ task('deploy:shared', function () { foreach (get('shared_files') as $file) { $dirname = dirname($file); + + // Create dir of shared file + run("mkdir -p $sharedPath/" . $dirname); + + // Check if shared file does not exists in shared. + // and file exist in release + if (!test("[ -f $sharedPath/$file ]") && test("[ -f {{release_path}}/$file ]")) { + // Copy file in shared dir if not present + run("cp -rv {{release_path}}/$file $sharedPath/$file"); + } // Remove from source. run("if [ -f $(echo {{release_path}}/$file) ]; then rm -rf {{release_path}}/$file; fi"); // Ensure dir is available in release run("if [ ! -d $(echo {{release_path}}/$dirname) ]; then mkdir -p {{release_path}}/$dirname;fi"); - // Create dir of shared file - run("mkdir -p $sharedPath/" . $dirname); - // Touch shared run("touch $sharedPath/$file");