-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
053cabd
commit e5025f8
Showing
7 changed files
with
85 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* Event hooks for the PHP plugin | ||
* | ||
* @param {Object} app - The Lando app instance | ||
* @param {Object} lando - The Lando instance | ||
* @return {void} | ||
*/ | ||
module.exports = (app, lando) => { | ||
// Remove the service config directory on appdestroy | ||
app.events.on('post-destroy', async () => { | ||
return await require('../hooks/app-purge-service-dirs')(app, lando); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
/** | ||
* Removes all PHP service directories for an app | ||
* | ||
* @param {Object} app - The Lando app instance | ||
* @param {Object} lando - The Lando instance | ||
* @return {Promise<void>} Promise that resolves when directories are removed | ||
* @throws {Error} If unable to get services directory | ||
*/ | ||
module.exports = async (app, lando) => { | ||
try { | ||
const servicesDir = require('../utils/get-services-dir')(lando, app); | ||
app.log.debug('removing php service directories...'); | ||
// Get all subdirectories starting with 'php-' and remove them | ||
if (fs.existsSync(servicesDir)) { | ||
fs.readdirSync(servicesDir) | ||
.filter(dir => dir.startsWith('php-')) | ||
.forEach(dir => { | ||
const phpServiceDir = path.join(servicesDir, dir); | ||
lando.utils.remove(phpServiceDir); | ||
}); | ||
} | ||
} catch {} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use strict'; | ||
|
||
const path = require('path'); | ||
|
||
/** | ||
* Get the app's config directory path | ||
* @param {Object} lando - The Lando instance | ||
* @param {Object} app - The application object | ||
* @return {string} The full path to the app's config directory | ||
* @throws {Error} If required parameters are missing | ||
*/ | ||
module.exports = (lando, app) => { | ||
if (!lando?.config?.userConfRoot) throw new Error('Invalid Lando configuration'); | ||
if (!app?.name || !app?.id) throw new Error('Invalid app configuration'); | ||
|
||
return path.join(lando.config.userConfRoot, 'apps', `${app.name}-${app.id}`); | ||
}; |