diff --git a/.env.example b/.env.example index 702c98dee6..e1ea0f094d 100644 --- a/.env.example +++ b/.env.example @@ -2,7 +2,7 @@ APP_DEBUG=FALSE APP_NAME="ProcessMaker" APP_ENV=production APP_KEY= -BROADCAST_DRIVER=redis +BROADCAST_CONNECTION=redis BROADCASTER_HOST=https://processmaker.local.processmaker.com:6001 BROADCASTER_KEY= LARAVEL_ECHO_SERVER_AUTH_HOST=https://processmaker.local.processmaker.com @@ -29,6 +29,13 @@ DATA_DB_DATABASE=processmaker DATA_DB_USERNAME=homestead DATA_DB_PASSWORD=secret APP_URL=https://processmaker.local.processmaker.com + +APP_LOCALE=en +APP_FALLBACK_LOCALE=en +APP_FAKER_LOCALE=en_US +APP_MAINTENANCE_DRIVER=file +APP_MAINTENANCE_STORE=database +BCRYPT_ROUNDS=12 TELESCOPE_ENABLED=false REDIS_CLIENT=predis REDIS_PREFIX= @@ -51,3 +58,9 @@ CUSTOM_EXECUTORS=false CACHE_SETTING_DRIVER=cache_settings CACHE_SETTING_PREFIX=settings: AI_ENABLE_RAG_COLLECTIONS=false + +LOG_STACK=single + +SESSION_ENCRYPT=false +SESSION_PATH=/ +SESSION_DOMAIN=null diff --git a/ProcessMaker/Console/Commands/ChangeKeyEncryptedData.php b/ProcessMaker/Console/Commands/ChangeKeyEncryptedData.php index feab536017..4804129199 100644 --- a/ProcessMaker/Console/Commands/ChangeKeyEncryptedData.php +++ b/ProcessMaker/Console/Commands/ChangeKeyEncryptedData.php @@ -4,8 +4,8 @@ use Exception; use Illuminate\Console\Command; -use ProcessMaker\Facades\EncryptedData; use Illuminate\Support\Facades\Log; +use ProcessMaker\Facades\EncryptedData; class ChangeKeyEncryptedData extends Command { diff --git a/ProcessMaker/Console/Commands/CreateSamlCertificate.php b/ProcessMaker/Console/Commands/CreateSamlCertificate.php index edfc5c34e9..99b0bf5433 100644 --- a/ProcessMaker/Console/Commands/CreateSamlCertificate.php +++ b/ProcessMaker/Console/Commands/CreateSamlCertificate.php @@ -16,7 +16,7 @@ class CreateSamlCertificate extends CreateCertificate {--keyname=key.pem : Full name of the certificate key file} {--certname=cert.pem : Full name to the certificate file} {--subject= : Set subject of request or cert ' - . '(e.g. /C=US/ST=New York/L=New York City/O=Example Inc/CN=example.com)}'; + . '(e.g. /C=US/ST=New York/L=New York City/O=Example Inc/CN=example.com)}'; /** * The console command description. diff --git a/ProcessMaker/Console/Commands/Install.php b/ProcessMaker/Console/Commands/Install.php index ec719c993b..3078780c05 100644 --- a/ProcessMaker/Console/Commands/Install.php +++ b/ProcessMaker/Console/Commands/Install.php @@ -108,7 +108,7 @@ public function handle() 'APP_ENV' => 'production', 'APP_KEY' => $this->key, 'APP_URL' => $this->option('url'), - 'BROADCAST_DRIVER' => $this->option('broadcast-driver'), + 'BROADCAST_CONNECTION' => $this->option('broadcast-driver'), 'BROADCASTER_HOST' => null, 'BROADCASTER_KEY' => $this->option('broadcast-key') ? $this->option('broadcast-key') : '21a795019957dde6bcd96142e05d4b10', 'LARAVEL_ECHO_SERVER_AUTH_HOST' => null, diff --git a/ProcessMaker/Console/Commands/UpdateSettingsGroupId.php b/ProcessMaker/Console/Commands/UpdateSettingsGroupId.php index 02804f9ccb..fa213146c7 100644 --- a/ProcessMaker/Console/Commands/UpdateSettingsGroupId.php +++ b/ProcessMaker/Console/Commands/UpdateSettingsGroupId.php @@ -32,6 +32,7 @@ public function handle() { // Update the setting.group_id with the corresponding category created in settings_menus Setting::updateAllSettingsGroupId(); - return $this->info("Settings group_id updated successfully"); + + return $this->info('Settings group_id updated successfully'); } } diff --git a/ProcessMaker/Events/ActivityAssigned.php b/ProcessMaker/Events/ActivityAssigned.php index 75c51c5fde..418b4eb8b7 100644 --- a/ProcessMaker/Events/ActivityAssigned.php +++ b/ProcessMaker/Events/ActivityAssigned.php @@ -54,7 +54,7 @@ public function broadcastOn() /** * Return the process request. * - * @return \ProcessMaker\Models\ProcessRequestToken + * @return ProcessRequestToken */ public function getProcessRequestToken() { diff --git a/ProcessMaker/Events/ActivityCompleted.php b/ProcessMaker/Events/ActivityCompleted.php index 83e99c8b36..7e69679741 100644 --- a/ProcessMaker/Events/ActivityCompleted.php +++ b/ProcessMaker/Events/ActivityCompleted.php @@ -51,7 +51,7 @@ public function broadcastOn() /** * Return the process request. * - * @return \ProcessMaker\Models\ProcessRequestToken + * @return ProcessRequestToken */ public function getProcessRequestToken() { diff --git a/ProcessMaker/Events/CustomizeUiUpdated.php b/ProcessMaker/Events/CustomizeUiUpdated.php index 17137eade7..86db58a684 100644 --- a/ProcessMaker/Events/CustomizeUiUpdated.php +++ b/ProcessMaker/Events/CustomizeUiUpdated.php @@ -31,7 +31,7 @@ class CustomizeUiUpdated implements SecurityLogEventInterface private function defaultVariables(): string { $defaults = config('app.default_colors'); - + $objects = []; foreach ($defaults as $name => $value) { $objects[] = [ @@ -40,10 +40,10 @@ private function defaultVariables(): string 'title' => ucfirst($name), ]; } - + return json_encode($objects); } - + /** * Create a new event instance. * diff --git a/ProcessMaker/Events/ProcessCompleted.php b/ProcessMaker/Events/ProcessCompleted.php index 566fd59730..af37cbd0cb 100644 --- a/ProcessMaker/Events/ProcessCompleted.php +++ b/ProcessMaker/Events/ProcessCompleted.php @@ -57,7 +57,7 @@ public function broadcastOn() /** * Return the process request. * - * @return \ProcessMaker\Models\ProcessRequest + * @return ProcessRequest */ public function getProcessRequest() { diff --git a/ProcessMaker/Events/RedirectToEvent.php b/ProcessMaker/Events/RedirectToEvent.php index df05b8b010..4b2e1b6639 100644 --- a/ProcessMaker/Events/RedirectToEvent.php +++ b/ProcessMaker/Events/RedirectToEvent.php @@ -45,16 +45,17 @@ public function broadcastOn(): array { $channels = [ // Current request - new PrivateChannel('ProcessMaker.Models.ProcessRequest.' . $this->processRequest->getKey()) + new PrivateChannel('ProcessMaker.Models.ProcessRequest.' . $this->processRequest->getKey()), ]; // include child requests if any - foreach($this->processRequest->childRequests()->pluck('id') as $childRequestId) { + foreach ($this->processRequest->childRequests()->pluck('id') as $childRequestId) { $channels[] = new PrivateChannel('ProcessMaker.Models.ProcessRequest.' . $childRequestId); } // include parent request if any if ($this->processRequest->parent_request_id) { $channels[] = new PrivateChannel('ProcessMaker.Models.ProcessRequest.' . $this->processRequest->parent_request_id); } + return $channels; } } diff --git a/ProcessMaker/Events/SessionStarted.php b/ProcessMaker/Events/SessionStarted.php index c55631656c..9ee5aa96ac 100644 --- a/ProcessMaker/Events/SessionStarted.php +++ b/ProcessMaker/Events/SessionStarted.php @@ -32,7 +32,7 @@ public function __construct(User $user) /** * Get the channels the event should broadcast on. * - * @return \Illuminate\Broadcasting\Channel|array + * @return Channel|array */ public function broadcastOn() { diff --git a/ProcessMaker/Facades/Docker.php b/ProcessMaker/Facades/Docker.php index 4ebe691cf8..2a4c18fca9 100644 --- a/ProcessMaker/Facades/Docker.php +++ b/ProcessMaker/Facades/Docker.php @@ -6,7 +6,7 @@ use ProcessMaker\Managers\DockerManager; /** - * @see \ProcessMaker\Managers\DockerManager + * @see DockerManager * * @method bool hasRemoteDocker() * @method string getDockerHost() diff --git a/ProcessMaker/Facades/MatchingTasks.php b/ProcessMaker/Facades/MatchingTasks.php index 3f3d27d821..6f95adf898 100644 --- a/ProcessMaker/Facades/MatchingTasks.php +++ b/ProcessMaker/Facades/MatchingTasks.php @@ -16,6 +16,6 @@ class MatchingTasks extends Facade */ protected static function getFacadeAccessor() { - return MatchingTasks::class; + return self::class; } } diff --git a/ProcessMaker/Facades/RequestDevice.php b/ProcessMaker/Facades/RequestDevice.php index 1b7be10c4c..8941a976cb 100644 --- a/ProcessMaker/Facades/RequestDevice.php +++ b/ProcessMaker/Facades/RequestDevice.php @@ -6,7 +6,7 @@ use ProcessMaker\Models\RequestDevice as RequestDeviceModel; /** - * @see \ProcessMaker\Models\RequestDevice + * @see RequestDeviceModel * * @method static string getVariableName() * @method static string getId() diff --git a/ProcessMaker/Http/Controllers/Api/GroupMemberController.php b/ProcessMaker/Http/Controllers/Api/GroupMemberController.php index b5b95207f1..face7d9e48 100644 --- a/ProcessMaker/Http/Controllers/Api/GroupMemberController.php +++ b/ProcessMaker/Http/Controllers/Api/GroupMemberController.php @@ -214,7 +214,7 @@ public function destroy(GroupMember $group_member) /** * Display a listing of groups available * - * @param \Illuminate\Http\Request $request + * @param Request $request * @return ApiCollection * * @OA\Get( @@ -338,7 +338,7 @@ public function groupsAvailable(Request $request) /** * Display a listing of users available * - * @param \Illuminate\Http\Request $request + * @param Request $request * @return ApiCollection * * @OA\Get( diff --git a/ProcessMaker/Http/Controllers/Api/SignalController.php b/ProcessMaker/Http/Controllers/Api/SignalController.php index b4432e8fa0..798b642838 100644 --- a/ProcessMaker/Http/Controllers/Api/SignalController.php +++ b/ProcessMaker/Http/Controllers/Api/SignalController.php @@ -24,7 +24,7 @@ class SignalController extends Controller * * @param Request $request * - * @return \Illuminate\Http\Response + * @return Response * * @OA\Get( * path="/signals", diff --git a/ProcessMaker/Http/Controllers/Auth/ClientController.php b/ProcessMaker/Http/Controllers/Auth/ClientController.php index e38c9f2288..94996f717c 100644 --- a/ProcessMaker/Http/Controllers/Auth/ClientController.php +++ b/ProcessMaker/Http/Controllers/Auth/ClientController.php @@ -14,7 +14,7 @@ class ClientController extends PassportClientController /** * List auth clients * - * @param \Illuminate\Http\Request $request + * @param Request $request * @return array */ public function index(Request $request) @@ -27,7 +27,7 @@ public function index(Request $request) /** * Get an individual auth client * - * @param \Illuminate\Http\Request $request + * @param Request $request * @param string $clientId * @return array */ @@ -42,7 +42,7 @@ public function show(Request $request, $clientId) /** * Store a new client. * - * @param \Illuminate\Http\Request $request + * @param Request $request * @return \Laravel\Passport\Client */ public function store(Request $request) @@ -70,7 +70,7 @@ public function store(Request $request) /** * Update the given client. * - * @param \Illuminate\Http\Request $request + * @param Request $request * @param string $clientId * @return \Illuminate\Http\Response|\Laravel\Passport\Client */ @@ -108,7 +108,7 @@ public function update(Request $request, $clientId) /** * Delete the given client. * - * @param \Illuminate\Http\Request $request + * @param Request $request * @param string $clientId * @return null */ diff --git a/ProcessMaker/Http/Controllers/Auth/TwoFactorAuthController.php b/ProcessMaker/Http/Controllers/Auth/TwoFactorAuthController.php index ed50fda849..17109c562c 100644 --- a/ProcessMaker/Http/Controllers/Auth/TwoFactorAuthController.php +++ b/ProcessMaker/Http/Controllers/Auth/TwoFactorAuthController.php @@ -153,7 +153,7 @@ public function testSettings(Request $request) if (count($enabled) === 0) { $message = [ 'status' => 'error', - 'message' => __('The two-step method must be selected.') + 'message' => __('The two-step method must be selected.'), ]; $status = 500; } @@ -237,6 +237,7 @@ public static function check2faByGroups() { try { $user = Auth::user(); + return $user->in2FAGroupOrIndependent(); } catch (Exception $e) { session()->put(self::TFA_ERROR, $e->getMessage()); diff --git a/ProcessMaker/Http/Controllers/Process/ScreenController.php b/ProcessMaker/Http/Controllers/Process/ScreenController.php index 65ba86dbb3..182a130400 100644 --- a/ProcessMaker/Http/Controllers/Process/ScreenController.php +++ b/ProcessMaker/Http/Controllers/Process/ScreenController.php @@ -83,7 +83,7 @@ public function edit(Screen $screen) { $addons = $this->getPluginAddons('edit', compact(['screen'])); $assignedProjects = json_decode($screen->projects, true); - + $lastDraftOrPublishedVersion = $screen->getDraftOrPublishedLatestVersion(); $isDraft = 0; @@ -92,11 +92,11 @@ public function edit(Screen $screen) } return view('processes.screens.edit', compact( - 'screen', - 'addons', - 'assignedProjects', - 'isDraft' - ) + 'screen', + 'addons', + 'assignedProjects', + 'isDraft' + ) ); } diff --git a/ProcessMaker/Http/Controllers/Process/SignalController.php b/ProcessMaker/Http/Controllers/Process/SignalController.php index d248e832b3..a632bc7561 100644 --- a/ProcessMaker/Http/Controllers/Process/SignalController.php +++ b/ProcessMaker/Http/Controllers/Process/SignalController.php @@ -28,7 +28,7 @@ public function index(Request $request) /** * Get a specific signal * - * @return \Illuminate\View\View|\Illuminate\Contracts\View + * @return View|\Illuminate\Contracts\View */ public function edit($id) { diff --git a/ProcessMaker/Http/Middleware/AuthenticateSession.php b/ProcessMaker/Http/Middleware/AuthenticateSession.php index 4d03e83c64..e38be2124e 100644 --- a/ProcessMaker/Http/Middleware/AuthenticateSession.php +++ b/ProcessMaker/Http/Middleware/AuthenticateSession.php @@ -12,7 +12,7 @@ class AuthenticateSession extends BaseAuthenticateSession * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param Closure $next * * @return mixed * @throws \Illuminate\Auth\AuthenticationException diff --git a/ProcessMaker/Http/Middleware/BrowserCache.php b/ProcessMaker/Http/Middleware/BrowserCache.php index 4f632f86f2..1a30f6554d 100644 --- a/ProcessMaker/Http/Middleware/BrowserCache.php +++ b/ProcessMaker/Http/Middleware/BrowserCache.php @@ -10,7 +10,7 @@ class BrowserCache * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param Closure $next * @return mixed */ public function handle($request, Closure $next) diff --git a/ProcessMaker/Http/Middleware/EncryptCookies.php b/ProcessMaker/Http/Middleware/EncryptCookies.php index 56273fb944..a242982d36 100644 --- a/ProcessMaker/Http/Middleware/EncryptCookies.php +++ b/ProcessMaker/Http/Middleware/EncryptCookies.php @@ -21,6 +21,6 @@ class EncryptCookies extends BaseEncrypter */ 'device_id', 'fromTriggerStartEvent', - 'language' + 'language', ]; } diff --git a/ProcessMaker/Http/Middleware/HideServerHeaders.php b/ProcessMaker/Http/Middleware/HideServerHeaders.php index 31a9258648..34db52d56a 100644 --- a/ProcessMaker/Http/Middleware/HideServerHeaders.php +++ b/ProcessMaker/Http/Middleware/HideServerHeaders.php @@ -55,7 +55,7 @@ class HideServerHeaders /** * Handle an incoming request. * - * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next + * @param Closure(Request): (Response) $next */ public function handle(Request $request, Closure $next): Response { diff --git a/ProcessMaker/Http/Middleware/IgnoreMapFiles.php b/ProcessMaker/Http/Middleware/IgnoreMapFiles.php index 46ed2eaee0..1fdeab0388 100644 --- a/ProcessMaker/Http/Middleware/IgnoreMapFiles.php +++ b/ProcessMaker/Http/Middleware/IgnoreMapFiles.php @@ -10,7 +10,7 @@ class IgnoreMapFiles * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param Closure $next * @return mixed */ public function handle($request, Closure $next) diff --git a/ProcessMaker/Http/Middleware/IsAdmin.php b/ProcessMaker/Http/Middleware/IsAdmin.php index 232347f356..5e52f70156 100644 --- a/ProcessMaker/Http/Middleware/IsAdmin.php +++ b/ProcessMaker/Http/Middleware/IsAdmin.php @@ -11,7 +11,7 @@ class IsAdmin /** * Handle an incoming request. * - * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next + * @param Closure(Request): (Response) $next */ public function handle(Request $request, Closure $next): Response { diff --git a/ProcessMaker/Http/Middleware/IsManager.php b/ProcessMaker/Http/Middleware/IsManager.php index 638072f2be..f43580842a 100644 --- a/ProcessMaker/Http/Middleware/IsManager.php +++ b/ProcessMaker/Http/Middleware/IsManager.php @@ -13,7 +13,7 @@ class IsManager /** * Handle an incoming request. * - * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next + * @param Closure(Request): (Response) $next */ public function handle(Request $request, Closure $next): Response { diff --git a/ProcessMaker/Http/Middleware/NoCache.php b/ProcessMaker/Http/Middleware/NoCache.php index d85df5ff3b..ca7694ecbf 100644 --- a/ProcessMaker/Http/Middleware/NoCache.php +++ b/ProcessMaker/Http/Middleware/NoCache.php @@ -11,7 +11,7 @@ class NoCache /** * Handle an incoming request. * - * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next + * @param Closure(Request): (Response) $next */ public function handle(Request $request, Closure $next): Response { diff --git a/ProcessMaker/Http/Middleware/PermissionCheck.php b/ProcessMaker/Http/Middleware/PermissionCheck.php index 8b55c9348b..40d2154ac0 100644 --- a/ProcessMaker/Http/Middleware/PermissionCheck.php +++ b/ProcessMaker/Http/Middleware/PermissionCheck.php @@ -14,22 +14,22 @@ class PermissionCheck /** * The authentication factory instance. * - * @var \Illuminate\Contracts\Auth\Factory + * @var Auth */ protected $auth; /** * The gate instance. * - * @var \Illuminate\Contracts\Auth\Access\Gate + * @var Gate */ protected $gate; /** * Create a new middleware instance. * - * @param \Illuminate\Contracts\Auth\Factory $auth - * @param \Illuminate\Contracts\Auth\Access\Gate $gate + * @param Auth $auth + * @param Gate $gate * @return void */ public function __construct(Auth $auth, Gate $gate) @@ -42,7 +42,7 @@ public function __construct(Auth $auth, Gate $gate) * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param Closure $next * @param string $ability * @param array|null $models * @return mixed diff --git a/ProcessMaker/Http/Middleware/RedirectIfAuthenticated.php b/ProcessMaker/Http/Middleware/RedirectIfAuthenticated.php index 390d42bbd5..e80eae30ea 100644 --- a/ProcessMaker/Http/Middleware/RedirectIfAuthenticated.php +++ b/ProcessMaker/Http/Middleware/RedirectIfAuthenticated.php @@ -11,7 +11,7 @@ class RedirectIfAuthenticated * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param Closure $next * @param string|null $guard * @return mixed */ diff --git a/ProcessMaker/Http/Middleware/SamlRequest.php b/ProcessMaker/Http/Middleware/SamlRequest.php index 1ab1b40740..65f3ecb763 100644 --- a/ProcessMaker/Http/Middleware/SamlRequest.php +++ b/ProcessMaker/Http/Middleware/SamlRequest.php @@ -12,7 +12,7 @@ class SamlRequest /** * Handle an incoming request. * - * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next + * @param Closure(Request): (Response) $next */ public function handle(Request $request, Closure $next): Response { diff --git a/ProcessMaker/Http/Middleware/ServerTimingMiddleware.php b/ProcessMaker/Http/Middleware/ServerTimingMiddleware.php index 96ade2bded..e379e84e8a 100644 --- a/ProcessMaker/Http/Middleware/ServerTimingMiddleware.php +++ b/ProcessMaker/Http/Middleware/ServerTimingMiddleware.php @@ -20,7 +20,7 @@ public function __construct() /** * Handle an incoming request. * - * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next + * @param Closure(Request): (Response) $next */ public function handle(Request $request, Closure $next): Response { diff --git a/ProcessMaker/Http/Middleware/SessionControlBlock.php b/ProcessMaker/Http/Middleware/SessionControlBlock.php index 40cc8d9b7c..94d8ad7782 100644 --- a/ProcessMaker/Http/Middleware/SessionControlBlock.php +++ b/ProcessMaker/Http/Middleware/SessionControlBlock.php @@ -21,7 +21,7 @@ class SessionControlBlock /** * Handle an incoming request. * - * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next + * @param Closure(Request): (Response) $next */ public function handle(Request $request, Closure $next): Response { diff --git a/ProcessMaker/Http/Middleware/SessionControlKill.php b/ProcessMaker/Http/Middleware/SessionControlKill.php index 30646faf1b..687d8b3082 100644 --- a/ProcessMaker/Http/Middleware/SessionControlKill.php +++ b/ProcessMaker/Http/Middleware/SessionControlKill.php @@ -21,7 +21,7 @@ class SessionControlKill /** * Handle an incoming request. * - * @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next + * @param Closure(Request): (Response) $next */ public function handle(Request $request, Closure $next): Response { diff --git a/ProcessMaker/Http/Middleware/TrustHosts.php b/ProcessMaker/Http/Middleware/TrustHosts.php index 68330a6e89..d518ea7b39 100644 --- a/ProcessMaker/Http/Middleware/TrustHosts.php +++ b/ProcessMaker/Http/Middleware/TrustHosts.php @@ -2,8 +2,8 @@ namespace ProcessMaker\Http\Middleware; -use Illuminate\Http\Middleware\TrustHosts as Middleware; use Closure; +use Illuminate\Http\Middleware\TrustHosts as Middleware; use Illuminate\Http\Request; class TrustHosts extends Middleware @@ -11,6 +11,7 @@ class TrustHosts extends Middleware public function hosts(): array { $trustedHost = $this->allSubdomainsOfApplicationUrl(); + return [$trustedHost]; } @@ -19,11 +20,11 @@ public function handle(Request $request, $next) if ($request->hasHeader('X-Forwarded-Host')) { $forwardedHost = $request->header('X-Forwarded-Host'); $trustedPattern = $this->allSubdomainsOfApplicationUrl(); - + if (!$this->hostIsValid($forwardedHost, $trustedPattern)) { \Log::warning('Rejected request with untrusted X-Forwarded-Host', [ 'forwarded_host' => $forwardedHost, - 'trusted_pattern' => $trustedPattern + 'trusted_pattern' => $trustedPattern, ]); abort(400, 'Invalid Host Header'); } @@ -36,4 +37,4 @@ protected function hostIsValid(string $host, string $pattern): bool { return preg_match('/' . str_replace('/', '\/', $pattern) . '/', $host) === 1; } -} \ No newline at end of file +} diff --git a/ProcessMaker/Http/Middleware/TwoFactorAuthentication.php b/ProcessMaker/Http/Middleware/TwoFactorAuthentication.php index 2dd7f74042..ca9fa124b8 100644 --- a/ProcessMaker/Http/Middleware/TwoFactorAuthentication.php +++ b/ProcessMaker/Http/Middleware/TwoFactorAuthentication.php @@ -11,7 +11,7 @@ class TwoFactorAuthentication * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param Closure $next * @return mixed */ public function handle($request, Closure $next) diff --git a/ProcessMaker/Http/Middleware/VerifyChangePasswordNeeded.php b/ProcessMaker/Http/Middleware/VerifyChangePasswordNeeded.php index 1305992f8e..797a1cc78b 100644 --- a/ProcessMaker/Http/Middleware/VerifyChangePasswordNeeded.php +++ b/ProcessMaker/Http/Middleware/VerifyChangePasswordNeeded.php @@ -12,7 +12,7 @@ class VerifyChangePasswordNeeded * Handle an incoming request. * * @param \Illuminate\Http\Request $request - * @param \Closure $next + * @param Closure $next * @return mixed */ public function handle($request, Closure $next) diff --git a/ProcessMaker/Http/Resources/ApiCollection.php b/ProcessMaker/Http/Resources/ApiCollection.php index 07f3b7d529..c4b2a7788c 100644 --- a/ProcessMaker/Http/Resources/ApiCollection.php +++ b/ProcessMaker/Http/Resources/ApiCollection.php @@ -62,7 +62,7 @@ public function __construct($resource, $total = null) /** * Generic collection to add sorting and filtering metadata. * - * @param \Illuminate\Http\Request $request + * @param Request $request * @return array */ public function toArray($request) @@ -92,7 +92,7 @@ public function toArray($request) /** * Create an HTTP response that represents the object. * - * @param \Illuminate\Http\Request $request + * @param Request $request * @return \Illuminate\Http\JsonResponse */ public function toResponse($request) @@ -109,9 +109,9 @@ public function toResponse($request) /** * Convert a Collection to a LengthAwarePaginator * - * @param \Illuminate\Support\Collection $collection - * @param \Illuminate\Http\Request $request - * @return \Illuminate\Pagination\LengthAwarePaginator + * @param Collection $collection + * @param Request $request + * @return LengthAwarePaginator */ public function collectionToPaginator(Collection $collection, Request $request) { diff --git a/ProcessMaker/Http/Resources/Task.php b/ProcessMaker/Http/Resources/Task.php index cde9101604..7772a2f9f7 100644 --- a/ProcessMaker/Http/Resources/Task.php +++ b/ProcessMaker/Http/Resources/Task.php @@ -131,7 +131,7 @@ private function addActiveAssignedUsers(array $users, array $assignedUsers) ->whereNotIn('status', Process::NOT_ASSIGNABLE_USER_STATUS) ->whereIn('id', $chunk) ->pluck('id')->toArray(); - $assignedUsers = array_merge($assignedUsers,$activeUsers); + $assignedUsers = array_merge($assignedUsers, $activeUsers); } return $assignedUsers; diff --git a/ProcessMaker/Jobs/BoundaryEvent.php b/ProcessMaker/Jobs/BoundaryEvent.php index d5a56a7f0c..c42276a306 100644 --- a/ProcessMaker/Jobs/BoundaryEvent.php +++ b/ProcessMaker/Jobs/BoundaryEvent.php @@ -42,7 +42,7 @@ public function __construct(Definitions $definitions, ExecutionInstanceInterface * * @param TokenInterface $token * @param CatchEventInterface $element - * @return \ProcessMaker\Nayra\Contracts\Engine\ExecutionInstanceInterface + * @return ExecutionInstanceInterface */ public function action(BpmnDocumentInterface $definitions, TokenInterface $token = null) { diff --git a/ProcessMaker/Jobs/CatchEvent.php b/ProcessMaker/Jobs/CatchEvent.php index bd0aefd676..961580bbfc 100644 --- a/ProcessMaker/Jobs/CatchEvent.php +++ b/ProcessMaker/Jobs/CatchEvent.php @@ -37,7 +37,7 @@ public function __construct(Definitions $definitions, ExecutionInstanceInterface * * @param TokenInterface $token * @param CatchEventInterface $element - * @return \ProcessMaker\Nayra\Contracts\Engine\ExecutionInstanceInterface + * @return ExecutionInstanceInterface */ public function action(TokenInterface $token, CatchEventInterface $element) { diff --git a/ProcessMaker/Jobs/CatchSignalEventInRequest.php b/ProcessMaker/Jobs/CatchSignalEventInRequest.php index ca8c0c4f0b..f177113ee3 100644 --- a/ProcessMaker/Jobs/CatchSignalEventInRequest.php +++ b/ProcessMaker/Jobs/CatchSignalEventInRequest.php @@ -27,7 +27,7 @@ class CatchSignalEventInRequest extends BpmnAction implements ShouldQueue /** * Create a new job instance. * - * @param \ProcessMaker\Models\ProcessRequest $instance + * @param ProcessRequest $instance * @param array $data * @param string $signalRef */ diff --git a/ProcessMaker/Jobs/ExecuteScript.php b/ProcessMaker/Jobs/ExecuteScript.php index f82147a07c..e57eb6427f 100644 --- a/ProcessMaker/Jobs/ExecuteScript.php +++ b/ProcessMaker/Jobs/ExecuteScript.php @@ -115,6 +115,7 @@ public function handleNayraDocker() ]); $result = curl_exec($ch); curl_close($ch); + return $result; } diff --git a/ProcessMaker/Jobs/ImportProcess.php b/ProcessMaker/Jobs/ImportProcess.php index 51ca215d7c..7a49114e62 100644 --- a/ProcessMaker/Jobs/ImportProcess.php +++ b/ProcessMaker/Jobs/ImportProcess.php @@ -518,6 +518,7 @@ protected function saveScreen($screen) return $new; } catch (\Exception $e) { Log::error('Import Screen: ' . $e->getMessage()); + return false; } } diff --git a/ProcessMaker/Jobs/RunNayraScriptTask.php b/ProcessMaker/Jobs/RunNayraScriptTask.php index ceea72f896..bc4fec29a5 100644 --- a/ProcessMaker/Jobs/RunNayraScriptTask.php +++ b/ProcessMaker/Jobs/RunNayraScriptTask.php @@ -36,7 +36,7 @@ class RunNayraScriptTask implements ShouldQueue /** * Create a new job instance. * - * @param \ProcessMaker\Models\ProcessRequestToken $token + * @param ProcessRequestToken $token * @param array $data */ public function __construct(TokenInterface $token) diff --git a/ProcessMaker/Jobs/RunNayraServiceTask.php b/ProcessMaker/Jobs/RunNayraServiceTask.php index 5cd7583234..b1f7d15bb5 100644 --- a/ProcessMaker/Jobs/RunNayraServiceTask.php +++ b/ProcessMaker/Jobs/RunNayraServiceTask.php @@ -25,7 +25,7 @@ class RunNayraServiceTask implements ShouldQueue /** * Create a new job instance. * - * @param \ProcessMaker\Models\ProcessRequestToken $token + * @param ProcessRequestToken $token * @param array $data */ public function __construct(TokenInterface $token) diff --git a/ProcessMaker/Jobs/RunServiceTask.php b/ProcessMaker/Jobs/RunServiceTask.php index 76ce0c9746..22281ce800 100644 --- a/ProcessMaker/Jobs/RunServiceTask.php +++ b/ProcessMaker/Jobs/RunServiceTask.php @@ -36,9 +36,9 @@ class RunServiceTask extends BpmnAction implements ShouldQueue /** * Create a new job instance. * - * @param \ProcessMaker\Models\Process $definitions - * @param \ProcessMaker\Models\ProcessRequest $instance - * @param \ProcessMaker\Models\ProcessRequestToken $token + * @param Definitions $definitions + * @param ProcessRequest $instance + * @param ProcessRequestToken $token * @param array $data */ public function __construct(Definitions $definitions, ProcessRequest $instance, ProcessRequestToken $token, array $data, $attemptNum = 1) diff --git a/ProcessMaker/Jobs/SmartInboxExistingTasks.php b/ProcessMaker/Jobs/SmartInboxExistingTasks.php index 371596b7f4..6f50d306ed 100644 --- a/ProcessMaker/Jobs/SmartInboxExistingTasks.php +++ b/ProcessMaker/Jobs/SmartInboxExistingTasks.php @@ -2,22 +2,23 @@ namespace ProcessMaker\Jobs; +use Facades\ProcessMaker\InboxRules\ApplyAction; +use Facades\ProcessMaker\InboxRules\MatchingTasks; +use Facades\ProcessMaker\Models\InboxRule; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldBeUnique; use Illuminate\Contracts\Queue\ShouldQueue; +use Illuminate\Database\Eloquent\ModelNotFoundException; use Illuminate\Foundation\Bus\Dispatchable; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; -use Facades\ProcessMaker\InboxRules\MatchingTasks; -use Facades\ProcessMaker\InboxRules\ApplyAction; -use Facades\ProcessMaker\Models\InboxRule; -use Illuminate\Database\Eloquent\ModelNotFoundException; class SmartInboxExistingTasks implements ShouldQueue { use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; public int $inboxRuleId; + /** * Create a new job instance. */ diff --git a/ProcessMaker/JsonColumnIndex.php b/ProcessMaker/JsonColumnIndex.php index bcdae6e57d..a7322dfe10 100644 --- a/ProcessMaker/JsonColumnIndex.php +++ b/ProcessMaker/JsonColumnIndex.php @@ -23,6 +23,7 @@ public function add(string $table, string $column, string $path) if (!config('database.enable_index_json_columns')) { Log::warning('Indexing JSON columns is disabled. The following index was not created: ' . $sql); + return false; } diff --git a/ProcessMaker/Listeners/HandleActivityCompletedRedirect.php b/ProcessMaker/Listeners/HandleActivityCompletedRedirect.php index 95c9cd253f..91ad7e2a57 100644 --- a/ProcessMaker/Listeners/HandleActivityCompletedRedirect.php +++ b/ProcessMaker/Listeners/HandleActivityCompletedRedirect.php @@ -6,7 +6,6 @@ class HandleActivityCompletedRedirect extends HandleRedirectListener { - /** * Handle the event. */ diff --git a/ProcessMaker/Logging/CreateTestLogger.php b/ProcessMaker/Logging/CreateTestLogger.php index b73409d56d..3ddce5a3c7 100644 --- a/ProcessMaker/Logging/CreateTestLogger.php +++ b/ProcessMaker/Logging/CreateTestLogger.php @@ -11,7 +11,7 @@ class CreateTestLogger * Create a custom Monolog instance. * * @param array $config - * @return \Monolog\Logger + * @return Logger */ public function __invoke(array $config) { diff --git a/ProcessMaker/Models/MediaPathGenerator.php b/ProcessMaker/Models/MediaPathGenerator.php index 732b4b1f25..15ea3e97b2 100644 --- a/ProcessMaker/Models/MediaPathGenerator.php +++ b/ProcessMaker/Models/MediaPathGenerator.php @@ -1,4 +1,5 @@ on('assignables.assignable_id', '=', 'users.id'); }) ->select('users.*') - ->union(\ProcessMaker\Models\User::where('is_administrator', '=', true)) + ->union(User::where('is_administrator', '=', true)) ->groupBy('users.id') ->get(); diff --git a/ProcessMaker/Models/ProcessEvents.php b/ProcessMaker/Models/ProcessEvents.php index bb4fc2ea95..87a2335491 100644 --- a/ProcessMaker/Models/ProcessEvents.php +++ b/ProcessMaker/Models/ProcessEvents.php @@ -62,7 +62,7 @@ public function initRelation(array $models, $relation) * Match the eagerly loaded results to their parents. * * @param Process[] $models - * @param \Illuminate\Database\Eloquent\Collection $results + * @param Collection $results * @param string $relation * @return array */ diff --git a/ProcessMaker/Models/ScriptDockerNayraTrait.php b/ProcessMaker/Models/ScriptDockerNayraTrait.php index 83c38bcc55..cc3760f6ea 100644 --- a/ProcessMaker/Models/ScriptDockerNayraTrait.php +++ b/ProcessMaker/Models/ScriptDockerNayraTrait.php @@ -11,9 +11,9 @@ use ProcessMaker\Exception\ScriptException; use ProcessMaker\Facades\Docker; use ProcessMaker\ScriptRunners\Base; -use RuntimeException; -use Psr\Container\NotFoundExceptionInterface; use Psr\Container\ContainerExceptionInterface; +use Psr\Container\NotFoundExceptionInterface; +use RuntimeException; use UnexpectedValueException; /** @@ -21,8 +21,8 @@ */ trait ScriptDockerNayraTrait { - private $schema = 'http'; + public static $nayraPort = 8080; /** @@ -76,12 +76,14 @@ public function handleNayraDocker(string $code, array $data, array $config, $tim ]); throw new ScriptException($result); } + return $result; } private function getNayraInstanceUrl() { $servers = self::getNayraAddresses(); + return $this->schema . '://' . $servers[0] . ':' . static::$nayraPort; } @@ -93,6 +95,7 @@ private function getDockerLogs($instanceName) if ($status) { return 'Error getting logs from Nayra Docker: ' . implode("\n", $logs); } + return implode("\n", $logs); } @@ -131,7 +134,6 @@ private function bringUpNayra($restart = false) if ($status) { $this->bringUpNayraContainer(); } else { - exec($docker . " stop {$instanceName}_nayra 2>&1 || true"); exec($docker . " rm {$instanceName}_nayra 2>&1 || true"); exec( @@ -204,7 +206,7 @@ private static function findNayraAddresses($docker, $instanceName, $times): bool . ($nayraDockerNetwork ? "'{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'" : "'{{ .NetworkSettings.IPAddress }}'" - ) + ) . " {$instanceName}_nayra 2>/dev/null", $output, $status @@ -215,6 +217,7 @@ private static function findNayraAddresses($docker, $instanceName, $times): bool } if ($ip) { self::setNayraAddresses([$ip]); + return true; } } @@ -278,6 +281,7 @@ public static function clearNayraAddresses() private static function isCacheArrayStore(): bool { $cacheDriver = Cache::getFacadeRoot()->getStore(); + return $cacheDriver instanceof ArrayStore; } diff --git a/ProcessMaker/Models/SettingsMenus.php b/ProcessMaker/Models/SettingsMenus.php index f24aa2f2aa..40b976fc86 100644 --- a/ProcessMaker/Models/SettingsMenus.php +++ b/ProcessMaker/Models/SettingsMenus.php @@ -77,38 +77,38 @@ public function groups() */ public static function getId($menuName) { - return SettingsMenus::where('menu_group', $menuName)->pluck('id')->first(); + return self::where('menu_group', $menuName)->pluck('id')->first(); } public static function populateSettingMenus() { // Menu 1. Email SettingsMenus::EMAIL_GROUP_ID = 1 - SettingsMenus::firstOrCreate([ - 'menu_group' => SettingsMenus::EMAIL_MENU_GROUP + self::firstOrCreate([ + 'menu_group' => self::EMAIL_MENU_GROUP, ], [ - 'menu_group_order' => SettingsMenus::EMAIL_MENU_ORDER, - 'ui' => json_encode(["icon" => SettingsMenus::EMAIL_MENU_ICON]), + 'menu_group_order' => self::EMAIL_MENU_ORDER, + 'ui' => json_encode(['icon' => self::EMAIL_MENU_ICON]), ]); // Menu 2. Integrations SettingsMenus::INTEGRATIONS_GROUP_ID = 2 - SettingsMenus::firstOrCreate([ - 'menu_group' => SettingsMenus::INTEGRATIONS_MENU_GROUP + self::firstOrCreate([ + 'menu_group' => self::INTEGRATIONS_MENU_GROUP, ], [ - 'menu_group_order' => SettingsMenus::INTEGRATIONS_MENU_ORDER, - 'ui' => json_encode(["icon" => SettingsMenus::INTEGRATIONS_MENU_ICON]), + 'menu_group_order' => self::INTEGRATIONS_MENU_ORDER, + 'ui' => json_encode(['icon' => self::INTEGRATIONS_MENU_ICON]), ]); // Menu 3. Log-in & Auth SettingsMenus::LOG_IN_AUTH_GROUP_ID = 3 - SettingsMenus::firstOrCreate([ - 'menu_group' => SettingsMenus::LOG_IN_AUTH_MENU_GROUP + self::firstOrCreate([ + 'menu_group' => self::LOG_IN_AUTH_MENU_GROUP, ], [ - 'menu_group_order' => SettingsMenus::LOG_IN_AUTH_MENU_ORDER, - 'ui' => json_encode(["icon" => SettingsMenus::LOG_IN_AUTH_MENU_ICON]), + 'menu_group_order' => self::LOG_IN_AUTH_MENU_ORDER, + 'ui' => json_encode(['icon' => self::LOG_IN_AUTH_MENU_ICON]), ]); // Menu 4. Users Settings SettingsMenus::USER_SETTINGS_GROUP_ID = 4 - SettingsMenus::firstOrCreate([ - 'menu_group' => SettingsMenus::USER_SETTINGS_MENU_GROUP + self::firstOrCreate([ + 'menu_group' => self::USER_SETTINGS_MENU_GROUP, ], [ - 'menu_group_order' => SettingsMenus::USER_SETTINGS_MENU_ORDER, - 'ui' => json_encode(["icon" => SettingsMenus::USER_SETTINGS_MENU_ICON]), + 'menu_group_order' => self::USER_SETTINGS_MENU_ORDER, + 'ui' => json_encode(['icon' => self::USER_SETTINGS_MENU_ICON]), ]); } } diff --git a/ProcessMaker/Nayra/Services/FixBpmnSchemaService.php b/ProcessMaker/Nayra/Services/FixBpmnSchemaService.php index 4c3cf3ffff..46d5ae14eb 100644 --- a/ProcessMaker/Nayra/Services/FixBpmnSchemaService.php +++ b/ProcessMaker/Nayra/Services/FixBpmnSchemaService.php @@ -13,7 +13,7 @@ class FixBpmnSchemaService * * @param string $bpmn * @return string - * @throws \Exception + * @throws Exception */ public static function fix(string $bpmn): string { @@ -47,7 +47,7 @@ public static function fix(string $bpmn): string $taskNodes = $xpath->query('//*[local-name()="task"]'); foreach ($taskNodes as $task) { - $taskId = $task->getAttribute("id"); + $taskId = $task->getAttribute('id'); $taskPrefix = !empty($task->prefix) ? "$task->prefix:" : ''; $taskNS = $task->namespaceURI; @@ -72,22 +72,22 @@ public static function fix(string $bpmn): string // Create ioSpecification and children $ioSpec = $document->createElementNS($taskNS, "{$taskPrefix}ioSpecification"); $ioSpecId = "{$taskId}_inner_" . round(microtime(true) * 1000); - $ioSpec->setAttribute("id", $ioSpecId); + $ioSpec->setAttribute('id', $ioSpecId); $dataInputId = "data_input_{$sourceId}"; $dataInput = $document->createElementNS($taskNS, "{$taskPrefix}dataInput"); - $dataInput->setAttribute("id", $dataInputId); - $dataInput->setAttribute("name", "Template for protocol"); + $dataInput->setAttribute('id', $dataInputId); + $dataInput->setAttribute('name', 'Template for protocol'); $ioSpec->appendChild($dataInput); $inputSet = $document->createElementNS($taskNS, "{$taskPrefix}inputSet"); - $inputSet->setAttribute("id", "{$taskId}_inner_" . (round(microtime(true) * 1000) + 2)); + $inputSet->setAttribute('id', "{$taskId}_inner_" . (round(microtime(true) * 1000) + 2)); $dataInputRefs = $document->createElementNS($taskNS, "{$taskPrefix}dataInputRefs", $dataInputId); $inputSet->appendChild($dataInputRefs); $ioSpec->appendChild($inputSet); $outputSet = $document->createElementNS($taskNS, "{$taskPrefix}outputSet"); - $outputSet->setAttribute("id", "{$taskId}_inner_" . (round(microtime(true) * 1000) + 3)); + $outputSet->setAttribute('id', "{$taskId}_inner_" . (round(microtime(true) * 1000) + 3)); $ioSpec->appendChild($outputSet); $task->insertBefore($ioSpec, $dataInputAssociation); @@ -99,7 +99,7 @@ public static function fix(string $bpmn): string // Add BPMNEdge to BPMNDiagram $diagramNodes = $xpath->query('//*[local-name() = "BPMNDiagram"]'); if ($diagramNodes->length === 0) { - throw new Exception("No BPMNDiagram node found in the BPMN file."); + throw new Exception('No BPMNDiagram node found in the BPMN file.'); } $bpmnDiagram = $diagramNodes->item(0); $diagramPrefix = $bpmnDiagram->prefix; @@ -107,23 +107,23 @@ public static function fix(string $bpmn): string $bpmnPlaneNodes = $xpath->query('.//*[local-name() = "BPMNPlane"]', $bpmnDiagram); if ($bpmnPlaneNodes->length === 0) { - throw new Exception("No BPMNPlane found inside BPMNDiagram."); + throw new Exception('No BPMNPlane found inside BPMNDiagram.'); } $bpmnPlane = $bpmnPlaneNodes->item(0); - $edgeId = 'BPMNEdge_' . $dataInputAssociation->getAttribute("id"); + $edgeId = 'BPMNEdge_' . $dataInputAssociation->getAttribute('id'); $bpmnEdge = $document->createElementNS($diagramNS, "{$diagramPrefix}:BPMNEdge"); - $bpmnEdge->setAttribute("id", $edgeId); - $bpmnEdge->setAttribute("bpmnElement", $dataInputAssociation->getAttribute("id")); + $bpmnEdge->setAttribute('id', $edgeId); + $bpmnEdge->setAttribute('bpmnElement', $dataInputAssociation->getAttribute('id')); $diNS = 'http://www.omg.org/spec/DD/20100524/DI'; - $waypoint1 = $document->createElementNS($diNS, "di:waypoint"); - $waypoint1->setAttribute("x", "100"); - $waypoint1->setAttribute("y", "100"); + $waypoint1 = $document->createElementNS($diNS, 'di:waypoint'); + $waypoint1->setAttribute('x', '100'); + $waypoint1->setAttribute('y', '100'); - $waypoint2 = $document->createElementNS($diNS, "di:waypoint"); - $waypoint2->setAttribute("x", "200"); - $waypoint2->setAttribute("y", "200"); + $waypoint2 = $document->createElementNS($diNS, 'di:waypoint'); + $waypoint2->setAttribute('x', '200'); + $waypoint2->setAttribute('y', '200'); $bpmnEdge->appendChild($waypoint1); $bpmnEdge->appendChild($waypoint2); diff --git a/ProcessMaker/Notifications/ActivityActivatedNotification.php b/ProcessMaker/Notifications/ActivityActivatedNotification.php index 457fd8b542..bf0f625ffc 100644 --- a/ProcessMaker/Notifications/ActivityActivatedNotification.php +++ b/ProcessMaker/Notifications/ActivityActivatedNotification.php @@ -53,7 +53,7 @@ public function via($notifiable) * Get the mail representation of the notification. * * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage + * @return MailMessage */ public function toMail($notifiable) { diff --git a/ProcessMaker/Notifications/ActivityCompletedNotification.php b/ProcessMaker/Notifications/ActivityCompletedNotification.php index 55e42de096..8e7a6e121f 100644 --- a/ProcessMaker/Notifications/ActivityCompletedNotification.php +++ b/ProcessMaker/Notifications/ActivityCompletedNotification.php @@ -53,7 +53,7 @@ public function via($notifiable) * Get the mail representation of the notification. * * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage + * @return MailMessage */ public function toMail($notifiable) { diff --git a/ProcessMaker/Notifications/ErrorExecutionNotification.php b/ProcessMaker/Notifications/ErrorExecutionNotification.php index b470618875..5a9422ffde 100644 --- a/ProcessMaker/Notifications/ErrorExecutionNotification.php +++ b/ProcessMaker/Notifications/ErrorExecutionNotification.php @@ -55,7 +55,7 @@ public function via($notifiable) * Get the mail representation of the notification. * * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage + * @return MailMessage */ public function toMail($notifiable) { @@ -77,7 +77,7 @@ public function toMail($notifiable) * Get the broadcast representation of the notification. * * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\BroadcastMessage + * @return BroadcastMessage */ public function toBroadcast($notifiable) { diff --git a/ProcessMaker/Notifications/ImportReady.php b/ProcessMaker/Notifications/ImportReady.php index a408eb651f..467c12322e 100644 --- a/ProcessMaker/Notifications/ImportReady.php +++ b/ProcessMaker/Notifications/ImportReady.php @@ -67,7 +67,7 @@ public function toArray($notifiable) * * @param mixed $notifiable * - * @return \Illuminate\Notifications\Messages\BroadcastMessage + * @return BroadcastMessage */ public function toBroadcast($notifiable) { diff --git a/ProcessMaker/Notifications/ProcessCanceledNotification.php b/ProcessMaker/Notifications/ProcessCanceledNotification.php index 38fb616989..f7bfd7f72b 100644 --- a/ProcessMaker/Notifications/ProcessCanceledNotification.php +++ b/ProcessMaker/Notifications/ProcessCanceledNotification.php @@ -46,7 +46,7 @@ public function via($notifiable) * Get the mail representation of the notification. * * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage + * @return MailMessage */ public function toMail($notifiable) { diff --git a/ProcessMaker/Notifications/ProcessCompletedNotification.php b/ProcessMaker/Notifications/ProcessCompletedNotification.php index c3cc0e655b..cfc21fd912 100644 --- a/ProcessMaker/Notifications/ProcessCompletedNotification.php +++ b/ProcessMaker/Notifications/ProcessCompletedNotification.php @@ -46,7 +46,7 @@ public function via($notifiable) * Get the mail representation of the notification. * * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage + * @return MailMessage */ public function toMail($notifiable) { diff --git a/ProcessMaker/Notifications/ProcessCreatedNotification.php b/ProcessMaker/Notifications/ProcessCreatedNotification.php index c5cc3ccf7c..88de7d7eaf 100644 --- a/ProcessMaker/Notifications/ProcessCreatedNotification.php +++ b/ProcessMaker/Notifications/ProcessCreatedNotification.php @@ -46,7 +46,7 @@ public function via($notifiable) * Get the mail representation of the notification. * * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage + * @return MailMessage */ public function toMail($notifiable) { diff --git a/ProcessMaker/Notifications/ProcessTranslationReady.php b/ProcessMaker/Notifications/ProcessTranslationReady.php index 5bdb8b9b92..58a7eeeb26 100644 --- a/ProcessMaker/Notifications/ProcessTranslationReady.php +++ b/ProcessMaker/Notifications/ProcessTranslationReady.php @@ -68,7 +68,7 @@ public function toArray($notifiable) * * @param mixed $notifiable * - * @return \Illuminate\Notifications\Messages\BroadcastMessage + * @return BroadcastMessage */ public function toBroadcast($notifiable) { diff --git a/ProcessMaker/Notifications/ResetPassword.php b/ProcessMaker/Notifications/ResetPassword.php index 4bd4a1828c..8a26b617b0 100644 --- a/ProcessMaker/Notifications/ResetPassword.php +++ b/ProcessMaker/Notifications/ResetPassword.php @@ -12,7 +12,7 @@ class ResetPassword extends LaravelResetPassword * Get the reset password notification mail message for the given URL. * * @param string $url - * @return \Illuminate\Notifications\Messages\MailMessage + * @return MailMessage */ protected function buildMailMessage($url) { diff --git a/ProcessMaker/Notifications/SassCompiledNotification.php b/ProcessMaker/Notifications/SassCompiledNotification.php index ccb747521c..5453830683 100644 --- a/ProcessMaker/Notifications/SassCompiledNotification.php +++ b/ProcessMaker/Notifications/SassCompiledNotification.php @@ -44,7 +44,7 @@ public function via($notifiable) * Get the mail representation of the notification. * * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage + * @return MailMessage */ public function toMail($notifiable) { diff --git a/ProcessMaker/Notifications/ScriptResponseNotification.php b/ProcessMaker/Notifications/ScriptResponseNotification.php index 31e880da27..5601583931 100644 --- a/ProcessMaker/Notifications/ScriptResponseNotification.php +++ b/ProcessMaker/Notifications/ScriptResponseNotification.php @@ -76,7 +76,7 @@ public function toArray($notifiable) * * @param mixed $notifiable * - * @return \Illuminate\Notifications\Messages\BroadcastMessage + * @return BroadcastMessage */ public function toBroadcast($notifiable) { diff --git a/ProcessMaker/Notifications/TaskReassignmentNotification.php b/ProcessMaker/Notifications/TaskReassignmentNotification.php index c2d59867f9..d1337fcddc 100644 --- a/ProcessMaker/Notifications/TaskReassignmentNotification.php +++ b/ProcessMaker/Notifications/TaskReassignmentNotification.php @@ -53,7 +53,7 @@ public function via($notifiable) * Get the mail representation of the notification. * * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage + * @return MailMessage */ public function toMail($notifiable) { diff --git a/ProcessMaker/Notifications/TwoFactorAuthNotification.php b/ProcessMaker/Notifications/TwoFactorAuthNotification.php index 2b36e3953a..fd1a1e4bbc 100644 --- a/ProcessMaker/Notifications/TwoFactorAuthNotification.php +++ b/ProcessMaker/Notifications/TwoFactorAuthNotification.php @@ -19,7 +19,7 @@ class TwoFactorAuthNotification extends Notification /** * Create a new notification instance. * - * @param \ProcessMaker\Models\User $user + * @param User $user * @param string $code */ public function __construct(User $user, string $code) @@ -43,7 +43,7 @@ public function via($notifiable) * Get the mail representation of the notification. * * @param mixed $notifiable - * @return \Illuminate\Notifications\Messages\MailMessage + * @return MailMessage */ public function toMail($notifiable) { diff --git a/ProcessMaker/Policies/MediaPolicy.php b/ProcessMaker/Policies/MediaPolicy.php index 627ae09835..dd7de7be7a 100644 --- a/ProcessMaker/Policies/MediaPolicy.php +++ b/ProcessMaker/Policies/MediaPolicy.php @@ -14,7 +14,7 @@ class MediaPolicy * Run before all methods to determine if the * user is an admin and can do everything. * - * @param \ProcessMaker\Models\User $user + * @param User $user * @return mixed */ public function before(User $user) @@ -27,8 +27,8 @@ public function before(User $user) /** * Determine whether the user can view the media. * - * @param \ProcessMaker\Models\User $user - * @param \ProcessMaker\Models\Media $media + * @param User $user + * @param Media $media * @return mixed */ public function view(User $user, Media $media) @@ -43,7 +43,7 @@ public function view(User $user, Media $media) /** * Determine whether the user can create media. * - * @param \ProcessMaker\Models\User $user + * @param User $user * @return mixed */ public function create(User $user) @@ -78,8 +78,8 @@ public function create(User $user) /** * Determine whether the user can update the media. * - * @param \ProcessMaker\Models\User $user - * @param \ProcessMaker\Models\Media $media + * @param User $user + * @param Media $media * @return mixed */ public function update(User $user, Media $media) @@ -94,8 +94,8 @@ public function update(User $user, Media $media) /** * Determine whether the user can delete the media. * - * @param \ProcessMaker\Models\User $user - * @param \ProcessMaker\Models\Media $media + * @param User $user + * @param Media $media * @return mixed */ public function delete(User $user, Media $media) diff --git a/ProcessMaker/Policies/ProcessRequestPolicy.php b/ProcessMaker/Policies/ProcessRequestPolicy.php index 7d42766194..43ac776666 100644 --- a/ProcessMaker/Policies/ProcessRequestPolicy.php +++ b/ProcessMaker/Policies/ProcessRequestPolicy.php @@ -14,7 +14,7 @@ class ProcessRequestPolicy * Run before all methods to determine if the * user is an admin and can do everything. * - * @param \ProcessMaker\Models\User $user + * @param User $user * @return mixed */ public function before(User $user) @@ -27,8 +27,8 @@ public function before(User $user) /** * Determine whether the user can view the process request. * - * @param \ProcessMaker\Models\User $user - * @param \ProcessMaker\Models\ProcessRequest $processRequest + * @param User $user + * @param ProcessRequest $processRequest * @return mixed */ public function view(User $user, ProcessRequest $processRequest) @@ -42,8 +42,8 @@ public function view(User $user, ProcessRequest $processRequest) /** * Determine whether the user can update the process request. * - * @param \ProcessMaker\Models\User $user - * @param \ProcessMaker\Models\ProcessRequest $processRequest + * @param User $user + * @param ProcessRequest $processRequest * @return mixed */ public function update(User $user, ProcessRequest $processRequest) @@ -60,8 +60,8 @@ public function update(User $user, ProcessRequest $processRequest) /** * Determine whether the user can update the process request. * - * @param \ProcessMaker\Models\User $user - * @param \ProcessMaker\Models\ProcessRequest $processRequest + * @param User $user + * @param ProcessRequest $processRequest * @return mixed */ public function destroy(User $user, ProcessRequest $processRequest) @@ -74,7 +74,7 @@ public function destroy(User $user, ProcessRequest $processRequest) /** * Determine whether the user can edit request data. * - * @param \ProcessMaker\Models\User $user + * @param User $user * @param \ProcessMaker\Process $process * @return bool */ @@ -94,8 +94,8 @@ public function editData(User $user, ProcessRequest $request) /** * User has access if participates in the request. * - * @param \ProcessMaker\Models\User $user - * @param \ProcessMaker\Models\ProcessRequest $processRequest + * @param User $user + * @param ProcessRequest $processRequest * * @return mixed */ diff --git a/ProcessMaker/Policies/ScreenPolicy.php b/ProcessMaker/Policies/ScreenPolicy.php index 37c24c1217..367f1acbd7 100644 --- a/ProcessMaker/Policies/ScreenPolicy.php +++ b/ProcessMaker/Policies/ScreenPolicy.php @@ -15,7 +15,7 @@ class ScreenPolicy /** * Determine whether the user can view the screen. * - * @param \ProcessMaker\Models\User $user + * @param User $user * @param \ProcessMaker\Screen $screen * @return mixed */ diff --git a/ProcessMaker/Policies/UserPolicy.php b/ProcessMaker/Policies/UserPolicy.php index d84995f07a..d3cf2785f5 100644 --- a/ProcessMaker/Policies/UserPolicy.php +++ b/ProcessMaker/Policies/UserPolicy.php @@ -13,7 +13,7 @@ class UserPolicy * Run before all methods to determine if the * user is an admin and can do everything. * - * @param \ProcessMaker\Models\User $user + * @param User $user * @return mixed */ public function before(User $user) @@ -26,8 +26,8 @@ public function before(User $user) /** * Determine whether the user can view the user. * - * @param \ProcessMaker\Models\User $user - * @param \ProcessMaker\Models\User $targetUser + * @param User $user + * @param User $targetUser * @return mixed */ public function view(User $user, User $targetUser) @@ -42,8 +42,8 @@ public function view(User $user, User $targetUser) /** * Determine whether the user can update the user. * - * @param \ProcessMaker\Models\User $user - * @param \ProcessMaker\Models\User $targetUser + * @param User $user + * @param User $targetUser * @return mixed */ public function edit(User $user, User $targetUser) @@ -58,8 +58,8 @@ public function edit(User $user, User $targetUser) /** * Determine whether the user can update the user. * - * @param \ProcessMaker\Models\User $user - * @param \ProcessMaker\Models\User $targetUser + * @param User $user + * @param User $targetUser * @return mixed */ public function destroy(User $user, User $targetUser) diff --git a/ProcessMaker/Rules/SortBy.php b/ProcessMaker/Rules/SortBy.php index 2fb3398141..610e3b92e4 100644 --- a/ProcessMaker/Rules/SortBy.php +++ b/ProcessMaker/Rules/SortBy.php @@ -10,7 +10,7 @@ class SortBy implements ValidationRule /** * Run the validation rule. * - * @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail + * @param Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail */ public function validate(string $attribute, mixed $value, Closure $fail): void { diff --git a/ProcessMaker/Upgrades/Commands/UpgradeInstallCommand.php b/ProcessMaker/Upgrades/Commands/UpgradeInstallCommand.php index 1058babf98..405bdbc7b8 100755 --- a/ProcessMaker/Upgrades/Commands/UpgradeInstallCommand.php +++ b/ProcessMaker/Upgrades/Commands/UpgradeInstallCommand.php @@ -24,14 +24,14 @@ class UpgradeInstallCommand extends BaseCommand /** * The repository instance. * - * @var \Illuminate\Database\Migrations\MigrationRepositoryInterface + * @var MigrationRepositoryInterface */ protected $repository; /** * Create a new migration install command instance. * - * @param \Illuminate\Database\Migrations\MigrationRepositoryInterface $repository + * @param MigrationRepositoryInterface $repository * @return void */ public function __construct(MigrationRepositoryInterface $repository) diff --git a/ProcessMaker/Upgrades/Commands/UpgradeMakeCommand.php b/ProcessMaker/Upgrades/Commands/UpgradeMakeCommand.php index 5471586e81..45bbb7bf15 100644 --- a/ProcessMaker/Upgrades/Commands/UpgradeMakeCommand.php +++ b/ProcessMaker/Upgrades/Commands/UpgradeMakeCommand.php @@ -33,7 +33,7 @@ class UpgradeMakeCommand extends BaseCommand /** * The Composer instance. * - * @var \Illuminate\Support\Composer + * @var Composer */ protected $composer; @@ -41,7 +41,7 @@ class UpgradeMakeCommand extends BaseCommand * Create a new migration install command instance. * * @param \Illuminate\Database\Migrations\MigrationCreator $creator - * @param \Illuminate\Support\Composer $composer + * @param Composer $composer * @return void */ public function __construct(UpgradeCreator $creator, Composer $composer) diff --git a/ProcessMaker/Upgrades/Commands/UpgradeStatusCommand.php b/ProcessMaker/Upgrades/Commands/UpgradeStatusCommand.php index 121882cbed..c21f45e7ed 100644 --- a/ProcessMaker/Upgrades/Commands/UpgradeStatusCommand.php +++ b/ProcessMaker/Upgrades/Commands/UpgradeStatusCommand.php @@ -64,7 +64,7 @@ public function handle() * * @param array $ran * @param array $batches - * @return \Illuminate\Support\Collection + * @return Collection */ protected function getStatusFor(array $ran, array $batches) { diff --git a/ProcessMaker/Upgrades/UpgradeCreator.php b/ProcessMaker/Upgrades/UpgradeCreator.php index bad23a27b2..076e340938 100644 --- a/ProcessMaker/Upgrades/UpgradeCreator.php +++ b/ProcessMaker/Upgrades/UpgradeCreator.php @@ -17,7 +17,7 @@ class UpgradeCreator extends MigrationCreator * * @return string * - * @throws \ProcessMaker\Exception\InvalidSemanticVersion + * @throws InvalidSemanticVersion */ public function createUpgrade($name, $path) { diff --git a/artisan b/artisan index ec4bb7bd24..8e04b42240 100644 --- a/artisan +++ b/artisan @@ -1,45 +1,15 @@ #!/usr/bin/env php setVerbosity(100); -$kernel = $app->make(Illuminate\Contracts\Console\Kernel::class); -$status = $kernel->handle( - $input = new Symfony\Component\Console\Input\ArgvInput, - $consoleOutput -); -/* -|-------------------------------------------------------------------------- -| Shutdown The Application -|-------------------------------------------------------------------------- -| -| Once Artisan has finished running, we will fire off the shutdown events -| so that any final work may be done by the application before we shut -| down the process. This is the last thing to happen to the request. -| -*/ -$kernel->terminate($input, $status); -exit($status); \ No newline at end of file + +// Bootstrap Laravel and handle the command... +$status = (require_once __DIR__.'/bootstrap/app.php') + ->handleCommand(new ArgvInput); + +exit($status); diff --git a/bootstrap/app.php b/bootstrap/app.php index f87a8d4dd3..aed9ac63fd 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,65 +1,47 @@ singleton( - HttpKernelContract::class, - HttpKernel::class -); - -$app->singleton( - ConsoleKernelContract::class, - ConsoleKernel::class -); - -$app->singleton( - ExceptionHandler::class, - Handler::class -); - -/* -|-------------------------------------------------------------------------- -| Return The Application -|-------------------------------------------------------------------------- -| -| This script returns the application instance. The instance is given to -| the calling script so we can separate the building of the instances -| from the actual running of the application and sending responses. -| -*/ - -return $app; +use Illuminate\Foundation\Application; +use Illuminate\Foundation\Configuration\Exceptions; +use Illuminate\Foundation\Configuration\Middleware; + +return Application::configure(basePath: dirname(__DIR__)) + ->withProviders([ + \Spatie\Multitenancy\MultitenancyServiceProvider::class, + \Laravel\Passport\PassportServiceProvider::class, + \Laravel\Scout\ScoutServiceProvider::class, + \TeamTNT\Scout\TNTSearchScoutServiceProvider::class, + \Jenssegers\Agent\AgentServiceProvider::class, + \ProcessMaker\Providers\ProcessMakerServiceProvider::class, + \ProcessMaker\Providers\RecommendationsServiceProvider::class, + \ProcessMaker\Providers\AuthServiceProvider::class, + \ProcessMaker\Providers\EventServiceProvider::class, + \ProcessMaker\Providers\HorizonServiceProvider::class, + \ProcessMaker\Providers\TelescopeServiceProvider::class, + \ProcessMaker\Providers\RouteServiceProvider::class, + \ProcessMaker\Providers\BroadcastServiceProvider::class, + \ProcessMaker\Providers\WorkflowServiceProvider::class, + \ProcessMaker\Providers\UpgradeServiceProvider::class, + \ProcessMaker\Providers\OauthMailServiceProvider::class, + \ProcessMaker\Providers\OpenAiServiceProvider::class, + \ProcessMaker\Providers\LicenseServiceProvider::class, + \ProcessMaker\Providers\MetricsServiceProvider::class, + \ProcessMaker\Providers\MixServiceProvider::class, + \ProcessMaker\Providers\TenantQueueServiceProvider::class, + \ProcessMaker\Providers\JsonOptimizerServiceProvider::class, + ]) + ->withRouting( + web: __DIR__.'/../routes/web.php', + api: __DIR__.'/../routes/api.php', + commands: __DIR__.'/../routes/console.php', + channels: __DIR__.'/../routes/channels.php', + health: '/up', + ) + ->withMiddleware(function (Middleware $middleware) { + $middleware->redirectGuestsTo(fn () => route('login')); + $middleware->redirectUsersTo(RouteServiceProvider::HOME); + + $middleware->throttleApi(); + }) + ->withExceptions(function (Exceptions $exceptions) { + // + })->create(); diff --git a/bootstrap/providers.php b/bootstrap/providers.php new file mode 100644 index 0000000000..38b258d185 --- /dev/null +++ b/bootstrap/providers.php @@ -0,0 +1,5 @@ + env('APP_NAME', 'ProcessMaker'), - - // The url of our host, will usually be set during installation - 'url' => env('APP_URL', 'http://localhost'), - - // The application key to be used for hashing secrets - 'key' => env('APP_KEY', 'base64:x80I9vQNxwllSuwBkTwfUa5qkgPTRdwqHCPSz7zHi1U='), - - // The encryption cipher to use, industry standard - 'cipher' => 'AES-256-CBC', - - // What environment are we running in. Local, prod, etc. - 'env' => env('APP_ENV', 'local'), - - // Should we place our application in debug mode - 'debug' => env('APP_DEBUG', false), - - // What's our default cache lifecycle 'cache_lifetime' => env('APP_CACHE_LIFETIME', 60), - // The timezone for the application 'timezone' => env('APP_TIMEZONE', 'America/Los_Angeles'), - // The time format for the application 'dateformat' => env('DATE_FORMAT', 'm/d/Y h:i A'), - // The system locale - 'locale' => env('APP_LANG', 'en'), - - // The fallback locale - 'fallback_locale' => 'en', - - // The timeout length for API calls, in milliseconds (0 for no timeout) 'api_timeout' => env('API_TIMEOUT', 5000), - // Hide server headers for security (prevents information disclosure) 'hide_server_headers' => env('HIDE_SERVER_HEADERS', true), - // Disables PHP execution in the storage directory - // TODO Is this config value still used anywhere? :) 'disable_php_upload_execution' => env('DISABLE_PHP_UPLOAD_EXECUTION', 0), - // Option Fractal, Serializer - // TODO Does the ProcessMakerSerializer class exist, if so, we need to fix its namespace :) 'serialize_fractal' => env('SERIALIZE_FRACTAL', ProcessMaker\Transformers\ProcessMakerSerializer::class), - // Option Fractal, paginator 'paginate_fractal' => env('PAGINATE_FRACTAL', League\Fractal\Pagination\IlluminatePaginatorAdapter::class), - // The processmaker identifier of the web client application 'web_client_application_id' => env('PM_CLIENT_ID', 'x-pm-local-client'), - // The processmaker BPM scripts configuration 'processmaker_scripts_home' => env('PROCESSMAKER_SCRIPTS_HOME', __DIR__ . '/../storage/app'), - // Path to docker executable 'processmaker_scripts_docker' => env('PROCESSMAKER_SCRIPTS_DOCKER', '/usr/bin/docker'), - // Docker mode with scripts 'processmaker_scripts_docker_mode' => env('PROCESSMAKER_SCRIPTS_DOCKER_MODE', 'binding'), - // tcp/other protocol uri to the docker host 'processmaker_scripts_docker_host' => env('PROCESSMAKER_SCRIPTS_DOCKER_HOST', ''), - // Default parameters for docker run command 'processmaker_scripts_docker_params' => env('PROCESSMAKER_SCRIPTS_DOCKER_PARAMS', ''), - // Default timeout for scripts 'processmaker_scripts_timeout' => env('PROCESSMAKER_SCRIPTS_TIMEOUT', 'timeout'), - // System-level scripts timeout 'processmaker_system_scripts_timeout_seconds' => env('PROCESSMAKER_SYSTEM_SCRIPTS_TIMEOUT_SECONDS', 300), - // Since the task scheduler has a preset of one minute (crontab), the times - // must be rounded or truncated to the nearest HH:MM:00 before compare 'timer_events_seconds' => env('TIMER_EVENTS_SECONDS', 'truncate'), - // Table locks threshold for process_request_lock table 'bpmn_actions_max_lock_time' => (int) env('BPMN_ACTIONS_MAX_LOCK_TIME', 60), - // Maximum time to wait for a lock to be released. Default 60000 [ms] - // If the processes are going to have thousands of concurrent parallel instances, increase this number. 'bpmn_actions_max_lock_timeout' => (int) env('BPMN_ACTIONS_MAX_LOCK_TIMEOUT', 60000), - // Lock check interval. Default every second. 1000 [ms] 'bpmn_actions_lock_check_interval' => (int) env('BPMN_ACTIONS_LOCK_CHECK_INTERVAL', 1000), - // The url of our host from inside the docker 'docker_host_url' => env( 'DOCKER_HOST_URL', preg_replace( @@ -102,46 +53,36 @@ env('APP_URL', 'http://localhost') ) ), + 'nayra_rest_api_host' => env('NAYRA_REST_API_HOST', ''), + 'screen_task_cache_time' => env('SCREEN_TASK_CACHE_TIME', 86400), - // Allows our script executors to ignore invalid SSL. This should only be set to false for development. 'api_ssl_verify' => env('API_SSL_VERIFY', 'true'), - // Unique name on multi-tenant installations. Just use the DB name for now 'instance' => env('DB_DATABASE'), - // Allows to detect if OpenAI is enabled or not 'open_ai_nlq_to_pmql' => env('OPEN_AI_NLQ_TO_PMQL_ENABLED', false) && env('OPEN_AI_SECRET', false), 'open_ai_process_translations' => env('OPEN_AI_PROCESS_TRANSLATIONS_ENABLED', false) && env('OPEN_AI_SECRET', false), - // Microservice AI Host 'ai_microservice_host' => env('AI_MICROSERVICE_HOST'), - // Security log 'security_log' => env('SECURITY_LOG', 'true'), - // Security log custom S3 URI 'security_log_s3_uri' => env('SECURITY_LOG_S3_URI', 'security-logs'), - // PM Analytics Dashboard 'pm_analytics_dashboard' => env('PM_ANALYTICS_DASHBOARD', 'https://localhost'), - // PM Analytics Chart 'pm_analytics_chart' => env('PM_ANALYTICS_CHART', 'https://localhost'), - // Enable default SSO 'enable_default_sso' => env('ENABLE_DEFAULT_SSO', 'true'), - // Message broker driver to use in Workflow Manager 'message_broker_driver' => env('MESSAGE_BROKER_DRIVER', 'default'), - // When true, halt process execution if certain configuration settings are missing 'configuration_debug_mode' => env('CONFIGURATION_DEBUG_MODE', false), - // Global app settings 'settings' => [ // Path to logo image to be used on login page @@ -166,44 +107,10 @@ 'max_filesize_limit' => env('MAX_FILESIZE_LIMIT', '10M'), ], - // Turn on/off the recommendation engine 'recommendations_enabled' => env('RECOMMENDATIONS_ENABLED', true), - // Define the view of the Login 'login_view' => env('LOGIN_VIEW', 'auth.newLogin'), - 'providers' => ServiceProvider::defaultProviders()->merge([ - Spatie\Multitenancy\MultitenancyServiceProvider::class, - /** - * Package Service Providers - */ - Laravel\Passport\PassportServiceProvider::class, - Laravel\Scout\ScoutServiceProvider::class, - TeamTNT\Scout\TNTSearchScoutServiceProvider::class, - Jenssegers\Agent\AgentServiceProvider::class, - - /** - * ProcessMaker Service Providers - */ - ProcessMaker\Providers\ProcessMakerServiceProvider::class, - ProcessMaker\Providers\RecommendationsServiceProvider::class, - ProcessMaker\Providers\AuthServiceProvider::class, - ProcessMaker\Providers\EventServiceProvider::class, - ProcessMaker\Providers\HorizonServiceProvider::class, - ProcessMaker\Providers\TelescopeServiceProvider::class, - ProcessMaker\Providers\RouteServiceProvider::class, - ProcessMaker\Providers\BroadcastServiceProvider::class, - ProcessMaker\Providers\WorkflowServiceProvider::class, - ProcessMaker\Providers\UpgradeServiceProvider::class, - ProcessMaker\Providers\OauthMailServiceProvider::class, - ProcessMaker\Providers\OpenAiServiceProvider::class, - ProcessMaker\Providers\LicenseServiceProvider::class, - ProcessMaker\Providers\MetricsServiceProvider::class, - ProcessMaker\Providers\MixServiceProvider::class, - ProcessMaker\Providers\TenantQueueServiceProvider::class, - ProcessMaker\Providers\JsonOptimizerServiceProvider::class, - ])->toArray(), - 'aliases' => Facade::defaultAliases()->merge([ 'Agent' => Jenssegers\Agent\Facades\Agent::class, 'Docker' => ProcessMaker\Facades\Docker::class, @@ -241,7 +148,6 @@ ], - // Screen builder options 'screen' => [ 'cache_enabled' => env('SCREEN_CACHE_ENABLED', false), 'cache_timeout' => env('SCREEN_CACHE_TIMEOUT', 5000), // timeout in milliseconds @@ -258,8 +164,8 @@ 'nayra_docker_network' => env('NAYRA_DOCKER_NETWORK', 'host'), - // Process Request security log rate limit: 1 per day (86400 seconds) 'process_request_errors_rate_limit' => env('PROCESS_REQUEST_ERRORS_RATE_LIMIT', 1), + 'process_request_errors_rate_limit_duration' => env('PROCESS_REQUEST_ERRORS_RATE_LIMIT_DURATION', 86400), 'default_colors' => [ @@ -273,7 +179,6 @@ 'light' => '#FFFFFF', ], - // For encrypted fields 'encrypted_data' => [ 'driver' => env('ENCRYPTED_DATA_DRIVER', 'local'), 'key' => env('ENCRYPTED_DATA_KEY', ''), @@ -284,7 +189,6 @@ 'custom_executors' => env('CUSTOM_EXECUTORS', false), - // Enable or disable TCE customization feature 'tce_customization_enable' => env('TCE_CUSTOMIZATION_ENABLED', false), 'prometheus_namespace' => env('PROMETHEUS_NAMESPACE', strtolower(preg_replace('/[^a-zA-Z0-9_]+/', '_', env('APP_NAME', 'processmaker')))), @@ -301,5 +205,7 @@ 'multitenancy' => env('MULTITENANCY', false), 'reassign_restrict_to_assignable_users' => env('REASSIGN_RESTRICT_TO_ASSIGNABLE_USERS', true), + 'resources_core_path' => base_path('resources-core'), + ]; diff --git a/config/auth.php b/config/auth.php index e7811a250d..676f9973e6 100644 --- a/config/auth.php +++ b/config/auth.php @@ -2,45 +2,7 @@ return [ - /* - |-------------------------------------------------------------------------- - | Authentication Defaults - |-------------------------------------------------------------------------- - | - | This option controls the default authentication "guard" and password - | reset options for your application. You may change these defaults - | as required, but they're a perfect start for most applications. - | - */ - - 'defaults' => [ - 'guard' => 'web', - 'passwords' => 'users', - ], - - /* - |-------------------------------------------------------------------------- - | Authentication Guards - |-------------------------------------------------------------------------- - | - | Next, you may define every authentication guard for your application. - | Of course, a great default configuration has been defined for you - | here which uses session storage and the Eloquent user provider. - | - | All authentication drivers have a user provider. This defines how the - | users are actually retrieved out of your database or other storage - | mechanisms used by this application to persist your user's data. - | - | Supported: "session" - | - */ - 'guards' => [ - 'web' => [ - 'driver' => 'session', - 'provider' => 'users', - ], - 'api' => [ 'driver' => 'passport', 'provider' => 'users', @@ -52,76 +14,6 @@ ], ], - /* - |-------------------------------------------------------------------------- - | User Providers - |-------------------------------------------------------------------------- - | - | All authentication drivers have a user provider. This defines how the - | users are actually retrieved out of your database or other storage - | mechanisms used by this application to persist your user's data. - | - | If you have multiple user tables or models you may configure multiple - | sources which represent each model / table. These sources may then - | be assigned to any extra authentication guards you have defined. - | - | Supported: "database", "eloquent" - | - */ - - 'providers' => [ - 'users' => [ - 'driver' => 'eloquent', - 'model' => ProcessMaker\Models\User::class, - ], - - // 'users' => [ - // 'driver' => 'database', - // 'table' => 'users', - // ], - ], - - /* - |-------------------------------------------------------------------------- - | Resetting Passwords - |-------------------------------------------------------------------------- - | - | You may specify multiple password reset configurations if you have more - | than one user table or model in the application and you want to have - | separate password reset settings based on the specific user types. - | - | The expiry time is the number of minutes that each reset token will be - | considered valid. This security feature keeps tokens short-lived so - | they have less time to be guessed. You may change this as needed. - | - | The throttle setting is the number of seconds a user must wait before - | generating more password reset tokens. This prevents the user from - | quickly generating a very large amount of password reset tokens. - | - */ - - 'passwords' => [ - 'users' => [ - 'provider' => 'users', - 'table' => 'password_reset_tokens', - 'expire' => 60, - 'throttle' => 60, - ], - ], - 'log_auth_events' => env('LOG_AUTH_EVENTS', true), - /* - |-------------------------------------------------------------------------- - | Password Confirmation Timeout - |-------------------------------------------------------------------------- - | - | Here you may define the amount of seconds before a password confirmation - | times out and the user is prompted to re-enter their password via the - | confirmation screen. By default, the timeout lasts for three hours. - | - */ - - 'password_timeout' => 10800, - ]; diff --git a/config/broadcasting.php b/config/broadcasting.php index d5a71197ce..40a40067d4 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -13,34 +13,7 @@ return [ - /* - |-------------------------------------------------------------------------- - | Default Broadcaster - |-------------------------------------------------------------------------- - | - | This option controls the default broadcaster that will be used by the - | framework when an event needs to be broadcast. You may set this to - | any of the connections defined in the "connections" array below. - | - | Supported: "pusher", "ably", "redis", "log", "null" - | - */ - - 'default' => env('BROADCAST_DRIVER', 'null'), - - /* - |-------------------------------------------------------------------------- - | Broadcast Connections - |-------------------------------------------------------------------------- - | - | Here you may define all of the broadcast connections that will be used - | to broadcast events to other systems or over websockets. Samples of - | each available type of connection are provided inside this array. - | - */ - 'connections' => [ - 'pusher' => [ 'driver' => 'pusher', 'key' => env('PUSHER_APP_KEY', 'app-key'), @@ -55,27 +28,6 @@ 'verify' => env('PUSHER_SSL_VERIFY', true), ], ], - - 'ably' => [ - 'driver' => 'ably', - 'key' => env('ABLY_KEY'), - ], - - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'host' => env('BROADCASTER_HOST'), - 'key' => env('BROADCASTER_KEY'), - ], - - 'log' => [ - 'driver' => 'log', - ], - - 'null' => [ - 'driver' => 'null', - ], - ], ]; diff --git a/config/cache.php b/config/cache.php index b0eb4f2696..a775ba3643 100644 --- a/config/cache.php +++ b/config/cache.php @@ -4,121 +4,19 @@ return [ - /* - |-------------------------------------------------------------------------- - | Default Cache Store - |-------------------------------------------------------------------------- - | - | This option controls the default cache connection that gets used while - | using this caching library. This connection is used when another is - | not explicitly specified when executing a given caching function. - | - */ - - 'default' => env('CACHE_DRIVER', 'redis'), - - /* - |-------------------------------------------------------------------------- - | Cache Stores - |-------------------------------------------------------------------------- - | - | Here you may define all of the cache "stores" for your application as - | well as their drivers. You may even define multiple stores for the - | same cache driver to group types of items stored in your caches. - | - | Supported drivers: "apc", "array", "database", "file", - | "memcached", "redis", "dynamodb", "octane", "null" - | - */ - 'stores' => [ - - 'apc' => [ - 'driver' => 'apc', - ], - - 'array' => [ - 'driver' => 'array', - 'serialize' => false, - ], - - 'database' => [ - 'driver' => 'database', - 'table' => 'cache', - 'connection' => null, - 'lock_connection' => null, - ], - - 'file' => [ - 'driver' => 'file', - 'path' => storage_path('framework/cache/data'), - 'lock_path' => storage_path('framework/cache/data'), - ], - 'global_variables' => [ 'driver' => 'database', 'table' => 'global_variables', 'connection' => 'processmaker', ], - 'memcached' => [ - 'driver' => 'memcached', - 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), - 'sasl' => [ - env('MEMCACHED_USERNAME'), - env('MEMCACHED_PASSWORD'), - ], - 'options' => [ - // Memcached::OPT_CONNECT_TIMEOUT => 2000, - ], - 'servers' => [ - [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), - 'weight' => 100, - ], - ], - ], - - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'lock_connection' => 'default', - ], - - 'dynamodb' => [ - 'driver' => 'dynamodb', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), - 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), - 'endpoint' => env('DYNAMODB_ENDPOINT'), - ], - - 'octane' => [ - 'driver' => 'octane', - ], - 'cache_settings' => [ 'driver' => 'redis', 'connection' => 'cache_settings', 'lock_connection' => 'cache_settings', 'prefix' => env('CACHE_SETTING_PREFIX', 'settings:'), ], - ], - /* - |-------------------------------------------------------------------------- - | Cache Key Prefix - |-------------------------------------------------------------------------- - | - | When utilizing the APC, database, memcached, Redis, or DynamoDB cache - | stores there might be other applications using the same cache. For - | that reason, you may prefix every cache key to avoid collisions. - | - */ - - 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache_'), - ]; diff --git a/config/cors.php b/config/cors.php deleted file mode 100644 index 8a39e6daa6..0000000000 --- a/config/cors.php +++ /dev/null @@ -1,34 +0,0 @@ - ['api/*', 'sanctum/csrf-cookie'], - - 'allowed_methods' => ['*'], - - 'allowed_origins' => ['*'], - - 'allowed_origins_patterns' => [], - - 'allowed_headers' => ['*'], - - 'exposed_headers' => [], - - 'max_age' => 0, - - 'supports_credentials' => false, - -]; diff --git a/config/database.php b/config/database.php index 5f015dd528..b206045d9e 100644 --- a/config/database.php +++ b/config/database.php @@ -4,35 +4,6 @@ return [ - /* - |-------------------------------------------------------------------------- - | Default Database Connection Name - |-------------------------------------------------------------------------- - | - | Here you may specify which of the database connections below you wish - | to use as your default connection for all database work. Of course - | you may use many connections at once using the Database library. - | - */ - - 'default' => env('DB_CONNECTION', 'processmaker'), - - /* - |-------------------------------------------------------------------------- - | Database Connections - |-------------------------------------------------------------------------- - | - | Here are each of the database connections setup for your application. - | Of course, examples of configuring each database platform that is - | supported by Laravel is shown below to make development simple. - | - | - | All database work in Laravel is done through the PHP PDO facilities - | so make sure you have the driver for your particular database of - | choice installed on your machine before you begin development. - | - */ - 'connections' => [ 'processmaker' => [ 'driver' => env('DB_DRIVER', 'mysql'), @@ -67,34 +38,15 @@ ], ], - /* - |-------------------------------------------------------------------------- - | Migration Repository Table - |-------------------------------------------------------------------------- - | - | This table keeps track of all the migrations that have already run for - | your application. Using this information, we can determine which of - | the migrations on disk haven't actually been run in the database. - | - */ - - 'migrations' => 'migrations', + 'migrations' => [ + 'table' => 'migrations', + 'update_date_on_publish' => false, // disable to preserve original behavior for existing applications + ], 'upgrades' => 'upgrade_migrations', 'enable_index_json_columns' => filter_var(env('ENABLE_INDEXED_JSON_COLUMNS', true), FILTER_VALIDATE_BOOLEAN), - /* - |-------------------------------------------------------------------------- - | Redis Databases - |-------------------------------------------------------------------------- - | - | Redis is an open source, fast, and advanced key-value store that also - | provides a richer body of commands than a typical key-value system - | such as APC or Memcached. Laravel makes it easy to dig right in. - | - */ - 'redis' => [ 'client' => env('REDIS_CLIENT', 'phpredis'), diff --git a/config/filesystems.php b/config/filesystems.php index ba60def6ff..6a328b8a3c 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -2,34 +2,7 @@ return [ - /* - |-------------------------------------------------------------------------- - | Default Filesystem Disk - |-------------------------------------------------------------------------- - | - | Here you may specify the default filesystem disk that should be used - | by the framework. The "local" disk, as well as a variety of cloud - | based disks are available to your application. Just store away! - | - */ - - 'default' => env('FILESYSTEM_DISK', 'local'), - - /* - |-------------------------------------------------------------------------- - | Filesystem Disks - |-------------------------------------------------------------------------- - | - | Here you may configure as many filesystem "disks" as you wish, and you - | may even configure multiple disks of the same driver. Defaults have - | been set up for each driver as an example of the required values. - | - | Supported Drivers: "local", "ftp", "sftp", "s3" - | - */ - 'disks' => [ - 'local' => [ // used throught the system 'driver' => 'local', 'root' => storage_path('app'), @@ -56,26 +29,6 @@ 'root' => env('PROCESS_TEMPLATES_PATH') ? base_path(env('PROCESS_TEMPLATES_PATH')) : database_path('processes/templates'), ], - 'public' => [ // used throught the system - 'driver' => 'local', - 'root' => storage_path('app/public'), - 'url' => env('APP_URL') . '/storage', - 'visibility' => 'public', - 'throw' => false, - ], - - 's3' => [ // DownloadSecurityLog - 'driver' => 's3', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION'), - 'bucket' => env('AWS_BUCKET'), - 'url' => env('AWS_URL'), - 'endpoint' => env('AWS_ENDPOINT'), - 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), - 'throw' => false, - ], - 'profile' => [ 'driver' => 'local', 'root' => storage_path('app/public/profile'), @@ -125,25 +78,6 @@ 'driver' => 'local', 'root' => lang_path(), ], - - // Others declared in packages - // - translations - package-translations - // - 'filesystems.disks.install' configured on the fly - ], - - /* - |-------------------------------------------------------------------------- - | Symbolic Links - |-------------------------------------------------------------------------- - | - | Here you may configure the symbolic links that will be created when the - | `storage:link` Artisan command is executed. The array keys should be - | the locations of the links and the values should be their targets. - | - */ - - 'links' => [ - public_path('storage') => storage_path('app/public'), ], ]; diff --git a/config/hashing.php b/config/hashing.php deleted file mode 100644 index bcd3be4c28..0000000000 --- a/config/hashing.php +++ /dev/null @@ -1,52 +0,0 @@ - 'bcrypt', - - /* - |-------------------------------------------------------------------------- - | Bcrypt Options - |-------------------------------------------------------------------------- - | - | Here you may specify the configuration options that should be used when - | passwords are hashed using the Bcrypt algorithm. This will allow you - | to control the amount of time it takes to hash the given password. - | - */ - - 'bcrypt' => [ - 'rounds' => env('BCRYPT_ROUNDS', 10), - ], - - /* - |-------------------------------------------------------------------------- - | Argon Options - |-------------------------------------------------------------------------- - | - | Here you may specify the configuration options that should be used when - | passwords are hashed using the Argon algorithm. These will allow you - | to control the amount of time it takes to hash the given password. - | - */ - - 'argon' => [ - 'memory' => 65536, - 'threads' => 1, - 'time' => 4, - ], - -]; diff --git a/config/kafka.php b/config/kafka.php index 5a1dfc5d86..ce97f99724 100644 --- a/config/kafka.php +++ b/config/kafka.php @@ -49,7 +49,7 @@ | Repository for batching messages together | Implement BatchRepositoryInterface to save batches in different storage */ - 'batch_repository' => env('KAFKA_BATCH_REPOSITORY', \Junges\Kafka\BatchRepositories\InMemoryBatchRepository::class), + 'batch_repository' => env('KAFKA_BATCH_REPOSITORY', Junges\Kafka\BatchRepositories\InMemoryBatchRepository::class), /* | The sleep time in milliseconds that will be used when retrying flush diff --git a/config/l5-swagger.php b/config/l5-swagger.php index 22df63a6cc..5d30b7e9b7 100644 --- a/config/l5-swagger.php +++ b/config/l5-swagger.php @@ -2,12 +2,12 @@ // Middlewares required to use swagger with authentication $authMiddleware = [ - \ProcessMaker\Http\Middleware\EncryptCookies::class, - \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, - \Illuminate\Session\Middleware\StartSession::class, - \Illuminate\View\Middleware\ShareErrorsFromSession::class, - \Illuminate\Routing\Middleware\SubstituteBindings::class, - \Laravel\Passport\Http\Middleware\CreateFreshApiToken::class, + ProcessMaker\Http\Middleware\EncryptCookies::class, + Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, + Illuminate\Session\Middleware\StartSession::class, + Illuminate\View\Middleware\ShareErrorsFromSession::class, + Illuminate\Routing\Middleware\SubstituteBindings::class, + Laravel\Passport\Http\Middleware\CreateFreshApiToken::class, 'auth', ]; @@ -120,14 +120,14 @@ /** * analyser: defaults to \OpenApi\StaticAnalyser . * - * @see \OpenApi\scan + * @see OpenApi\scan */ 'analyser' => null, /** * analysis: defaults to a new \OpenApi\Analysis . * - * @see \OpenApi\scan + * @see OpenApi\scan */ 'analysis' => null, @@ -135,7 +135,7 @@ * Custom query path processors classes. * * @link https://github.com/zircote/swagger-php/tree/master/Examples/schema-query-parameter-processor - * @see \OpenApi\scan + * @see OpenApi\scan */ 'processors' => [ // new \App\SwaggerProcessors\SchemaQueryParameter(), @@ -144,7 +144,7 @@ /** * pattern: string $pattern File pattern(s) to scan (default: *.php) . * - * @see \OpenApi\scan + * @see OpenApi\scan */ 'pattern' => null, diff --git a/config/logging.php b/config/logging.php index 075376e46c..e1a46bb925 100644 --- a/config/logging.php +++ b/config/logging.php @@ -7,59 +7,14 @@ return [ - /* - |-------------------------------------------------------------------------- - | Default Log Channel - |-------------------------------------------------------------------------- - | - | This option defines the default log channel that gets used when writing - | messages to the logs. The name specified in this option should match - | one of the channels defined in the "channels" configuration array. - | - */ - - 'default' => env('LOG_CHANNEL', 'stack'), - - /* - |-------------------------------------------------------------------------- - | Deprecations Log Channel - |-------------------------------------------------------------------------- - | - | This option controls the log channel that should be used to log warnings - | regarding deprecated PHP and library features. This allows you to get - | your application ready for upcoming major versions of dependencies. - | - */ - 'deprecations' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), - /* - |-------------------------------------------------------------------------- - | Log Channels - |-------------------------------------------------------------------------- - | - | Here you may configure the log channels for your application. Out of - | the box, Laravel uses the Monolog PHP logging library. This gives - | you a variety of powerful log handlers / formatters to utilize. - | - | Available Drivers: "single", "daily", "slack", "syslog", - | "errorlog", "monolog", - | "custom", "stack" - | - */ - 'channels' => [ 'test' => [ 'driver' => 'custom', 'via' => ProcessMaker\Logging\CreateTestLogger::class, ], - 'stack' => [ - 'driver' => 'stack', - 'channels' => ['daily'], - 'ignore_exceptions' => false, - ], - 'single' => [ 'driver' => 'single', 'path' => env('LOG_PATH', base_path('storage/logs/processmaker.log')), @@ -75,56 +30,6 @@ 'replace_placeholders' => true, ], - 'slack' => [ - 'driver' => 'slack', - 'url' => env('LOG_SLACK_WEBHOOK_URL'), - 'username' => 'Laravel Log', - 'emoji' => ':boom:', - 'level' => env('LOG_LEVEL', 'critical'), - 'replace_placeholders' => true, - ], - - 'papertrail' => [ - 'driver' => 'monolog', - 'level' => env('LOG_LEVEL', 'debug'), - 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), - 'handler_with' => [ - 'host' => env('PAPERTRAIL_URL'), - 'port' => env('PAPERTRAIL_PORT'), - 'connectionString' => 'tls://' . env('PAPERTRAIL_URL') . ':' . env('PAPERTRAIL_PORT'), - ], - 'processors' => [PsrLogMessageProcessor::class], - ], - - 'stderr' => [ - 'driver' => 'monolog', - 'level' => env('LOG_LEVEL', 'debug'), - 'handler' => StreamHandler::class, - 'formatter' => env('LOG_STDERR_FORMATTER'), - 'with' => [ - 'stream' => 'php://stderr', - ], - 'processors' => [PsrLogMessageProcessor::class], - ], - - 'syslog' => [ - 'driver' => 'syslog', - 'level' => env('LOG_LEVEL', 'debug'), - 'facility' => LOG_USER, - 'replace_placeholders' => true, - ], - - 'errorlog' => [ - 'driver' => 'errorlog', - 'level' => env('LOG_LEVEL', 'debug'), - 'replace_placeholders' => true, - ], - - 'null' => [ - 'driver' => 'monolog', - 'handler' => NullHandler::class, - ], - 'emergency' => [ 'path' => base_path('storage/logs/laravel.log'), ], diff --git a/config/mail.php b/config/mail.php index d78ea38d62..8ec55731c9 100644 --- a/config/mail.php +++ b/config/mail.php @@ -8,37 +8,6 @@ 'port' => env('MAIL_PORT', 587), - /* - |-------------------------------------------------------------------------- - | Default Mailer - |-------------------------------------------------------------------------- - | - | This option controls the default mailer that is used to send any email - | messages sent by your application. Alternative mailers may be setup - | and used as needed; however, this mailer will be used by default. - | - */ - - 'default' => env('MAIL_MAILER', 'smtp'), - - /* - |-------------------------------------------------------------------------- - | Mailer Configurations - |-------------------------------------------------------------------------- - | - | Here you may configure all of the mailers used by your application plus - | their respective settings. Several examples have been configured for - | you and you are free to add your own as your application requires. - | - | Laravel supports a variety of mail "transport" drivers to be used while - | sending an e-mail. You will specify which one you are using for your - | mailers below. You are free to add additional mailers as required. - | - | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", - | "postmark", "log", "array", "failover" - | - */ - 'mailers' => [ 'smtp' => [ 'transport' => 'smtp', @@ -54,61 +23,12 @@ 'verify_peer' => env('VERIFY_PEER', false), ], - 'ses' => [ - 'transport' => 'ses', - ], - 'mailgun' => [ 'transport' => 'mailgun', // 'client' => [ // 'timeout' => 5, // ], ], - - 'postmark' => [ - 'transport' => 'postmark', - // 'client' => [ - // 'timeout' => 5, - // ], - ], - - 'sendmail' => [ - 'transport' => 'sendmail', - 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), - ], - - 'log' => [ - 'transport' => 'log', - 'channel' => env('MAIL_LOG_CHANNEL'), - ], - - 'array' => [ - 'transport' => 'array', - ], - - 'failover' => [ - 'transport' => 'failover', - 'mailers' => [ - 'smtp', - 'log', - ], - ], - ], - - /* - |-------------------------------------------------------------------------- - | Global "From" Address - |-------------------------------------------------------------------------- - | - | You may wish for all e-mails sent by your application to be sent from - | the same address. Here, you may specify a name and address that is - | used globally for all e-mails that are sent by your application. - | - */ - - 'from' => [ - 'address' => env('MAIL_FROM_ADDRESS', 'admin@example.com'), - 'name' => env('MAIL_FROM_NAME', 'ProcessMaker'), ], 'encryption' => env('MAIL_ENCRYPTION', 'tls'), @@ -119,17 +39,6 @@ 'sendmail' => '/usr/sbin/sendmail -bs', - /* - |-------------------------------------------------------------------------- - | Markdown Mail Settings - |-------------------------------------------------------------------------- - | - | If you are using Markdown based email rendering, you may configure your - | theme and component paths here, allowing you to customize the design - | of the emails. Or, you may simply stick with the Laravel defaults! - | - */ - 'markdown' => [ 'theme' => 'default', diff --git a/config/queue.php b/config/queue.php index c5029a5baa..d027dad96b 100644 --- a/config/queue.php +++ b/config/queue.php @@ -2,117 +2,8 @@ return [ - /* - |-------------------------------------------------------------------------- - | Default Queue Connection Name - |-------------------------------------------------------------------------- - | - | Laravel's queue API supports an assortment of back-ends via a single - | API, giving you convenient access to each back-end using the same - | syntax for every one. Here you may define a default connection. - | - */ - - 'default' => env('QUEUE_DRIVER', 'redis'), - - /* - |-------------------------------------------------------------------------- - | Queue Connections - |-------------------------------------------------------------------------- - | - | Here you may configure the connection information for each server that - | is used by your application. A default configuration has been added - | for each back-end shipped with Laravel. You are free to add more. - | - | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" - | - */ - - 'connections' => [ - - 'sync' => [ - 'driver' => 'sync', - ], - - 'database' => [ - 'driver' => 'database', - 'table' => 'jobs', - 'queue' => 'default', - 'retry_after' => 90, - 'after_commit' => false, - ], - - 'beanstalkd' => [ - 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', - 'retry_after' => 90, - 'block_for' => 0, - 'after_commit' => false, - ], - - 'sqs' => [ - 'driver' => 'sqs', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), - 'queue' => env('SQS_QUEUE', 'default'), - 'suffix' => env('SQS_SUFFIX'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), - 'after_commit' => false, - ], - - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'queue' => env('REDIS_QUEUE', 'default'), - 'retry_after' => 86400, - 'block_for' => null, - 'after_commit' => false, - ], - - ], - - /* - |-------------------------------------------------------------------------- - | Failed Queue Jobs - |-------------------------------------------------------------------------- - | - | These options configure the behavior of failed queue job logging so you - | can control which database and table are used to store the jobs that - | have failed. You may change them to any database / table you wish. - | - */ - - 'failed' => [ - 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), - 'database' => env('DB_CONNECTION', 'processmaker'), - 'table' => 'failed_jobs', - ], - - /* - |-------------------------------------------------------------------------- - | Tenant Job Tracking - |-------------------------------------------------------------------------- - | - | These options configure the behavior of tenant-specific job tracking. - | Job tracking is enabled by default when multitenancy is enabled. - | When enabled, jobs will be tracked per tenant in Redis for monitoring - | and analytics purposes. - | - | Set this to true to disable job tracking for all tenants. - */ - 'disable_tenant_tracking' => env('QUEUE_DISABLE_TENANT_TRACKING', false), - /* - |-------------------------------------------------------------------------- - | Restrict Queue UI to Tenant - |-------------------------------------------------------------------------- - | - | Allow viewing queue info for all tenants in a multitenant environment. - | Only enable for debugging! - | - */ 'ui_allow_all_tenants' => env('QUEUE_UI_ALLOW_ALL_TENANTS', false), + ]; diff --git a/config/rabbitmq.php b/config/rabbitmq.php index 71fcaa7e0c..d71947d4b0 100644 --- a/config/rabbitmq.php +++ b/config/rabbitmq.php @@ -48,7 +48,7 @@ * Read more about possible values at https://www.rabbitmq.com/tutorials/amqp-concepts.html */ - 'type' => env('RABBITMQ_EXCHANGE_TYPE', \PhpAmqpLib\Exchange\AMQPExchangeType::DIRECT), + 'type' => env('RABBITMQ_EXCHANGE_TYPE', PhpAmqpLib\Exchange\AMQPExchangeType::DIRECT), 'passive' => env('RABBITMQ_EXCHANGE_PASSIVE', false), 'durable' => env('RABBITMQ_EXCHANGE_DURABLE', true), 'auto_delete' => env('RABBITMQ_EXCHANGE_AUTODELETE', false), diff --git a/config/samlidp.php b/config/samlidp.php index 2373f0697a..f4280682dd 100644 --- a/config/samlidp.php +++ b/config/samlidp.php @@ -34,7 +34,7 @@ // Make sure messages are signed 'messages_signed' => true, // Defind what digital algorithm you want to use - 'digest_algorithm' => \RobRichards\XMLSecLibs\XMLSecurityDSig::SHA1, + 'digest_algorithm' => RobRichards\XMLSecLibs\XMLSecurityDSig::SHA1, // list of all service providers 'sp' => [ // Base64 encoded ACS URL diff --git a/config/services.php b/config/services.php index fde93f96cd..4f27b4f709 100644 --- a/config/services.php +++ b/config/services.php @@ -2,18 +2,6 @@ return [ - /* - |-------------------------------------------------------------------------- - | Third Party Services - |-------------------------------------------------------------------------- - | - | This file is for storing the credentials for third party services such - | as Mailgun, Postmark, AWS and more. This file provides the de facto - | location for this type of information, allowing packages to have - | a conventional file to locate the various service credentials. - | - */ - 'mailgun' => [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), @@ -21,16 +9,6 @@ 'scheme' => 'https', ], - 'postmark' => [ - 'token' => env('POSTMARK_TOKEN'), - ], - - 'ses' => [ - 'key' => env('SES_KEY'), - 'secret' => env('SES_SECRET'), - 'region' => env('SES_REGION', 'us-east-1'), - ], - 'processmakerpost' => [ 'secret' => env('PROCESSMAKERPOST_SECRET'), ], @@ -59,6 +37,7 @@ 'template_branch' => env('SCREEN_TEMPLATE_BRANCH', 'spring-2024'), 'template_categories' => env('SCREEN_TEMPLATE_CATEGORIES', 'all'), ], + 'userway' => [ 'account_id' => env('USERWAY_ACCOUNT_ID'), ], @@ -69,4 +48,5 @@ 'branch' => env('RECOMMENDATIONS_BRANCH', 'develop'), 'token' => env('RECOMMENDATIONS_GITHUB_TOKEN'), ], + ]; diff --git a/config/session.php b/config/session.php index 1452f75dbe..ac2615b850 100644 --- a/config/session.php +++ b/config/session.php @@ -4,200 +4,6 @@ return [ - /* - |-------------------------------------------------------------------------- - | Default Session Driver - |-------------------------------------------------------------------------- - | - | This option controls the default session "driver" that will be used on - | requests. By default, we will use the lightweight native driver but - | you may specify any of the other wonderful drivers provided here. - | - | Supported: "file", "cookie", "database", "apc", - | "memcached", "redis", "dynamodb", "array" - | - */ - - 'driver' => env('SESSION_DRIVER', 'file'), - - /* - |-------------------------------------------------------------------------- - | Session Lifetime - |-------------------------------------------------------------------------- - | - | Here you may specify the number of minutes that you wish the session - | to be allowed to remain idle before it expires. If you want them - | to immediately expire on the browser closing, set that option. - | - */ - - 'lifetime' => env('SESSION_LIFETIME', 120), - - 'expire_on_close' => true, - 'expire_warning' => env('SESSION_EXPIRE_WARNING', 180), - /* - |-------------------------------------------------------------------------- - | Session Encryption - |-------------------------------------------------------------------------- - | - | This option allows you to easily specify that all of your session data - | should be encrypted before it is stored. All encryption will be run - | automatically by Laravel and you can use the Session like normal. - | - */ - - 'encrypt' => false, - - /* - |-------------------------------------------------------------------------- - | Session File Location - |-------------------------------------------------------------------------- - | - | When using the native session driver, we need a location where session - | files may be stored. A default has been set for you but a different - | location may be specified. This is only needed for file sessions. - | - */ - - 'files' => storage_path('framework/sessions'), - - /* - |-------------------------------------------------------------------------- - | Session Database Connection - |-------------------------------------------------------------------------- - | - | When using the "database" or "redis" session drivers, you may specify a - | connection that should be used to manage these sessions. This should - | correspond to a connection in your database configuration options. - | - */ - - 'connection' => env('SESSION_CONNECTION'), - - /* - |-------------------------------------------------------------------------- - | Session Database Table - |-------------------------------------------------------------------------- - | - | When using the "database" session driver, you may specify the table we - | should use to manage the sessions. Of course, a sensible default is - | provided for you; however, you are free to change this as needed. - | - */ - - 'table' => 'sessions', - - /* - |-------------------------------------------------------------------------- - | Session Cache Store - |-------------------------------------------------------------------------- - | - | While using one of the framework's cache driven session backends you may - | list a cache store that should be used for these sessions. This value - | must match with one of the application's configured cache "stores". - | - | Affects: "apc", "dynamodb", "memcached", "redis" - | - */ - - 'store' => env('SESSION_STORE'), - - /* - |-------------------------------------------------------------------------- - | Session Sweeping Lottery - |-------------------------------------------------------------------------- - | - | Some session drivers must manually sweep their storage location to get - | rid of old sessions from storage. Here are the chances that it will - | happen on a given request. By default, the odds are 2 out of 100. - | - */ - - 'lottery' => [2, 100], - - /* - |-------------------------------------------------------------------------- - | Session Cookie Name - |-------------------------------------------------------------------------- - | - | Here you may change the name of the cookie used to identify a session - | instance by ID. The name specified here will get used every time a - | new session cookie is created by the framework for every driver. - | - */ - - 'cookie' => env( - 'SESSION_COOKIE', - Str::slug(env('APP_NAME', 'laravel'), '_') . '_session' - ), - - /* - |-------------------------------------------------------------------------- - | Session Cookie Path - |-------------------------------------------------------------------------- - | - | The session cookie path determines the path for which the cookie will - | be regarded as available. Typically, this will be the root path of - | your application but you are free to change this when necessary. - | - */ - - 'path' => '/', - - /* - |-------------------------------------------------------------------------- - | Session Cookie Domain - |-------------------------------------------------------------------------- - | - | Here you may change the domain of the cookie used to identify a session - | in your application. This will determine which domains the cookie is - | available to in your application. A sensible default has been set. - | - */ - - 'domain' => env('SESSION_DOMAIN'), - - /* - |-------------------------------------------------------------------------- - | HTTPS Only Cookies - |-------------------------------------------------------------------------- - | - | By setting this option to true, session cookies will only be sent back - | to the server if the browser has a HTTPS connection. This will keep - | the cookie from being sent to you when it can't be done securely. - | - */ - - 'secure' => env('SESSION_SECURE_COOKIE', false), - - /* - |-------------------------------------------------------------------------- - | HTTP Access Only - |-------------------------------------------------------------------------- - | - | Setting this value to true will prevent JavaScript from accessing the - | value of the cookie and the cookie will only be accessible through - | the HTTP protocol. You are free to modify this option if needed. - | - */ - - 'http_only' => env('SESSION_HTTP_ONLY', true), - - /* - |-------------------------------------------------------------------------- - | Same-Site Cookies - |-------------------------------------------------------------------------- - | - | This option determines how your cookies behave when cross-site requests - | take place, and can be used to mitigate CSRF attacks. By default, we - | will set this value to "lax" since this is a secure default value. - | - | Supported: "lax", "strict", "none", null - | - */ - - 'same_site' => env('SESSION_SAME_SITE', 'lax'), - ]; diff --git a/config/trustedproxy.php b/config/trustedproxy.php index 0cb1d72bf8..ef299f01d3 100644 --- a/config/trustedproxy.php +++ b/config/trustedproxy.php @@ -41,5 +41,5 @@ * * @link https://symfony.com/doc/current/deployment/proxies.html */ - 'headers' => env('PROXIES_AWS', false) ? Illuminate\Http\Request::HEADER_X_FORWARDED_AWS_ELB : Illuminate\Http\Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_AWS_ELB, + 'headers' => env('PROXIES_AWS', false) ? Request::HEADER_X_FORWARDED_AWS_ELB : Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_AWS_ELB, ]; diff --git a/config/view.php b/config/view.php deleted file mode 100644 index 22b8a18d32..0000000000 --- a/config/view.php +++ /dev/null @@ -1,36 +0,0 @@ - [ - resource_path('views'), - ], - - /* - |-------------------------------------------------------------------------- - | Compiled View Path - |-------------------------------------------------------------------------- - | - | This option determines where all the compiled Blade templates will be - | stored for your application. Typically, this is within the storage - | directory. However, as usual, you are free to change this value. - | - */ - - 'compiled' => env( - 'VIEW_COMPILED_PATH', - realpath(storage_path('framework/views')) - ), - -]; diff --git a/database/factories/ProcessMaker/Models/EncryptedDataFactory.php b/database/factories/ProcessMaker/Models/EncryptedDataFactory.php index c1943e4bf5..a8515a4657 100644 --- a/database/factories/ProcessMaker/Models/EncryptedDataFactory.php +++ b/database/factories/ProcessMaker/Models/EncryptedDataFactory.php @@ -21,6 +21,7 @@ public function definition() $driver = config('app.encrypted_data.driver'); $cipherText = EncryptedData::driver($driver)->encryptText($this->faker->sentence(3)); + return [ 'field_name' => $this->faker->word(), 'iv' => base64_encode(EncryptedData::driver($driver)->getIv()), diff --git a/database/factories/ProcessMaker/Models/InboxRuleLogFactory.php b/database/factories/ProcessMaker/Models/InboxRuleLogFactory.php index 1099e9e308..3f48ee3bc4 100644 --- a/database/factories/ProcessMaker/Models/InboxRuleLogFactory.php +++ b/database/factories/ProcessMaker/Models/InboxRuleLogFactory.php @@ -2,8 +2,8 @@ namespace Database\Factories\ProcessMaker\Models; -use ProcessMaker\Models\InboxRuleLog; use Illuminate\Database\Eloquent\Factories\Factory; +use ProcessMaker\Models\InboxRuleLog; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\ProcessMaker\Models\InboxRule> diff --git a/database/factories/ProcessMaker/Models/ProcessAbeRequestTokenFactory.php b/database/factories/ProcessMaker/Models/ProcessAbeRequestTokenFactory.php index 2e31b4c71f..f3bcd96431 100644 --- a/database/factories/ProcessMaker/Models/ProcessAbeRequestTokenFactory.php +++ b/database/factories/ProcessMaker/Models/ProcessAbeRequestTokenFactory.php @@ -27,7 +27,7 @@ public function definition() ]); $processRequestToken = ProcessRequestToken::factory()->create([ 'process_id' => $process->getKey(), - 'process_request_id' => $processRequest->getKey() + 'process_request_id' => $processRequest->getKey(), ]); return [ @@ -35,7 +35,7 @@ public function definition() 'process_request_token_id' => $processRequestToken->getKey(), 'completed_screen_id' => $screen->getKey(), 'is_answered' => 0, - 'require_login' => 0 + 'require_login' => 0, ]; } } diff --git a/database/factories/ProcessMaker/Models/RecommendationFactory.php b/database/factories/ProcessMaker/Models/RecommendationFactory.php index 37507d3794..24e06b80cd 100644 --- a/database/factories/ProcessMaker/Models/RecommendationFactory.php +++ b/database/factories/ProcessMaker/Models/RecommendationFactory.php @@ -2,8 +2,8 @@ namespace Database\Factories\ProcessMaker\Models; -use Illuminate\Support\Str; use Illuminate\Database\Eloquent\Factories\Factory; +use Illuminate\Support\Str; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\ProcessMaker\Models\Recommendation> diff --git a/database/factories/ProcessMaker/Models/SettingsMenusFactory.php b/database/factories/ProcessMaker/Models/SettingsMenusFactory.php index a1fcbd81c9..c0ff2d58f1 100644 --- a/database/factories/ProcessMaker/Models/SettingsMenusFactory.php +++ b/database/factories/ProcessMaker/Models/SettingsMenusFactory.php @@ -22,10 +22,11 @@ public function definition() 'Log-In & Auth', 'User Settings', ]); + return [ 'menu_group' => $menus, 'menu_group_order' => 1, - 'ui' => json_encode(["icon" => "envelope-open-text"]), + 'ui' => json_encode(['icon' => 'envelope-open-text']), ]; } } diff --git a/database/factories/ProcessMaker/Models/TaskDraftFactory.php b/database/factories/ProcessMaker/Models/TaskDraftFactory.php index bed5e26e10..ee342dc89e 100644 --- a/database/factories/ProcessMaker/Models/TaskDraftFactory.php +++ b/database/factories/ProcessMaker/Models/TaskDraftFactory.php @@ -2,12 +2,11 @@ namespace Database\Factories\ProcessMaker\Models; -use ProcessMaker\Models\TaskDraft; use Illuminate\Database\Eloquent\Factories\Factory; +use ProcessMaker\Models\TaskDraft; class TaskDraftFactory extends Factory { - protected $model = TaskDraft::class; /** diff --git a/database/migrations/2019_07_03_174209_update_bpmn_column_to_mediumtext.php b/database/migrations/2019_07_03_174209_update_bpmn_column_to_mediumtext.php index 49547722af..7a7d16272a 100644 --- a/database/migrations/2019_07_03_174209_update_bpmn_column_to_mediumtext.php +++ b/database/migrations/2019_07_03_174209_update_bpmn_column_to_mediumtext.php @@ -8,7 +8,6 @@ return new class extends Migration { public function __construct() { - } /** diff --git a/database/migrations/2022_12_15_014415_add_is_self_service_index_to_process_request_tokens_table.php b/database/migrations/2022_12_15_014415_add_is_self_service_index_to_process_request_tokens_table.php index 2a44237d21..5b095c842e 100644 --- a/database/migrations/2022_12_15_014415_add_is_self_service_index_to_process_request_tokens_table.php +++ b/database/migrations/2022_12_15_014415_add_is_self_service_index_to_process_request_tokens_table.php @@ -20,7 +20,6 @@ public function __construct() { - } public function up() diff --git a/database/migrations/2024_01_17_183702_add_2fa_field_to_groups_table.php b/database/migrations/2024_01_17_183702_add_2fa_field_to_groups_table.php index f19ab100a9..f49cb5ddb3 100644 --- a/database/migrations/2024_01_17_183702_add_2fa_field_to_groups_table.php +++ b/database/migrations/2024_01_17_183702_add_2fa_field_to_groups_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2024_02_14_140435_add_is_priority_to_process_request_tokens_table.php b/database/migrations/2024_02_14_140435_add_is_priority_to_process_request_tokens_table.php index 0da26463f0..b46670bd6b 100644 --- a/database/migrations/2024_02_14_140435_add_is_priority_to_process_request_tokens_table.php +++ b/database/migrations/2024_02_14_140435_add_is_priority_to_process_request_tokens_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2024_02_26_182828_create_settings_menus_table.php b/database/migrations/2024_02_26_182828_create_settings_menus_table.php index 52da8e67f1..02254ee117 100644 --- a/database/migrations/2024_02_26_182828_create_settings_menus_table.php +++ b/database/migrations/2024_02_26_182828_create_settings_menus_table.php @@ -5,8 +5,7 @@ use Illuminate\Support\Facades\Schema; use ProcessMaker\Models\SettingsMenus; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. * diff --git a/database/migrations/2024_02_27_182828_add_group_id_column_to_settings_table.php b/database/migrations/2024_02_27_182828_add_group_id_column_to_settings_table.php index 1b60071c86..c11e082728 100644 --- a/database/migrations/2024_02_27_182828_add_group_id_column_to_settings_table.php +++ b/database/migrations/2024_02_27_182828_add_group_id_column_to_settings_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2024_03_06_213416_create_alternatives_table.php b/database/migrations/2024_03_06_213416_create_alternatives_table.php index ea54f147fa..9f42f340d8 100644 --- a/database/migrations/2024_03_06_213416_create_alternatives_table.php +++ b/database/migrations/2024_03_06_213416_create_alternatives_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2024_03_28_164852_create_embed_table.php b/database/migrations/2024_03_28_164852_create_embed_table.php index 68a5a66231..a257b5f5ba 100644 --- a/database/migrations/2024_03_28_164852_create_embed_table.php +++ b/database/migrations/2024_03_28_164852_create_embed_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2024_04_01_161132_create_process_launchpad.php b/database/migrations/2024_04_01_161132_create_process_launchpad.php index 5d56b758bd..5fea7668e3 100644 --- a/database/migrations/2024_04_01_161132_create_process_launchpad.php +++ b/database/migrations/2024_04_01_161132_create_process_launchpad.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2024_04_26_183624_add_index_to_case_number_column_in_process_requests_table.php b/database/migrations/2024_04_26_183624_add_index_to_case_number_column_in_process_requests_table.php index e195033835..64766267f6 100644 --- a/database/migrations/2024_04_26_183624_add_index_to_case_number_column_in_process_requests_table.php +++ b/database/migrations/2024_04_26_183624_add_index_to_case_number_column_in_process_requests_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2024_05_29_171650_create_recommendations_table.php b/database/migrations/2024_05_29_171650_create_recommendations_table.php index 7b23e9ab47..109e9fa72a 100644 --- a/database/migrations/2024_05_29_171650_create_recommendations_table.php +++ b/database/migrations/2024_05_29_171650_create_recommendations_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2024_05_29_171659_create_recommendation_users_table.php b/database/migrations/2024_05_29_171659_create_recommendation_users_table.php index dc0555f31f..dfd0730cff 100644 --- a/database/migrations/2024_05_29_171659_create_recommendation_users_table.php +++ b/database/migrations/2024_05_29_171659_create_recommendation_users_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2024_06_14_143814_add_index_to_updated_at_column_for_process_request_tokens_table.php b/database/migrations/2024_06_14_143814_add_index_to_updated_at_column_for_process_request_tokens_table.php index e96815257f..8eeb9d8483 100644 --- a/database/migrations/2024_06_14_143814_add_index_to_updated_at_column_for_process_request_tokens_table.php +++ b/database/migrations/2024_06_14_143814_add_index_to_updated_at_column_for_process_request_tokens_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2024_06_18_191149_create_process_slideshow.php b/database/migrations/2024_06_18_191149_create_process_slideshow.php index 081ed3f963..6a53c9f184 100644 --- a/database/migrations/2024_06_18_191149_create_process_slideshow.php +++ b/database/migrations/2024_06_18_191149_create_process_slideshow.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2024_07_02_122418_add_process_abe_request_tokens_table.php b/database/migrations/2024_07_02_122418_add_process_abe_request_tokens_table.php index 909ee3ea26..2e4b4b2de3 100644 --- a/database/migrations/2024_07_02_122418_add_process_abe_request_tokens_table.php +++ b/database/migrations/2024_07_02_122418_add_process_abe_request_tokens_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2024_07_30_120225_modify_watchers_column_in_screens_table.php b/database/migrations/2024_07_30_120225_modify_watchers_column_in_screens_table.php index 9d7d9046a8..b3fa159d4f 100644 --- a/database/migrations/2024_07_30_120225_modify_watchers_column_in_screens_table.php +++ b/database/migrations/2024_07_30_120225_modify_watchers_column_in_screens_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2024_07_30_203849_update_code_in_scripts_table.php b/database/migrations/2024_07_30_203849_update_code_in_scripts_table.php index e8b4103951..ad2df169bf 100644 --- a/database/migrations/2024_07_30_203849_update_code_in_scripts_table.php +++ b/database/migrations/2024_07_30_203849_update_code_in_scripts_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ @@ -26,4 +25,3 @@ public function down(): void }); } }; - diff --git a/database/migrations/2024_07_30_203903_update_code_in_script_versions_table.php b/database/migrations/2024_07_30_203903_update_code_in_script_versions_table.php index bada803947..b87eb929e5 100644 --- a/database/migrations/2024_07_30_203903_update_code_in_script_versions_table.php +++ b/database/migrations/2024_07_30_203903_update_code_in_script_versions_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2024_08_26_190935_create_encrypted_data.php b/database/migrations/2024_08_26_190935_create_encrypted_data.php index f64e4a369b..9a670da2b0 100644 --- a/database/migrations/2024_08_26_190935_create_encrypted_data.php +++ b/database/migrations/2024_08_26_190935_create_encrypted_data.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2024_09_12_172734_create_cases_participated_table.php b/database/migrations/2024_09_12_172734_create_cases_participated_table.php index 2d0eef7dc3..74d12af280 100644 --- a/database/migrations/2024_09_12_172734_create_cases_participated_table.php +++ b/database/migrations/2024_09_12_172734_create_cases_participated_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2025_04_08_115507_add_the_comments_field_to_the_process_request_token_table.php b/database/migrations/2025_04_08_115507_add_the_comments_field_to_the_process_request_token_table.php index 69811599b1..4877eec6d9 100644 --- a/database/migrations/2025_04_08_115507_add_the_comments_field_to_the_process_request_token_table.php +++ b/database/migrations/2025_04_08_115507_add_the_comments_field_to_the_process_request_token_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/phpunit.package.xml b/phpunit.package.xml index 13d9f28b16..fc29bc6fc1 100644 --- a/phpunit.package.xml +++ b/phpunit.package.xml @@ -31,13 +31,13 @@ - + - + diff --git a/phpunit.xml b/phpunit.xml index 81690f715b..7bf410a342 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -30,13 +30,13 @@ - + - + diff --git a/public/index.php b/public/index.php index 1d69f3a289..947d98963f 100644 --- a/public/index.php +++ b/public/index.php @@ -1,55 +1,17 @@ make(Kernel::class); - -$response = $kernel->handle( - $request = Request::capture() -)->send(); - -$kernel->terminate($request, $response); +// Bootstrap Laravel and handle the request... +(require_once __DIR__.'/../bootstrap/app.php') + ->handleRequest(Request::capture()); diff --git a/routes/channels.php b/routes/channels.php index 50c9ffd80b..64d6c9651d 100644 --- a/routes/channels.php +++ b/routes/channels.php @@ -1,4 +1,5 @@ name('test.email'); }); -Route::group([ - 'middleware' => ['web', 'auth:web,anon', 'sanitize', 'bindings'], -], function () { +Route::middleware('web', 'auth:web,anon', 'sanitize', 'bindings')->group(function () { Route::get('tasks/update_variable/{token_abe}', [TaskController::class, 'updateVariable'])->name('tasks.abe.update'); }); diff --git a/tests/DuskTestCase.php b/tests/DuskTestCase.php index 2af55ba64f..4ab5816933 100644 --- a/tests/DuskTestCase.php +++ b/tests/DuskTestCase.php @@ -25,7 +25,7 @@ public static function prepare() /** * Create the RemoteWebDriver instance. * - * @return \Facebook\WebDriver\Remote\RemoteWebDriver + * @return RemoteWebDriver */ protected function driver() { diff --git a/tests/Feature/Api/RequestFileUploadTest.php b/tests/Feature/Api/RequestFileUploadTest.php index 15446b8696..992cf11529 100644 --- a/tests/Feature/Api/RequestFileUploadTest.php +++ b/tests/Feature/Api/RequestFileUploadTest.php @@ -28,7 +28,7 @@ class RequestFileUploadTest extends TestCase protected $task; /** - * @var \ProcessMaker\Models\User[] + * @var User[] */ protected $assigned = []; diff --git a/tests/Feature/Api/TaskAssignmentPreviousOwnerTest.php b/tests/Feature/Api/TaskAssignmentPreviousOwnerTest.php index ea87216196..1852b96726 100644 --- a/tests/Feature/Api/TaskAssignmentPreviousOwnerTest.php +++ b/tests/Feature/Api/TaskAssignmentPreviousOwnerTest.php @@ -25,7 +25,7 @@ class TaskAssignmentPreviousOwnerTest extends TestCase protected $task; /** - * @var \ProcessMaker\Models\User + * @var User */ protected $assigned; @@ -109,10 +109,10 @@ public function testSingleUserAssignment() /** * Complete task * - * @param \ProcessMaker\Models\ProcessRequestToken $task + * @param ProcessRequestToken $task * @param array $data * - * @return \ProcessMaker\Models\ProcessRequestToken + * @return ProcessRequestToken */ private function completeTask(ProcessRequestToken $task, $data = []) { diff --git a/tests/Feature/Api/TaskControllerTest.php b/tests/Feature/Api/TaskControllerTest.php index a545789a58..b0b832c32c 100644 --- a/tests/Feature/Api/TaskControllerTest.php +++ b/tests/Feature/Api/TaskControllerTest.php @@ -254,10 +254,10 @@ public function testShowTaskIncludesNewProperty() $user = User::factory()->create(); $this->actingAs($user); - $comments = "This is a comment"; + $comments = 'This is a comment'; $task = ProcessRequestToken::factory()->create([ - "comments" => $comments + 'comments' => $comments, ]); $this->assertEquals($comments, $task->comments); diff --git a/tests/Feature/Api/TaskLockAssignmentTest.php b/tests/Feature/Api/TaskLockAssignmentTest.php index c312e5c3aa..2abb4af07e 100644 --- a/tests/Feature/Api/TaskLockAssignmentTest.php +++ b/tests/Feature/Api/TaskLockAssignmentTest.php @@ -17,12 +17,12 @@ class TaskLockAssignmentTest extends TestCase use RequestHelper; /** - * @var \ProcessMaker\Models\User + * @var User */ protected $user1; /** - * @var \ProcessMaker\Models\User + * @var User */ protected $user2; @@ -160,10 +160,10 @@ public function testWithNoLockAssignment() /** * Complete task * - * @param \ProcessMaker\Models\ProcessRequestToken $task + * @param ProcessRequestToken $task * @param array $data * - * @return \ProcessMaker\Models\ProcessRequestToken + * @return ProcessRequestToken */ private function completeTask(ProcessRequestToken $task, $data = []) { diff --git a/tests/Feature/Api/V1_1/CaseUtilsTest.php b/tests/Feature/Api/V1_1/CaseUtilsTest.php index b8be5d38a5..d0f3df3a60 100644 --- a/tests/Feature/Api/V1_1/CaseUtilsTest.php +++ b/tests/Feature/Api/V1_1/CaseUtilsTest.php @@ -123,8 +123,8 @@ public function test_store_participants_with_empty_data() public function test_extract_data_process() { - $object = (object)[ - 'process' => (object)[ + $object = (object) [ + 'process' => (object) [ 'id' => 1, 'name' => 'Process 1', ], @@ -138,11 +138,11 @@ public function test_extract_data_process() public function test_extract_data_request() { - $object = (object)[ - 'processRequest' => (object)[ + $object = (object) [ + 'processRequest' => (object) [ 'id' => 1, 'name' => 'Request 1', - 'parentRequest' => (object)[ + 'parentRequest' => (object) [ 'id' => 2, ], ], @@ -157,7 +157,7 @@ public function test_extract_data_request() public function test_extract_data_task() { - $object = (object)[ + $object = (object) [ 'id' => 1, 'element_id' => 101, 'element_name' => 'Task 1', diff --git a/tests/Feature/AuthTest.php b/tests/Feature/AuthTest.php index baa02cd488..075b32dd01 100644 --- a/tests/Feature/AuthTest.php +++ b/tests/Feature/AuthTest.php @@ -74,7 +74,6 @@ public function testLoginWithUnknownUser() } /** - * * Test logout flow */ public function testLogoutStandard() diff --git a/tests/Feature/Cases/CaseSyncRepositoryTest.php b/tests/Feature/Cases/CaseSyncRepositoryTest.php index c91cd2b4fa..7eef39f43f 100644 --- a/tests/Feature/Cases/CaseSyncRepositoryTest.php +++ b/tests/Feature/Cases/CaseSyncRepositoryTest.php @@ -2,11 +2,11 @@ namespace Tests\Feature\Cases; -use ProcessMaker\Repositories\CaseSyncRepository; +use Illuminate\Support\Facades\DB; use ProcessMaker\Models\ProcessRequest; use ProcessMaker\Models\ProcessRequestToken; +use ProcessMaker\Repositories\CaseSyncRepository; use Tests\TestCase; -use Illuminate\Support\Facades\DB; class CaseSyncRepositoryTest extends TestCase { @@ -24,7 +24,7 @@ public function testSyncCases() 'status' => 'ACTIVE', 'element_id' => 'task-1', 'process_request_id' => $processRequest1->id, - 'process_id' => $processRequest1->process_id + 'process_id' => $processRequest1->process_id, ])->toArray(), ProcessRequestToken::factory()->make([ 'element_name' => 'Task 2', @@ -32,7 +32,7 @@ public function testSyncCases() 'status' => 'CLOSED', 'element_id' => 'task-2', 'process_request_id' => $processRequest1->id, - 'process_id' => $processRequest1->process_id + 'process_id' => $processRequest1->process_id, ])->toArray(), ProcessRequestToken::factory()->make([ 'element_name' => 'Task 3', @@ -40,7 +40,7 @@ public function testSyncCases() 'status' => 'ACTIVE', 'element_id' => 'call-activity-1', 'process_request_id' => $processRequest1->id, - 'process_id' => $processRequest1->process_id + 'process_id' => $processRequest1->process_id, ])->toArray(), ]); @@ -51,7 +51,7 @@ public function testSyncCases() 'status' => 'CLOSED', 'element_id' => 'task-4', 'process_request_id' => $processRequest2->id, - 'process_id' => $processRequest2->process_id + 'process_id' => $processRequest2->process_id, ])->toArray(), ProcessRequestToken::factory()->make([ 'element_name' => 'Task 5', @@ -59,7 +59,7 @@ public function testSyncCases() 'status' => 'ACTIVE', 'element_id' => 'task-5', 'process_request_id' => $processRequest2->id, - 'process_id' => $processRequest2->process_id + 'process_id' => $processRequest2->process_id, ])->toArray(), ]); @@ -85,21 +85,21 @@ public function testSyncCases() 'name' => 'Task 5', 'status' => 'ACTIVE', 'element_id' => 'task-5', - 'process_id' => $processRequest2->process_id + 'process_id' => $processRequest2->process_id, ], [ 'id' => $processRequest1->tokens()->where('element_id', 'task-2')->first()->id, 'name' => 'Task 2', 'status' => 'CLOSED', 'element_id' => 'task-2', - 'process_id' => $processRequest1->process_id + 'process_id' => $processRequest1->process_id, ], [ 'id' => $processRequest1->tokens()->where('element_id', 'task-1')->first()->id, 'name' => 'Task 1', 'status' => 'ACTIVE', 'element_id' => 'task-1', - 'process_id' => $processRequest1->process_id + 'process_id' => $processRequest1->process_id, ], ]; $expectedParticipants = [ diff --git a/tests/Feature/Console/InstallTest.php b/tests/Feature/Console/InstallTest.php index 57bfed742c..142072792c 100644 --- a/tests/Feature/Console/InstallTest.php +++ b/tests/Feature/Console/InstallTest.php @@ -56,7 +56,7 @@ private function generateParameters() $params->push(new Param('--redis-prefix', 'REDIS_PREFIX', "{$faker->word()}:")); $params->push(new Param('--horizon-prefix', 'HORIZON_PREFIX', "{$faker->word()}:")); $params->push(new Param('--broadcast-debug', 'LARAVEL_ECHO_SERVER_DEBUG', $faker->boolean())); - $params->push(new Param('--broadcast-driver', 'BROADCAST_DRIVER', $faker->randomElement(['pusher', 'redis']))); + $params->push(new Param('--broadcast-driver', 'BROADCAST_CONNECTION', $faker->randomElement(['pusher', 'redis']))); $params->push(new Param('--broadcast-host', 'BROADCASTER_HOST', "https://{$faker->domainName()}")); $params->push(new Param('--broadcast-key', 'BROADCASTER_KEY', $faker->md5())); $params->push(new Param('--echo-host', 'LARAVEL_ECHO_SERVER_AUTH_HOST', "https://{$faker->domainName()}")); diff --git a/tests/Feature/EditDataTest.php b/tests/Feature/EditDataTest.php index 1c2011fb1b..1c3b618b34 100644 --- a/tests/Feature/EditDataTest.php +++ b/tests/Feature/EditDataTest.php @@ -103,7 +103,7 @@ private function addProcessPermission(Process $process, array $users, array $gro * * @param User $userAssigned * - * @return \ProcessMaker\Models\Process + * @return Process */ private function createSingleTaskProcessUserAssignment(User $userAssigned) { @@ -132,7 +132,7 @@ private function createSingleTaskProcessUserAssignment(User $userAssigned) /** * Start a process * - * @param \ProcessMaker\Models\Process $process + * @param Process $process * @param string $startEvent * @param array $data * @@ -149,10 +149,10 @@ private function startProcess($process, $startEvent, $data = []) /** * Complete task * - * @param \ProcessMaker\Models\ProcessRequestToken $task + * @param ProcessRequestToken $task * @param array $data * - * @return \ProcessMaker\Models\ProcessRequestToken + * @return ProcessRequestToken */ private function completeTask(ProcessRequestToken $task, $data = []) { diff --git a/tests/Feature/HomeControllerTest.php b/tests/Feature/HomeControllerTest.php index ebd1527464..b6897d91d8 100644 --- a/tests/Feature/HomeControllerTest.php +++ b/tests/Feature/HomeControllerTest.php @@ -2,11 +2,11 @@ namespace Tests\Feature; -use Tests\TestCase; -use ProcessMaker\Models\User; use ProcessMaker\Models\Group; +use ProcessMaker\Models\User; use ProcessMaker\Package\PackageDynamicUI\Models\DynamicUI; use Tests\Feature\Shared\RequestHelper; +use Tests\TestCase; class HomeControllerTest extends TestCase { @@ -32,7 +32,7 @@ public function testRedirectsToLoginWhenNotAuthenticated() public function testRedirectsToCustomDashboardWhenUserHasDashboard() { $user = User::factory()->create(); - + // Create a custom dashboard for the user DynamicUI::create([ 'type' => 'DASHBOARD', @@ -68,7 +68,7 @@ public function testRedirectsToCustomDashboardWhenGroupHasDashboard() public function testRedirectsToTasksOnMobileWithoutCustomDashboard() { $user = User::factory()->create(); - + // Mock MobileHelper to return true $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1'; $_COOKIE['isMobile'] = 'true'; @@ -84,7 +84,7 @@ public function testRedirectsToTasksOnMobileWithoutCustomDashboard() public function testRedirectsToInboxOnDesktopWithoutCustomDashboard() { $user = User::factory()->create(); - + // Mock MobileHelper to return false $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36'; $_COOKIE['isMobile'] = 'false'; diff --git a/tests/Feature/Http/Middleware/TrustHostsTest.php b/tests/Feature/Http/Middleware/TrustHostsTest.php index 262fab49eb..bed48b6634 100644 --- a/tests/Feature/Http/Middleware/TrustHostsTest.php +++ b/tests/Feature/Http/Middleware/TrustHostsTest.php @@ -2,10 +2,10 @@ namespace Tests\Feature\Http\Middleware; -use Tests\TestCase; -use ProcessMaker\Http\Middleware\TrustHosts; use Illuminate\Http\Request; use Illuminate\Support\Facades\Config; +use ProcessMaker\Http\Middleware\TrustHosts; +use Tests\TestCase; class TrustHostsTest extends TestCase { @@ -51,11 +51,11 @@ public function test_invalid_trusted_host() public function test_missing_forwarded_host() { $request = Request::create('https://example.processmaker.net'); - + $response = $this->middleware->handle($request, function ($req) { return response()->json(['status' => 'success']); }); $this->assertEquals(200, $response->status()); } -} \ No newline at end of file +} diff --git a/tests/Feature/ImportExport/Exporters/ScriptExporterTest.php b/tests/Feature/ImportExport/Exporters/ScriptExporterTest.php index 5dcbb6b564..a3c1e5e76c 100644 --- a/tests/Feature/ImportExport/Exporters/ScriptExporterTest.php +++ b/tests/Feature/ImportExport/Exporters/ScriptExporterTest.php @@ -58,7 +58,7 @@ public function testExportUncategorized() { DB::beginTransaction(); (new CategorySystemSeeder)->run(); - $uncategorizedCategory = \ProcessMaker\Models\ScriptCategory::first(); + $uncategorizedCategory = ScriptCategory::first(); $script = Script::factory()->create(['title' => 'test']); $script->categories()->sync([$uncategorizedCategory->id]); @@ -66,7 +66,7 @@ public function testExportUncategorized() DB::rollBack(); // Delete all created items since DB::beginTransaction (new CategorySystemSeeder)->run(); - $existingUncategorizedCategory = \ProcessMaker\Models\ScriptCategory::first(); + $existingUncategorizedCategory = ScriptCategory::first(); $existingUuid = $existingUncategorizedCategory->uuid; $this->import($payload); @@ -191,4 +191,5 @@ public function testWithDuplicatedEnvVariable() $this->assertDatabaseHas('environment_variables', ['name' => $environmentVariable1->name . '_2']); $this->assertDatabaseHas('environment_variables', ['name' => $environmentVariable2->name . '_2']); $this->assertDatabaseMissing('environment_variables', ['name' => $environmentVariable3->name . '_2']); - }} + } +} diff --git a/tests/Feature/InterstitialTest.php b/tests/Feature/InterstitialTest.php index 5afb765ace..9545bb8a7e 100644 --- a/tests/Feature/InterstitialTest.php +++ b/tests/Feature/InterstitialTest.php @@ -45,6 +45,7 @@ private function loadProcess($file) { $data = []; $data['bpmn'] = Process::getProcessTemplate($file); + return Process::factory()->create($data); } @@ -56,6 +57,7 @@ private function importProcessPackage(string $file) $maxId = Process::max('id') ?? 0; $data = json_decode(file_get_contents(base_path('tests/Fixtures/' . $file)), true); $this->import($data); + return Process::where('id', '>', $maxId)->get(); } @@ -63,6 +65,7 @@ private function startProcess(Process $process, string $event, array $data = []) { $route = route('api.process_events.trigger', [$process->id, 'event' => $event]); $response = $this->apiCall('POST', $route, $data); + return $response->json(); } @@ -71,8 +74,10 @@ private function getActiveTasks() //Get the active tasks of the request $route = route('api.tasks.index', ['status' => 'ACTIVE']); $response = $this->apiCall('GET', $route); + return $response->json('data'); } + private function completeActiveTask(array $data = []) { //Get the active tasks of the request @@ -80,6 +85,7 @@ private function completeActiveTask(array $data = []) //Complete the task $route = route('api.tasks.update', [$tasks[0]['id'], 'status' => 'COMPLETED']); $response = $this->apiCall('PUT', $route, ['data' => $data]); + return $response->json(); } @@ -91,6 +97,7 @@ private function broadcastedTo(RedirectToEvent $event, array $expectedChannels): return false; } } + return true; } @@ -118,7 +125,7 @@ public function testExecuteProcessRedirects() [ 'tokenId' => $tasks[0]['id'], 'nodeId' => $tasks[0]['element_id'], - ] + ], ], ]; $dispatched[] = $expectedEvent; @@ -136,14 +143,13 @@ public function testExecuteProcessRedirects() 'params' => [ [ 'tokenId' => $tasks[0]['id'], - ] + ], ], ]; $dispatched[] = $expectedEvent; Event::assertDispatched(RedirectToEvent::class, function ($event) use ($expectedEvent) { return $event->method === $expectedEvent['method'] && $event->params[0]['tokenId'] === $expectedEvent['params'][0]['tokenId']; - }); // Complete active task (sub process - Task 2) and check RedirectToEvent dispatched to next Task not to subprocess summary @@ -154,12 +160,12 @@ public function testExecuteProcessRedirects() 'params' => [ [ 'tokenId' => $tasks[0]['id'], - ] + ], ], 'broadcastTo' => [ 'private-ProcessMaker.Models.ProcessRequest.' . $tasks[0]['process_request_id'], // active task: parent request 'private-ProcessMaker.Models.ProcessRequest.' . $task['process_request_id'], // completed task: child request - ] + ], ]; $dispatched[] = $expectedEvent; Event::assertDispatched(RedirectToEvent::class, function ($event) use ($expectedEvent, $task) { diff --git a/tests/Feature/LoginRedirectTest.php b/tests/Feature/LoginRedirectTest.php index eb3b0800b2..4c80492c40 100644 --- a/tests/Feature/LoginRedirectTest.php +++ b/tests/Feature/LoginRedirectTest.php @@ -9,7 +9,6 @@ class LoginRedirectTest extends TestCase { /** - * * Test to verify that the login page redirects to the about page */ public function testLoginRedirect() @@ -25,7 +24,7 @@ public function testLoginRedirect() // Verify it redirects to the login page $response->assertRedirect('/login'); - // When we try to open the about page, we should be redirected to the login page + // When we try to open the about page, we should be redirected to the login page $response = $this->get(route('about.index')); $response->assertRedirect('/login'); @@ -50,7 +49,7 @@ public function testLoginRedirectWithDevtoolsOpeningMapFile() // Verify it redirects to the login page $response->assertRedirect('/login'); - // When we try to open the about page, we should be redirected to the login page + // When we try to open the about page, we should be redirected to the login page $response = $this->get(route('about.index')); $response->assertRedirect('/login'); diff --git a/tests/Feature/RequestControllerShowTest.php b/tests/Feature/RequestControllerShowTest.php index fa9add2348..4b878b0b9f 100644 --- a/tests/Feature/RequestControllerShowTest.php +++ b/tests/Feature/RequestControllerShowTest.php @@ -19,7 +19,7 @@ class RequestControllerShowTest extends TestCase protected function setUp(): void { parent::setUp(); - + $this->user = User::factory()->create([ 'is_administrator' => true, ]); @@ -87,10 +87,10 @@ public function testShowPageRendersManagerModelerScripts() // Get the filtered scripts (should exclude the disabled ones) $managerModelerScripts = $response->viewData('managerModelerScripts'); - + // Assert that the filtered scripts contain only the allowed scripts $this->assertCount(2, $managerModelerScripts); - + // Check that the disabled scripts are filtered out $scriptSources = array_column($managerModelerScripts, 'src'); $this->assertContains('/js/test-script-1.js', $scriptSources); @@ -104,7 +104,7 @@ public function testShowPageRendersManagerModelerScripts() $response->assertSee('type="module"', false); $response->assertSee('async'); $response->assertSee('defer'); - + // Assert that disabled scripts are not rendered $response->assertDontSee('/js/package-slideshow.js'); $response->assertDontSee('/js/package-process-optimization.js'); diff --git a/tests/Feature/Shared/ResourceAssertionsTrait.php b/tests/Feature/Shared/ResourceAssertionsTrait.php index dd65b22734..4fbed6dce9 100644 --- a/tests/Feature/Shared/ResourceAssertionsTrait.php +++ b/tests/Feature/Shared/ResourceAssertionsTrait.php @@ -22,7 +22,7 @@ trait ResourceAssertionsTrait * @param type $query * @param type $expectedMeta * - * @return \Illuminate\Testing\TestResponse + * @return TestResponse */ protected function assertCorrectModelListing($query, $expectedMeta = []) { @@ -56,7 +56,7 @@ protected function assertModelSorting($query, $expectedFirstRow) * @param string $modelClass * @param array $attributes * - * @return \Illuminate\Testing\TestResponse + * @return TestResponse */ protected function assertCorrectModelCreation($modelClass, array $attributes = []) { @@ -84,7 +84,7 @@ protected function assertCorrectModelCreation($modelClass, array $attributes = [ * @param array $attributes * @param array $errors * - * @return \Illuminate\Testing\TestResponse + * @return TestResponse */ protected function assertModelCreationFails($modelClass, array $attributes = [], array $errors = []) { @@ -105,7 +105,7 @@ protected function assertModelCreationFails($modelClass, array $attributes = [], * @param string $id * @param array $includes * - * @return \Illuminate\Testing\TestResponse + * @return TestResponse */ protected function assertModelShow($id, array $includes = []) { @@ -127,7 +127,7 @@ protected function assertModelShow($id, array $includes = []) * * @param type $id * - * @return \Illuminate\Testing\TestResponse + * @return TestResponse */ protected function assertCorrectModelDeletion($id) { @@ -144,7 +144,7 @@ protected function assertCorrectModelDeletion($id) * * @param type $id * - * @return \Illuminate\Testing\TestResponse + * @return TestResponse */ protected function assertModelDeletionFails($id, array $errors = []) { @@ -236,7 +236,7 @@ private function getDataAttributes($row) * Assert that the response has the given status code. * * @param string $expected - * @param \Illuminate\Testing\TestResponse $response + * @param TestResponse $response */ protected function assertStatus($expected, TestResponse $response) { diff --git a/tests/ScriptExecutors/BuildScriptExecutorsTest.php b/tests/ScriptExecutors/BuildScriptExecutorsTest.php index 91597623cd..00a2096999 100644 --- a/tests/ScriptExecutors/BuildScriptExecutorsTest.php +++ b/tests/ScriptExecutors/BuildScriptExecutorsTest.php @@ -8,7 +8,6 @@ class BuildScriptExecutorsTest extends TestCase { - public function testBuildScriptExecutorsDockerfile() { $scriptExecutor = ScriptExecutor::factory()->create([ @@ -19,7 +18,7 @@ public function testBuildScriptExecutorsDockerfile() $code = $builder->getDockerfileContent($scriptExecutor); // Check the $code contains 'WORKDIR /opt/executor/src' - $expectedCode = <<metricsService->counter('test_counter', 'Test Counter', ['label1']); // Assert the counter is registered - $this->assertInstanceOf(\Prometheus\Counter::class, $counter); + $this->assertInstanceOf(Counter::class, $counter); // Increment the counter and assert the value $counter->inc(['value1']); @@ -83,7 +82,7 @@ public function testHistogramRegistrationAndObserve(): void ); // Assert the histogram is registered - $this->assertInstanceOf(\Prometheus\Histogram::class, $histogram); + $this->assertInstanceOf(Histogram::class, $histogram); // Observe a value and assert it is recorded $histogram->observe(0.5, ['value1']); @@ -112,7 +111,7 @@ public function testDefaultNamespace(): void $counter = $this->metricsService->counter('namespace_test'); // Assert default namespace is applied - $this->assertInstanceOf(\Prometheus\Counter::class, $counter); + $this->assertInstanceOf(Counter::class, $counter); $counter->inc(); $samples = $this->metricsService->renderMetrics(); @@ -131,6 +130,7 @@ public function testSetGaugeValue(): void $this->assertStringContainsString('test_set_gauge', $samples); $this->assertStringContainsString('5', $samples); } + /** * Test that counterInc calls Metrics::counter() and then inc() with the correct labels. */ diff --git a/tests/unit/ProcessMaker/Models/ProcessTest.php b/tests/unit/ProcessMaker/Models/ProcessTest.php index 337d42bfec..f9a5a77bb3 100644 --- a/tests/unit/ProcessMaker/Models/ProcessTest.php +++ b/tests/unit/ProcessMaker/Models/ProcessTest.php @@ -42,12 +42,12 @@ public function testGetAssignableUsersByAssignmentTypeWithManagerOnlyRules() { $manager1 = User::factory()->create(['status' => 'ACTIVE']); $manager2 = User::factory()->create(['status' => 'ACTIVE']); - + // Create process with multiple managers (array) $process = Process::factory()->create([ - 'properties' => ['manager_id' => [$manager1->id, $manager2->id]] + 'properties' => ['manager_id' => [$manager1->id, $manager2->id]], ]); - + $request = ProcessRequest::factory()->create(['process_id' => $process->id]); $token = ProcessRequestToken::factory()->create([ 'process_id' => $process->id, @@ -57,13 +57,13 @@ public function testGetAssignableUsersByAssignmentTypeWithManagerOnlyRules() // Mock getAssignmentRule to return different manager-only rules $managerOnlyRules = ['previous_task_assignee', 'requester', 'process_manager']; - + foreach ($managerOnlyRules as $rule) { $tokenMock = Mockery::mock($token)->makePartial(); $tokenMock->shouldReceive('getAssignmentRule')->andReturn($rule); - + $result = $process->getAssignableUsersByAssignmentType($tokenMock); - + // Should return both managers $this->assertIsArray($result); $this->assertCount(2, $result); @@ -78,12 +78,12 @@ public function testGetAssignableUsersByAssignmentTypeWithManagerOnlyRules() public function testGetAssignableUsersByAssignmentTypeWithSingleManager() { $manager = User::factory()->create(['status' => 'ACTIVE']); - + // Create process with single manager (not array) $process = Process::factory()->create([ - 'properties' => ['manager_id' => $manager->id] + 'properties' => ['manager_id' => $manager->id], ]); - + $request = ProcessRequest::factory()->create(['process_id' => $process->id]); $token = ProcessRequestToken::factory()->create([ 'process_id' => $process->id, @@ -92,9 +92,9 @@ public function testGetAssignableUsersByAssignmentTypeWithSingleManager() $tokenMock = Mockery::mock($token)->makePartial(); $tokenMock->shouldReceive('getAssignmentRule')->andReturn('process_manager'); - + $result = $process->getAssignableUsersByAssignmentType($tokenMock); - + $this->assertIsArray($result); $this->assertCount(1, $result); $this->assertContains($manager->id, $result); @@ -108,14 +108,14 @@ public function testGetAssignableUsersByAssignmentTypeWithGroupBasedRules() $manager = User::factory()->create(['status' => 'ACTIVE']); $assignableUser1 = User::factory()->create(['status' => 'ACTIVE']); $assignableUser2 = User::factory()->create(['status' => 'ACTIVE']); - + $process = Process::factory()->create([ - 'properties' => ['manager_id' => $manager->id] + 'properties' => ['manager_id' => $manager->id], ]); - + $request = ProcessRequest::factory()->create(['process_id' => $process->id]); $elementId = 'test_element_' . uniqid(); - + // Create task assignments ProcessTaskAssignment::factory()->create([ 'process_id' => $process->id, @@ -123,14 +123,14 @@ public function testGetAssignableUsersByAssignmentTypeWithGroupBasedRules() 'assignment_id' => $assignableUser1->id, 'assignment_type' => User::class, ]); - + ProcessTaskAssignment::factory()->create([ 'process_id' => $process->id, 'process_task_id' => $elementId, 'assignment_id' => $assignableUser2->id, 'assignment_type' => User::class, ]); - + $token = ProcessRequestToken::factory()->create([ 'process_id' => $process->id, 'process_request_id' => $request->id, @@ -138,13 +138,13 @@ public function testGetAssignableUsersByAssignmentTypeWithGroupBasedRules() ]); $groupBasedRules = ['user_group', 'process_variable', 'rule_expression']; - + foreach ($groupBasedRules as $rule) { $tokenMock = Mockery::mock($token)->makePartial(); $tokenMock->shouldReceive('getAssignmentRule')->andReturn($rule); - + $result = $process->getAssignableUsersByAssignmentType($tokenMock); - + // Should return assignable users + manager $this->assertIsArray($result); $this->assertCount(3, $result); @@ -160,11 +160,11 @@ public function testGetAssignableUsersByAssignmentTypeWithGroupBasedRules() public function testGetAssignableUsersByAssignmentTypeWithEmptyElementId() { $manager = User::factory()->create(['status' => 'ACTIVE']); - + $process = Process::factory()->create([ - 'properties' => ['manager_id' => $manager->id] + 'properties' => ['manager_id' => $manager->id], ]); - + $request = ProcessRequest::factory()->create(['process_id' => $process->id]); $token = ProcessRequestToken::factory()->create([ 'process_id' => $process->id, @@ -174,9 +174,9 @@ public function testGetAssignableUsersByAssignmentTypeWithEmptyElementId() $tokenMock = Mockery::mock($token)->makePartial(); $tokenMock->shouldReceive('getAssignmentRule')->andReturn('user_group'); - + $result = $process->getAssignableUsersByAssignmentType($tokenMock); - + // Should only return manager when element_id is empty $this->assertIsArray($result); $this->assertCount(1, $result); @@ -189,9 +189,9 @@ public function testGetAssignableUsersByAssignmentTypeWithEmptyElementId() public function testGetAssignableUsersByAssignmentTypeWithNullManager() { $process = Process::factory()->create([ - 'properties' => ['manager_id' => null] + 'properties' => ['manager_id' => null], ]); - + $request = ProcessRequest::factory()->create(['process_id' => $process->id]); $token = ProcessRequestToken::factory()->create([ 'process_id' => $process->id, @@ -200,9 +200,9 @@ public function testGetAssignableUsersByAssignmentTypeWithNullManager() $tokenMock = Mockery::mock($token)->makePartial(); $tokenMock->shouldReceive('getAssignmentRule')->andReturn('process_manager'); - + $result = $process->getAssignableUsersByAssignmentType($tokenMock); - + // Should return empty array when manager_id is null $this->assertIsArray($result); $this->assertEmpty($result); @@ -214,11 +214,11 @@ public function testGetAssignableUsersByAssignmentTypeWithNullManager() public function testGetAssignableUsersByAssignmentTypeWithUnknownRule() { $manager = User::factory()->create(['status' => 'ACTIVE']); - + $process = Process::factory()->create([ - 'properties' => ['manager_id' => $manager->id] + 'properties' => ['manager_id' => $manager->id], ]); - + $request = ProcessRequest::factory()->create(['process_id' => $process->id]); $token = ProcessRequestToken::factory()->create([ 'process_id' => $process->id, @@ -227,9 +227,9 @@ public function testGetAssignableUsersByAssignmentTypeWithUnknownRule() $tokenMock = Mockery::mock($token)->makePartial(); $tokenMock->shouldReceive('getAssignmentRule')->andReturn('unknown_rule'); - + $result = $process->getAssignableUsersByAssignmentType($tokenMock); - + // Should return empty array for unknown rules $this->assertIsArray($result); $this->assertEmpty($result); @@ -242,13 +242,13 @@ public function testGetAssignableUsersByAssignmentTypeHandlesNestedArrays() { $manager1 = User::factory()->create(['status' => 'ACTIVE']); $manager2 = User::factory()->create(['status' => 'ACTIVE']); - + // Simulate nested array scenario (shouldn't happen but test the normalization) // Note: The accessor will normalize this, but we test the normalization logic $process = Process::factory()->create([ - 'properties' => ['manager_id' => [[$manager1->id], [$manager2->id]]] + 'properties' => ['manager_id' => [[$manager1->id], [$manager2->id]]], ]); - + $request = ProcessRequest::factory()->create(['process_id' => $process->id]); $token = ProcessRequestToken::factory()->create([ 'process_id' => $process->id, @@ -257,9 +257,9 @@ public function testGetAssignableUsersByAssignmentTypeHandlesNestedArrays() $tokenMock = Mockery::mock($token)->makePartial(); $tokenMock->shouldReceive('getAssignmentRule')->andReturn('process_manager'); - + $result = $process->getAssignableUsersByAssignmentType($tokenMock); - + // Should flatten and return both managers $this->assertIsArray($result); $this->assertCount(2, $result); @@ -278,14 +278,14 @@ public function testGetAssignableUsersByAssignmentTypeRemovesDuplicates() { $manager = User::factory()->create(['status' => 'ACTIVE']); $assignableUser = User::factory()->create(['status' => 'ACTIVE']); - + $process = Process::factory()->create([ - 'properties' => ['manager_id' => $manager->id] + 'properties' => ['manager_id' => $manager->id], ]); - + $request = ProcessRequest::factory()->create(['process_id' => $process->id]); $elementId = 'test_element_' . uniqid(); - + // Create task assignment with manager as assignable user (duplicate scenario) ProcessTaskAssignment::factory()->create([ 'process_id' => $process->id, @@ -293,14 +293,14 @@ public function testGetAssignableUsersByAssignmentTypeRemovesDuplicates() 'assignment_id' => $manager->id, // Same as manager 'assignment_type' => User::class, ]); - + ProcessTaskAssignment::factory()->create([ 'process_id' => $process->id, 'process_task_id' => $elementId, 'assignment_id' => $assignableUser->id, 'assignment_type' => User::class, ]); - + $token = ProcessRequestToken::factory()->create([ 'process_id' => $process->id, 'process_request_id' => $request->id, @@ -309,9 +309,9 @@ public function testGetAssignableUsersByAssignmentTypeRemovesDuplicates() $tokenMock = Mockery::mock($token)->makePartial(); $tokenMock->shouldReceive('getAssignmentRule')->andReturn('user_group'); - + $result = $process->getAssignableUsersByAssignmentType($tokenMock); - + // Should return unique values (manager should appear only once) $this->assertIsArray($result); $this->assertCount(2, $result); // manager + assignableUser (no duplicates) diff --git a/tests/unit/ProcessMaker/Nayra/Services/FixBpmnSchemaServiceTest.php b/tests/unit/ProcessMaker/Nayra/Services/FixBpmnSchemaServiceTest.php index 2b3ec5adaf..c334cf5f30 100644 --- a/tests/unit/ProcessMaker/Nayra/Services/FixBpmnSchemaServiceTest.php +++ b/tests/unit/ProcessMaker/Nayra/Services/FixBpmnSchemaServiceTest.php @@ -22,7 +22,7 @@ public function testExceptionInIncompleteProcess() { $bpmn = file_get_contents( __DIR__ . - "/../../../../Fixtures/process_data_input_without_targetref.bpmn" + '/../../../../Fixtures/process_data_input_without_targetref.bpmn' ); $document = new BpmnDocument(); @@ -30,7 +30,7 @@ public function testExceptionInIncompleteProcess() $this->expectException(Exception::class); $validation = $document->validateBPMNSchema( - public_path("definitions/ProcessMaker.xsd") + public_path('definitions/ProcessMaker.xsd') ); } @@ -43,7 +43,7 @@ public function testFixIncompleteProcess() { $bpmn = file_get_contents( __DIR__ . - "/../../../../Fixtures/process_data_input_without_targetref.bpmn" + '/../../../../Fixtures/process_data_input_without_targetref.bpmn' ); $fixBpmnSchemaService = app(FixBpmnSchemaService::class); @@ -52,7 +52,7 @@ public function testFixIncompleteProcess() $document = new BpmnDocument(); $document->loadXML($bpmn); $validation = $document->validateBPMNSchema( - public_path("definitions/ProcessMaker.xsd") + public_path('definitions/ProcessMaker.xsd') ); $this->assertTrue($validation); @@ -67,7 +67,7 @@ public function testFixPm4Process() { $bpmn = file_get_contents( __DIR__ . - "/../../../../Fixtures/process_data_input_generated_in_pm4.bpmn" + '/../../../../Fixtures/process_data_input_generated_in_pm4.bpmn' ); $fixBpmnSchemaService = app(FixBpmnSchemaService::class); @@ -76,7 +76,7 @@ public function testFixPm4Process() $document = new BpmnDocument(); $document->loadXML($bpmn); $validation = $document->validateBPMNSchema( - public_path("definitions/ProcessMaker.xsd") + public_path('definitions/ProcessMaker.xsd') ); $this->assertTrue($validation);