From 8ccd11b31ab7089794a35688f1fabc5fe84ef662 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Tue, 4 Nov 2025 16:36:42 -0800 Subject: [PATCH 1/7] Bump build hash --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 591f8a6db1..29b814d332 100644 --- a/composer.json +++ b/composer.json @@ -106,7 +106,7 @@ "Gmail" ], "processmaker": { - "build": "9f756fb9", + "build": "8193a8eb", "cicd-enabled": true, "custom": { "package-ellucian-ethos": "1.19.7", From 0f3adba664a906528d9ccbd7b571c1ead5bfcda7 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Tue, 11 Nov 2025 09:19:44 -0800 Subject: [PATCH 2/7] Support getenv by setting vars with putenv --- ProcessMaker/Multitenancy/TenantBootstrapper.php | 1 + ProcessMaker/Providers/ProcessMakerServiceProvider.php | 1 + 2 files changed, 2 insertions(+) diff --git a/ProcessMaker/Multitenancy/TenantBootstrapper.php b/ProcessMaker/Multitenancy/TenantBootstrapper.php index 629e45e346..7475dfef13 100644 --- a/ProcessMaker/Multitenancy/TenantBootstrapper.php +++ b/ProcessMaker/Multitenancy/TenantBootstrapper.php @@ -146,6 +146,7 @@ private function set($key, $value) // Env::getRepository() is immutable but will use values from $_SERVER and $_ENV $_SERVER[$key] = $value; $_ENV[$key] = $value; + putenv("$key=$value"); } private function decrypt($value) diff --git a/ProcessMaker/Providers/ProcessMakerServiceProvider.php b/ProcessMaker/Providers/ProcessMakerServiceProvider.php index fb5cbb85bb..3fa0be9169 100644 --- a/ProcessMaker/Providers/ProcessMakerServiceProvider.php +++ b/ProcessMaker/Providers/ProcessMakerServiceProvider.php @@ -295,6 +295,7 @@ private static function resetTenantApp($event): void foreach (self::$landlordValues as $key => $value) { $_SERVER[$key] = $value; $_ENV[$key] = $value; + putenv("$key=$value"); } } From 80f5e2c26b55b12e8f160e21259a1377181f1cc0 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Wed, 12 Nov 2025 09:22:22 -0800 Subject: [PATCH 3/7] Bump build hash --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 29b814d332..a36c89797d 100644 --- a/composer.json +++ b/composer.json @@ -106,7 +106,7 @@ "Gmail" ], "processmaker": { - "build": "8193a8eb", + "build": "78537ddc", "cicd-enabled": true, "custom": { "package-ellucian-ethos": "1.19.7", From 7428740906f419605f96d6592f0426dd42bc0c30 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Thu, 13 Nov 2025 14:17:06 -0800 Subject: [PATCH 4/7] Re-bootstrap on each queue job --- ProcessMaker/Application.php | 5 +++++ ProcessMaker/Providers/ProcessMakerServiceProvider.php | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ProcessMaker/Application.php b/ProcessMaker/Application.php index b459358dd3..3f6102a2c7 100644 --- a/ProcessMaker/Application.php +++ b/ProcessMaker/Application.php @@ -112,4 +112,9 @@ public function bootstrapWith(array $bootstrappers) return parent::bootstrapWith($bootstrappers); } + + public function resetHasBeenBootstrapped() + { + $this->hasBeenBootstrapped = false; + } } diff --git a/ProcessMaker/Providers/ProcessMakerServiceProvider.php b/ProcessMaker/Providers/ProcessMakerServiceProvider.php index 3fa0be9169..6da430ac95 100644 --- a/ProcessMaker/Providers/ProcessMakerServiceProvider.php +++ b/ProcessMaker/Providers/ProcessMakerServiceProvider.php @@ -268,9 +268,10 @@ private static function bootstrapTenantApp(JobProcessing|JobRetryRequested $even if (!isset(self::$tenantAppContainers[$tenantId])) { $tenantApp = require app()->bootstrapPath('app.php'); $tenantApp->instance('landlordValues', self::$landlordValues); - $tenantApp->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap(); self::$tenantAppContainers[$tenantId] = $tenantApp; } + self::$tenantAppContainers[$tenantId]->resetHasBeenBootstrapped(); + self::$tenantAppContainers[$tenantId]->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap(); // Change the job's app service container to the tenant app $event->job->getRedisQueue()->setContainer(self::$tenantAppContainers[$tenantId]); From f5449019c11cdd9e3c82b355352c7bb00b4f4e40 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Fri, 14 Nov 2025 15:49:34 -0800 Subject: [PATCH 5/7] Set the global container instance when switching --- ProcessMaker/Application.php | 6 ++- .../Multitenancy/TenantBootstrapper.php | 23 ++++------- .../Providers/ProcessMakerServiceProvider.php | 41 +------------------ 3 files changed, 15 insertions(+), 55 deletions(-) diff --git a/ProcessMaker/Application.php b/ProcessMaker/Application.php index 3f6102a2c7..87f85281df 100644 --- a/ProcessMaker/Application.php +++ b/ProcessMaker/Application.php @@ -3,6 +3,7 @@ namespace ProcessMaker; use Igaster\LaravelTheme\Facades\Theme; +use Illuminate\Container\Container; use Illuminate\Filesystem\Filesystem; use Illuminate\Foundation\Application as IlluminateApplication; use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables; @@ -12,6 +13,7 @@ use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Config; +use ProcessMaker\Console\Kernel; use ProcessMaker\Multitenancy\Tenant; use ProcessMaker\Multitenancy\TenantBootstrapper; @@ -113,8 +115,10 @@ public function bootstrapWith(array $bootstrappers) return parent::bootstrapWith($bootstrappers); } - public function resetHasBeenBootstrapped() + public function reactivateConsoleApp() { + Container::setInstance($this); $this->hasBeenBootstrapped = false; + $this->make(Kernel::class)->bootstrap(); } } diff --git a/ProcessMaker/Multitenancy/TenantBootstrapper.php b/ProcessMaker/Multitenancy/TenantBootstrapper.php index 7475dfef13..7ab897f0e8 100644 --- a/ProcessMaker/Multitenancy/TenantBootstrapper.php +++ b/ProcessMaker/Multitenancy/TenantBootstrapper.php @@ -26,21 +26,6 @@ class TenantBootstrapper private $app = null; - public static $landlordKeysToSave = [ - 'APP_URL', - 'APP_KEY', - 'LOG_PATH', - 'DB_USERNAME', - 'DB_PASSWORD', - 'DB_HOSTNAME', - 'DB_PORT', - 'LANDLORD_DB_DATABASE', - 'REDIS_PREFIX', - 'CACHE_SETTING_PREFIX', - 'SCRIPT_MICROSERVICE_CALLBACK', - 'CACHE_PREFIX', - ]; - public function bootstrap(Application $app) { try { @@ -116,6 +101,14 @@ private function setTenantEnvironmentVariables($tenantData) $this->set('LOG_PATH', $this->app->storagePath('logs/processmaker.log')); } + // Used for debugging + public static function log($message) + { + $message = '[TenantBootstrapper] ' . $message; + $today = date('Y-m-d'); + file_put_contents(base_path('storage/logs/processmaker-' . $today . '.log'), date('Y-m-d H:i:s') . ' ' . $message . PHP_EOL, FILE_APPEND); + } + private function getOriginalValue($key, $default = '') { if (self::$landlordValues === []) { diff --git a/ProcessMaker/Providers/ProcessMakerServiceProvider.php b/ProcessMaker/Providers/ProcessMakerServiceProvider.php index 6da430ac95..ab176d3c66 100644 --- a/ProcessMaker/Providers/ProcessMakerServiceProvider.php +++ b/ProcessMaker/Providers/ProcessMakerServiceProvider.php @@ -254,52 +254,19 @@ private static function bootstrapTenantApp(JobProcessing|JobRetryRequested $even return; } - // Save the landlord's config values so we can reset them later - if (self::$landlordValues === null) { - foreach (TenantBootstrapper::$landlordKeysToSave as $key) { - self::$landlordValues[$key] = $_SERVER[$key] ?? ''; - } - } - // Create a new tenant app instance $_SERVER['TENANT'] = $tenantId; - $_ENV['TENANT'] = $tenantId; if (!isset(self::$tenantAppContainers[$tenantId])) { - $tenantApp = require app()->bootstrapPath('app.php'); - $tenantApp->instance('landlordValues', self::$landlordValues); - self::$tenantAppContainers[$tenantId] = $tenantApp; + self::$tenantAppContainers[$tenantId] = require base_path('bootstrap/app.php'); } - self::$tenantAppContainers[$tenantId]->resetHasBeenBootstrapped(); - self::$tenantAppContainers[$tenantId]->make(\Illuminate\Contracts\Console\Kernel::class)->bootstrap(); + self::$tenantAppContainers[$tenantId]->reactivateConsoleApp(); // Change the job's app service container to the tenant app $event->job->getRedisQueue()->setContainer(self::$tenantAppContainers[$tenantId]); } } - private static function resetTenantApp($event): void - { - if (!method_exists($event->job, 'getRedisQueue')) { - // Not a redis job - return; - } - - unset($_SERVER['TENANT']); - unset($_ENV['TENANT']); - - if (!self::$landlordValues) { - return; - } - - // Restore the original values since the tenant boostrapper modified them - foreach (self::$landlordValues as $key => $value) { - $_SERVER[$key] = $value; - $_ENV[$key] = $value; - putenv("$key=$value"); - } - } - /** * Register app-level events. */ @@ -313,10 +280,6 @@ protected static function registerEvents(): void self::bootstrapTenantApp($event); }); - Facades\Event::listen(JobAttempted::class, function (JobAttempted $event) { - self::resetTenantApp($event); - }); - // Listen to the events for our core screen // types and add our javascript Facades\Event::listen(ScreenBuilderStarting::class, function ($event) { From 703cc9fbcdd2f4f782f727375b1790d788e3731a Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Mon, 17 Nov 2025 05:48:59 -0800 Subject: [PATCH 6/7] Upgrade laravel framework ^11.44 --- composer.json | 4 ++-- composer.lock | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 3289e29ee2..74432a1db3 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "guzzlehttp/guzzle": "^7.9", "igaster/laravel-theme": "^2.0", "jenssegers/agent": "^2.6", - "laravel/framework": "^11.0", + "laravel/framework": "^11.44.1", "laravel/horizon": "^5.30", "laravel/pail": "^1.2", "laravel/passport": "^12.3", @@ -229,4 +229,4 @@ "tbachert/spi": true } } -} \ No newline at end of file +} diff --git a/composer.lock b/composer.lock index ebeba822fb..571446e5d8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "515c98c58265bbe08807b0cca8f55a8c", + "content-hash": "ce131ffa0ed4680ed836398726f161ba", "packages": [ { "name": "aws/aws-crt-php", @@ -2806,16 +2806,16 @@ }, { "name": "laravel/framework", - "version": "v11.43.2", + "version": "v11.44.7", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "99d1573698abc42222f04d25fcd5b213d0eedf21" + "reference": "00bc6ac91a6d577bf051c18ddaa638c0d221e1c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/99d1573698abc42222f04d25fcd5b213d0eedf21", - "reference": "99d1573698abc42222f04d25fcd5b213d0eedf21", + "url": "https://api.github.com/repos/laravel/framework/zipball/00bc6ac91a6d577bf051c18ddaa638c0d221e1c7", + "reference": "00bc6ac91a6d577bf051c18ddaa638c0d221e1c7", "shasum": "" }, "require": { @@ -2923,7 +2923,7 @@ "league/flysystem-read-only": "^3.25.1", "league/flysystem-sftp-v3": "^3.25.1", "mockery/mockery": "^1.6.10", - "orchestra/testbench-core": "^9.9.4", + "orchestra/testbench-core": "^9.11.2", "pda/pheanstalk": "^5.0.6", "php-http/discovery": "^1.15", "phpstan/phpstan": "^2.0", @@ -3017,7 +3017,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2025-02-19T21:53:48+00:00" + "time": "2025-04-25T12:40:47+00:00" }, { "name": "laravel/horizon", From 65fb4971c1e92b5cd4dffae45a0e8ca9207b7409 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Mon, 17 Nov 2025 06:37:05 -0800 Subject: [PATCH 7/7] Upgrade dependent packages with security advisories --- composer.json | 2 ++ composer.lock | 35 ++++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/composer.json b/composer.json index 74432a1db3..22e7c0bb99 100644 --- a/composer.json +++ b/composer.json @@ -33,6 +33,7 @@ "laravel/ui": "^4.6", "lavary/laravel-menu": "^1.8", "lcobucci/jwt": "^4.2", + "league/commonmark": "^2.7", "league/flysystem-aws-s3-v3": "^3.29", "mateusjunges/laravel-kafka": "^2.4", "mittwald/vault-php": "^2.1", @@ -63,6 +64,7 @@ "spatie/laravel-multitenancy": "^4.0", "spomky-labs/otphp": "^11.3", "symfony/expression-language": "^7.2", + "symfony/http-foundation": "^7.3", "teamtnt/laravel-scout-tntsearch-driver": "^14.0", "twilio/sdk": "^8.3", "typo3/class-alias-loader": "^1.2", diff --git a/composer.lock b/composer.lock index 571446e5d8..e254da25b5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ce131ffa0ed4680ed836398726f161ba", + "content-hash": "7b1bd0f76a6238e4f322305dee717161", "packages": [ { "name": "aws/aws-crt-php", @@ -3848,16 +3848,16 @@ }, { "name": "league/commonmark", - "version": "2.6.1", + "version": "2.7.1", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "d990688c91cedfb69753ffc2512727ec646df2ad" + "reference": "10732241927d3971d28e7ea7b5712721fa2296ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d990688c91cedfb69753ffc2512727ec646df2ad", - "reference": "d990688c91cedfb69753ffc2512727ec646df2ad", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/10732241927d3971d28e7ea7b5712721fa2296ca", + "reference": "10732241927d3971d28e7ea7b5712721fa2296ca", "shasum": "" }, "require": { @@ -3886,7 +3886,7 @@ "symfony/process": "^5.4 | ^6.0 | ^7.0", "symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0 | ^7.0", "unleashedtech/php-coding-standard": "^3.1.1", - "vimeo/psalm": "^4.24.0 || ^5.0.0" + "vimeo/psalm": "^4.24.0 || ^5.0.0 || ^6.0.0" }, "suggest": { "symfony/yaml": "v2.3+ required if using the Front Matter extension" @@ -3894,7 +3894,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "2.7-dev" + "dev-main": "2.8-dev" } }, "autoload": { @@ -3951,7 +3951,7 @@ "type": "tidelift" } ], - "time": "2024-12-29T14:10:59+00:00" + "time": "2025-07-20T12:47:49+00:00" }, { "name": "league/config", @@ -10006,16 +10006,16 @@ }, { "name": "symfony/http-foundation", - "version": "v7.2.3", + "version": "v7.3.7", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "ee1b504b8926198be89d05e5b6fc4c3810c090f0" + "reference": "db488a62f98f7a81d5746f05eea63a74e55bb7c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/ee1b504b8926198be89d05e5b6fc4c3810c090f0", - "reference": "ee1b504b8926198be89d05e5b6fc4c3810c090f0", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/db488a62f98f7a81d5746f05eea63a74e55bb7c4", + "reference": "db488a62f98f7a81d5746f05eea63a74e55bb7c4", "shasum": "" }, "require": { @@ -10032,6 +10032,7 @@ "doctrine/dbal": "^3.6|^4", "predis/predis": "^1.1|^2.0", "symfony/cache": "^6.4.12|^7.1.5", + "symfony/clock": "^6.4|^7.0", "symfony/dependency-injection": "^6.4|^7.0", "symfony/expression-language": "^6.4|^7.0", "symfony/http-kernel": "^6.4|^7.0", @@ -10064,7 +10065,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v7.2.3" + "source": "https://github.com/symfony/http-foundation/tree/v7.3.7" }, "funding": [ { @@ -10075,12 +10076,16 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2025-01-17T10:56:55+00:00" + "time": "2025-11-08T16:41:12+00:00" }, { "name": "symfony/http-kernel", @@ -15214,5 +15219,5 @@ "php": "^8.3" }, "platform-dev": {}, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.9.0" }