Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
180 commits
Select commit Hold shift + click to select a range
ddc0986
Fix sort in script executor
CarliPinell Dec 5, 2024
c6ba4e6
changed the navbar-icon when expended for mobile
gustavobascope Dec 24, 2024
03c5dff
FOUR-24085: Email Screen is not displaying its styles when it assigne…
fagubla Jul 25, 2025
a2c2559
Merge remote-tracking branch 'origin/develop' into bugfix/FOUR-24085
pmPaulis Aug 15, 2025
40735cb
Update TaskActionByEmail.php
fagubla Aug 22, 2025
8ce546d
FOUR-24683: [45464] Richtext field not rendering ul tag (regression)
henryjonathanquispe Aug 25, 2025
2126731
first commit improve performance of permissions and groups
rodriquelca Aug 25, 2025
9868d22
remove build folder
rodriquelca Aug 25, 2025
fa4e0da
improve test unit
rodriquelca Aug 25, 2025
45037fa
FOUR-25919
pmPaulis Aug 25, 2025
b8fea1d
reduce test logs 2
rodriquelca Aug 26, 2025
7a789f8
FOUR-25374
pmPaulis Aug 26, 2025
ecb1b85
add invalidate cache for permisions
rodriquelca Aug 28, 2025
a46973c
remove not needed test
rodriquelca Aug 28, 2025
0681def
FOUR-23734 [44349] - Reassignment User List Not Filtering by Regular …
gproly Aug 28, 2025
6088e4b
FOUR-23734 Remove console.log
gproly Aug 28, 2025
e19462d
complete test units and add invalid cache for groups
rodriquelca Aug 28, 2025
77780f6
Merge remote-tracking branch 'origin/develop' into permissionPerformance
rodriquelca Aug 28, 2025
534240d
fix tests
rodriquelca Aug 29, 2025
b89b3b6
clean invalidate group of groups cachew
rodriquelca Aug 29, 2025
c5a98de
remove spanish coments
rodriquelca Aug 29, 2025
b17d2b8
improve tes for process request and profile
rodriquelca Aug 29, 2025
2bee0fb
enable find recrusively dependencies
marcoAntonioNina Sep 1, 2025
f58afe6
Add value to request id
marcoAntonioNina Sep 1, 2025
cf40dc1
FOUR-25919: solving obsevations
pmPaulis Sep 3, 2025
3c1e9ca
FOUR-25910
pmPaulis Sep 5, 2025
ca1d745
Added a case sync status when a request end with a signal
gustavobascope Sep 5, 2025
013b226
Added the option to chose update or copy for devlink installing asset
gustavobascope Sep 8, 2025
4b38171
Initial attempt at TenantBootstrapper
nolanpro Sep 12, 2025
31948e0
Merge branch 'develop' of github.com:ProcessMaker/processmaker into o…
gustavobascope Sep 15, 2025
7e6f55d
Add scrollbar to right panel in request details
agustinbusso Sep 15, 2025
a5f6899
Insert TenantBootstrapper after LoadEnvironmentVariables
nolanpro Sep 15, 2025
8336f3e
Add translations en.json
gustavobascope Sep 15, 2025
32c9d1d
Add pagination to panel settings check boxes
marcoAntonioNina Sep 16, 2025
d98a244
Add data page
marcoAntonioNina Sep 16, 2025
4adfd20
Merge branch 'develop' of github.com:ProcessMaker/processmaker into o…
gustavobascope Sep 18, 2025
c65746d
Remove hack since this was fixed in symfony
nolanpro Sep 23, 2025
413c92d
Merge branch 'develop' into feature/FOUR-24651_C
nolanpro Sep 24, 2025
ace382a
FOUR-26568 [47293] Error on parent request even the ABE process shows…
rodriquelca Sep 24, 2025
12a5155
FOUR-26661: Implement cases list compoment in the Application Dashboard
henryjonathanquispe Sep 24, 2025
19242c5
update Exception by ModelNotFoundException
rodriquelca Sep 24, 2025
4c5eb45
Roll back screen-builder
nolanpro Sep 24, 2025
e9ec0b9
FOUR-26661: Implement cases list compoment in the Application Dashboard
henryjonathanquispe Sep 24, 2025
2edc7c1
Refactor multitenant configuration
nolanpro Sep 26, 2025
820086c
Add the application updates for multitenancy
nolanpro Sep 26, 2025
2e28e1a
Merge branch 'develop' into feature/FOUR-24651_C
nolanpro Sep 26, 2025
7bd3713
Fix for non-multitenant instances
nolanpro Sep 26, 2025
8ae49b8
Remove debugging
nolanpro Sep 26, 2025
fdecec4
FOUR-26661: Implement cases list compoment in the Application Dashboard
henryjonathanquispe Sep 26, 2025
af7b2f6
Fix
nolanpro Sep 26, 2025
6c71af7
Fix MT decrypt password
nolanpro Sep 26, 2025
55675a1
Revert "Use a dedicated non-multitenant disk for license.json"
nolanpro Sep 29, 2025
2df438d
Move lang setting to bootstrapper so we can use it in filesystems.php
nolanpro Sep 29, 2025
ad06e80
Fix test
nolanpro Sep 30, 2025
ae53316
Fix test
nolanpro Sep 30, 2025
4f5db81
allow more than 1 manager per process
marcoAntonioNina Sep 30, 2025
ac2b6a0
change to manage multiple managers
marcoAntonioNina Sep 30, 2025
e5bb977
Merge pull request #8548 from ProcessMaker/fix-tests
nolanpro Sep 30, 2025
228e248
fix styles
marcoAntonioNina Sep 30, 2025
6f7e708
Remove custom provider ordering
nolanpro Sep 30, 2025
72318fd
set nullable
marcoAntonioNina Sep 30, 2025
bc9afa0
Fixes for cursorbot
nolanpro Sep 30, 2025
103f212
Fix test
marcoAntonioNina Oct 1, 2025
f800432
Return int in fucntion
marcoAntonioNina Oct 1, 2025
6a2dc10
Do not override package cache path yet
nolanpro Oct 1, 2025
e9fda96
preview managers export
marcoAntonioNina Oct 1, 2025
a41e840
add validation max managers
marcoAntonioNina Oct 1, 2025
a568aba
Change array_rand
marcoAntonioNina Oct 2, 2025
9d5adef
Change manager name and ids
marcoAntonioNina Oct 2, 2025
7750207
Validate values of managers
marcoAntonioNina Oct 2, 2025
951bb1f
Merge branch 'develop' of github.com:ProcessMaker/processmaker into t…
marcoAntonioNina Oct 2, 2025
2a54a6c
Debounce refresh artisan caches
nolanpro Oct 2, 2025
b2bd361
Merge branch 'develop' into feature/FOUR-24651_C
nolanpro Oct 2, 2025
7baa570
validate value is string or array
marcoAntonioNina Oct 2, 2025
3fc107c
Fix missing return from conflict
nolanpro Oct 2, 2025
30e9ad0
Merge pull request #8543 from ProcessMaker/feature/FOUR-24651_C
nolanpro Oct 2, 2025
50458bc
Fix value managerId
marcoAntonioNina Oct 2, 2025
842c5e8
Version v4.15.9+alpha-1
processmaker-bot Oct 3, 2025
48cc299
FOUR-26751
pmPaulis Sep 24, 2025
38b777f
Version 4.15.9+alpha-1
nolanpro Oct 3, 2025
c183389
Add IsManager middleware for enhanced access control
marcoAntonioNina Oct 3, 2025
af97cf6
Refactor TaskController to improve user filtering and caching logic
marcoAntonioNina Oct 3, 2025
ae2a94e
Fix error when dependent screen is missing
nolanpro Oct 8, 2025
a4bda31
Remove all the debounce logic
nolanpro Oct 8, 2025
4e4a758
Run synchronously and debounce using a simple variable
nolanpro Oct 8, 2025
3b9ac1b
Add json output
nolanpro Oct 8, 2025
a3bc22d
Add additional documentation
nolanpro Oct 8, 2025
6659ce0
Merge pull request #8559 from ProcessMaker/bugfix/FOUR-27150
nolanpro Oct 9, 2025
3ff7d99
Merge pull request #8560 from ProcessMaker/feature/FOUR-27177
nolanpro Oct 9, 2025
3f036c7
feat: add secure handler toggle visibility configuration to screen se…
eiresendez Oct 9, 2025
e5abff2
Version 4.15.9+beta=1
processmaker-bot Oct 9, 2025
f13da1c
Version 4.15.9+beta-1
processmaker-bot Oct 9, 2025
852fb22
Merge branch 'develop' of github.com:ProcessMaker/processmaker into …
marcoAntonioNina Oct 13, 2025
5cb79f3
Merge pull request #8510 from ProcessMaker/observation/FOUR-26310
nolanpro Oct 14, 2025
8666f11
Merge pull request #8507 from ProcessMaker/bugfix/FOUR-25165
nolanpro Oct 14, 2025
36283a4
Merge pull request #8495 from ProcessMaker/bugfix/FOUR-25312
nolanpro Oct 14, 2025
182013d
Merge pull request #8525 from ProcessMaker/bugfix/FOUR-26519
nolanpro Oct 14, 2025
fb51a78
Merge pull request #8561 from ProcessMaker/defect/FOUR-26678
nolanpro Oct 14, 2025
c98b6bc
Update dependencies
nolanpro Oct 14, 2025
f7d1abd
Version 4.15.10
processmaker-bot Oct 14, 2025
fe817e6
Version 4.15.9+beta-2
processmaker-bot Oct 14, 2025
83948f0
Refactor for a single horizon instance to improve memory
nolanpro Oct 14, 2025
beaf3dd
Removing comments
nolanpro Oct 14, 2025
4745320
Set the storage path instead of the env var
nolanpro Oct 14, 2025
ce25e78
Implement SAML email edit restriction alert in user profile updates
marcoAntonioNina Oct 14, 2025
f98013b
Fix alert message translation for SAML email edit restriction in user…
marcoAntonioNina Oct 14, 2025
61a6a86
Fix boolean values
nolanpro Oct 15, 2025
4c8a6f3
Bring back MakeQueueTenantAwareAction
nolanpro Oct 15, 2025
7d3d801
Fix tenant queues
nolanpro Oct 16, 2025
f96dee9
Fix for null queue name
nolanpro Oct 16, 2025
c89085c
Update dependencies
nolanpro Oct 16, 2025
49ae243
Version 4.15.9+beta-2
processmaker-bot Oct 16, 2025
736ba0f
Restrict queue to tenant's jobs
nolanpro Oct 16, 2025
994fd78
Merge branch 'develop' into task/FOUR-27352
nolanpro Oct 16, 2025
658e61e
Merge pull request #8565 from ProcessMaker/task/FOUR-27352
nolanpro Oct 16, 2025
0317dec
Version 4.15.9+beta-3
processmaker-bot Oct 16, 2025
a08445f
Add middleware hide server headers
marcoAntonioNina Oct 20, 2025
a2a6b7e
Add name attribute in task resource
agustinbusso Oct 20, 2025
3edc98e
Add Name Server
marcoAntonioNina Oct 20, 2025
adb49a7
Add queue metrics for prometheus
nolanpro Oct 21, 2025
02310ed
Add note
nolanpro Oct 21, 2025
ccadcca
Fix config key
nolanpro Oct 21, 2025
2180898
Handle cache prefixing in bootstrapper
nolanpro Oct 22, 2025
10779c3
Make metrics tenant aware
nolanpro Oct 22, 2025
0f0dd73
Fix schedule:run cron error
nolanpro Oct 23, 2025
a47b94b
Merge pull request #8570 from ProcessMaker/task/FOUR-27380
nolanpro Oct 23, 2025
a56fdfe
Version 4.15.9-RC1
processmaker-bot Oct 23, 2025
7e6bcac
Version 4.15.9
processmaker-bot Oct 23, 2025
0832e48
Fix multitenancy settings cache
nolanpro Oct 23, 2025
f2fdf6c
Introduced ValidatesFileTrait for file validation, ensuring security …
marcoAntonioNina Oct 23, 2025
929a573
Refactor tenant queue authorization
nolanpro Oct 24, 2025
612afc4
Fix docker host url
nolanpro Oct 25, 2025
726b6a3
Merge pull request #8572 from ProcessMaker/bugfix/FOUR-27531
nolanpro Oct 27, 2025
5f26d05
Bump build
nolanpro Oct 27, 2025
e1d9637
Merge pull request #8558 from ProcessMaker/bugfix/FOUR-27169
nolanpro Oct 27, 2025
c008028
Merge pull request #8475 from ProcessMaker/feature/FOUR-25919
nolanpro Oct 27, 2025
73cc8c9
Merge pull request #8491 from ProcessMaker/bugfix/FOUR-25970
nolanpro Oct 27, 2025
1076120
Merge pull request #8394 from ProcessMaker/bugfix/FOUR-24085
nolanpro Oct 27, 2025
81dde41
Merge pull request #7856 from ProcessMaker/observation/FOUR-21268
nolanpro Oct 27, 2025
ec367da
Merge pull request #8467 from ProcessMaker/bugfix/FOUR-24683
nolanpro Oct 27, 2025
018d359
Merge pull request #8506 from ProcessMaker/bugfix/FOUR-25910-b
nolanpro Oct 27, 2025
9e910ab
remove readme
rodriquelca Oct 27, 2025
923b7d0
Merge pull request #8518 from ProcessMaker/bugfix/FOUR-21536
nolanpro Oct 27, 2025
d1df158
Merge pull request #7807 from ProcessMaker/bugfix/FOUR-19358
nolanpro Oct 27, 2025
ae27fd4
Merge pull request #8568 from ProcessMaker/bugfix/FOUR-26739
nolanpro Oct 27, 2025
74b55ee
Merge pull request #8566 from ProcessMaker/bugfix/FOUR-26588
nolanpro Oct 27, 2025
5712645
Fix test
marcoAntonioNina Oct 27, 2025
97b618b
Merge pull request #8552 from ProcessMaker/task/FOUR-26776
nolanpro Oct 27, 2025
d3cb6b9
Merge pull request #8487 from ProcessMaker/bugfix/FOUR-23734
nolanpro Oct 27, 2025
c09606b
Merge branch 'develop' into bugfix/FOUR-26915
nolanpro Oct 27, 2025
be56304
Merge branch 'develop' into task/FOUR-26777
nolanpro Oct 27, 2025
2535d62
Merge pull request #8567 from ProcessMaker/bugfix/FOUR-26915
nolanpro Oct 28, 2025
8a60016
Merge pull request #8549 from ProcessMaker/task/FOUR-26777
nolanpro Oct 28, 2025
6ea8075
fix CR notes
rodriquelca Oct 28, 2025
db0f9a4
Update dependencies
nolanpro Oct 28, 2025
f89c7d6
restore update permission logs
rodriquelca Oct 28, 2025
ca0c63b
Version 4.15.10+beta-1
processmaker-bot Oct 28, 2025
65f0fa9
fix failing test
rodriquelca Oct 28, 2025
76d4a6f
Merge remote-tracking branch 'origin/permissionPerformance' into feat…
rodriquelca Oct 28, 2025
602f6ea
FOUR-25374: Updating as DBA request
pmPaulis Oct 29, 2025
950ecc9
Fix scheduler when tenants have different db credentials
nolanpro Oct 29, 2025
1fae92c
Merge pull request #8578 from ProcessMaker/bugfix/FOUR-27667
nolanpro Oct 29, 2025
d8a0168
Bump build hash
nolanpro Oct 29, 2025
abc26e9
Move cache settings prefix to bootstrapper
nolanpro Oct 30, 2025
5344bc5
Bump build hash
nolanpro Oct 30, 2025
d71c319
Merge branch 'bugfix/FOUR-27531' into 4.15.9+patch-a
nolanpro Oct 30, 2025
0a8d996
Bump build hash
nolanpro Oct 30, 2025
53ab967
Merge pull request #8573 from ProcessMaker/bugfix/FOUR-26797
nolanpro Oct 30, 2025
429eb04
Update dependencies
nolanpro Oct 30, 2025
7946d96
Bump build hash
nolanpro Oct 30, 2025
e9512b5
Merge branch '4.15.9+patch-a' into develop
nolanpro Oct 30, 2025
464e2de
Merge pull request #8536 from ProcessMaker/feature/FOUR-26661
nolanpro Oct 30, 2025
d9995af
Merge pull request #8535 from ProcessMaker/bugfix/FOUR-26568
nolanpro Oct 30, 2025
21dbe7f
Merge pull request #8479 from ProcessMaker/bugfix/FOUR-25374
nolanpro Oct 30, 2025
5561a34
Merge pull request #8576 from ProcessMaker/feature/FOUR-19876
nolanpro Oct 30, 2025
f049a31
Update dependencies
nolanpro Oct 30, 2025
baa7d61
Version 4.15.10+beta-2
processmaker-bot Oct 30, 2025
1f182cc
Fix memory issues with queue workers
nolanpro Nov 4, 2025
e89fdaa
Merge pull request #8585 from ProcessMaker/task/FOUR-27735
nolanpro Nov 4, 2025
c216919
Merge branch '4.15.9+patch-a' into develop
nolanpro Nov 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions ProcessMaker/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,25 @@
use Igaster\LaravelTheme\Facades\Theme;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Foundation\Application as IlluminateApplication;
use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables;
use Illuminate\Foundation\Bootstrap\RegisterProviders;
use Illuminate\Foundation\PackageManifest;
use Illuminate\Support\Env;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Config;
use ProcessMaker\Multitenancy\Tenant;
use ProcessMaker\Multitenancy\TenantBootstrapper;

