-
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.
- Loading branch information
Showing
712 changed files
with
24,467 additions
and
6,729 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
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
49 changes: 49 additions & 0 deletions
49
ProcessMaker/Console/Commands/ProcessMakerLicenseRemove.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,49 @@ | ||
<?php | ||
|
||
namespace ProcessMaker\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\Storage; | ||
|
||
class ProcessMakerLicenseRemove extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'processmaker:license-remove'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Remove the license.json file from the system'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return int | ||
*/ | ||
/** | ||
* Execute the console command. | ||
* | ||
* @return int | ||
*/ | ||
public function handle() | ||
{ | ||
if (Storage::disk('local')->exists('license.json')) { | ||
if ($this->confirm('Are you sure you want to remove the license.json file?')) { | ||
Storage::disk('local')->delete('license.json'); | ||
$this->info('license.json removed successfully!'); | ||
} else { | ||
$this->info('Operation cancelled. license.json was not removed.'); | ||
} | ||
} else { | ||
$this->error('license.json does not exist on the local disk.'); | ||
} | ||
|
||
return 0; | ||
} | ||
} |
91 changes: 91 additions & 0 deletions
91
ProcessMaker/Console/Commands/ProcessMakerLicenseUpdate.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,91 @@ | ||
<?php | ||
|
||
namespace ProcessMaker\Console\Commands; | ||
|
||
use Carbon\Carbon; | ||
use Exception; | ||
use Illuminate\Console\Command; | ||
use Illuminate\Support\Facades\Artisan; | ||
use Illuminate\Support\Facades\Http; | ||
use Illuminate\Support\Facades\Storage; | ||
|
||
class ProcessMakerLicenseUpdate extends Command | ||
{ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'processmaker:license-update {licenseFile}'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Update the license from a given URL or local path and store it in local disk'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return int | ||
*/ | ||
public function handle() | ||
{ | ||
$input = $this->argument('licenseFile'); | ||
|
||
try { | ||
$content = file_get_contents($input); | ||
if (!$this->isValidLicenseContent($content)) { | ||
return 1; | ||
} | ||
|
||
Storage::disk('local')->put('license.json', $content); | ||
|
||
Artisan::call('package:discover'); | ||
$this->info('License updated successfully'); | ||
} catch (Exception $e) { | ||
$this->error('An error occurred: ' . $e->getMessage()); | ||
} | ||
|
||
return 0; | ||
} | ||
|
||
/** | ||
* Validates the license content. | ||
* | ||
* @param string $content | ||
* @return bool | ||
*/ | ||
protected function isValidLicenseContent(string $content): bool | ||
{ | ||
$data = json_decode($content, true); | ||
|
||
if (json_last_error() !== JSON_ERROR_NONE) { | ||
$this->error('The provided license does not have a valid format.'); | ||
|
||
return false; | ||
} | ||
|
||
if (!isset($data['expires_at']) || !is_string($data['expires_at'])) { | ||
$this->error('The provided license does not have a valid "expires_at" property.'); | ||
|
||
return false; | ||
} | ||
|
||
try { | ||
Carbon::parse($data['expires_at']); | ||
} catch (Exception $e) { | ||
$this->error('The "expires_at" property is not a valid date.'); | ||
return false; | ||
} | ||
|
||
if (!isset($data['packages']) || !is_array($data['packages'])) { | ||
$this->error('The provided license does not have a valid "packages" property.'); | ||
|
||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} |
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
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,25 @@ | ||
<?php | ||
|
||
namespace ProcessMaker\Enums; | ||
|
||
enum ExporterMap | ||
{ | ||
const TYPES = [ | ||
'screen' => [\ProcessMaker\Models\Screen::class, \ProcessMaker\ImportExport\Exporters\ScreenExporter::class], | ||
'process' => [\ProcessMaker\Models\Process::class, \ProcessMaker\ImportExport\Exporters\ProcessExporter::class], | ||
'script' => [\ProcessMaker\Models\Script::class, \ProcessMaker\ImportExport\Exporters\ScriptExporter::class], | ||
'process_templates' => [\ProcessMaker\Models\ProcessTemplates::class, \ProcessMaker\ImportExport\Exporters\TemplateExporter::class], | ||
'data_source' => [\ProcessMaker\Packages\Connectors\DataSources\Models\DataSource::class, \ProcessMaker\Packages\Connectors\DataSources\ImportExport\DataSourceExporter::class], | ||
'decision_table' => [\ProcessMaker\Package\PackageDecisionEngine\Models\DecisionTable::class, \ProcessMaker\Package\PackageDecisionEngine\ImportExport\DecisionTableExporter::class], | ||
]; | ||
|
||
public static function getModelClass(string $type): ?string | ||
{ | ||
return self::TYPES[$type][0] ?? null; | ||
} | ||
|
||
public static function getExporterClass(string $type): ?string | ||
{ | ||
return self::TYPES[$type][1] ?? null; | ||
} | ||
} |
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,59 @@ | ||
<?php | ||
|
||
namespace ProcessMaker\Events; | ||
|
||
use Illuminate\Broadcasting\InteractsWithSockets; | ||
use Illuminate\Broadcasting\PrivateChannel; | ||
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow; | ||
use Illuminate\Foundation\Events\Dispatchable; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class CommentsUpdated implements ShouldBroadcastNow | ||
{ | ||
use Dispatchable; | ||
use InteractsWithSockets; | ||
use SerializesModels; | ||
public $users; | ||
|
||
/** | ||
* Create a new event instance. | ||
*/ | ||
public function __construct($users) | ||
{ | ||
$this->users = $users; | ||
} | ||
|
||
/** | ||
* Get the channels the event should broadcast on. | ||
* | ||
* @return \Illuminate\Broadcasting\Channel|array | ||
*/ | ||
public function broadcastOn() | ||
{ | ||
$channels = []; | ||
foreach ($this->users as $user) { | ||
$channels[] = new PrivateChannel("ProcessMaker.Models.User.{$user->id}"); | ||
} | ||
return $channels; | ||
} | ||
|
||
/** | ||
* Set the event name | ||
* | ||
* @return string | ||
*/ | ||
public function broadcastAs() | ||
{ | ||
return 'CommentsUpdated'; | ||
} | ||
|
||
/** | ||
* Set the data to broadcast with this event | ||
* | ||
* @return array | ||
*/ | ||
public function broadcastWith() | ||
{ | ||
return []; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace ProcessMaker\Exception; | ||
|
||
use Exception; | ||
|
||
class ProjectAssetSyncException extends Exception | ||
{ | ||
protected $message = 'Error syncing project assets.'; | ||
} |
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.