WriteFile() still seems to be broken on Linux dedicated servers, even after the attempted fixes.
Disregarding the too low max_request_size in the dedicated-server-api I'm still struggling to write files via the WriteFile() XMLRPC method.
My setup: Ubuntu 16.04 LTS
Server installed via the NADEO APT repository (in /opt/maniaplanet-server)
I'm trying to send files to the server, but the only error I'm getting is
Code: Select all
couldn't write file '/opt/maniaplanet-server/UserData/Maps'.
Code: Select all
<?php
/**
* Created by PhpStorm.
* User: chris
* Date: 10.01.2019
* Time: 20:30
*/
require_once("./vendor/autoload.php");
class Main{
//settings
private $host = "IP_ADDRESS";
private $port = "PORT";
private $user = "SuperAdmin";
private $pw = "SUPER_SECRET_PASSWORD";
private function connect(){
$conn = \Maniaplanet\DedicatedServer\Connection::factory($this->host, $this->port, 5, $this->user, $this->pw);
$conn->triggerModeScriptEvent("XmlRpc.SetApiVersion", ["2.1.0"]);
return $conn;
}
public function TryWriteFile(){
$conn = $this->connect();
$filename = "OTHERWORLD.Map.Gbx";
$file = file_get_contents($filename);
try{
$conn->writeFile($filename, base64_encode($file));
$conn->addmap($filename);
}
catch (Exception $ex){
echo $ex->getMessage();
}
}
}
$main = new Main();
$main->TryWriteFile();
The map I'm using to test is Otherworld by Snake55wildcat
I hope we can get this nasty error resolved once and for all.