/**
* Class Application.
*/
class Application extends IlluminateApplication
{
public $overrideTenantId = null;

public $skipCacheEvents = false;

/**
* Sets the timezone for the application and for php with the specified timezone.
*
Expand Down Expand Up @@ -90,4 +101,15 @@ public function registerConfiguredProviders()

parent::registerConfiguredProviders();
}

public function bootstrapWith(array $bootstrappers)
{
// Insert TenantBootstrapper after LoadEnvironmentVariables
if ($bootstrappers[0] !== LoadEnvironmentVariables::class) {
throw new \Exception('LoadEnvironmentVariables is not the first bootstrapper. Did a laravel upgrade change this?');
}
array_splice($bootstrappers, 1, 0, [TenantBootstrapper::class]);

return parent::bootstrapWith($bootstrappers);
}
}
52 changes: 50 additions & 2 deletions ProcessMaker/AssignmentRules/ProcessManagerAssigned.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use ProcessMaker\Exception\ThereIsNoProcessManagerAssignedException;
use ProcessMaker\Models\Process;
use ProcessMaker\Models\ProcessRequest;
use ProcessMaker\Models\ProcessRequestToken;
use ProcessMaker\Models\User;
use ProcessMaker\Nayra\Contracts\Bpmn\ActivityInterface;
use ProcessMaker\Nayra\Contracts\Bpmn\TokenInterface;

Expand All @@ -24,16 +26,62 @@ class ProcessManagerAssigned implements AssignmentRuleInterface
* @param TokenInterface $token
* @param Process $process
* @param ProcessRequest $request
* @return int
* @return int|null
* @throws ThereIsNoProcessManagerAssignedException
*/
public function getNextUser(ActivityInterface $task, TokenInterface $token, Process $process, ProcessRequest $request)
{
$user_id = $request->processVersion->manager_id;
// review for multiple managers
$managers = $request->processVersion->manager_id;
$user_id = $this->getNextManagerAssigned($managers, $task, $request);
if (!$user_id) {
throw new ThereIsNoProcessManagerAssignedException($task);
}

return $user_id;
}

/**
* Get the round robin manager using a true round robin algorithm
*
* @param array $managers
* @param ActivityInterface $task
* @param ProcessRequest $request
* @return int|null
*/
private function getNextManagerAssigned($managers, $task, $request)
{
// Validate input
if (empty($managers) || !is_array($managers)) {
return null;
}

// If only one manager, return it
if (count($managers) === 1) {
return $managers[0];
}

// get the last manager assigned to the task across all requests
$last = ProcessRequestToken::where('process_id', $request->process_id)
->where('element_id', $task->getId())
->whereIn('user_id', $managers)
->orderBy('created_at', 'desc')
->first();

$user_id = $last ? $last->user_id : null;

sort($managers);

$key = array_search($user_id, $managers);
if ($key === false) {
// If no previous manager found, start with the first manager
$key = 0;
} else {
// Move to the next manager in the round-robin
$key = ($key + 1) % count($managers);
}
$user_id = $managers[$key];

return $user_id;
}
}
4 changes: 2 additions & 2 deletions ProcessMaker/Console/Commands/ProcessMakerLicenseRemove.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class ProcessMakerLicenseRemove extends Command
*/
public function handle()
{
if (Storage::disk('root')->exists('license.json')) {
if (Storage::disk('local')->exists('license.json')) {
if ($this->option('force') || $this->confirm('Are you sure you want to remove the license.json file?')) {
Storage::disk('root')->delete('license.json');
Storage::disk('local')->delete('license.json');
$this->info('license.json removed successfully!');

$this->info('Calling package:discover to update the package cache with enabled packages');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function handle()
return 1;
}

Storage::disk('root')->put('license.json', $content);
Storage::disk('local')->put('license.json', $content);

$this->info('Calling package:discover to update the package cache with enabled packages');
Artisan::call('package:discover');
Expand Down
4 changes: 3 additions & 1 deletion ProcessMaker/Console/Commands/TenantsCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,9 @@ public function handle()
$this->line('- Run migrations and seed the database');
$this->line('- Run the install command for each package');
$this->line('- Run artisan upgrade');
$this->line('- Install passport by calling passport:install');
$this->line('- Install passport by calling passport:install (create the default clients');
$this->line('- Reset the admin password with auth:set-password');
$this->line('- Run processmaker:initialize-script-microservice');
$this->info("For example, `TENANT={$tenant->id} php artisan migrate:fresh --seed`");
}
}
Expand Down
8 changes: 7 additions & 1 deletion ProcessMaker/Console/Commands/TenantsList.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class TenantsList extends Command
*
* @var string
*/
protected $signature = 'tenants:list {--ids : Only output the ids}';
protected $signature = 'tenants:list {--ids : Only output the ids} {--json : Output the tenants as JSON}';

/**
* The console command description.
Expand All @@ -40,6 +40,12 @@ public function handle()
return;
}

if ($this->option('json')) {
$this->line(json_encode($tenants->toArray(), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));

return;
}

$formattedTenants = $tenants->map(function ($tenant) {
$config = $tenant->config;

Expand Down
141 changes: 61 additions & 80 deletions ProcessMaker/Console/Commands/TenantsVerify.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@
namespace ProcessMaker\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Log;
use ProcessMaker\Models\EnvironmentVariable;
use ProcessMaker\Models\User;
use Spatie\Multitenancy\Models\Tenant;

class TenantsVerify extends Command
Expand All @@ -14,7 +19,7 @@ class TenantsVerify extends Command
*
* @var string
*/
protected $signature = 'tenants:verify {--verify-against= : The tenant ID to verify against}';
protected $signature = 'tenants:verify';

/**
* The console command description.
Expand All @@ -23,17 +28,6 @@ class TenantsVerify extends Command
*/
protected $description = 'Verify tenant configuration and storage paths';

/**
* Strip protocol from URL
*
* @param string $url
* @return string
*/
private function stripProtocol(string $url): string
{
return preg_replace('#^https?://#', '', $url);
}

/**
* Execute the console command.
*
Expand All @@ -46,85 +40,72 @@ public function handle()
$currentTenant = app('currentTenant');
}

$verifyAgainstId = $this->option('verify-against');

if (!$currentTenant) {
$this->error('No current tenant found');
if (config('app.multitenancy') && !$currentTenant) {
$this->error('Multitenancy enabled but no current tenant found.');

return;
}

$this->info('Current Tenant ID: ' . $currentTenant->id);
$this->line('----------------------------------------');
$this->info('Current Tenant ID: ' . ($currentTenant?->id ?? 'NONE'));

// Expected paths and configurations
$expectedStoragePath = base_path('storage/tenant_' . $currentTenant->id);
$actualConfigs = [
'filesystems.disks.local.root' => storage_path('app'),
'cache.prefix' => config('cache.prefix'),
'app.url' => config('app.url'),
'script-runner-microservice.callback' => config('script-runner-microservice.callback'),
$paths = [
['Storage Path', storage_path()],
['Config Cache Path', app()->getCachedConfigPath()],
['Lang Path', lang_path()],
];

// Display current values
$this->info('Current Storage Path: ' . storage_path());
$this->line('----------------------------------------');

$this->info('Current Configuration Values:');
foreach ($actualConfigs as $key => $expectedValue) {
$currentValue = config($key);
$this->line("{$key}: {$currentValue}");
}

// If verify-against is specified, perform verification
if ($verifyAgainstId) {
$this->line('----------------------------------------');
$this->info("Verifying against tenant ID: {$verifyAgainstId}");
// Display paths in a nice table
$this->table(['Path', 'Value'], $paths);

$configs = [
'app.key',
'app.url',
'app.instance',
'cache.prefix',
'database.redis.options.prefix',
'cache.stores.cache_settings.prefix',
'script-runner-microservice.callback',
'database.connections.processmaker.database',
'logging.channels.daily.path',
'filesystems.disks.public.root',
'filesystems.disks.local.root',
'filesystems.disks.lang.root',
];

$expectedStoragePath = base_path('storage/tenant_' . $verifyAgainstId);
$expectedConfigs = [
'filesystems.disks.local.root' => $expectedStoragePath . '/app',
'cache.prefix' => 'tenant_id_' . $verifyAgainstId,
'app.url' => config('app.url'),
$configs = array_map(function ($config) {
return [
$config,
config($config),
];

$hasMismatch = false;

// Verify storage path
if (storage_path() !== $expectedStoragePath) {
$this->error('Storage path mismatch!');
$this->line("Expected: {$expectedStoragePath}");
$this->line('Current: ' . storage_path());
$hasMismatch = true;
}

// Verify tenant URL if tenant exists
$verifyTenant = Tenant::find($verifyAgainstId);
if ($verifyTenant && $verifyTenant->domain !== $this->stripProtocol(config('app.url'))) {
$this->error('Tenant URL mismatch!');
$this->line("Expected: {$verifyTenant->domain}");
$this->line('Current: ' . config('app.url'));
$hasMismatch = true;
}

// Verify config values
foreach ($expectedConfigs as $key => $expectedValue) {
$currentValue = config($key);
if ($currentValue !== $expectedValue) {
$this->error("Config mismatch for {$key}!");
$this->line("Expected: {$expectedValue}");
$this->line("Current: {$currentValue}");
$hasMismatch = true;
}
}, $configs);

// Display configs in a nice table
$this->table(['Config', 'Value'], $configs);

$env = EnvironmentVariable::first();
if (!$env) {
$decrypted = 'No environment variables found to test decryption';
} else {
$encryptedValue = $env->getAttributes()['value'];
try {
Crypt::decryptString($encryptedValue);
$decrypted = 'OK';
} catch (DecryptException $e) {
$decrypted = 'FAILED! ' . $e->getMessage();
}

if (!$hasMismatch) {
$this->info('All configurations match as expected!');
}

return $hasMismatch ? Command::FAILURE : Command::SUCCESS;
}

return Command::SUCCESS;
$other = [
['Landlord Config Cache Path', base_path('bootstrap/cache/config.php')],
['Landlord Config Is Cached', File::exists(base_path('bootstrap/cache/config.php')) ? 'Yes' : 'No'],
['Tenant Config Cache Path', app()->getCachedConfigPath()],
['Tenant Config Is Cached', File::exists(app()->getCachedConfigPath()) ? 'Yes' : 'No'],
['First username (database check)', User::first()?->username ?? 'No users found'],
['Decrypted check', substr($decrypted, 0, 50)],
['Original App URL (landlord)', $currentTenant?->getOriginalValue('APP_URL') ?? config('app.url')],
];

// Display other in a nice table
$this->table(['Other', 'Value'], $other);
}
}
3 changes: 3 additions & 0 deletions ProcessMaker/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ protected function schedule(Schedule $schedule)
$schedule->command('metrics:clear')->cron("*/{$clearInterval} * * * *");
break;
}

// 5 minutes is recommended in https://laravel.com/docs/12.x/horizon#metrics
$schedule->command('horizon:snapshot')->everyFiveMinutes();
}

/**
Expand Down
Loading
Loading