@@ -9,6 +9,7 @@ import { addAnnotation } from 'azure-actions-appservice-rest/Utilities/Annotatio
99
1010import fs from 'fs' ;
1111import path from 'path' ;
12+ import { dir } from 'console' ;
1213
1314export class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider {
1415
@@ -86,25 +87,32 @@ export class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider {
8687 }
8788
8889 private async deleteReleaseZipForLinuxPhpApps ( webPackage : string ) : Promise < void > {
89- const releaseZipPath = path . join ( webPackage , 'release.zip' ) ;
9090
9191 // Ignore if the app is not a Linux app or if release.zip does not exist
92- if ( ! this . actionParams . isLinux || ! fs . existsSync ( releaseZipPath ) ) {
92+ if ( ! this . actionParams . isLinux ) {
93+ core . info ( `It's not a Linux app, skipping deletion of release.zip` ) ;
94+ return ;
95+ }
96+
97+ const releaseZipPath = path . join ( webPackage , 'release.zip' ) ;
98+
99+ if ( ! fs . existsSync ( releaseZipPath ) ) {
100+ core . info ( `release.zip does not exist, skipping deletion: ${ releaseZipPath } ` ) ;
93101 return ;
94102 }
95103
96104 let isPhpApp = await this . checkIfTheAppIsPhpApp ( webPackage ) ;
97105
98106 // No need to delete release.zip for non-PHP apps
99107 if ( ! isPhpApp ) {
108+ core . info ( `Not a PHP app, skipping deletion of release.zip: ${ releaseZipPath } ` ) ;
100109 return ;
101110 }
102111
103112 // Delete release.zip if it exists
104-
105113 try {
106114 await fs . promises . unlink ( releaseZipPath ) ;
107- core . debug ( `Deleted release.zip` ) ;
115+ core . info ( `Deleted release.zip` ) ;
108116 } catch ( error ) {
109117 core . debug ( `Error while deleting release.zip for Linux PHP app: ${ error } ` ) ;
110118 }
@@ -116,17 +124,26 @@ export class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider {
116124 // Check if the webPackage folder contains a composer.json file
117125 const composerFile = 'composer.json' ;
118126 if ( fs . existsSync ( path . join ( webPackage , composerFile ) ) ) {
127+ core . info ( `Detected PHP app by presence of ${ composerFile } ` ) ;
119128 return true ;
120129 }
121130
122131 // Check if the webPackage folder contains a .php file
123- const hasPhpFiles = fs . readdirSync ( webPackage ) . some ( file => file . endsWith ( '.php' ) ) ;
132+ core . info ( `Checking for .php files in the web package directory: ${ webPackage } ` ) ;
133+ const hasPhpFiles = fs . readdirSync ( webPackage , { withFileTypes : true , recursive : true } ) . some ( file => file . isFile ( ) && file . name . endsWith ( '.php' ) ) ;
134+
135+ if ( hasPhpFiles ) {
136+ core . info ( `Detected PHP app by presence of .php files` ) ;
137+ } else {
138+ core . info ( `No .php files found in the web package directory.` ) ;
139+ }
124140
125141 return hasPhpFiles ;
126142 } catch ( error ) {
127- core . debug ( `Error while checking if the app is PHP: ${ error } ` ) ;
143+ core . info ( `Error while checking if the app is PHP: ${ error } ` ) ;
128144 }
129145
130146 return false ;
131147 }
148+
132149}
0 commit comments