map file erasing from browser
This commit is contained in:
parent
9fde082a71
commit
9e4f815278
@ -402,8 +402,6 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
|
|
||||||
// Queue requested Map
|
// Queue requested Map
|
||||||
$this->maniaControl->mapManager->mapQueue->addMapToMapQueue($player, $map);
|
$this->maniaControl->mapManager->mapQueue->addMapToMapQueue($player, $map);
|
||||||
|
|
||||||
$this->showManiaLink($player);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -415,7 +413,13 @@ class DirectoryBrowser implements ManialinkPageAnswerListener {
|
|||||||
public function handleEraseFile(array $actionCallback, Player $player) {
|
public function handleEraseFile(array $actionCallback, Player $player) {
|
||||||
$actionName = $actionCallback[1][2];
|
$actionName = $actionCallback[1][2];
|
||||||
$fileName = substr($actionName, strlen(self::ACTION_ERASE_FILE));
|
$fileName = substr($actionName, strlen(self::ACTION_ERASE_FILE));
|
||||||
// TODO: erase map
|
$folderPath = $player->getCache($this, self::CACHE_FOLDER_PATH);
|
||||||
var_dump($fileName);
|
$filePath = $folderPath . $fileName;
|
||||||
|
if (@unlink($filePath)) {
|
||||||
|
$this->maniaControl->chat->sendSuccess("Erased {$fileName}!");
|
||||||
|
$this->showManiaLink($player);
|
||||||
|
} else {
|
||||||
|
$this->maniaControl->chat->sendError("Couldn't erase {$fileName}!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -713,10 +713,16 @@ class MapManager implements CallbackListener {
|
|||||||
$this->maniaControl->callbackManager->triggerCallback(Callbacks::ENDMAP, $this->currentMap);
|
$this->maniaControl->callbackManager->triggerCallback(Callbacks::ENDMAP, $this->currentMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetch a map by its file path
|
||||||
|
*
|
||||||
|
* @param string $relativeFileName
|
||||||
|
* @return Map
|
||||||
|
*/
|
||||||
public function fetchMapByFileName($relativeFileName) {
|
public function fetchMapByFileName($relativeFileName) {
|
||||||
$mapInfo = $this->maniaControl->client->getMapInfo($relativeFileName);
|
$mapInfo = $this->maniaControl->client->getMapInfo($relativeFileName);
|
||||||
if (!$mapInfo) {
|
if (!$mapInfo) {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
return $this->initializeMap($mapInfo);
|
return $this->initializeMap($mapInfo);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user