function newUpdates($force) { // No need to check if developer mode if (isDeveloper()) { return false; } $cache_path = JAPPIX_BASE . '/store/updates/version.xml'; // No cache, obsolete one or refresh forced if (!file_exists($cache_path) || file_exists($cache_path) && time() - filemtime($cache_path) >= 86400 || $force) { // Get the content $last_version = read_url('http://codingteam.net/project/jappix/upload/briefcase/version.xml'); // Write the content file_put_contents($cache_path, $last_version); } else { $last_version = file_get_contents($cache_path); } // Parse the XML $xml = @simplexml_load_string($last_version); // No data? if ($xml === FALSE) { return false; } // Get the version numbers $current_version = getVersion(); $last_version = $xml->id; // Check if we have the latest version $current_version = versionNumber($current_version); $last_version = versionNumber($last_version); if ($current_version < $last_version) { return true; } return false; }
function newUpdates($force) { // No need to check if developer mode if (isDeveloper()) { return false; } $cache_path = JAPPIX_BASE . '/tmp/cache/version.xml'; // No cache, obsolete one or refresh forced if (!file_exists($cache_path) || file_exists($cache_path) && time() - filemtime($cache_path) >= 86400 || $force) { // Get the content $last_version = readUrl('https://jappix.org/xml/version.xml'); // Write the content file_put_contents($cache_path, $last_version, LOCK_EX); } else { // Read from cache $last_version = file_get_contents($cache_path); } // Parse the XML $xml = @simplexml_load_string($last_version); // No data? if ($xml === FALSE) { return false; } // Get the version numbers $current_version = getVersion(); $last_version = $xml->id; // Check if we have the latest version $current_version = versionNumber($current_version); $last_version = versionNumber($last_version); if ($current_version < $last_version) { return true; } return false; }