Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for licensing #5688

Merged
merged 4 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions ProcessMaker/Console/Commands/ProcessMakerLicenseRemove.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace ProcessMaker\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Storage;

class ProcessMakerLicenseRemove extends Command
Expand Down Expand Up @@ -37,6 +38,10 @@ public function handle()
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!');

$this->info('Calling package:discover to update the package cache with enabled packages');
Artisan::call('package:discover');
$this->info(Artisan::output());
} else {
$this->info('Operation cancelled. license.json was not removed.');
}
Expand Down
4 changes: 4 additions & 0 deletions ProcessMaker/Console/Commands/ProcessMakerLicenseUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ public function handle()

Storage::disk('local')->put('license.json', $content);

$this->info('Calling package:discover to update the package cache with enabled packages');
Artisan::call('package:discover');
$this->info(Artisan::output());

$this->info('License updated successfully');
} catch (Exception $e) {
$this->error('An error occurred: ' . $e->getMessage());
Expand Down Expand Up @@ -77,6 +80,7 @@ protected function isValidLicenseContent(string $content): bool
Carbon::parse($data['expires_at']);
} catch (Exception $e) {
$this->error('The "expires_at" property is not a valid date.');

return false;
}

Expand Down
2 changes: 1 addition & 1 deletion ProcessMaker/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function index(Request $request)
return redirect('/requests');
}
// Redirect to home dynamic only if the package was enable
if (!$isMobile && class_exists(\ProcessMaker\Package\PackageDynamicUI\Models\DynamicUI::class)) {
if (!$isMobile && hasPackage('package-dynamic-ui')) {
$user = \Auth::user();
$homePage = \ProcessMaker\Package\PackageDynamicUI\Models\DynamicUI::getHomePage($user);

Expand Down
14 changes: 8 additions & 6 deletions ProcessMaker/Http/Middleware/GenerateMenus.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ public function handle(Request $request, Closure $next)
Menu::make('topnav', function ($menu) {
// The home will display the dynamic ui view
// @todo home will replace the request and task
$menu->group(['prefix' => 'home'], function ($request_items) {
$request_items->add(
__('Home'),
['route' => 'home', 'id' => 'home']
)->active('home/*');
});
if (hasPackage('package-dynamic-ui')) {
$menu->group(['prefix' => 'home'], function ($request_items) {
$request_items->add(
__('Home'),
['route' => 'home', 'id' => 'home']
)->active('home/*');
});
}
$menu->group(['prefix' => 'requests'], function ($request_items) {
$request_items->add(
__('Requests'),
Expand Down
4 changes: 2 additions & 2 deletions ProcessMaker/Jobs/RefreshArtisanCaches.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ public function __construct()
*/
public function handle()
{
Artisan::call('clear-compiled', $options = [
$options = [
'--no-interaction' => true,
'--quiet' => true,
]);
];

if (app()->configurationIsCached()) {
Artisan::call('config:cache', $options);
Expand Down