check that temp folder is available

This commit is contained in:
Steffen Schröder 2014-08-03 13:13:52 +02:00
parent 28cfee646a
commit f6e791a2c6

View File

@ -339,6 +339,14 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
} }
$tempDir = FileUtil::getTempFolder(); $tempDir = FileUtil::getTempFolder();
if (!$tempDir) {
$message = "Update failed: Can't save Update zip!";
if ($player) {
$this->maniaControl->getChat()->sendError($message, $player);
}
$this->maniaControl->log($message);
return;
}
$updateFileName = $tempDir . basename($updateData->url); $updateFileName = $tempDir . basename($updateData->url);
$bytes = file_put_contents($updateFileName, $updateFileContent); $bytes = file_put_contents($updateFileName, $updateFileContent);
@ -359,6 +367,7 @@ class UpdateManager implements CallbackListener, CommandListener, TimerListener
$this->maniaControl->getChat()->sendError($message, $player); $this->maniaControl->getChat()->sendError($message, $player);
} }
$this->maniaControl->log($message); $this->maniaControl->log($message);
unlink($updateFileName);
return; return;
} }