Skip to content

Laravel 8.x Shift #4483

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

Merged
merged 92 commits into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
2c5d963
Apply code style
laravel-shift Aug 23, 2022
1c3290a
Adopt short array syntax
laravel-shift Aug 23, 2022
3386bed
Add laravel/ui dependency
laravel-shift Aug 23, 2022
349fa5d
Convert factory types to states
laravel-shift Aug 23, 2022
532d694
Shift config files
laravel-shift Aug 23, 2022
7672638
Default config files
laravel-shift Aug 23, 2022
2772efa
Bump Laravel dependencies
laravel-shift Aug 23, 2022
ff2b75a
Shift cleanup
laravel-shift Aug 23, 2022
f2c1f28
Shift test config and references
laravel-shift Aug 23, 2022
efd5ac2
Update error handler to use Throwable
nolanpro Aug 1, 2022
c747ac0
Remove unused traits in controllers
nolanpro Aug 1, 2022
0f6256e
Update namespaces for medialibrary
nolanpro Aug 1, 2022
47d568b
Use guzzle 7.4
nolanpro Aug 1, 2022
07713ca
Remove unused package
nolanpro Aug 1, 2022
973516f
Update argument compatibility
nolanpro Aug 1, 2022
2d25ec0
Update additional MediaLibrary namespaces
nolanpro Aug 9, 2022
cb15244
Fix Laravel echo server error
nolanpro Aug 9, 2022
6c84a28
Upgrade Spatie MediaLibrary to v9
nolanpro Aug 9, 2022
f6cb45a
Remove script
nolanpro Aug 10, 2022
f8689bf
Remove .phpunit.result.cache
nolanpro Aug 10, 2022
7308ed3
Add .phpunit.result.cache to git ignore
nolanpro Aug 10, 2022
da50ad1
Change getOriginal to getRawOriginal in test
nolanpro Aug 15, 2022
f8d25ea
Fix custom MediaPathGenerator
nolanpro Aug 15, 2022
e7f7c98
Upgrade php swagger
nolanpro Aug 16, 2022
dc78e37
Add bearer auth to swagger ui
nolanpro Aug 16, 2022
1bd9ab6
Fix phpunit tests
nolanpro Aug 16, 2022
492d58e
Fix additional tests
nolanpro Aug 16, 2022
cb7cd53
Add helper function to register OpenAPI annotations
nolanpro Aug 17, 2022
7b0b6e2
Use original mail settings for now
nolanpro Aug 18, 2022
8b8b3f0
Set pmql to dev-develop until a new release is available
nolanpro Aug 23, 2022
7e0626d
Run composer update
nolanpro Aug 23, 2022
e793f92
Apply code style
laravel-shift Aug 24, 2022
6c6b575
Replace deprecated `HEADER_X_FORWARDED_ALL` constant
laravel-shift Aug 24, 2022
1b61975
Convert route options to fluent methods
laravel-shift Aug 24, 2022
30a966a
Adopt class based routes
laravel-shift Aug 24, 2022
78a1ad0
Convert deprecated `$dates` property to `$casts`
laravel-shift Aug 24, 2022
358597d
Shift console routes
laravel-shift Aug 24, 2022
2ea58e4
Ignore temporary framework files
laravel-shift Aug 24, 2022
a897cce
Shift to class based factories
laravel-shift Aug 24, 2022
90e20b5
Namespace seeders
laravel-shift Aug 24, 2022
e42d9fd
Rename `retryAfter` and `timeoutAt`
laravel-shift Aug 24, 2022
23ab08d
Add `uuid` to `failed_jobs` table
laravel-shift Aug 24, 2022
f3a877e
Shift PSR-4 autoloading
laravel-shift Aug 24, 2022
4dde36a
Shift config files
laravel-shift Aug 24, 2022
e7157c8
Default config files
laravel-shift Aug 24, 2022
931a081
Bump Laravel dependencies
laravel-shift Aug 24, 2022
89fa7fc
Set return type of base TestCase methods
laravel-shift Aug 24, 2022
944711b
Upgrade to Laravel Mix 6
laravel-shift Aug 24, 2022
91b15af
Shift cleanup
laravel-shift Aug 24, 2022
ae645ab
Remove config files from packages
nolanpro Aug 26, 2022
e07b67c
Update horizon assets
nolanpro Aug 26, 2022
e58373f
Update index.php
nolanpro Aug 29, 2022
cc06502
Add new validation language strings
nolanpro Aug 29, 2022
6a42cf7
Update maintenance mode middleware class name
nolanpro Aug 29, 2022
c0d4963
Fix class based controller routes
nolanpro Aug 29, 2022
7b8c417
Use new built-in method for canAny permission check
nolanpro Aug 29, 2022
20006dc
Put the API guard back
nolanpro Aug 29, 2022
251d8dc
Fix class references in route definitions
nolanpro Aug 30, 2022
914e613
Remove unused controllers
nolanpro Aug 30, 2022
920b4fe
Make all models inherit from a base ProcessMakerModel
nolanpro Aug 30, 2022
b17af7d
Add generator stub containing new base class
nolanpro Aug 30, 2022
7193bac
Add HasFactory trait to User since it does not inherit from ProcessMa…
nolanpro Aug 30, 2022
34e3c1d
Tell the factory where to find classes
nolanpro Aug 30, 2022
eecf845
Fix pre-commit hooks
nolanpro Oct 4, 2022
b5d8ac5
Merge branch 'develop' into shift-69478
nolanpro Oct 4, 2022
c3f8bed
Apply formatting
nolanpro Oct 4, 2022
ad90823
Fix seeder
nolanpro Oct 4, 2022
caff4eb
Fix session name
nolanpro Oct 4, 2022
a1a952c
Updates for laravel mix 6
nolanpro Oct 5, 2022
1b993e8
Update composer dependencies
nolanpro Oct 5, 2022
25ae2fb
Fix model factories
nolanpro Oct 5, 2022
6074c1a
Need to call parent for $subscribers in laravel 8
nolanpro Oct 5, 2022
5a7d453
Support factories in packages
nolanpro Oct 6, 2022
f9a5967
Add support for additional package namespaces
nolanpro Oct 6, 2022
0a93c58
Refactor factory finder
nolanpro Oct 7, 2022
1badf5a
Add trait to Media model
mcraeteisha Oct 7, 2022
26f3ec3
Fix tests
nolanpro Oct 7, 2022
349a470
Merge branch 'shift-69478' of https://github.com/processmaker/process…
nolanpro Oct 7, 2022
49a428d
Create use original canAny method but rename to canAnyFirst
nolanpro Oct 7, 2022
90f1eef
Use correct exit code for success
nolanpro Oct 7, 2022
06a318e
Update package.lock
nolanpro Oct 8, 2022
954910f
Require node 16.15
nolanpro Oct 10, 2022
4d644bf
Update deprecated syntax
nolanpro Oct 11, 2022
7aaaf68
Remove unused factory code
nolanpro Oct 11, 2022
1fcbf60
Add route test
nolanpro Oct 11, 2022
8f91de0
Update RouteTest.php
nolanpro Oct 11, 2022
18e098c
Fix queue driver env var name
nolanpro Oct 12, 2022
fc52c0c
Include ethos routes in route test
nolanpro Oct 13, 2022
5b033bf
Merge branch 'develop' into shift-69390
nolanpro Oct 14, 2022
1a5799a
Merge branch 'shift-69390' into shift-69478
nolanpro Oct 14, 2022
c1985fb
Use original env var name for pusher cluster
nolanpro Oct 17, 2022
693fdbd
Update PMQL to official release of v1.7.0
ryancooley Oct 17, 2022
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ coverage
cypress/screenshots
cypress/videos
cypress/downloads
.phpunit.result.cache
.php-cs-fixer.cache
.phpunit.result.cache
6 changes: 3 additions & 3 deletions ProcessMaker/Console/Commands/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

