Passed
Push — master ( c0a3a7...3b84a4 )
by Jeroen
58:51
created

views/default/admin/upgrades.php (1 issue)

1
<?php
2
/**
3
 * Lists pending upgrades
4
 */
5
6
elgg_require_js('core/js/upgrader');
7
8
$upgrades = elgg_get_entities([
9
	'type' => 'object',
10
	'subtype' => 'elgg_upgrade',
11
	'limit' => false,
12
	'private_setting_name' => 'is_completed',
13
	'private_setting_value' => 0,
14
]);
15
16
if ($upgrades) {
17
	foreach ($upgrades as $key => $upgrade) {
18
		// unsupported upgrade objects could still exist in the database and not be marked as completed
19
		// don't know what to do with them, so skipping if they are not supported by the output view
20
		if (!isset($upgrade->class)) {
21
			unset($upgrades[$key]);
22
		}
23
	}
24
}
25
26
if (!$upgrades) {
27
	echo elgg_echo('admin:upgrades:none');
28
	return;
29
}
30
31
elgg_register_menu_item('title', [
32
	'name' => 'run_upgrades',
33
	'text' => elgg_echo('admin:upgrades:run'),
34
	'id' => 'elgg-upgrades-run',
35
	'link_class' => 'elgg-button elgg-button-action',
36
]);
37
	
38
echo elgg_view_entity_list($upgrades);
0 ignored issues
show
It seems like $upgrades can also be of type integer; however, parameter $entities of elgg_view_entity_list() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

38
echo elgg_view_entity_list(/** @scrutinizer ignore-type */ $upgrades);
Loading history...
39