diff --git a/core/upgrade/index.php b/core/upgrade/index.php index a2ae223736..c17c87b1b2 100644 --- a/core/upgrade/index.php +++ b/core/upgrade/index.php @@ -50,17 +50,35 @@ //set a default message_timeout $message_timeout = 4*1000; +//get the language + $language = $settings->get('domain', 'language', 'en-us'); + //find optional apps with repos $updateable_repos = git_find_repos($_SERVER["PROJECT_ROOT"]."/app"); if (!empty($updateable_repos) && is_array($updateable_repos) && @sizeof($updateable_repos) != 0) { foreach ($updateable_repos as $app_path => $repo) { + //set the value $x = 0; + + //skip this application if the file doesn't exist + if (!file_exists($app_path.'/app_config.php')) { + continue; + } + + //build the $apps array include $app_path.'/app_config.php'; + + //skip this application if the name or uuid are empty + if (empty($apps[$x]['name']) || empty($apps[$x]['uuid'])) { continue; } + + //build the updateable_repos array $updateable_repos[$app_path]['app'] = $repo[0]; $updateable_repos[$app_path]['name'] = $apps[$x]['name']; $updateable_repos[$app_path]['uuid'] = $apps[$x]['uuid']; - $updateable_repos[$app_path]['version'] = $apps[$x]['version']; - $updateable_repos[$app_path]['description'] = $apps[$x]['description'][$settings->get('domain', 'language', 'en-us')]; + $updateable_repos[$app_path]['version'] = $apps[$x]['version'] ?? ''; + $updateable_repos[$app_path]['description'] = $apps[$x]['description'][$language] ?? ''; + + //unset the values unset($apps, $updateable_repos[$app_path][0]); } } @@ -323,8 +341,8 @@ if (!empty($updateable_repos) && is_array($updateable_repos)) { foreach ($updateable_repos as $app_path => $app) { $repo_info = git_repo_info($app_path); - $pull_method = substr($repo_info['url'], 0, 4) == 'http' ? 'http' : 'ssh'; if (empty($repo_info)) { continue; } + $pull_method = substr($repo_info['url'], 0, 4) == 'http' ? 'http' : 'ssh'; echo "\n"; echo "\n"; echo "
\n"; diff --git a/resources/functions.php b/resources/functions.php index 993f6c11f8..6f80003e95 100644 --- a/resources/functions.php +++ b/resources/functions.php @@ -3132,7 +3132,7 @@ if (!function_exists('git_repo_info')) { //get the remote origin url for updates exec("git config --get remote.origin.url", $git_url); - $repo['url'] = preg_replace('/\.git$/', '', $git_url[0] ); + $repo['url'] = preg_replace('/\.git$/', '', $git_url[0] ?? ''); //add the path to the repo array $repo['path'] = $path;