namespace ProcessMaker\Console\Commands;

use Database\Seeders\UserSeeder;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Database\Query\Grammars\SqlServerGrammar;
use Illuminate\Encryption\Encrypter;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use ProcessMaker\Traits\SupportsNonInteraction;
use Symfony\Component\Console\Helper\Table;
use UserSeeder;
use Validator;

/**
Expand Down Expand Up @@ -317,7 +317,7 @@ public function handle()
$this->info(__('Installer completed. Consult ProcessMaker documentation on how to configure email, jobs and notifications.'));
}

return true;
return 0;
}

/**
Expand Down
23 changes: 15 additions & 8 deletions ProcessMaker/Console/Commands/InstallPreCommitHooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,13 @@ private function addHook($hookDir)
unlink($hookPath);
}

symlink(
base_path('.pre-commit'),
$hookPath
);
try {
symlink(
base_path('.pre-commit'),
$hookPath
);
} catch(\ErrorException $e) {
}
}

private function addConfig($configDir)
Expand All @@ -85,9 +88,13 @@ private function addConfig($configDir)
if (file_exists($configPath)) {
unlink($configPath);
}
symlink(
base_path('.php-cs-fixer.php'),
$configPath
);

try {
symlink(
base_path('.php-cs-fixer.php'),
$configPath
);
} catch(\ErrorException $e) {
}
}
}
2 changes: 0 additions & 2 deletions ProcessMaker/Contracts/ProcessAssetsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

namespace ProcessMaker\Contracts;

use Illuminate\Database\Eloquent\Model;

interface ProcessAssetsInterface
{
/**
Expand Down
18 changes: 10 additions & 8 deletions ProcessMaker/Exception/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace ProcessMaker\Exception;

use Exception;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
Expand All @@ -12,6 +11,7 @@
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Route as RouteFacade;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Throwable;

/**
* Our general exception handler
Expand All @@ -34,10 +34,12 @@ class Handler extends ExceptionHandler

/**
* Report our exception. If in testing with verbosity, it will also dump exception information to the console
* @param Exception $exception
* @throws Exception
*
* @param Throwable $exception
*
* @throws Throwable
*/
public function report(Exception $exception)
public function report(Throwable $exception)
{
if (App::environment() == 'testing' && env('TESTING_VERBOSE')) {
// If we're verbose, we should print ALL Exceptions to the screen
Expand All @@ -52,10 +54,10 @@ public function report(Exception $exception)
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @param \Throwable $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
public function render($request, Throwable $exception)
{
$prefix = '';
$route = $request->route();
Expand Down Expand Up @@ -118,10 +120,10 @@ protected function unauthenticated($request, AuthenticationException $exception)
* Convert the given exception to an array.
* @note This is overridding Laravel's default exception handler in order to handle binary data in message
*
* @param \Exception $e
* @param \Throwable $e
* @return array
*/
protected function convertExceptionToArray(Exception $e)
protected function convertExceptionToArray(Throwable $e)
{
return config('app.debug') ? [
'message' => utf8_encode($e->getMessage()),
Expand Down
4 changes: 2 additions & 2 deletions ProcessMaker/Exception/ReferentialIntegrityException.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
namespace ProcessMaker\Exception;

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

class ReferentialIntegrityException extends Exception
{
public function __construct(Model $source, Model $parent)
public function __construct(Model $source, ProcessMakerModel $parent)
{
$source = class_basename($source) . ':' . $source->getKey();
$parent = class_basename($parent) . ':' . $parent->getKey();
Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/Http/Controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class AdminController extends Controller
{
public function index()
{
switch (\Auth::user()->canAny('view-users|view-groups|view-auth_clients|manage-public-files|view-settings')) {
switch (\Auth::user()->canAnyFirst('view-users|view-groups|view-auth_clients|manage-public-files|view-settings')) {
case 'view-users':
return redirect()->route('users.index');
case 'view-groups':
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<?php

namespace ProcessMaker\Http\Controllers\Api;

/**
* @OA\OpenApi(
* @OA\Info(
Expand Down Expand Up @@ -89,10 +92,8 @@
* )
* ),
* ),
* security={
* {"pm_api_auth_code": {}},
* {"pm_api_bearer": {}},
* {"pm_api_key": {}}
* },
* )
*/
class OpenApiSpec
{
}
14 changes: 7 additions & 7 deletions ProcessMaker/Http/Controllers/Api/ProcessController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
use ProcessMaker\Nayra\Exceptions\ElementNotFoundException;
use ProcessMaker\Nayra\Storage\BpmnDocument;
use ProcessMaker\Nayra\Storage\BpmnElement;
use ProcessMaker\Rules\BPMNValidation;
use ProcessMaker\Providers\WorkflowServiceProvider;
use ProcessMaker\Package\WebEntry\Models\WebentryRoute;
use ProcessMaker\Providers\WorkflowServiceProvider;
use ProcessMaker\Rules\BPMNValidation;
use Throwable;

class ProcessController extends Controller
Expand Down Expand Up @@ -1176,21 +1176,21 @@ private function validateImportedFile($content)
return $isDecoded && $validType && $validVersion;
}

private function checkForExistingRoute($processId, $route)
{
$existingRoute = WebentryRoute::where('first_segment', $route)->where('process_id','!=', $processId)->first();
private function checkForExistingRoute($processId, $route)
{
$existingRoute = WebentryRoute::where('first_segment', $route)->where('process_id', '!=', $processId)->first();
if ($existingRoute) {
throw new \Exception('Segment should be unique. Used in process ' . $existingRoute->process_id . 'node ID: "' . $existingRoute->node_id . '"');
}
}

private function updateRoute($node, $route)
private function updateRoute($node, $route)
{
$config = json_decode($node->getAttributeNS(WorkflowServiceProvider::PROCESS_MAKER_NS, 'config'), true);
if ($config['web_entry']['webentryRouteConfig']['firstUrlSegment'] !== $route) {
// update firstUrlSegment to new route
$config['web_entry']['webentryRouteConfig']['firstUrlSegment'] = $route;

// update entryUrl to new route
$path = parse_url($config['web_entry']['webentryRouteConfig']['entryUrl'], PHP_URL_PATH);
$newEntryUrl = str_replace($config['web_entry']['webentryRouteConfig']['firstUrlSegment'], $route, $path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
use ProcessMaker\Http\Resources\ApiResource;
use ProcessMaker\Models\Media;
use ProcessMaker\Models\ProcessRequest;
use Spatie\MediaLibrary\HasMedia\HasMedia;
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;

class ProcessRequestFileController extends Controller
{
Expand All @@ -36,8 +34,6 @@ class ProcessRequestFileController extends Controller
'responsive_images',
];

use HasMediaTrait;

/**
* Display a listing of the resource.
*
Expand Down
40 changes: 0 additions & 40 deletions ProcessMaker/Http/Controllers/Designer/ProcessController.php

This file was deleted.

19 changes: 0 additions & 19 deletions ProcessMaker/Http/Controllers/Designer/TaskController.php

This file was deleted.

4 changes: 2 additions & 2 deletions ProcessMaker/Http/Controllers/Process/ModelerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class ModelerController extends Controller
/**
* Invokes the Process Modeler for rendering.
*/
public function __invoke(ModelerManager $manager, Process $process, Request $request)
public function show(ModelerManager $manager, Process $process, Request $request)
{
/**
/*
* Emit the ModelerStarting event, passing in our ModelerManager instance. This will
* allow packages to add additional javascript for modeler initialization which
* can customize the modeler controls list.
Expand Down
11 changes: 0 additions & 11 deletions ProcessMaker/Http/Controllers/Process/ProcessController.php

This file was deleted.

2 changes: 1 addition & 1 deletion ProcessMaker/Http/Controllers/ProcessController.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public function triggerStartEventApi(Process $process, Request $request)
private function checkAuth()
{
$perm = 'view-processes|view-process-categories|view-scripts|view-screens|view-environment_variables';
switch (\Auth::user()->canAny($perm)) {
switch (\Auth::user()->canAnyFirst($perm)) {
case 'view-processes':
return false; // already on index, continue with it
case 'view-process-categories':
Expand Down
5 changes: 1 addition & 4 deletions ProcessMaker/Http/Controllers/RequestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,10 @@
use ProcessMaker\Package\PackageComments\PackageServiceProvider;
use ProcessMaker\Traits\HasControllerAddons;
use ProcessMaker\Traits\SearchAutocompleteTrait;
use Spatie\MediaLibrary\HasMedia\HasMedia;
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
use Spatie\MediaLibrary\Models\Media;
use Spatie\MediaLibrary\MediaCollections\Models\Media;

class RequestController extends Controller
{
use HasMediaTrait;
use SearchAutocompleteTrait;
use HasControllerAddons;

Expand Down
17 changes: 16 additions & 1 deletion ProcessMaker/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Kernel extends HttpKernel
* @var array
*/
protected $middleware = [
\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
\Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\ProcessMaker\Http\Middleware\TrimStrings::class,
\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
Expand Down Expand Up @@ -69,4 +69,19 @@ class Kernel extends HttpKernel
'external.connection' => \ProcessMaker\Http\Middleware\ValidateExternalConnection::class,
'client' => \Laravel\Passport\Http\Middleware\CheckClientCredentials::class,
];

/**
* The auth:anon middleware must run after a session is set up to
* check if there is a user logged in before implying the user is
* anonymous.
*
* The auth:anon middleware is only used for the laravel echo
* server route: broadcasting/auth
*
* @var array
*/
protected $middlewarePriority = [
\Illuminate\Session\Middleware\AuthenticateSession::class,
\ProcessMaker\Http\Middleware\ProcessMakerAuthenticate::class,
];
}
Loading