Skip to content

Commit 6cce01d

Browse files
Merge remote-tracking branch 'origin/develop' into feature/FOUR-22569_deploy
2 parents 3f4cd9a + 0317dec commit 6cce01d

281 files changed

Lines changed: 72090 additions & 3358 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy-pm4.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ on:
99
jobs:
1010
run:
1111
name: Run PM4-workflow
12-
uses: processmaker/.github/.github/workflows/deploy-pm4.yml@multitenancy
12+
uses: processmaker/.github/.github/workflows/deploy-pm4.yml@main
1313
secrets: inherit

ProcessMaker/Application.php

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,27 @@
33
namespace ProcessMaker;
44

55
use Igaster\LaravelTheme\Facades\Theme;
6+
use Illuminate\Filesystem\Filesystem;
67
use Illuminate\Foundation\Application as IlluminateApplication;
8+
use Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables;
9+
use Illuminate\Foundation\Bootstrap\RegisterProviders;
10+
use Illuminate\Foundation\PackageManifest;
11+
use Illuminate\Support\Env;
12+
use Illuminate\Support\Facades\App;
713
use Illuminate\Support\Facades\Auth;
14+
use Illuminate\Support\Facades\Config;
15+
use ProcessMaker\Multitenancy\Tenant;
16+
use ProcessMaker\Multitenancy\TenantBootstrapper;
817

918
/**
1019
* Class Application.
1120
*/
1221
class Application extends IlluminateApplication
1322
{
23+
public $overrideTenantId = null;
24+
25+
public $skipCacheEvents = false;
26+
1427
/**
1528
* Sets the timezone for the application and for php with the specified timezone.
1629
*
@@ -78,13 +91,25 @@ public function path($path = '')
7891
return $this->basePath . DIRECTORY_SEPARATOR . 'ProcessMaker' . ($path ? DIRECTORY_SEPARATOR . $path : $path);
7992
}
8093

81-
public function setStoragePath($path)
94+
public function registerConfiguredProviders()
8295
{
83-
$this->storagePath = $path;
96+
// Must be rebound before registerConfiguredProviders() runs but after bootstrapping is done
97+
// so we can access storage and cache facades.
98+
$this->singleton(PackageManifest::class, fn () => new LicensedPackageManifest(
99+
new Filesystem, $this->basePath(), $this->getCachedPackagesPath()
100+
));
101+
102+
parent::registerConfiguredProviders();
84103
}
85104

86-
public function getStoragePath()
105+
public function bootstrapWith(array $bootstrappers)
87106
{
88-
return $this->storagePath;
107+
// Insert TenantBootstrapper after LoadEnvironmentVariables
108+
if ($bootstrappers[0] !== LoadEnvironmentVariables::class) {
109+
throw new \Exception('LoadEnvironmentVariables is not the first bootstrapper. Did a laravel upgrade change this?');
110+
}
111+
array_splice($bootstrappers, 1, 0, [TenantBootstrapper::class]);
112+
113+
return parent::bootstrapWith($bootstrappers);
89114
}
90115
}

ProcessMaker/Cache/AbstractCacheFactory.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
abstract class AbstractCacheFactory implements CacheFactoryInterface
1111
{
1212
protected static ?CacheInterface $testInstance = null;
13+
1314
protected static bool $storeMetrics = true;
1415

1516
/**

ProcessMaker/Console/Commands/ProcessMakerLicenseRemove.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class ProcessMakerLicenseRemove extends Command
3434
*/
3535
public function handle()
3636
{
37-
if (Storage::disk('root')->exists('license.json')) {
37+
if (Storage::disk('local')->exists('license.json')) {
3838
if ($this->option('force') || $this->confirm('Are you sure you want to remove the license.json file?')) {
39-
Storage::disk('root')->delete('license.json');
39+
Storage::disk('local')->delete('license.json');
4040
$this->info('license.json removed successfully!');
4141

4242
$this->info('Calling package:discover to update the package cache with enabled packages');

ProcessMaker/Console/Commands/ProcessMakerLicenseUpdate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function handle()
4040
return 1;
4141
}
4242

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

4545
$this->info('Calling package:discover to update the package cache with enabled packages');
4646
Artisan::call('package:discover');

ProcessMaker/Console/Commands/SyncGuidedTemplates.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,28 +22,16 @@ class SyncGuidedTemplates extends Command
2222
*/
2323
protected $description = 'Synchronize guided templates from a central repository';
2424

25-
/**
26-
* Create a new command instance.
27-
*
28-
* @return void
29-
*/
30-
public function __construct()
31-
{
32-
parent::__construct();
33-
}
34-
3525
/**
3626
* Execute the console command.
37-
*
38-
* @return int
3927
*/
40-
public function handle()
28+
public function handle(): int
4129
{
4230
if ($this->option('queue')) {
4331
$randomDelay = random_int(10, 120);
4432
Job::dispatch()->delay(now()->addMinutes($randomDelay));
45-
} else {
46-
Job::dispatchSync();
33+
34+
return 0;
4735
}
4836

4937
Job::dispatchSync();

0 commit comments

Comments
 (0)