Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
CiviCRM Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Development
CiviCRM Core
Commits
cf953e02
Unverified
Commit
cf953e02
authored
3 years ago
by
colemanw
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #22640 from totten/5.46-ext-check
Extensions - Add dependency status check
parents
fa931b26
ebe174fa
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CRM/Utils/Check/Component/Env.php
+40
-5
40 additions, 5 deletions
CRM/Utils/Check/Component/Env.php
with
40 additions
and
5 deletions
CRM/Utils/Check/Component/Env.php
+
40
−
5
View file @
cf953e02
...
...
@@ -600,10 +600,29 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component {
return
$messages
;
}
$keys
=
array_keys
(
$manager
->
getStatuses
());
$stauses
=
$manager
->
getStatuses
();
$keys
=
array_keys
(
$stauses
);
$enabled
=
array_keys
(
array_filter
(
$stauses
,
function
(
$status
)
{
return
$status
===
CRM_Extension_Manager
::
STATUS_INSTALLED
;
}));
sort
(
$keys
);
$updates
=
$errors
=
$okextensions
=
[];
$extPrettyLabel
=
function
(
$key
)
use
(
$mapper
)
{
// We definitely know a $key, but we may not have a $label.
// Which is too bad - because it would be nicer if $label could be the reliable start of the string.
$keyFmt
=
'<code>'
.
htmlentities
(
$key
)
.
'</code>'
;
try
{
$info
=
$mapper
->
keyToInfo
(
$key
);
if
(
$info
->
label
)
{
return
sprintf
(
'"<em>%s</em>" (%s)'
,
htmlentities
(
$info
->
label
),
$keyFmt
);
}
}
catch
(
CRM_Extension_Exception
$ex
)
{
return
"(
$keyFmt
)"
;
}
};
foreach
(
$keys
as
$key
)
{
try
{
$obj
=
$mapper
->
keyToInfo
(
$key
);
...
...
@@ -615,11 +634,20 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component {
$row
=
CRM_Admin_Page_Extensions
::
createExtendedInfo
(
$obj
);
switch
(
$row
[
'status'
])
{
case
CRM_Extension_Manager
::
STATUS_INSTALLED_MISSING
:
$errors
[]
=
ts
(
'%1
extension (%2)
is installed but missing files.'
,
[
1
=>
$
row
[
'label'
]
??
NULL
,
2
=>
$key
]);
$errors
[]
=
ts
(
'%1 is installed but missing files.'
,
[
1
=>
$
extPrettyLabel
(
$key
)
]);
break
;
case
CRM_Extension_Manager
::
STATUS_INSTALLED
:
if
(
!
empty
(
$remotes
[
$key
])
&&
version_compare
(
$row
[
'version'
],
$remotes
[
$key
]
->
version
,
'<'
))
{
$missingRequirements
=
array_diff
(
$row
[
'requires'
],
$enabled
);
if
(
!
empty
(
$row
[
'requires'
])
&&
$missingRequirements
)
{
$errors
[]
=
ts
(
'%1 has a missing dependency on %2'
,
[
1
=>
$extPrettyLabel
(
$key
),
2
=>
implode
(
', '
,
array_map
(
$extPrettyLabel
,
$missingRequirements
)),
'plural'
=>
'%1 has missing dependencies: %2'
,
'count'
=>
count
(
$missingRequirements
),
]);
}
elseif
(
!
empty
(
$remotes
[
$key
])
&&
version_compare
(
$row
[
'version'
],
$remotes
[
$key
]
->
version
,
'<'
))
{
$updates
[]
=
$row
[
'label'
]
.
': '
.
$mapper
->
getUpgradeLink
(
$remotes
[
$key
],
$row
);
}
else
{
...
...
@@ -652,8 +680,15 @@ class CRM_Utils_Check_Component_Env extends CRM_Utils_Check_Component {
if
(
$errors
)
{
$messages
[]
=
new
CRM_Utils_Check_Message
(
__FUNCTION__
.
'Error'
,
'<ul><li>'
.
implode
(
'</li><li>'
,
$errors
)
.
'</li></ul>'
,
ts
(
'Extension Error'
),
ts
(
'There is one extension error:'
,
[
'count'
=>
count
(
$errors
),
'plural'
=>
'There are %count extension errors:'
,
])
.
'<ul><li>'
.
implode
(
'</li><li>'
,
$errors
)
.
'</li></ul>'
.
ts
(
'To resolve any errors, go to <a %1>Manage Extensions</a>.'
,
[
1
=>
'href="'
.
CRM_Utils_System
::
url
(
'civicrm/admin/extensions'
,
'reset=1'
)
.
'"'
,
]),
ts
(
'Extension Error'
,
[
'count'
=>
count
(
$errors
),
'plural'
=>
'Extension Errors'
]),
\Psr\Log\LogLevel
::
ERROR
,
'fa-plug'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment