[Updater] PSUpdater2.0

Status
Not open for further replies.
Newbie Spellweaver
Joined
Feb 10, 2006
Messages
11
Reaction score
6
Location
Canada
[Updater] PSUpdater2.0 + Source

I finialy got a working copy of v2.0 not much added but it downloads file by file like real kal updater :)

MAKE SURE YOU READ THE README FILE

hosted files for the updater can be hosted on either windows or *nix (linux or unix based) systems but DOES NOT WORK WITH IIS on windows

ScreenShot

Used CloseUp's layout image becuase everyone seemed to like it

perpetualfear - [Updater] PSUpdater2.0 - RaGEZONE Forums


AS Promised here is the source
 

Attachments

Last edited:
Re: PSUpdater2.0

to everyone who already downloaded this, make sure the folder your putting everything into is writable so that filelist.php can make file.list for the updater to work, this only applys to *nix systems, This script also works on windows systems but DOES NOT WORK WITH IIS
 
Re: PSUpdater2.0

Everyone got spoiled. Too much releases and sharing in the last month,
They got used to having everything they need without doing sht themselves.

IMO.
 
Re: PSUpdater2.0

@rak3: and how do you run an updateSvr on a webserver? what if your updates are not on the same server as the kal server?

UpdateSVR on the same server as MainSvr causes a constant download/upload -> Laggy

Thanks for the nice release perp, I'm sure u spent a lot of time in this and i'll keep using you releases...
 
Re: PSUpdater2.0

here my edit of filelist.php it adds the option to edit the notice.txt
PHP:
<?php
// !! START EDIT UNDER HERE !! //
$seccode = "YOURPASSWORDHERE";
// !! DON'T EDIT UNDER HERE !! //
class Boot
{
 private $i = 0;
 /**
  * Create the script boot file.
  *
  * @param string $FILEN
  * @param int $mode
  * @return bool
  */
 public function Create($FILEN, $mode)
 {
  $dir = "./";
  if(is_dir($dir))
  {
   $Handle = opendir($dir);
   if($Handle)
   {
    $FHandle = fopen($FILEN, 'w');
    $this->ReadDir($Handle, $dir, $FHandle, $mode);
    //Cut trails
    $temps = file_get_contents($FILEN);
    $temps[strlen($temps) - 1] = "";
    file_put_contents($FILEN, $temps);
 
   }
  }
  return true;
 }
 /**
  * Read all files in a given directory.
  *
  * @param resource $Handle
  * @param string $dir
  * @param resource $FHandle
  * @param int $mode
  * @return bool
  */
 private function ReadDir($Handle, $dir, $FHandle, $mode)
 {
 
  while (($file = readdir($Handle)) !== false)
  {
   if(is_dir($dir.$file) && $file != ".." && $file != ".")
   {
    $NHandle = opendir($dir.$file."/");
    if($NHandle)
    {
     $this->ReadDir($NHandle, $dir.$file."/", $FHandle, $mode);
    }
   }
   elseif (is_file($dir.$file))
   {
    $Skip = array(
    'file.list',
    'filelist.php'
    );
    if($mode == 1)
    {
     if($this->FileExt($file) == "zip" && !array_key_exists($file, $Skip) && $file[0] != '_')
     {
      $data = $this->FileName($file) . "," . filesize($dir.$file) . "*";
      $dat = $data;
      fwrite($FHandle, $dat);
      $this->i++;
     }
    }
    else
    if(!$this->CheckName($file, $Skip) && $file[0] != '_')
    {
     $data = $dir.$file . "," .md5_file($dir.$file);
     $dat = "$data\r\n";
     fwrite($FHandle, $dat);
     $this->i++;
    }
   }
   else
   { // Then what is it? oO
    continue;
   }
  }
  closedir($Handle);
  return true;
 }
 /**
  * Returns the extension of the file name
  *
  * @param string $file
  * @return string
  */
 private function FileExt($file)
 {
  $TEMP = explode('.', $file);
  return $TEMP[count($TEMP) - 1];
 }
 private function FileName($file)
 {
  $TEMP = explode('.', $file);
  return $TEMP[0];
 }
 /**
  * Loads a boot file.
  *
  * @param string $FILEN
  * @return bool
  */
 public function Load($FILEN)
 {
  $fp = fopen("list.txt", 'r');
  $TEMP['RESOURCE'] = fopen($FILEN, 'r');
  $i = 0;
  while (!feof($TEMP['RESOURCE']))
  {
   $TEMP['FILE'][$i] = fgets($TEMP['RESOURCE'], 1024);
   $i++;
  }
  for($c = 0; $c < count($TEMP['FILE']); $c++)
  {
   include($TEMP['FILE'][$i]);
  }
  unset($TEMP);
  return true;
 }
 private function CheckName($file, $array)
 {
  for($i = 0; $i < count($array); $i++)
  {
   if($file == $array[$i])
   {
    return true;
    break;
   }
  }
  return false;
 }
}
if(isset($_POST['submit']) && $_POST['pa'] == "$seccode")
{
$file = "notice.txt";
$fp = fopen($file, "w");
fwrite($fp, "$_POST[notice_text]");
fclose($fp); 
 $boot = new Boot();
 $boot->Create("file.list", 0);
 echo "Done!";
}
$myFile = "notice.txt";
$fh = fopen($myFile, 'r');
$theData = fread($fh, filesize($myFile));
fclose($fh);
?>
<form method="POST" action="">
 
<table border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center">Genix Online Update </td>
  </tr>
  <tr>
    <td align="center"><textarea name="notice_text" cols="35" rows="10" id="notice_text"><?php echo $theData; ?></textarea></td>
  </tr>
  <tr>
    <td align="center">Securty Code<br>
      <input type="password" maxlength="50" name="pa"></td>
  </tr>
  <tr>
    <td align="center"><input type="submit" name="submit" value="Do it."> <input name="" type="reset" value="Reset"></td>
  </tr>
</table>
</form>
 
Re: PSUpdater2.0

Heads up. this script WELL NOT work whith Windows Server 2003 IIS... if i come across ill let u guys know (beta tester)
 
Re: PSUpdater2.0

let me confirm, with this you put all game files on server, and this gets all the files and makes a list of what needs updating depending on what you have already?
 
Re: PSUpdater2.0

ok I got a problem with understanding this completely here... If I upload ALL my files and make a file list, it will update all 1 gig of my files or only ones newer than theirs on their system individually? OR is it ONLY for NEW files. Give me specific details on this pls as I have asked about all topics, if its all files or only files needing updated..
 
Re: PSUpdater2.0

only upload file that need updating but never delete any files from a previous update that where uploaded the updater checks the local users files with the files on the update webserver and only downloads the files that are newer then the ones they already have
 
Status
Not open for further replies.
Back