Hulkkiller Posted June 20, 2013 Share Posted June 20, 2013 I would like programming an MTA server updater program for Linux Is there a file where the latest Linux server version is in there because it should automatically update as the MTA client then Link to comment
dzek (varez) Posted June 22, 2013 Share Posted June 22, 2013 Sometimes updated breaks compatibility with older scripts. Personally I would NOT like my server to autoupdate and get broken, while I sleep or I'm on vacation. Link to comment
Hulkkiller Posted June 29, 2013 Author Share Posted June 29, 2013 https://nightly.multitheftauto.com/ver/ (It's given for the Linux Server?) Link to comment
x86 Posted July 1, 2013 Share Posted July 1, 2013 https://nightly.multitheftauto.com/ver/ (It's given for the Linux Server?) No, only the client. Link to comment
Hulkkiller Posted July 1, 2013 Author Share Posted July 1, 2013 nightly.multitheftauto.com running on php, can create and upload a script for get the latest and recommend version for the Linux Server? Is less work for me, because then I could build my project better (I have my own MTA Panel for hosting and need this for a update interface) Link to comment
uhm Posted July 3, 2013 Share Posted July 3, 2013 Hi Specially for you I built this: http://uhm.sparksptpm.co.uk/mta-linux/latest fetch latest version URL as text http://uhm.sparksptpm.co.uk/mta-linux/get fetch latest version (redirect, suitable for use with wget) http://uhm.sparksptpm.co.uk/mta-linux/ documentation and source download checks every 4 hours and caches result you are welcome to give me free lifetime hosting now Link to comment
Hulkkiller Posted July 3, 2013 Author Share Posted July 3, 2013 I meaning the Nightly Version (nightly.multitheftauto.com), Otherwise this is good with the latest normal Release I can hosting the php source on my webserver if you want, i can register a sub-domain example.. (mtasa.keppe.org) Link to comment
uhm Posted July 3, 2013 Share Posted July 3, 2013 youre free to alter the code and host it edit: service edited to do nightlies now and update time set to 2 hrs http://uhm.sparksptpm.co.uk/mta-linux/latest http://uhm.sparksptpm.co.uk/mta-linux/get new source code: <?php /**************************************************** MTA LINUX SERVER LATEST BUILD FETCH SERVICE Documentation: [url=http://uhm.sparksptpm.co.uk/mta-linux/]http://uhm.sparksptpm.co.uk/mta-linux/[/url] Developed by uhm under Apache License v2.0 *****************************************************/ function get_data($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); $data = curl_exec($ch); curl_close($ch); return $data; } function getBetween($haystack,$start,$end,$index=0) { $positions = array(); $positionsB = array(); $count = 0; $cnt2=0; while($cnt2<($index+1) && $count = strpos($haystack , $start , $count+1)) { $positions[] = $count+strlen($start); $cnt2++; } $cnt2=0; while($cnt2<($index+1) && $count = strpos($haystack , $end , $positions[$cnt2]+1)) { $positionsB[] = $count; $cnt2++; } return substr($haystack,$positions[$index],$positionsB[$index]-$positions[$index]); } // get last check date $time = filemtime('cache.txt'); if ((time() - $time) > 7200) // has it been longer than 2 hrs? (7200 seconds) { $data = get_data('https://nightly.multitheftauto.com/'); $version = getBetween($data,'<img src="mta_nightly.php?image=gz" alt="gz" /> <a href="','"'); file_put_contents ( 'cache.txt' , $version ); // make sure to chmod this file to 777 } else { $version = file_get_contents('cache.txt'); } if (isset($_GET['latest'])) { echo getBetween($version,'/','.tar'); } elseif (isset($_GET['get'])) { header('Location: ' . 'https://nightly.multitheftauto.com/' . $version); } else { echo 'Invalid request; see [url=http://uhm.sparksptpm.co.uk/mta-linux/']http://uhm.sparksptpm.co.uk/mta-linux/'[/url]; } ?> Link to comment
Hulkkiller Posted July 4, 2013 Author Share Posted July 4, 2013 its work for me, http://mtasa.keppe.org (I am running PHP5.4 on my Server) My Public Code <?php /**************************************************** MTA LINUX SERVER LATEST BUILD FETCH SERVICE Documentation: [url=http://uhm.sparksptpm.co.uk/mta-linux/]http://uhm.sparksptpm.co.uk/mta-linux/[/url] Developed by uhm under Apache License v2.0 Edited by KPT (Keppe Project-Team) *****************************************************/ function get_data($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); $data = curl_exec($ch); curl_close($ch); return $data; } function getBetween($haystack,$start,$end,$index=0) { $positions = array(); $positionsB = array(); $count = 0; $cnt2=0; while($cnt2<($index+1) && $count = strpos($haystack , $start , $count+1)) { $positions[] = $count+strlen($start); $cnt2++; } $cnt2=0; while($cnt2<($index+1) && $count = strpos($haystack , $end , $positions[$cnt2]+1)) { $positionsB[] = $count; $cnt2++; } return substr($haystack,$positions[$index],$positionsB[$index]-$positions[$index]); } // get last check date $time = filemtime('cache.txt'); if ((time() - $time) > 7200) // has it been longer than 2 hrs? (7200 seconds) { $data = get_data('https://nightly.multitheftauto.com/'); $psdata = explode("- Current release version",$data); $version = getBetween($psdata[1],'<img src="mta_nightly.php?image=gz" alt="gz" /> <a href="','"'); file_put_contents ( 'cache.txt' , $version ); // make sure to chmod this file to 644, 755, 775 or 777 } else { $version = file_get_contents('cache.txt'); } if (isset($_GET['latest'])) { echo getBetween($version,'/','.tar'); } elseif (isset($_GET['ver'])) { $gdata = getBetween($version,'/','.tar'); $psg1data = explode("-",$gdata); $psg2data = explode("-",$psg1data[1]); echo $psg2data[0]; } elseif (isset($_GET['build'])) { $gdata = getBetween($version,'/','.tar'); $psg1data = explode("-",$gdata); $psg2data = explode("-",$psg1data[3]); echo $psg2data[0]; } elseif (isset($_GET['get'])) { header('Location: ' . 'https://nightly.multitheftauto.com/' . $version); } else { echo 'Invalid request; see [url=http://uhm.sparksptpm.co.uk/mta-linux/']http://uhm.sparksptpm.co.uk/mta-linux/'[/url]; } Thank your for the help thx Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now