refactor: replace custom CRM with Monica fork
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
Some checks failed
Build & Push Monica Image to Gitea Registry / build-and-push (push) Failing after 9s
This commit is contained in:
58
app/Helpers/ComposerScripts.php
Normal file
58
app/Helpers/ComposerScripts.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Helpers;
|
||||
|
||||
class ComposerScripts
|
||||
{
|
||||
const CONFIG = 'bootstrap/cache/config.php';
|
||||
|
||||
/**
|
||||
* Handle the pre-install Composer event.
|
||||
*
|
||||
* @param mixed $event
|
||||
* @return void
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function preInstall($event)
|
||||
{
|
||||
try {
|
||||
if (file_exists('vendor')) {
|
||||
\Illuminate\Foundation\ComposerScripts::postInstall($event);
|
||||
}
|
||||
static::clear();
|
||||
} catch (\Throwable $e) {
|
||||
// catch all
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the pre-update Composer event.
|
||||
*
|
||||
* @param mixed $event
|
||||
* @return void
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function preUpdate($event)
|
||||
{
|
||||
try {
|
||||
if (file_exists('vendor')) {
|
||||
\Illuminate\Foundation\ComposerScripts::postUpdate($event);
|
||||
}
|
||||
static::clear();
|
||||
} catch (\Throwable $e) {
|
||||
// catch all
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
protected static function clear()
|
||||
{
|
||||
if (file_exists(self::CONFIG)) {
|
||||
\unlink(self::CONFIG); /** @phpstan-ignore-line */
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user