From 7a3b8a4b7fd722e8981679e0b5ca0ddb25914cff Mon Sep 17 00:00:00 2001 From: Roly Gutierrez Date: Thu, 19 Dec 2024 15:19:25 -0400 Subject: [PATCH 1/5] FOUR-20506 Update project dependencies --- ProcessMaker/Providers/ProcessMakerServiceProvider.php | 2 +- config/app.php | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/ProcessMaker/Providers/ProcessMakerServiceProvider.php b/ProcessMaker/Providers/ProcessMakerServiceProvider.php index ce11b8e437..e6fb9c92c5 100644 --- a/ProcessMaker/Providers/ProcessMakerServiceProvider.php +++ b/ProcessMaker/Providers/ProcessMakerServiceProvider.php @@ -271,7 +271,7 @@ protected static function configureVendors(): void }); // we are using custom passport migrations - Passport::ignoreMigrations(); + //Passport::ignoreMigrations(); } private function setupFactories(): void diff --git a/config/app.php b/config/app.php index a011248e48..90a119d361 100644 --- a/config/app.php +++ b/config/app.php @@ -167,7 +167,6 @@ */ Laravel\Passport\PassportServiceProvider::class, Laravel\Scout\ScoutServiceProvider::class, - Collective\Html\HtmlServiceProvider::class, TeamTNT\Scout\TNTSearchScoutServiceProvider::class, Jenssegers\Agent\AgentServiceProvider::class, @@ -194,9 +193,7 @@ 'Agent' => Jenssegers\Agent\Facades\Agent::class, 'Docker' => ProcessMaker\Facades\Docker::class, 'ElasticScoutDriver\Factories\SearchRequestFactory' => ProcessMaker\Factories\SearchRequestFactory::class, - 'Form' => Collective\Html\FormFacade::class, 'GlobalScripts' => ProcessMaker\Facades\GlobalScripts::class, - 'Html' => Collective\Html\HtmlFacade::class, 'Menu' => Lavary\Menu\Facade::class, 'Redis' => Illuminate\Support\Facades\Redis::class, 'RequestDevice' => ProcessMaker\Facades\RequestDevice::class, From a93a0be479252f65a12cfb2b898eca2d65a4a339 Mon Sep 17 00:00:00 2001 From: Roly Gutierrez Date: Thu, 19 Dec 2024 15:30:20 -0400 Subject: [PATCH 2/5] FOUR-20506 update composer.json --- composer.json | 102 +++++++++++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/composer.json b/composer.json index 3bab81abc5..2338afcc05 100644 --- a/composer.json +++ b/composer.json @@ -11,73 +11,74 @@ "prefer-stable": true, "require": { "php": "^8.2", - "babenkoivan/elastic-scout-driver": "^3.0", + "babenkoivan/elastic-scout-driver": "^4.0", "bacon/bacon-qr-code": "^2.0", "codegreencreative/laravel-samlidp": "^5.2", - "composer/semver": "^3.3", - "darkaonline/l5-swagger": "^8.3", - "doctrine/dbal": "^3.5", - "fakerphp/faker": "^1.9.1", - "google/apiclient": "^2.12", - "guzzlehttp/guzzle": "^7.4", - "igaster/laravel-theme": "2.0.*", + "composer/semver": "^3.4", + "darkaonline/l5-swagger": "^8.6", + "doctrine/dbal": "^4.2", + "fakerphp/faker": "^1.24", + "google/apiclient": "^2.18", + "guzzlehttp/guzzle": "^7.9", + "igaster/laravel-theme": "^2.0", "jenssegers/agent": "^2.6", - "laravel/framework": "^10.19", - "laravel/horizon": "^5.12", - "laravel/pail": "*", - "laravel/passport": "^11.5", - "laravel/scout": "^9.8", - "laravel/telescope": "^4.12", - "laravel/tinker": "^2.8", - "laravel/ui": "^4.2", - "laravelcollective/html": "^6.4", + "laravel/framework": "^11.0", + "laravel/horizon": "^5.30", + "laravel/pail": "^1.2", + "laravel/passport": "^12.3", + "laravel/scout": "^10.11", + "laravel/telescope": "^5.2", + "laravel/tinker": "^2.10", + "laravel/ui": "^4.6", + "lavary/laravel-menu": "^1.8", - "lcobucci/jwt": "^4.2", - "league/flysystem-aws-s3-v3": "^3.15", - "mateusjunges/laravel-kafka": "^1.11", - "microsoft/microsoft-graph": "^1.77", + "lcobucci/jwt": "^5.4", + "league/flysystem-aws-s3-v3": "^3.29", + "mateusjunges/laravel-kafka": "^2.4", + "microsoft/microsoft-graph": "^2.8", "mittwald/vault-php": "^2.1", "moontoast/math": "^1.2", "mustache/mustache": "^2.14", - "openai-php/client": "^0.5.2", - "openai-php/laravel": "^0.5.3", - "phing/phing": "^2.17", - "php-amqplib/php-amqplib": "^3.5", + "openai-php/client": "^0.10.3", + "openai-php/laravel": "^0.10.2", + "phing/phing": "^3.0", + "php-amqplib/php-amqplib": "^3.7", "pion/laravel-chunk-upload": "^1.5", - "predis/predis": "^2.0", + "predis/predis": "^2.3", "processmaker/docker-executor-lua": "^1.0", "processmaker/docker-executor-node": "1.1.0", "processmaker/docker-executor-php": "1.2.0", "processmaker/laravel-i18next": "dev-master", "processmaker/nayra": "1.12.0", "processmaker/pmql": "1.12.1", - "psr/http-message": "^1.1", - "psr/log": "^2.0", - "psr/simple-cache": "^2.0", - "pusher/pusher-php-server": "^7.0", + "psr/http-message": "^2.0", + "psr/log": "^3.0", + "psr/simple-cache": "^3.0", + "pusher/pusher-php-server": "^7.2", "ralouphie/getallheaders": "^3.0", - "simplesoftwareio/simple-qrcode": "~4", - "spatie/laravel-fractal": "^6.0", - "spatie/laravel-medialibrary": "^10.7", - "spomky-labs/otphp": "^11.2", - "symfony/expression-language": "^6.2", - "teamtnt/laravel-scout-tntsearch-driver": "^12.2", - "twilio/sdk": "^7.13", - "typo3/class-alias-loader": "^1.0", + "simplesoftwareio/simple-qrcode": "*", + "spatie/laravel-fractal": "^6.3", + "spatie/laravel-html": "*", + "spatie/laravel-medialibrary": "^11.11", + "spomky-labs/otphp": "^11.3", + "symfony/expression-language": "^7.2", + "teamtnt/laravel-scout-tntsearch-driver": "^14.0", + "twilio/sdk": "^8.3", + "typo3/class-alias-loader": "^1.2", "whichbrowser/parser": "^2.1" }, "require-dev": { - "brianium/paratest": "^6.6", - "dms/phpunit-arraysubset-asserts": "^0.5", - "filp/whoops": "^2.14", - "laravel/dusk": "^7.4", - "laravel/homestead": "^13.2", - "mockery/mockery": "^1.4.4", - "nunomaduro/collision": "^6.3", - "phpunit/phpunit": "^9.5.13", - "squizlabs/php_codesniffer": "^3.7", - "symfony/dom-crawler": "^6.2", - "spatie/laravel-ignition": "^2.0" + "brianium/paratest": "^7.7", + "dms/phpunit-arraysubset-asserts": "*", + "filp/whoops": "^2.16", + "laravel/dusk": "^8.2", + "laravel/homestead": "^15.0", + "mockery/mockery": "^1.6", + "nunomaduro/collision": "^8.5", + "phpunit/phpunit": "^11.5", + "squizlabs/php_codesniffer": "^3.11", + "symfony/dom-crawler": "^7.2", + "spatie/laravel-ignition": "^2.9" }, "autoload": { "files": [ @@ -223,7 +224,8 @@ "allow-plugins": { "typo3/class-alias-loader": true, "dealerdirect/phpcodesniffer-composer-installer": true, - "php-http/discovery": true + "php-http/discovery": true, + "tbachert/spi": true } } } From 879ef791b30dc222f05cb40ae20387704219c066 Mon Sep 17 00:00:00 2001 From: Roly Gutierrez Date: Fri, 20 Dec 2024 18:34:53 -0400 Subject: [PATCH 3/5] FOUR-20506 Improvements --- ProcessMaker/Application.php | 3 -- ProcessMaker/Providers/AppServiceProvider.php | 31 +++++++++++++++++++ config/app.php | 1 + config/mail.php | 2 +- 4 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 ProcessMaker/Providers/AppServiceProvider.php diff --git a/ProcessMaker/Application.php b/ProcessMaker/Application.php index 58cb1d6df6..5db942f1ee 100644 --- a/ProcessMaker/Application.php +++ b/ProcessMaker/Application.php @@ -14,9 +14,6 @@ */ class Application extends IlluminateApplication { - // ProcessMaker Version - public const VERSION = '4.0.0'; - /** * Sets the timezone for the application and for php with the specified timezone. * diff --git a/ProcessMaker/Providers/AppServiceProvider.php b/ProcessMaker/Providers/AppServiceProvider.php new file mode 100644 index 0000000000..75f2b2cccb --- /dev/null +++ b/ProcessMaker/Providers/AppServiceProvider.php @@ -0,0 +1,31 @@ +app->make(ConnectionResolverInterface::class); + $table = $this->app['config']['database.migrations']; + $this->app->bind(MigrationRepositoryInterface::class, function ($app) use ($resolver, $table) { + return new DatabaseMigrationRepository($resolver, $table); + }); + } + + /** + * Bootstrap any application services. + */ + public function boot(): void + { + // + } +} diff --git a/config/app.php b/config/app.php index 90a119d361..4f79f10fcc 100644 --- a/config/app.php +++ b/config/app.php @@ -173,6 +173,7 @@ /** * ProcessMaker Service Providers */ + ProcessMaker\Providers\AppServiceProvider::class, ProcessMaker\Providers\ProcessMakerServiceProvider::class, ProcessMaker\Providers\RecommendationsServiceProvider::class, ProcessMaker\Providers\SettingServiceProvider::class, diff --git a/config/mail.php b/config/mail.php index a914bac41c..d78ea38d62 100644 --- a/config/mail.php +++ b/config/mail.php @@ -49,7 +49,7 @@ 'username' => env('MAIL_USERNAME'), 'password' => env('MAIL_PASSWORD'), 'timeout' => null, - 'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL'))['host']), + 'local_domain' => env('MAIL_EHLO_DOMAIN', parse_url(env('APP_URL', 'http://localhost'))['host']), 'auth_mode' => null, 'verify_peer' => env('VERIFY_PEER', false), ], From 46d7540cd9f0679aea7aca031ca30479d46426ab Mon Sep 17 00:00:00 2001 From: Roly Gutierrez Date: Tue, 24 Dec 2024 10:37:19 -0400 Subject: [PATCH 4/5] FOUR-20506 Doctrine DBAL Removal: The following list of Doctrine DBAL related classes and methods have been removed (https://laravel.com/docs/11.x/upgrade#doctrine-dbal-removal). Laravel is no longer dependent on this package and registering custom Doctrines types is no longer necessary for the proper creation and alteration of various column types that previously required custom types. --- .../Console/Commands/CreateDataLakeViews.php | 10 ++++++++-- ...7_03_174209_update_bpmn_column_to_mediumtext.php | 4 +--- .../2020_04_20_114503_change_type_comments.php | 4 +--- ...21_02_17_095337_add_delegation_manager_users.php | 4 ---- ...ervice_index_to_process_request_tokens_table.php | 13 +++---------- tests/Feature/Api/PerformanceModelsTest.php | 5 ++++- .../unit/ProcessMaker/MediaOrderColumnIndexTest.php | 6 ++---- 7 files changed, 19 insertions(+), 27 deletions(-) diff --git a/ProcessMaker/Console/Commands/CreateDataLakeViews.php b/ProcessMaker/Console/Commands/CreateDataLakeViews.php index efe360f622..b21fc7f0b0 100644 --- a/ProcessMaker/Console/Commands/CreateDataLakeViews.php +++ b/ProcessMaker/Console/Commands/CreateDataLakeViews.php @@ -177,7 +177,10 @@ protected function getTableColumns(string $tableName): array */ protected function getTables(): array { - return DB::connection()->getDoctrineSchemaManager()->listTableNames(); + $tables = array_map(function ($item) { + return $item['name']; + }, Schema::getTables()); + return $tables; } /** @@ -185,6 +188,9 @@ protected function getTables(): array */ protected function getViews(): array { - return DB::connection()->getDoctrineSchemaManager()->listViews(); + $views = array_map(function ($item) { + return $item['name']; + }, Schema::getViews()); + return $views; } } 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 65c5527f55..49547722af 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,9 +8,7 @@ return new class extends Migration { public function __construct() { - // I guess this is still a bug in laravel 5.7 and doctrine - // https://stackoverflow.com/questions/33140860/laravel-5-1-unknown-database-type-enum-requested - DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string'); + } /** diff --git a/database/migrations/2020_04_20_114503_change_type_comments.php b/database/migrations/2020_04_20_114503_change_type_comments.php index 33dd5b3cd6..d576d11e13 100644 --- a/database/migrations/2020_04_20_114503_change_type_comments.php +++ b/database/migrations/2020_04_20_114503_change_type_comments.php @@ -15,9 +15,7 @@ public function up() { $model = new Comment(); $schema = Schema::connection($model->getConnectionName()); - $schema->getConnection()->getDoctrineSchemaManager() - ->getDatabasePlatform() - ->registerDoctrineTypeMapping('enum', 'string'); + $schema->table('comments', function (Blueprint $table) { $table->string('type')->default('LOG')->change(); }); diff --git a/database/migrations/2021_02_17_095337_add_delegation_manager_users.php b/database/migrations/2021_02_17_095337_add_delegation_manager_users.php index 72e61e8a37..d0c5ab5c9f 100644 --- a/database/migrations/2021_02_17_095337_add_delegation_manager_users.php +++ b/database/migrations/2021_02_17_095337_add_delegation_manager_users.php @@ -13,10 +13,6 @@ */ public function up() { - $dbPlatform = DB::connection()->getDoctrineSchemaManager()->getDatabasePlatform(); - if (!$dbPlatform->hasDoctrineTypeMappingFor('enum')) { - $dbPlatform->registerDoctrineTypeMapping('enum', 'string'); - } Schema::table('users', function (Blueprint $table) { $table->unsignedInteger('delegation_user_id')->nullable(); $table->unsignedInteger('manager_id')->nullable(); 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 4213969e32..2a44237d21 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,18 +20,14 @@ public function __construct() { - DB::getDoctrineSchemaManager()->getDatabasePlatform()->registerDoctrineTypeMapping('enum', Types::STRING); + } public function up() { Schema::table($this->table, function (Blueprint $table) { - $sm = Schema::getConnection()->getDoctrineSchemaManager(); - $doctrineTable = $sm->listTableDetails($this->table); - - if (!$doctrineTable->hasIndex($this->indexName)) { + if (!Schema::hasIndex($this->table, $this->indexName)) { $table->index($this->column, $this->indexName); - } else { } }); } @@ -44,10 +40,7 @@ public function up() public function down() { Schema::table('process_request_tokens', function (Blueprint $table) { - $sm = Schema::getConnection()->getDoctrineSchemaManager(); - $doctrineTable = $sm->listTableDetails($this->table); - - if ($doctrineTable->hasIndex($this->indexName)) { + if (Schema::hasIndex($this->table, $this->indexName)) { $table->dropIndex($this->indexName); } }); diff --git a/tests/Feature/Api/PerformanceModelsTest.php b/tests/Feature/Api/PerformanceModelsTest.php index 7abaca8c1d..2e9110d9d8 100644 --- a/tests/Feature/Api/PerformanceModelsTest.php +++ b/tests/Feature/Api/PerformanceModelsTest.php @@ -5,6 +5,7 @@ use Illuminate\Database\Eloquent\Factory as EloquentFactory; use Illuminate\Foundation\Testing\WithFaker; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Schema; use ProcessMaker\Models\Group; use ProcessMaker\Models\ScriptExecutor; use ReflectionObject; @@ -121,7 +122,9 @@ private function getTotalRecords() $tables = []; foreach (config('database.connections') as $name => $config) { $connection = DB::connection($name); - $list = $connection->getDoctrineSchemaManager()->listTableNames(); + $list = array_map(function ($item) { + return $item['name']; + }, Schema::getTables()); foreach ($list as $table) { if (!isset($tables[$table])) { $tables[$table] = $connection->table($table)->count(); diff --git a/tests/unit/ProcessMaker/MediaOrderColumnIndexTest.php b/tests/unit/ProcessMaker/MediaOrderColumnIndexTest.php index 40ef28d7d1..3174acb004 100644 --- a/tests/unit/ProcessMaker/MediaOrderColumnIndexTest.php +++ b/tests/unit/ProcessMaker/MediaOrderColumnIndexTest.php @@ -17,10 +17,8 @@ public function it_has_order_column_index_on_media_table() $this->artisan('migrate'); // Check if the index exists - $indexExists = Schema::getConnection() - ->getDoctrineSchemaManager() - ->listTableIndexes('media'); + $indexExists = Schema::getIndexListing('media'); - $this->assertArrayHasKey('media_order_column_index', $indexExists); + $this->assertContains('media_order_column_index', $indexExists); } } From 1e40e5f66e46a64fdb85aa8c570d07a2ed832c4a Mon Sep 17 00:00:00 2001 From: Roly Gutierrez Date: Tue, 24 Dec 2024 18:32:07 -0400 Subject: [PATCH 5/5] FOUR-20506 Fixing inconsistencies in the constructor call. --- .../unit/ProcessMaker/Managers/TaskSchedulerManagerTest.php | 2 +- tests/unit/ProcessMaker/RecommendationEngineTest.php | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/unit/ProcessMaker/Managers/TaskSchedulerManagerTest.php b/tests/unit/ProcessMaker/Managers/TaskSchedulerManagerTest.php index 44b1939558..7937ed4211 100644 --- a/tests/unit/ProcessMaker/Managers/TaskSchedulerManagerTest.php +++ b/tests/unit/ProcessMaker/Managers/TaskSchedulerManagerTest.php @@ -15,7 +15,7 @@ class TaskSchedulerManagerTest extends TestCase protected function setUp(): void { - parent::__construct(); + parent::setUp(); $this->manager = new TaskSchedulerManager; } diff --git a/tests/unit/ProcessMaker/RecommendationEngineTest.php b/tests/unit/ProcessMaker/RecommendationEngineTest.php index 890dfcb8c0..789c37a7fc 100644 --- a/tests/unit/ProcessMaker/RecommendationEngineTest.php +++ b/tests/unit/ProcessMaker/RecommendationEngineTest.php @@ -24,9 +24,9 @@ class RecommendationEngineTest extends TestCase private SyncRecommendations $syncRecommendations; - public function __construct() + public function setUp(): void { - parent::__construct(); + parent::setUp(); $this->syncRecommendations = app(SyncRecommendations::class); } @@ -179,8 +179,6 @@ public function testRecommendationsSync(): void /** * Use a factory to generate a Recommendation model's data * without persisting it to use as mock JSON responses - * - * @return array */ protected function generateModelData(): array {