CodeIgniter Forums
Version/System update notifications - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Version/System update notifications (/showthread.php?tid=68754)



Version/System update notifications - n2fole00 - 08-21-2017

Hi folks,

Is there any way I can receive notifications (perhaps via email) when there is a CI system update?

Thanks.


RE: Version/System update notifications - InsiteFX - 08-21-2017

I believe that there is an RSS channel, you would need to ask the administrator for the link.


RE: Version/System update notifications - Paradinight - 08-21-2017

(08-21-2017, 01:30 AM)n2fole00 Wrote: Hi folks,

Is there any way I can receive notifications (perhaps via email) when there is a CI system update?

Thanks.

https://github.com/bcit-ci/CodeIgniter/releases.atom


RE: Version/System update notifications - n2fole00 - 08-21-2017

(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