[FIXED] WriteFile() XMLRPC call still errors on Linux

Moderator: NADEO

Post Reply
User avatar
Chris92
Translator
Translator
Posts: 943
Joined: 15 Jun 2010, 13:22
Location: Vilshofen, Germany
Contact:

[FIXED] WriteFile() XMLRPC call still errors on Linux

Post by Chris92 » 21 Jan 2019, 16:18

Hello xbx and others,
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'.
This is the PHP script I'm using:

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();
Directory permissions are 775 for UserData and Maps, user to run the server is in the games group and I've also tried running the server as root to no avail.

The map I'm using to test is Otherworld by Snake55wildcat

I hope we can get this nasty error resolved once and for all.
Last edited by Chris92 on 12 Feb 2019, 19:06, edited 1 time in total.
Check out my Personal Twitter account!

User avatar
Chris92
Translator
Translator
Posts: 943
Joined: 15 Jun 2010, 13:22
Location: Vilshofen, Germany
Contact:

Re: WriteFile() XMLRPC call still errors on Linux

Post by Chris92 » 21 Jan 2019, 18:26

Thanks to Miss, we might have narrowed down the source of the error.
Somehow the Linux server doesn't find the file name it should write the data in.
Tried with two Maps, one smaller map (332kb) and OTHERWORLD from above (1800kb)
Check out my Personal Twitter account!

User avatar
Miss
Posts: 1951
Joined: 05 Jan 2016, 11:34
Location: The Netherlands
Contact:

Re: WriteFile() XMLRPC call still errors on Linux

Post by Miss » 22 Jan 2019, 00:13

Worth noting I'm only assuming that because of the specific error not including any filename.
1070 GTX, Ryzen 3700X, 16GB RAM, Windows 10
Forum moderator, opinions are my own. :thx:
Check out Image openplanet, the alternative ManiaPlanet & Turbo scripting platform! (Openplanet subforum)
I also stream on Twitch and tweet on Twitter.

User avatar
Chris92
Translator
Translator
Posts: 943
Joined: 15 Jun 2010, 13:22
Location: Vilshofen, Germany
Contact:

Re: WriteFile() XMLRPC call still errors on Linux

Post by Chris92 » 12 Feb 2019, 18:15

Seems to be fixed with the latest server version, according to initial tests.
Check out my Personal Twitter account!

Post Reply

Return to “Dedicated Server”

Who is online

Users browsing this forum: No registered users and 2 guests