Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Commit

Permalink
fix(versioning): migrate global var to config function
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiSchwarz-cnic committed May 27, 2020
1 parent e22bad5 commit 002d9a8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
19 changes: 12 additions & 7 deletions ispapidpi.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,25 @@
use WHMCS\Module\Registrar\Ispapi\Helper;

session_start();
$module_version = "5.0.0";

function ispapidpi_config()
{
global $module_version;
$configarray = array(
return [
"name" => "ISPAPI Pricing Importer",
"description" => "Quickly update your WHMCS domain pricing list.",
"version" => $module_version,
"author" => "HEXONET",
"language" => "english",
"fields" => array("username" => array ("FriendlyName" => "Admin username", "Type" => "text", "Size" => "30", "Description" => "[REQUIRED]", "Default" => "admin",))
);
return $configarray;
"fields" => [
"username" => [
"FriendlyName" => "Admin username",
"Type" => "text",
"Size" => "30",
"Description" => "[REQUIRED]",
"Default" => "admin"
]
],
"version" => "5.0.0"
];
}

function ispapidpi_output($vars)
Expand Down
9 changes: 3 additions & 6 deletions updateVersion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@

# version format: X.Y.Z
newversion="$1";
branch="$2";
date="$(date +'%Y-%m-%d')";

if [ "$branch" = "master" ]; then
sed -i "s/\$module_version = \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/\$module_version = \"${newversion}\"/g" ispapidpi.php
sed -i "s/\"version\": \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/\"version\": \"${newversion}\"/g" release.json
sed -i "s/\"date\": \"[0-9]\+-[0-9]\+-[0-9]\+\"/\"date\": \"${date}\"/g" release.json
fi;
sed -i "s/\"version\" => \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/\"version\" => \"${newversion}\"/g" ispapidpi.php
sed -i "s/\"version\": \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/\"version\": \"${newversion}\"/g" release.json
sed -i "s/\"date\": \"[0-9]\+-[0-9]\+-[0-9]\+\"/\"date\": \"${date}\"/g" release.json

0 comments on commit 002d9a8

Please sign in to comment.