@@ -159,7 +159,8 @@ public function checkForUpdate() {
159159 if ($ version !== '' && $ version !== $ this ->currentVersion ) {
160160 $ this ->updateAvailable = true ;
161161 $ releaseChannel = $ this ->getCurrentReleaseChannel ();
162- $ updateText = 'Update to ' . htmlentities ($ versionString ) . ' available. (channel: " ' . htmlentities ($ releaseChannel ) . '")<br /><span class="light">Following file will be downloaded automatically:</span> <code class="light"> ' . (string )$ response ['url ' ] . '</code> ' ;
162+ $ downloadUrl = current ($ this ->getDownloadURLs ());
163+ $ updateText = 'Update to ' . htmlentities ($ versionString ) . ' available. (channel: " ' . htmlentities ($ releaseChannel ) . '")<br /><span class="light">Following file will be downloaded automatically:</span> <code class="light"> ' . $ downloadUrl . '</code> ' ;
163164
164165 // only show changelog link for stable releases (non-RC & non-beta)
165166 if (!preg_match ('!(rc|beta)!i ' , $ versionString )) {
@@ -555,10 +556,10 @@ private function getUpdateServerResponse(): array {
555556 *
556557 * @throws \Exception
557558 */
558- public function downloadUpdate (? string $ url = null ): void {
559+ public function downloadUpdate (string $ url = '' ): void {
559560 $ this ->silentLog ('[info] downloadUpdate() ' );
560561
561- if ($ url ) {
562+ if ($ url !== '' ) {
562563 // If a URL is provided, use it directly
563564 $ downloadURLs = [$ url ];
564565 } else {
@@ -599,7 +600,10 @@ public function downloadUpdate(?string $url = null): void {
599600 private function getDownloadURLs (): array {
600601 $ response = $ this ->getUpdateServerResponse ();
601602 $ downloadURLs = [];
602- if (!isset ($ response ['downloads ' ]) || !is_array ($ response ['downloads ' ])) {
603+
604+ if (isset ($ response ['downloads ' ])) {
605+ $ response ['downloads ' ] = (array )$ response ['downloads ' ];
606+ } else {
603607 if (isset ($ response ['url ' ]) && is_string ($ response ['url ' ])) {
604608 // Compatibility with previous verison of updater_server
605609 $ ext = pathinfo ($ response ['url ' ], PATHINFO_EXTENSION );
@@ -610,6 +614,7 @@ private function getDownloadURLs(): array {
610614 throw new \Exception ('Response from update server is missing download URLs ' );
611615 }
612616 }
617+
613618 foreach ($ response ['downloads ' ] as $ format => $ urls ) {
614619 if (!$ this ->isAbleToDecompress ($ format )) {
615620 continue ;
0 commit comments