Skip to content

Commit

Permalink
Rename file
Browse files Browse the repository at this point in the history
  • Loading branch information
YTBJero authored Apr 25, 2022
1 parent f124264 commit 9d1204f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/updater/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static function handleUpdateInfo(Array $data): void
Server::getInstance()->getLogger()->warning(" §c" .$lines[$i]);
}
Server::getInstance()->getLogger()->warning("§dUpdate Link :: " . $data["Response"]["link"]);
Server::getInstance()->getLogger()->warning("Update file was install in plugin_data/MultiPlayerCounter");
Server::getInstance()->getLogger()->warning("Update file was install in plugin_data/Clothes");
} else {
if ($update < 0) Server::getInstance()->getLogger()->debug("Running a build not yet released, this can cause un intended side effects (including possible data loss)");
return;
Expand All @@ -57,9 +57,9 @@ public static function handleUpdateInfo(Array $data): void
* @return void
*/
protected static function downloadUpdate(string $url) : void {
$plugin = Server::getInstance()->getPluginManager()->getPlugin("MultiPlayerCounter");
$plugin = Clothes::getInstance();
@mkdir($plugin->getDataFolder()."tmp/");
$path = $plugin->getDataFolder()."tmp/MultiPlayerCounter.phar";
$path = $plugin->getDataFolder()."tmp/Clothes.phar";
Server::getInstance()->getAsyncPool()->submitTask(new DownloadFile($plugin, $url, $path));
}
/**
Expand Down Expand Up @@ -127,14 +127,14 @@ public static function handleDownload(string $path, int $status) : void {
Utils::rmalldir($plugin->getDataFolder()."/tmp");
return;
}
@rename($path, Server::getInstance()->getPluginPath()."/MultiPlayerCounter.phar");
@rename($path, Server::getInstance()->getPluginPath()."/Clothes.phar");
if(Utils::getFileName() === null){
Server::getInstance()->getLogger()->debug("Deleting previous MultiPlayerCounter version...");
Server::getInstance()->getLogger()->debug("Deleting previous Clothes version...");
Utils::rmalldir($plugin->getFileHack());
Server::getInstance()->getLogger()->warning("Update complete, restart your server to load the new updated version.");
return;
}
@rename(Server::getInstance()->getPluginPath()."/".Utils::getFileName(), Server::getInstance()->getPluginPath()."/MultiPlayerCounter.phar.old"); //failsafe i guess.
@rename(Server::getInstance()->getPluginPath()."/".Utils::getFileName(), Server::getInstance()->getPluginPath()."/Clothes.phar.old"); //failsafe i guess.
Server::getInstance()->getLogger()->warning("Update complete, restart your server to load the new updated version.");
return;
}
Expand Down Expand Up @@ -173,4 +173,4 @@ private static function getFileName(){
$tmp = end($tmp); //requires reference, so cant do all in one
return str_replace("/","",$tmp);
}
}
}

0 comments on commit 9d1204f

Please sign in to comment.