Rewrite all URLs (images, videos, downloads)
[stouyapi.git] / bin / import-game-data.php
index 0073983aa7339849c51f050cd56922486b03a214..d98dd3f3eb5388ba2554f07c94209ceff9f62337 100755 (executable)
@@ -431,7 +431,7 @@ function buildAppDownload($game, $release)
             'fileSize'      => $release->size,
             'version'       => $release->uuid,
             'contentRating' => $game->contentRating,
-            'downloadLink'  => rewriteUrl($release->url),
+            'downloadLink'  => $release->url,
         ]
     ];
 }
@@ -904,6 +904,15 @@ function addMissingGameProperties($game)
             'url'  => $qrUrlPath,
         ];
     }
+
+    //rewrite urls from Internet Archive to our servers
+    $game->discover = rewriteUrl($game->discover);
+    foreach ($game->media as $medium) {
+        $medium->url = rewriteUrl($medium->url);
+    }
+    foreach ($game->releases as $release) {
+        $release->url = rewriteUrl($release->url);
+    }
 }
 
 /**