Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 10 Upgrade #5168

Merged
merged 69 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
cc6ac98
Apply code style
laravel-shift Aug 8, 2023
cbb8798
Move `resources/lang` folder
laravel-shift Aug 8, 2023
9574ad0
Remove `fruitcake/laravel-cors` dependency
laravel-shift Aug 8, 2023
bcdefd6
Upgrade to Flysystem 3.0
laravel-shift Aug 8, 2023
d6d8955
Shift core files
laravel-shift Aug 8, 2023
78b3dea
Convert `optional()` to nullsafe operator
laravel-shift Aug 8, 2023
bb50285
Use Faker methods
laravel-shift Aug 8, 2023
adfe498
Adopt class based routes
laravel-shift Aug 8, 2023
39a2986
Shift config files
laravel-shift Aug 8, 2023
89f9e4f
Default config files
laravel-shift Aug 8, 2023
3d2d9b3
Bump Laravel dependencies
laravel-shift Aug 8, 2023
aefa3ff
Set return type of base TestCase methods
laravel-shift Aug 8, 2023
d47628c
Adopt anonymous migrations
laravel-shift Aug 8, 2023
d97bd1f
Shift cleanup
laravel-shift Aug 8, 2023
005f043
Fix Language Resources issues after upgrade with Laravel Shift
pmoskrojas Aug 8, 2023
da6ca18
Solving unittest issues and libraries upgrade manual method
pmoskrojas Aug 10, 2023
7c80295
Delete composer.json
pmoskrojas Aug 10, 2023
79908d3
Update composer.json
pmoskrojas Aug 10, 2023
2bb95f7
Update package.json with new versions of Axios and Laravel Echo Serve…
pmoskrojas Aug 10, 2023
136f465
Update composer lock
nolanpro Aug 14, 2023
49c5778
Put back package name
nolanpro Aug 15, 2023
9e32fbf
Update .gitignore
nolanpro Aug 15, 2023
6e13095
Merge branch 'next' into shift-97359
nolanpro Aug 15, 2023
4782fd2
Remove package from composer.json
nolanpro Aug 15, 2023
509e7a9
Revert "Move `resources/lang` folder"
nolanpro Aug 16, 2023
ef6c60f
Keep original from email address
nolanpro Aug 16, 2023
91312b4
Use original package.json
nolanpro Aug 16, 2023
70abb7d
Move failing migration to upgrades
estebangallego Aug 15, 2023
3d5b3c2
Use legacy output formatting
nolanpro Aug 16, 2023
6b5ad1f
Merge branch 'next' into shift-97359
nolanpro Aug 16, 2023
91a1952
Update flysystem path getter
nolanpro Aug 16, 2023
a6d8fad
Use original lang path
nolanpro Aug 16, 2023
849693f
Fix composer.lock
nolanpro Aug 16, 2023
9bfbfb8
Merge pull request #5110 from ProcessMaker/shift-97359
nolanpro Aug 16, 2023
82f3a25
Move `resources/lang` folder
laravel-shift Aug 16, 2023
653a348
Convert deprecated methods
laravel-shift Aug 16, 2023
f9eee78
Shift core files
laravel-shift Aug 16, 2023
2613298
Default config files
laravel-shift Aug 16, 2023
2b213cb
Bump Laravel dependencies
laravel-shift Aug 16, 2023
80452d4
Adopt anonymous migrations
laravel-shift Aug 16, 2023
fe8ff9c
Rename `password_resets` table
laravel-shift Aug 16, 2023
6601801
Keep some original env names for configs
nolanpro Aug 16, 2023
740886c
Delete duplicate UserFactory
nolanpro Aug 16, 2023
4c546ea
Composer update for Laravel 10
nolanpro Aug 17, 2023
83d7c61
Change minimum stability back to dev
nolanpro Aug 17, 2023
1b29d78
Remove unused file
nolanpro Aug 17, 2023
6e058de
Update lang path
nolanpro Aug 17, 2023
4ba303a
Update default mail config
nolanpro Aug 17, 2023
3233fc7
Update default connection
nolanpro Aug 18, 2023
5e7b9bd
Remove deprecated event assertions
nolanpro Aug 18, 2023
befb5e9
Revert "Move `resources/lang` folder"
nolanpro Aug 18, 2023
dd957f6
Call job handler directly when a return value is needed
nolanpro Aug 21, 2023
d6d0c0e
dispatchSync requires all props to be defined
nolanpro Aug 21, 2023
48659b0
Do not queue an app re-binding when migrating for tests
nolanpro Aug 22, 2023
99fc564
Bus fake must include RefreshArtisanCaches
nolanpro Aug 22, 2023
925b87e
Log records are now monolog objects
nolanpro Aug 22, 2023
b398dec
Remove Laravel-specific translations
nolanpro Aug 22, 2023
fb66839
Ignore Laravel-specific language files
nolanpro Aug 22, 2023
1321f7e
Update Laravel-specific language files
nolanpro Aug 22, 2023
9b656d1
Use php 8.2
nolanpro Aug 23, 2023
0651664
Fix deprecated syntax
nolanpro Aug 23, 2023
060aff7
Specify base image
nolanpro Aug 23, 2023
0fe799d
Fix tests related to language file updates
nolanpro Aug 23, 2023
550ce86
Use request->merge
nolanpro Aug 24, 2023
144cb89
Merge pull request #5169 from ProcessMaker/shift-97938
nolanpro Aug 24, 2023
0c03f23
Merge branch 'next' into feature/FOUR-9714
nolanpro Aug 24, 2023
11c0445
Skip saved search user defaults in tests
nolanpro Aug 24, 2023
a4bfa47
Add additional cicd info to readme
nolanpro Aug 24, 2023
2e85220
Merge branch 'next' into feature/FOUR-9714
nolanpro Aug 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/deploy-pm4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ env:
IMAGE_TAG1: $(echo "$CI_PROJECT-$CI_PACKAGE_BRANCH" | sed "s;/;-;g")
GITHUB_COMMENT: ${{ secrets.GH_COMMENT }}
pull_req_id: ${{github.event.pull_request.number}}
BASE: ci-base-php82
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -68,9 +69,9 @@ jobs:
if: contains(github.event.pull_request.body, 'ci:build-base') || github.event_name == 'schedule'
run: |
cd pm4-stm-docker
docker-compose build --no-cache base
docker-compose build --no-cache base-php82
docker-compose build --no-cache cache
docker push ${REPOSITORY}:ci-base
docker push ${REPOSITORY}:ci-base-php82
docker push ${REPOSITORY}:ci-cache
- name: Build and Push the image to ECR
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ cypress/downloads
.php-cs-fixer.cache
.phpunit.result.cache
.editorconfig
resources/lang/de
resources/lang/es
resources/lang/fr
4 changes: 2 additions & 2 deletions ProcessMaker/Console/Commands/BuildScriptExecutors.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function buildExecutor()
$cmd .= ' --user-id=' . $this->userId;
}
$this->artisan($cmd);
$this->info("SDK is at ${sdkDir}");
$this->info("SDK is at {$sdkDir}");
}

