Skip to content

Commit 02aae14

Browse files
committed
Fix bug: Didn't create php start tag for cache
1 parent 45fad38 commit 02aae14

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

functions.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ function minecraftcache($username) {
66
$data = json_decode(file_get_contents("https://api.mojang.com/users/profiles/minecraft/$username"));
77
$uuid = $data->id;
88
$data = '$mcuuid[\''.$username.'\'] = "'. $uuid .'";';
9-
file_put_contents("query/cron/cache/minecraft.php", $data . "\n", FILE_APPEND);
9+
if (!file_exists("query/cron/cache/minecraft.php")) {
10+
file_put_contents("query/cron/cache/minecraft.php", "<?php\n".$data."\n", FILE_APPEND);
11+
} else {
12+
file_put_contents("query/cron/cache/minecraft.php", $data . "\n", FILE_APPEND);
13+
}
1014
return $uuid;
1115
} else {
1216
return $mcuuid[$username];

0 commit comments

Comments
 (0)