Skip to content
Browse files

Store result in cache file so that index module can let admin know a …

…new version is available
  • Loading branch information...
1 parent 07624ff commit bee04dc0a4113b048938690fde2b1a20454a9034 @markkevans markkevans committed with haraldpdl
View
2 catalog/admin/includes/languages/english/modules/index/update_check.php
@@ -15,4 +15,6 @@
define('ADMIN_INDEX_UPDATE_CHECK_NEVER', 'Never');
define('ADMIN_INDEX_UPDATE_CHECK_NOW', 'Check Now');
+define('TEXT_UPGRADE_AVAILABLE', 'An update for osCommerce is available');
+
?>
View
11 catalog/admin/includes/modules/index/update_check.php
@@ -11,7 +11,7 @@
*/
$last_update_check = LAST_UPDATE_CHECK_TIME;
-
+ $cache_file = DIR_FS_CACHE . '/versions.cache';
if (!empty($last_update_check)) {
$date_last_checked = date('F j, Y, H:i:s', $last_update_check);
} else {
@@ -28,5 +28,14 @@
' <td class="dataTableContent" align="left">' . ADMIN_INDEX_UPDATE_CHECK_DATE . ': ' . $date_last_checked . '</td>' .
' <td class="dataTableContent" align="right"><a href="' . tep_href_link(FILENAME_VERSION_CHECK) . '">' . ADMIN_INDEX_UPDATE_CHECK_NOW . '</a></td>' .
' </tr>';
+
+if (file_exists($cache_file)) {
+ $result = unserialize(join('', file($cache_file)));
+ if (count($result) > 0) {
+ echo ' <tr class="dataTableRow" onmouseover="rowOverEffect(this);" onmouseout="rowOutEffect(this);">' .
+ ' <td class="dataTableContent" align="left" colspan="2"><strong>' . TEXT_UPGRADE_AVAILABLE . '</strong></td>' .
+ ' </tr>';
+ }
+}
?>
</table>
View
6 catalog/admin/version_check.php
@@ -25,6 +25,12 @@
}
}
+ $serialized = serialize($upgrade_versions);
+ if ($f = @fopen(DIR_FS_CACHE . '/versions.cache', 'w')) {
+ fwrite ($f, $serialized, strlen($serialized));
+ fclose($f);
+ }
+
if (count($upgrade_versions) > 0) {
$messageStack->add(VERSION_UPGRADES_AVAILABLE, 'error');
} else {

0 comments on commit bee04dc

Please sign in to comment.
Something went wrong with that request. Please try again.