From 594f3b543c0b8478e388b1931111f571dccbcbe9 Mon Sep 17 00:00:00 2001 From: Nick Liu Date: Sat, 4 Apr 2020 17:53:58 -0500 Subject: [PATCH] Build Release: Include core image by itself in release files Also fixed an E_NOTICE pertaining to array_shift() --- .github/workflows/build-release/OsHelper.php | 3 ++- .github/workflows/build-release/e107_make.php | 21 ++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build-release/OsHelper.php b/.github/workflows/build-release/OsHelper.php index 46318c35a..d99d3d071 100644 --- a/.github/workflows/build-release/OsHelper.php +++ b/.github/workflows/build-release/OsHelper.php @@ -52,7 +52,8 @@ class OsHelper public static function gitVersionToPhpVersion($gitVersion, $verFileVersion = "0") { - $verFileVersion = array_shift(explode(" ", $verFileVersion)); + $verFileVersion = explode(" ", $verFileVersion); + $verFileVersion = array_shift($verFileVersion); $version = preg_replace("/^v/", "", $gitVersion); $versionSplit = explode("-", $version); if (count($versionSplit) > 1) diff --git a/.github/workflows/build-release/e107_make.php b/.github/workflows/build-release/e107_make.php index 655cfe98e..7033a7e15 100644 --- a/.github/workflows/build-release/e107_make.php +++ b/.github/workflows/build-release/e107_make.php @@ -252,7 +252,7 @@ class e107Build $this->createCoreImage(); // Create Image } - $this->copyCoreImage(); + $this->copyCoreImage($this->exportDir . "e107_admin/core_image.php"); if (isset($rel['readme'])) { @@ -276,6 +276,8 @@ class e107Build $releaseDir = "{$this->config['baseDir']}/target/{$this->config['main']['name']}/release/" . $this->releaseDir; + $this->copyCoreImage($releaseDir . "/core_image.php"); + /** * git archive -o update.zip HEAD $(git diff --name-only [id]) * @@ -490,22 +492,21 @@ class e107Build $this->changeDir($dir); } - private function copyCoreImage() + private function copyCoreImage($destination) { - $orig = $this->tempDir . "core_image.php"; - $dest = $this->exportDir . "e107_admin/core_image.php"; + $source = $this->tempDir . "core_image.php"; - if (!file_exists($orig)) + if (!file_exists($source)) { - throw new RuntimeException("Core image file not found: {$orig}"); + throw new RuntimeException("Core image file not found: {$source}"); } - $this->status("Copying Core Image into export directory", true); - OsHelper::runValidated("cp -rf " . escapeshellarg($orig) . " " . escapeshellarg($dest)); + $this->status("Copying Core Image into: $destination", true); + OsHelper::runValidated("cp -rf " . escapeshellarg($source) . " " . escapeshellarg($destination)); - if (!file_exists($dest)) + if (!file_exists($destination)) { - throw new RuntimeException("Core image file didnt copy to: {$dest}"); + throw new RuntimeException("Core image file didnt copy to: {$destination}"); } }