Jump to content
  • 0

Assistance with using the auto updater?


Teppy

Question

I'm trying to use the Auto Updater, specifically the update.php to dynamically generate metadata according to this documentation: https://docs.freemmorpgmaker.com/en-US/deploy/autoupdater.html#uploading

 

I keep getting the following error through the client went trying to auto update.

 

[16-Jul-2021 03:47:49 UTC] PHP Warning:  Creating default object from empty value in /home/public_html/updater/update.php on line 72

 

Has anyone else had this issue? Any ideas on how to fix it?

Link to comment
Share on other sites

18 answers to this question

Recommended Posts

  • 0

That link doesn't work. It should provide a long list of files, sizes, hashes, etc. The link might be wrong. Or the host might not support php or any other host of issues. Regardless it's not an Intersect problem.

Edited by jcsnider
Link to comment
Share on other sites

  • 0
4 hours ago, jcsnider said:

That link doesn't work. It should provide a long list of files, sizes, hashes, etc. The link might be wrong. Or the host might not support php or any other host of issues. Regardless it's not an Intersect problem.

 

Sorry about that can you check it again? I had messed with switching hosts last night and forgot to switch it back.  It does provide that list but still 403 error on the client when pointing to the update.php

Link to comment
Share on other sites

  • 0

So first off.. you need to make a "resources" folder inside the updater folder, and put everything in there except for the update.php file, the .exes, and the .pdbs.

 

So the file tree looks something like:

 

updater/

  update.php

  Intersect Client.exe

  Intersect Client.pdb

  Intersect Editor.exe

  Intersect Editor.pdb

  resources/

     animations

     items

     gui

     packs

     etc

 

 

Secondly, check and see if there is a file called error_log inside your /updater folder. The update.php script sees one, but that might be something hidden/inaccessible that your host has.

Link to comment
Share on other sites

  • 0
46 minutes ago, XFallSeane said:

 

If u have same error add this in top of your update.php after < ?php

 

ini_set('display_errors', 0);

Sadly, the error still up...
I have added that line of code just after < ?php , as you said, but the error's still there. 

Thanks for trying, tho. If you have any other thoughts in your mind, please don't be affraid to share xD

Link to comment
Share on other sites

  • 0
8 hours ago, Habib said:

Sadly, the error still up...
I have added that line of code just after < ?php , as you said, but the error's still there. 

Thanks for trying, tho. If you have any other thoughts in your mind, please don't be affraid to share xD

 

 

Can you share your update url ? 

Link to comment
Share on other sites

  • 0
3 minutes ago, XFallSeane said:

 

Not work have you link from your website ?

I can't share my website link for now since it's include another project that I'm not available to public share...

Here's update.php:

<?php
ini_set('display_errors', 0);

function scanD($target, $obj) {

	$excludeFiles = array("resources/mapcache.db", "update.json", "version.json");
	$clientExcludeFiles = array("Intersect Editor.exe", "Intersect Editor.pdb");
	$excludeDirectories = array("logs", "screenshots");
	$excludeExtensions = array(".dll", ".xml", ".config", ".php");

	if(is_dir($target)){

		$skipDir = false;
		$dir = str_replace(getcwd() . "/", "", $target);
		foreach ($excludeDirectories as $excludeDir) {
			if (endsWith($dir, $excludeDir . "/")) {
				$skipDir = true;
				break;
			}
		}

		if ($skipDir == false) {
			$files = glob( $target . '*', GLOB_MARK ); //GLOB_MARK adds a slash to directories returned

			foreach( $files as $file )
			{
				scanD( $file, $obj );

				$skip = is_dir($file);

				foreach ($excludeExtensions as $extension) {
					if (endsWith($file, $extension)) {
						$skip = true;
						break;
					}
				}

				$path = str_replace(getcwd() . "/", "", $file);

				if (in_array($path, $excludeFiles)) {
					$skip = true;	
				}
				
				if (strpos($path, ".") == false)
				{
					$skip = true;
				}

				if ($skip == false) {
					if (in_array($path,$clientExcludeFiles)) {
						$obj->Files[] = array("Path"=>$path, "Hash"=>md5_file($file), "Size"=>filesize($file), "ClientIgnore"=>true);
					}
					else {
						$obj->Files[] = array("Path"=>$path, "Hash"=>md5_file($file), "Size"=>filesize($file));
					}
				}

			}
		}


	} 
}

function endsWith($haystack, $needle)
{
	$length = strlen($needle);
	if ($length == 0) {
		return true;
	}

	return (substr($haystack, -$length) === $needle);
}


$path = getcwd();
$obj->TrustCache = true;
if (file_exists("stream.php")) {
	$obj->StreamingUrl = (((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on')) ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/') + 1) . "stream.php";
}
$obj->Files = [];
scanD($path, $obj);
echo json_encode($obj, JSON_UNESCAPED_SLASHES);

?>

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...