-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
feature/add-currently-installed-package-versions #17
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -133,6 +133,16 @@ public static function getComposerArray() | |
|
||
public static function getPackagesAndDependencies($packagesArray) | ||
{ | ||
$packageLockDetails = []; | ||
if (file_exists(base_path('composer.lock'))) { | ||
$lockFile = json_decode(file_get_contents(base_path('composer.lock'))); | ||
|
||
$packageLockDetails = []; | ||
foreach ($lockFile->packages as $package) { | ||
$packageLockDetails[$package->name] = $package; | ||
} | ||
} | ||
|
||
foreach ($packagesArray as $key => $value) { | ||
$packageFile = base_path("/vendor/{$key}/composer.json"); | ||
|
||
|
@@ -146,7 +156,8 @@ public static function getPackagesAndDependencies($packagesArray) | |
'name' => $key, | ||
'version' => $value, | ||
'dependencies' => $dependencies, | ||
'dev-dependencies' => $devDependencies | ||
'dev-dependencies' => $devDependencies, | ||
'version-installed' => isset($packageLockDetails[$key]) ? $packageLockDetails[$key] : "" | ||
]; | ||
} | ||
} | ||
|
@@ -265,7 +276,7 @@ private static function checkSslIsInstalled() | |
private static function folderSize($dir) | ||
{ | ||
$size = 0; | ||
foreach (glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $each) { | ||
foreach (glob(rtrim($dir, '/') . '/*', GLOB_NOSORT) as $each) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may remove the spaces back, it looks clean that older way :) |
||
$size += is_file($each) ? filesize($each) : self::folderSize($each); | ||
} | ||
return $size; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,14 +128,15 @@ | |
<table id="decomposer" class="table table-hover table-bordered"> | ||
<thead> | ||
<tr> | ||
<th>Package Name : Version</th> | ||
<th>Package Name : Version : Version Installed</th> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can make this |
||
<th>Dependency Name : Version</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
|
||
@foreach($packages as $package) | ||
<tr> | ||
<td>{{ $package['name'] }} : <span class="label ld-version-tag">{{ $package['version'] }}</span></td> | ||
<td>{{ $package['name'] }} : <span class="label ld-version-tag">{{ $package['version'] }}</span> : <span class="label ld-version-tag">{{ isset($package['version-installed']->version) ? $package['version-installed']->version : "N/A" }}</span> </td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the array above why |
||
<td> | ||
<ul> | ||
@if(is_array($package['dependencies'])) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
$packageLockDetails
array is also initialized in the if loop below. We don't need to initialize it twice.