$dockerfile = ScriptExecutor::initDockerfile($lang) . "\n" . $scriptExecutor->config;
Expand All @@ -152,7 +152,7 @@ public function buildExecutor()
$this->info('Building the docker executor');

$image = $scriptExecutor->dockerImageName();
$command = Docker::command() . " build --build-arg SDK_DIR=/sdk -t ${image} -f ${packagePath}/Dockerfile.custom ${packagePath}";
$command = Docker::command() . " build --build-arg SDK_DIR=/sdk -t {$image} -f {$packagePath}/Dockerfile.custom {$packagePath}";

if ($this->userId) {
$this->runProc(
Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/Console/Commands/ProcessMakerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private function checkMigrationStatus()
private function testHorizonService()
{
$testDispatchNow = 'Test immediate Jobs';
TestStatusJob::dispatchNow($testDispatchNow);
TestStatusJob::dispatchSync($testDispatchNow);
$this->waitTestPassed($testDispatchNow, 5);

$testDelayedWorkers = 'Test dispatch Jobs';
Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/Console/Commands/SyncDefaultTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function handle()
$randomDelay = random_int(10, 120);
Job::dispatch()->delay(now()->addMinutes($randomDelay));
} else {
Job::dispatchNow();
Job::dispatchSync();
}

return 0;
Expand Down
5 changes: 5 additions & 0 deletions ProcessMaker/Events/CustomizeUiUpdated.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ class CustomizeUiUpdated implements SecurityLogEventInterface
use FormatSecurityLogChanges;

private array $data;

private array $changes;

private array $original;

private bool $reset;

private string $defaultVariables = '[
{"id":"$primary","value":"#0872C2","title":"Primary"},
{"id":"$secondary","value":"#6C757D","title":"Secondary"},
Expand All @@ -27,6 +31,7 @@ class CustomizeUiUpdated implements SecurityLogEventInterface
{"id":"$dark","value":"#000000","title":"Dark"},
{"id":"$light","value":"#FFFFFF","title":"Light"}
]';

private string $defaultFont = '{"id":"\'Open Sans\'","title":"Default Font"}';

/**
Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/Exception/ReferentialIntegrityException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace ProcessMaker\Exception;

use Exception;
use ProcessMaker\Models\ProcessMakerModel;
use Illuminate\Database\Eloquent\Model;
use ProcessMaker\Models\ProcessMakerModel;

class ReferentialIntegrityException extends Exception
{
Expand Down
7 changes: 4 additions & 3 deletions ProcessMaker/Helpers/ArrayHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public static function replaceKeyInArray(array $array, string $oldKey, string $n
}

/**
* This method is analogous to the function array_diff_assoc, with the difference
* that it supports the comparison of array-type elements in the content of the
* This method is analogous to the function array_diff_assoc, with the difference
* that it supports the comparison of array-type elements in the content of the
* compared arrays.
*
*
* @param array $array1
* @param array $arrays
* @return array
Expand All @@ -86,6 +86,7 @@ public static function customArrayDiffAssoc(array $array1, ...$arrays): array
$diff[$key] = $value;
}
}

return $diff;
}
}
2 changes: 1 addition & 1 deletion ProcessMaker/Http/Controllers/Admin/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function edit(User $user)
$permissionGroups = $all_permissions->sortBy('title')->groupBy('group')->sortKeys();

$langs = [];
foreach (scandir(resource_path('lang')) as $file) {
foreach (scandir(app()->langPath()) as $file) {
preg_match('/([a-z]{2})\\.json/', $file, $matches);
if (!empty($matches)) {
$langs[] = $matches[1];
Expand Down
4 changes: 1 addition & 3 deletions ProcessMaker/Http/Controllers/Api/FileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,7 @@ public function show(Media $file)
*/
public function download(Media $file)
{
$path = Storage::disk('public')->getAdapter()->getPathPrefix() .
$file->id . '/' .
$file->file_name;
$path = Storage::disk('public')->path($file->id . '/' . $file->file_name);

// Register the Event
if (!empty($file->file_name)) {
Expand Down
4 changes: 2 additions & 2 deletions ProcessMaker/Http/Controllers/Api/NotificationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function index(Request $request)
public function store(Request $request)
{
$data = json_decode($request->data, true);
$request->request->add(['url' => $data['url'] ?? null]);
$request->merge(['url' => $data['url'] ?? null]);

$request->validate(Notification::rules());
$notification = new Notification();
Expand Down Expand Up @@ -233,7 +233,7 @@ public function show(Notification $notification)
public function update(Notification $notification, Request $request)
{
$data = json_decode($request->data, true);
$request->request->add(['url' => $data['url'] ?? null]);
$request->merge(['url' => $data['url'] ?? null]);

$request->validate(Notification::rules($notification));
$notification->fill($request->input());
Expand Down
8 changes: 4 additions & 4 deletions ProcessMaker/Http/Controllers/Api/ProcessController.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@ public function store(Request $request)
// Validate if exists file bpmn
if ($request->has('file')) {
$data['bpmn'] = $request->file('file')->get();
$request->request->add(['bpmn' => $data['bpmn']]);
$request->request->remove('file');
$request->merge(['bpmn' => $data['bpmn']]);
$request->offsetUnset('file');
unset($data['file']);
$processCreated = ProcessCreated::BPMN_CREATION;
}
Expand Down Expand Up @@ -888,7 +888,7 @@ public function destroy(Process $process)
*/
public function export(Request $request, Process $process)
{
$fileKey = ExportProcess::dispatchNow($process);
$fileKey = (new ExportProcess($process))->handle();

if ($fileKey) {
$url = url("/processes/{$process->id}/download/{$fileKey}");
Expand Down Expand Up @@ -999,7 +999,7 @@ public function import(Process $process, Request $request)
'code' => $code,
];
}
$import = ImportProcess::dispatchNow($content);
$import = (new ImportProcess($content))->handle();

return response([
'status' => $import->status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ private function checkDomain($domain, $whitelist)
*/
private function cancelRequestToken(ProcessRequest $request)
{
CancelRequest::dispatchNow($request);
CancelRequest::dispatchSync($request);
// Close process request
$request->status = 'CANCELED';
$request->save();
Expand All @@ -580,7 +580,7 @@ private function completeRequest(ProcessRequest $request)
Notification::send($notifiables, new ProcessCanceledNotification($request));

// Terminate request
TerminateRequest::dispatchNow($request);
TerminateRequest::dispatchSync($request);

event(new RequestAction($request, RequestAction::ACTION_COMPLETED));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public function getAvailableLanguages(Request $request)

// Available Pm Languages (user settings)
$pmLangs = [];
foreach (scandir(resource_path('lang')) as $file) {
foreach (scandir(app()->langPath()) as $file) {
preg_match('/([a-z]{2})\\.json/', $file, $matches);
if (!empty($matches)) {
$pmLangs[] = $matches[1];
Expand Down
4 changes: 2 additions & 2 deletions ProcessMaker/Http/Controllers/Api/ScreenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ public function destroy(Screen $screen)
*/
public function export(Request $request, Screen $screen)
{
$fileKey = ExportScreen::dispatchNow($screen);
$fileKey = (new ExportScreen($screen))->handle();

if ($fileKey) {
return ['url' => url("/designer/screens/{$screen->id}/download/{$fileKey}")];
Expand Down Expand Up @@ -504,7 +504,7 @@ public function import(Request $request)
);
}

$import = ImportScreen::dispatchNow($content);
$import = (new ImportScreen($content))->handle();

return ['status' => $import];
}
Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/Http/Controllers/Api/ScriptController.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public function execute(Request $request, ...$scriptKey)
$code = $script->code;

if ($request->get('sync') === true) {
return ExecuteScript::dispatchNow($script, $request->user(), $code, $data, $watcher, $config, true);
return (new ExecuteScript($script, $request->user(), $code, $data, $watcher, $config, true))->handle();
} else {
ExecuteScript::dispatch($script, $request->user(), $code, $data, $watcher, $config)->onQueue('bpmn');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ public function delete(Request $request, ScriptExecutor $scriptExecutor)
exec($cmd, $out, $return);

if ($return !== 0) {
throw ValidationException::withMessages(['delete' => _('Error removing image.') . " ${cmd} " . implode("\n", $out)]);
throw ValidationException::withMessages(['delete' => _('Error removing image.') . " {$cmd} " . implode("\n", $out)]);
}
}

Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/Http/Controllers/Api/SettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public function import(Request $request)
$content = $request->file('file')->get();

try {
$imported = ImportSettings::dispatchNow($content);
$imported = (new ImportSettings($content))->handle();
} catch (Throwable $e) {
return response([
'error' => $e->getMessage(),
Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/Http/Controllers/Api/TemplateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function store(string $type, Request $request)
}
$request->validate(Template::rules($request->id, $this->types[$type][4]));
$storeTemplate = $this->template->store($type, $request);
TemplatePublished::dispatch($request->request->all());
TemplatePublished::dispatch($request->all());

return $storeTemplate;
}
Expand Down
2 changes: 2 additions & 0 deletions ProcessMaker/Jobs/BpmnAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ abstract class BpmnAction implements ShouldQueue
*/
protected $instance;

protected $instanceId;

protected $tokenId = null;

protected $disableGlobalEvents = false;
Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/Jobs/DownloadSecurityLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ protected function createTemporaryFilename()

$s3Uri = empty(config('app.security_log_s3_uri')) ? 'security-logs' : config('app.security_log_s3_uri');

return $s3Uri .'/'. $uuid . '.' . $this->format;
return $s3Uri . '/' . $uuid . '.' . $this->format;
}

/**
Expand Down
2 changes: 0 additions & 2 deletions ProcessMaker/Jobs/ImportProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -879,8 +879,6 @@ protected function decodeFile()

/**
* Execute the job.
*
* @return bool
*/
public function handle()
{
Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/Managers/TaskSchedulerManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ public function evaluateConditionals()
->where('status', 'ACTIVE')
->get();
foreach ($processes as $process) {
StartEventConditional::dispatchNow($process);
StartEventConditional::dispatchSync($process);
}
}

Expand Down
4 changes: 2 additions & 2 deletions ProcessMaker/Models/CallActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ public function addToken(ExecutionInstanceInterface $instance, TokenInterface $t
*/
private function synchronizeInstances(ExecutionInstanceInterface $instance, ExecutionInstanceInterface $currentInstance)
{
$parentProcessId = optional($instance->getProcess()->getOwnerDocument()->getModel())->id;
$childProcessId = optional($currentInstance->getProcess()->getOwnerDocument()->getModel())->id;
$parentProcessId = $instance->getProcess()->getOwnerDocument()->getModel()?->id;
$childProcessId = $currentInstance->getProcess()->getOwnerDocument()->getModel()?->id;
if ($parentProcessId !== $childProcessId) {
$currentInstance->getProcess()->getEngine()->runToNextState();
}
Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/Models/EnvironmentVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public static function rules($existing = null)
return [
'description' => 'required',
'value' => 'nullable',
'name' => ['required', "regex:${validVariableName}", $unique],
'name' => ['required', "regex:{$validVariableName}", $unique],
];
}

Expand Down
4 changes: 1 addition & 3 deletions ProcessMaker/Models/ProcessRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -896,9 +896,7 @@ public function downloadFile($fileId)
return null;
}

$path = Storage::disk('public')->getAdapter()->getPathPrefix() .
$filtered['id'] . '/' .
$filtered['file_name'];
$path = Storage::disk('public')->path($filtered['id'] . '/' . $filtered['file_name']);

return $path;
}
Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/Models/ProcessRequestToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public function getNotifiableUserIds($notifiableType)
case 'manager':
$process = $this->process()->first();

return collect([optional($process)->manager_id]);
return collect([$process?->manager_id]);
break;
default:
return collect([]);
Expand Down
4 changes: 2 additions & 2 deletions ProcessMaker/Models/ScriptExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function dockerImageName()
$tag = $this->imageTag();
$instance = config('app.instance');

return "processmaker4/executor-${instance}-${lang}-${id}:${tag}";
return "processmaker4/executor-{$instance}-{$lang}-{$id}:{$tag}";
}

public function imageTag()
Expand Down Expand Up @@ -202,7 +202,7 @@ public static function listOfExecutorImages($filterByLanguage = null)
$instance = config('app.instance');

return array_values(array_filter($result, function ($image) use ($filterByLanguage, $instance) {
$filter = "processmaker4/executor-${instance}-";
$filter = "processmaker4/executor-{$instance}-";
if ($filterByLanguage) {
$filter .= $filterByLanguage . '-';
}
Expand Down