Skip to content

Commit

Permalink
use unique temp directories
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Jun 26, 2024
1 parent 1f459d2 commit a6488cd
Showing 1 changed file with 25 additions and 8 deletions.
33 changes: 25 additions & 8 deletions apps/updateserver/services/legacy/S3.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -374,19 +374,24 @@ component {
}

private function createWar(jar,version) {
local.temp=getTempDirectory();
var temp=getTempDirectory() & createUniqueId() "-#arguments.version#";
if ( directoryExists( temp ) )
directoryDelete( temp, true );
directoryCreate( temp );

local.war=variables.s3Root&"lucee-"&version&".war";
if ( fileExists( war ) ) {
systemOutput("--- " & war & " already built, skipping", true);
}
local.warTmp=temp&"lucee-"&version&"-temp-"&createUniqueId()&".war";
var curr=getDirectoryFromPath(getCurrenttemplatePath());

try {
// temp directory
// create paths and dir if necessary
local.build={};
loop list="extensions,common,website,war" item="local.name" {
local.tmp=expandPath("build/"&name&"/");
local.tmp=curr & "build/"&name&"/";
if ( !directoryExists( tmp ) ) directoryCreate( tmp, true );
build[name]=tmp;
}
Expand All @@ -411,7 +416,11 @@ component {

private function createLight(jar, version, boolean toS3=true) {
var sep=server.separator.file;
local.temp=getTempDirectory();
var temp=getTempDirectory() & createUniqueId() "-#arguments.version#";
if ( directoryExists( temp ) )
directoryDelete( temp, true );
directoryCreate( temp );

local.trg=variables.s3Root&"lucee-light-"&version&".jar";
if ( fileExists( trg ) ) {
// avoid double handling for forgebox light builds
Expand Down Expand Up @@ -470,7 +479,11 @@ component {

private string function createExpress(required jar,required string version) {
var sep=server.separator.file;
var temp=getTempDirectory();
var temp=getTempDirectory() & createUniqueId() "-#arguments.version#";
if ( directoryExists( temp ) )
directoryDelete( temp, true );
directoryCreate( temp );

var trg=variables.s3Root&"lucee-express-"&version&".zip";
if ( fileExists( trg ) ) {
systemOutput("--- " & trg & " already built, skipping", true);
Expand Down Expand Up @@ -523,7 +536,11 @@ component {

private string function createForgeBox(required jar,required string version, boolean light=false) {
var sep=server.separator.file;
var temp=getTempDirectory();
var temp=getTempDirectory() & createUniqueId() "-#arguments.version#";
if ( directoryExists( temp ) )
directoryDelete( temp, true );
directoryCreate( temp );
var curr=getDirectoryFromPath(getCurrenttemplatePath());
var trg=variables.s3Root&"forgebox#( light ? '-light' : '' )#-"&version&".zip";
if ( fileExists( trg ) ) {
systemOutput("--- " & trg & " already built, skipping", true);
Expand All @@ -533,15 +550,15 @@ component {
var zipTmp=temp&"forgebox#( light ? '-light' : '' )#-"&version&"-temp-"&createUniqueId()&".zip";
try {
// extension directory
local.extDir=expandPath("build/extensions/");
local.extDir=curr & "build/extensions/";
if(!directoryExists(extDir)) directoryCreate(extDir);

// common directory
local.commonDir=expandPath("build/common/");
local.commonDir=curr & "build/common/";
if(!directoryExists(commonDir)) directoryCreate(commonDir);

// war directory
local.warDir=expandPath("build/war/");
local.warDir=curr & "build/war/";
if(!directoryExists(warDir)) directoryCreate(warDir);

// create the war
Expand Down

0 comments on commit a6488cd

Please sign in to comment.