Welcome Guest, Not a member yet? Register   Sign In
Version/System update notifications
#4

(This post was last modified: 08-21-2017, 09:19 AM by n2fole00.)

(08-21-2017, 02:45 AM)Paradinight Wrote: https://github.com/bcit-ci/CodeIgniter/releases.atom

Thanks, I made this little script to keep me updated.

PHP Code:
<?php

/** 
 * Check CodeIgniter release for updates - Run as a cron job
 */

$local_version_file 'ci_version.txt'
if(!
file_exists($local_version_file)) { file_put_contents($local_version_file''); } // create for first run

$update_feed_address 'https://github.com/bcit-ci/CodeIgniter/releases.atom';
$xmlstr file_get_contents($update_feed_address);
$feed = new SimpleXMLElement($xmlstr);
$latest_version  $feed->entry[0]->id;

$file_contents file_get_contents($local_version_file); 
if(empty(
$file_contents)) { file_put_contents($local_version_file$latest_version); } // empty on first run 

if(strcmp($latest_version$file_contents) !== 0) { 
 
   // Release versions not matched - therefore new version available. Send notification 
 
   $to "[email protected]";
 
   $subject "CodeIgniter Update Available";
 
   $txt "There is a CodeIgniter update available. Version: " $latest_version;
 
   $headers "From: [email protected]"\r\n"// . "CC: [email protected]";

 
   if(!mail($to,$subject,$txt,$headers)) { echo "Failed to send mail."; } 
    
    
file_put_contents($local_version_file$latest_version); // add the latest version back to the local datastore 

Reply


Messages In This Thread
Version/System update notifications - by n2fole00 - 08-21-2017, 01:30 AM
RE: Version/System update notifications - by n2fole00 - 08-21-2017, 09:14 AM



Theme © iAndrew 2016 - Forum software by © MyBB