-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release-2024-fall' into observation/FOUR-19270
- Loading branch information
Showing
168 changed files
with
7,498 additions
and
6,425 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
ProcessMaker/Console/Commands/UpdateCommentsCaseNumber.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
|
||
namespace ProcessMaker\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\DB; | ||
use ProcessMaker\Models\Comment; | ||
|
||
class UpdateCommentsCaseNumber extends Command | ||
{ | ||
const CHUNK_SIZE = 5000; | ||
|
||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'processmaker:update-comments-case-number'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Update the column case_number in comments'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
// Update the case_number with the corresponding value in the table comments | ||
$chunkSize = self::CHUNK_SIZE; | ||
// Update the comments related to ProcessRequestToken | ||
DB::table('comments') | ||
->leftJoin('process_request_tokens', 'comments.commentable_id', '=', 'process_request_tokens.id') | ||
->leftJoin('process_requests', 'process_request_tokens.process_request_id', '=', 'process_requests.id') | ||
->where('comments.commentable_type', 'ProcessMaker\\Models\\ProcessRequestToken') | ||
->whereNull('comments.case_number') | ||
->select('comments.id', 'process_requests.case_number') | ||
->chunkById($chunkSize, function ($comments) { | ||
foreach ($comments as $comment) { | ||
// Update the comments.case_number with ptrocess_requests.case_number | ||
DB::table('comments') | ||
->where('id', $comment->id) | ||
->update(['case_number' => $comment->case_number]); | ||
} | ||
}); | ||
// Update the comments related to ProcessRequest | ||
DB::table('comments') | ||
->leftJoin('process_requests', 'comments.commentable_id', '=', 'process_requests.id') | ||
->where('comments.commentable_type', 'ProcessMaker\\Models\\ProcessRequest') | ||
->whereNull('comments.case_number') | ||
->select('comments.id', 'process_requests.case_number') | ||
->chunkById($chunkSize, function ($comments) { | ||
foreach ($comments as $comment) { | ||
// Update the comments.case_number with ptrocess_requests.case_number | ||
DB::table('comments') | ||
->where('id', $comment->id) | ||
->update(['case_number' => $comment->case_number]); | ||
} | ||
}); | ||
|
||
return $this->info('Comments case_number updated successfully'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace ProcessMaker\Facades; | ||
|
||
use Illuminate\Support\Facades\Facade; | ||
|
||
/** | ||
* @method static void storeCompiledContent(string $screenKey, mixed $compiledContent) | ||
* @method static mixed|null getCompiledContent(string $screenKey) | ||
* @method static void clearCompiledAssets() | ||
* @method static string createKey(string $processId, string $processVersionId, string $language, string $screenId, string $screenVersionId) | ||
* @method static int getLastScreenVersionId() | ||
* @method static void clearProcessScreensCache(string $processId) | ||
* | ||
* @see \ProcessMaker\Managers\ScreenCompiledManager | ||
*/ | ||
class ScreenCompiledManager extends Facade | ||
{ | ||
/** | ||
* Get the registered name of the component in the service container. | ||
* | ||
* @return string | ||
*/ | ||
protected static function getFacadeAccessor() | ||
{ | ||
return 'compiledscreen'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.