예제 #1
0
 /**
  * Check for updates to the esoTalk software. If there's a new version, and this is the first time we've heard
  * of it, create a notifcation for the current user.
  *
  * @return void
  */
 public function checkForUpdates()
 {
     // Save the last update check time so we won't do it again for a while.
     ET::writeConfig(array("esoTalk.admin.lastUpdateCheckTime" => time()));
     // If the latest version is different to what it was last time we checked...
     $info = C("esoTalk.admin.lastUpdateCheckInfo", array("version" => ESOTALK_VERSION));
     if ($package = ET::checkForUpdates() and $package["version"] != $info["version"]) {
         // Create a notification.
         ET::activityModel()->create("updateAvailable", ET::$session->userId, null, $package);
         // Write the latest checked version to the config file.
         ET::writeConfig(array("esoTalk.admin.lastUpdateCheckInfo" => $package));
     }
 }