[TEP-COMMIT] [CVS admin] update to the template structure / standards updates
hpdl-OfajU3CKLf1/[email protected] 18 Aug 2004 11:49:44 -0000
| Newsgroups | gmane.comp.web.oscommerce.cvs |
|---|---|
| Message-ID | <[email protected]> |
Commit in admin/admin on MAIN
cache.php +15 -101 1.26 -> 1.27
categories.php +14 -14 1.152 -> 1.153
manufacturers.php +2 -2 1.58 -> 1.59
includes/application_top.php -7 1.168 -> 1.169
includes/functions/general.php +4 -38 1.166 -> 1.167
includes/languages/english/cache.php +10 -9 1.10 -> 1.11
includes/languages/espanol/cache.php +10 -9 1.13 -> 1.14
includes/languages/german/cache.php +11 -10 1.13 -> 1.14
templates/default/images/icons/16x16/delete.png [binary] added 1.1
templates/pages/cache.php +70 added 1.1
+136 -190
2 added + 8 modified, total 10 files
update to the template structure / standards updates
replace calls to tep_reset_cache_block() to the osC_Cache class
----------
admin /admin
cache.php 1.26 -> 1.27
diff -u -r1.26 -r1.27
--- cache.php 2004/07/22 23:33:00 1.26
+++ cache.php 2004/08/18 11:49:35 1.27
@@ -5,7 +5,7 @@
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
- Copyright (c) 2003 osCommerce
+ Copyright (c) 2004 osCommerce
Released under the GNU General Public License
*/
@@ -14,16 +14,18 @@
$selected_box = 'tools';
- $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
+ $action = (isset($_GET['action']) ? $_GET['action'] : '');
- if (tep_not_null($action)) {
- if ($action == 'reset') {
- tep_reset_cache_block($HTTP_GET_VARS['block']);
+ if (!empty($action)) {
+ switch ($action) {
+ case 'reset':
+ if (isset($_GET['cache']) && !empty($_GET['cache'])) {
+ osC_Cache::clear($_GET['cache']);
+ }
- osC_Cache::clear($HTTP_GET_VARS['block']);
+ tep_redirect(tep_href_link(FILENAME_CACHE));
+ break;
}
-
- tep_redirect(tep_href_link(FILENAME_CACHE));
}
// check if the cache directory exists
@@ -32,98 +34,10 @@
} else {
$messageStack->add(ERROR_CACHE_DIRECTORY_DOES_NOT_EXIST, 'error');
}
-?>
-<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html <?php echo HTML_PARAMS; ?>>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
-<title><?php echo TITLE; ?></title>
-<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
-<script language="javascript" src="includes/general.js"></script>
-</head>
-<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
-<!-- header //-->
-<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
-<!-- header_eof //-->
-
-<!-- body //-->
-<table border="0" width="100%" cellspacing="2" cellpadding="2">
- <tr>
- <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
-<!-- left_navigation //-->
-<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
-<!-- left_navigation_eof //-->
- </table></td>
-<!-- body_text //-->
- <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
- <tr>
- <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
- <tr>
- <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
- <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
- <tr>
- <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
- <tr class="dataTableHeadingRow">
- <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CACHE; ?></td>
- <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_DATE_CREATED; ?></td>
- <td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?> </td>
- </tr>
-<?php
- if ($messageStack->size < 1) {
- for ($i=0, $n=sizeof($cache_blocks); $i<$n; $i++) {
- $cached_file = ereg_replace('-language', '-' . $language, $cache_blocks[$i]['file']);
-
- if (file_exists(DIR_FS_WORK . $cached_file)) {
- $cache_mtime = strftime(DATE_TIME_FORMAT, filemtime(DIR_FS_WORK . $cached_file));
- } elseif ($cache_blocks[$i]['multiple'] === true) {
- $cache_mtime = TEXT_FILE_DOES_NOT_EXIST;
- $dir = dir(DIR_FS_WORK);
-
- while ($cache_file = $dir->read()) {
- $cached_file = ereg_replace('-language', '-' . $language, $cache_blocks[$i]['file']);
-
- if (ereg('^' . $cached_file, $cache_file)) {
- $cache_mtime = strftime(DATE_TIME_FORMAT, filemtime(DIR_FS_WORK . $cache_file));
- break;
- }
- }
- $dir->close();
- } else {
- $cache_mtime = TEXT_FILE_DOES_NOT_EXIST;
- }
-?>
- <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)">
- <td class="dataTableContent"><?php echo $cache_blocks[$i]['title']; ?></td>
- <td class="dataTableContent" align="right"><?php echo $cache_mtime; ?></td>
- <td class="dataTableContent" align="right"><?php echo '<a href="' . tep_href_link(FILENAME_CACHE, 'action=reset&block=' . $cache_blocks[$i]['code'], 'NONSSL') . '">' . tep_image(DIR_WS_IMAGES . 'icon_reset.gif', 'Reset', 13, 13) . '</a>'; ?> </td>
- </tr>
-<?php
- }
- }
+ $page_contents = 'cache.php';
+
+ require('templates/default.php');
+
+ require('includes/application_bottom.php');
?>
- <tr>
- <td class="smallText" colspan="3"><?php echo TEXT_CACHE_DIRECTORY . ' ' . DIR_FS_WORK; ?></td>
- </tr>
- </table></td>
- </tr>
- </table></td>
- </tr>
- </table></td>
-<!-- body_text_eof //-->
- </tr>
-</table>
-<!-- body_eof //-->
-
-<!-- footer //-->
-<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
-<!-- footer_eof //-->
-<br>
-</body>
-</html>
-<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
----------
admin /admin
categories.php 1.152 -> 1.153
diff -u -r1.152 -r1.153
--- categories.php 2004/07/22 23:26:52 1.152
+++ categories.php 2004/08/18 11:49:35 1.153
@@ -87,8 +87,8 @@
if ($error === false) {
$osC_Database->commitTransaction();
- tep_reset_cache_block('categories');
- tep_reset_cache_block('also_purchased');
+ osC_Cache::reset('categories');
+ osC_Cache::reset('also_purchased');
$messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
} else {
@@ -138,8 +138,8 @@
tep_remove_product($key);
}
- tep_reset_cache_block('categories');
- tep_reset_cache_block('also_purchased');
+ osC_Cache::reset('categories');
+ osC_Cache::reset('also_purchased');
$messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
}
@@ -164,8 +164,8 @@
tep_remove_product($_GET['pID']);
}
- tep_reset_cache_block('categories');
- tep_reset_cache_block('also_purchased');
+ osC_Cache::reset('categories');
+ osC_Cache::reset('also_purchased');
$messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
}
@@ -187,8 +187,8 @@
$Qupdate->execute();
if ($Qupdate->affectedRows()) {
- tep_reset_cache_block('categories');
- tep_reset_cache_block('also_purchased');
+ osC_Cache::reset('categories');
+ osC_Cache::reset('also_purchased');
$messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
@@ -216,8 +216,8 @@
$Qupdate->execute();
if ($Qupdate->affectedRows()) {
- tep_reset_cache_block('categories');
- tep_reset_cache_block('also_purchased');
+ osC_Cache::reset('categories');
+ osC_Cache::reset('also_purchased');
$messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
@@ -320,8 +320,8 @@
if ($error === false) {
$osC_Database->commitTransaction();
- tep_reset_cache_block('categories');
- tep_reset_cache_block('also_purchased');
+ osC_Cache::reset('categories');
+ osC_Cache::reset('also_purchased');
$messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
} else {
@@ -425,8 +425,8 @@
if ($error === false) {
$osC_Database->commitTransaction();
- tep_reset_cache_block('categories');
- tep_reset_cache_block('also_purchased');
+ osC_Cache::reset('categories');
+ osC_Cache::reset('also_purchased');
$messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
----------
admin /admin
manufacturers.php 1.58 -> 1.59
diff -u -r1.58 -r1.59
--- manufacturers.php 2004/07/22 23:29:21 1.58
+++ manufacturers.php 2004/08/18 11:49:35 1.59
@@ -81,7 +81,7 @@
if ($error === false) {
$osC_Database->commitTransaction();
- tep_reset_cache_block('manufacturers');
+ osC_Cache::reset('manufacturers');
$messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
} else {
@@ -135,7 +135,7 @@
$Qupdate->execute();
}
- tep_reset_cache_block('manufacturers');
+ osC_Cache::reset('manufacturers');
$messageStack->add_session(SUCCESS_DB_ROWS_UPDATED, 'success');
}
----------
admin /admin /includes
application_top.php 1.168 -> 1.169
diff -u -r1.168 -r1.169
--- application_top.php 2004/08/15 18:11:32 1.168
+++ application_top.php 2004/08/18 11:49:36 1.169
@@ -150,13 +150,6 @@
// file uploading class
require('includes/classes/upload.php');
-// the following cache blocks are used in the Tools->Cache section
-// ('language' in the filename is automatically replaced by available languages)
- $cache_blocks = array(array('title' => TEXT_CACHE_CATEGORIES, 'code' => 'category_tree', 'file' => 'category_tree-language.cache', 'multiple' => false),
- array('title' => TEXT_CACHE_MANUFACTURERS, 'code' => 'manufacturers', 'file' => 'manufacturers_box-language.cache', 'multiple' => true),
- array('title' => TEXT_CACHE_ALSO_PURCHASED, 'code' => 'also_purchased', 'file' => 'also_purchased-language.cache', 'multiple' => true)
- );
-
// check if a default currency is set
if (!defined('DEFAULT_CURRENCY')) {
$messageStack->add(ERROR_NO_DEFAULT_CURRENCY_DEFINED, 'error');
----------
admin /admin /includes /functions
general.php 1.166 -> 1.167
diff -u -r1.166 -r1.167
--- general.php 2004/08/17 23:50:13 1.166
+++ general.php 2004/08/18 11:49:37 1.167
@@ -923,8 +923,8 @@
tep_db_query("delete from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . (int)$category_id . "'");
tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$category_id . "'");
- tep_reset_cache_block('categories');
- tep_reset_cache_block('also_purchased');
+ osC_Cache::reset('categories');
+ osC_Cache::reset('also_purchased');
}
function tep_remove_product($product_id) {
@@ -954,8 +954,8 @@
}
tep_db_query("delete from " . TABLE_REVIEWS . " where products_id = '" . (int)$product_id . "'");
- tep_reset_cache_block('categories');
- tep_reset_cache_block('also_purchased');
+ osC_Cache::reset('categories');
+ osC_Cache::reset('also_purchased');
}
function tep_remove_order($order_id, $restock = false) {
@@ -971,40 +971,6 @@
tep_db_query("delete from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int)$order_id . "'");
tep_db_query("delete from " . TABLE_ORDERS_STATUS_HISTORY . " where orders_id = '" . (int)$order_id . "'");
tep_db_query("delete from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int)$order_id . "'");
- }
-
- function tep_reset_cache_block($cache_block) {
- global $cache_blocks;
-
- for ($i=0, $n=sizeof($cache_blocks); $i<$n; $i++) {
- if ($cache_blocks[$i]['code'] == $cache_block) {
- if ($cache_blocks[$i]['multiple']) {
- if ($dir = @opendir(DIR_FS_CACHE)) {
- while ($cache_file = readdir($dir)) {
- $cached_file = $cache_blocks[$i]['file'];
- $languages = tep_get_languages();
- for ($j=0, $k=sizeof($languages); $j<$k; $j++) {
- $cached_file_unlink = ereg_replace('-language', '-' . $languages[$j]['directory'], $cached_file);
- if (ereg('^' . $cached_file_unlink, $cache_file)) {
- @unlink(DIR_FS_CACHE . $cache_file);
- }
- }
- }
- closedir($dir);
- }
- } else {
- $cached_file = $cache_blocks[$i]['file'];
- $languages = tep_get_languages();
- for ($j=0, $k=sizeof($languages); $j<$k; $j++) {
- $cached_file_unlink = ereg_replace('-language', '-' . $languages[$j]['directory'], $cached_file);
- if (file_exists(DIR_FS_CACHE . $cached_file_unlink)) {
- @unlink(DIR_FS_CACHE . $cached_file_unlink);
- }
- }
- }
- break;
- }
- }
}
function tep_get_file_permissions($mode) {
----------
admin /admin /includes /languages /english
cache.php 1.10 -> 1.11
diff -u -r1.10 -r1.11
--- cache.php 2003/07/06 20:33:01 1.10
+++ cache.php 2004/08/18 11:49:38 1.11
@@ -5,20 +5,21 @@
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
- Copyright (c) 2002 osCommerce
+ Copyright (c) 2004 osCommerce
Released under the GNU General Public License
*/
-define('HEADING_TITLE', 'Cache Control');
+ define('HEADING_TITLE', 'Cache Control');
-define('TABLE_HEADING_CACHE', 'Cache Blocks');
-define('TABLE_HEADING_DATE_CREATED', 'Date Created');
-define('TABLE_HEADING_ACTION', 'Action');
+ define('TABLE_HEADING_CACHE', 'Cache Blocks');
+ define('TABLE_HEADING_TOTAL', 'Total');
+ define('TABLE_HEADING_LAST_MODIFIED', 'Last Modified');
+ define('TABLE_HEADING_ACTION', 'Action');
-define('TEXT_FILE_DOES_NOT_EXIST', 'File does not exist');
-define('TEXT_CACHE_DIRECTORY', 'Cache Directory:');
+ define('TEXT_FILE_DOES_NOT_EXIST', 'File does not exist');
+ define('TEXT_CACHE_DIRECTORY', 'Cache Directory:');
-define('ERROR_CACHE_DIRECTORY_DOES_NOT_EXIST', 'Error: Cache directory does not exist. Please set this Configuration->Cache.');
-define('ERROR_CACHE_DIRECTORY_NOT_WRITEABLE', 'Error: Cache directory is not writeable.');
+ define('ERROR_CACHE_DIRECTORY_DOES_NOT_EXIST', 'Error: Cache directory does not exist. Please set this Configuration->Cache.');
+ define('ERROR_CACHE_DIRECTORY_NOT_WRITEABLE', 'Error: Cache directory is not writeable.');
?>
----------
admin /admin /includes /languages /espanol
cache.php 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- cache.php 2003/07/06 20:33:01 1.13
+++ cache.php 2004/08/18 11:49:38 1.14
@@ -5,20 +5,21 @@
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
- Copyright (c) 2003 osCommerce
+ Copyright (c) 2004 osCommerce
Released under the GNU General Public License
*/
-define('HEADING_TITLE', 'Control de Caché');
+ define('HEADING_TITLE', 'Control de Caché');
-define('TABLE_HEADING_CACHE', 'Paneles');
-define('TABLE_HEADING_DATE_CREATED', 'Fecha de Creación');
-define('TABLE_HEADING_ACTION', 'Acción');
+ define('TABLE_HEADING_CACHE', 'Paneles');
+ define('TABLE_HEADING_TOTAL', 'Total');
+ define('TABLE_HEADING_LAST_MODIFIED', 'Modificado');
+ define('TABLE_HEADING_ACTION', 'Acción');
-define('TEXT_FILE_DOES_NOT_EXIST', 'No existe fichero');
-define('TEXT_CACHE_DIRECTORY', 'Directorio para la Caché: ');
+ define('TEXT_FILE_DOES_NOT_EXIST', 'No existe fichero');
+ define('TEXT_CACHE_DIRECTORY', 'Directorio para la Caché: ');
-define('ERROR_CACHE_DIRECTORY_DOES_NOT_EXIST', 'Error: No existe el directorio para la caché. Especifique un directorio valido en Configuración->Caché.');
-define('ERROR_CACHE_DIRECTORY_NOT_WRITEABLE', 'Error: No hay permiso de escritura en el directorio para la caché.');
+ define('ERROR_CACHE_DIRECTORY_DOES_NOT_EXIST', 'Error: No existe el directorio para la caché. Especifique un directorio valido en Configuración->Caché.');
+ define('ERROR_CACHE_DIRECTORY_NOT_WRITEABLE', 'Error: No hay permiso de escritura en el directorio para la cach�');
?>
----------
admin /admin /includes /languages /german
cache.php 1.13 -> 1.14
diff -u -r1.13 -r1.14
--- cache.php 2003/05/03 20:52:25 1.13
+++ cache.php 2004/08/18 11:49:38 1.14
@@ -5,20 +5,21 @@
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
- Copyright (c) 2002 osCommerce
+ Copyright (c) 2004 osCommerce
Released under the GNU General Public License
*/
-define('HEADING_TITLE', 'Cache Steuerung');
+ define('HEADING_TITLE', 'Cache Steuerung');
-define('TABLE_HEADING_CACHE', 'Cache Blöcke');
-define('TABLE_HEADING_DATE_CREATED', 'erstellt am');
-define('TABLE_HEADING_ACTION', 'Aktion');
+ define('TABLE_HEADING_CACHE', 'Cache Blöcke');
+ define('TABLE_HEADING_TOTAL', 'Gesamt');
+ define('TABLE_HEADING_LAST_MODIFIED', 'Letzte Änderung');
+ define('TABLE_HEADING_ACTION', 'Aktion');
-define('TEXT_FILE_DOES_NOT_EXIST', 'Datei ist nicht vorhanden');
-define('TEXT_CACHE_DIRECTORY', 'Cache Verzeichnis:');
+ define('TEXT_FILE_DOES_NOT_EXIST', 'Datei ist nicht vorhanden');
+ define('TEXT_CACHE_DIRECTORY', 'Cache Verzeichnis:');
-define('ERROR_CACHE_DIRECTORY_DOES_NOT_EXIST', 'Fehler: Das Cache Verzeichnis ist nicht vorhanden. Please set it in Konfiguration / Cache');
-define('ERROR_CACHE_DIRECTORY_NOT_WRITEABLE', 'Fehler: Das Cache Verzeichnis ist schreibgeschützt.');
-?>
\ No newline at end of file
+ define('ERROR_CACHE_DIRECTORY_DOES_NOT_EXIST', 'Fehler: Das Cache Verzeichnis ist nicht vorhanden. Please set it in Konfiguration / Cache');
+ define('ERROR_CACHE_DIRECTORY_NOT_WRITEABLE', 'Fehler: Das Cache Verzeichnis ist schreibgeschützt.');
+?>
----------
admin /admin /templates /pages
cache.php added at 1.1
diff -N cache.php
--- /dev/null Wed Aug 18 13:49:32 2004
+++ /tmp/cvsAAAyPaqwO Wed Aug 18 13:49:40 2004
@@ -0,0 +1,70 @@
+<?php
+/*
+ $Id$
+
+ osCommerce, Open Source E-Commerce Solutions
+ http://www.oscommerce.com
+
+ Copyright (c) 2004 osCommerce
+
+ Released under the GNU General Public License
+*/
+
+ require('includes/classes/directory_listing.php');
+ $osC_DirectoryListing = new osC_DirectoryListing(DIR_FS_WORK);
+ $osC_DirectoryListing->setIncludeDirectories(false);
+ $osC_DirectoryListing->setCheckExtension('cache');
+ $files = $osC_DirectoryListing->getFiles();
+
+ $cached_files = array();
+
+ foreach ($files as $file) {
+ $last_modified = filemtime(DIR_FS_WORK . '/' . $file['name']);
+
+ if (strpos($file['name'], '-') !== false) {
+ $code = substr($file['name'], 0, strpos($file['name'], '-'));
+ } else {
+ $code = substr($file['name'], 0, strpos($file['name'], '.'));
+ }
+
+ if (isset($cached_files[$code])) {
+ $cached_files[$code]['total']++;
+
+ if ($last_modified > $cached_files[$code]['last_modified']) {
+ $cached_files[$code]['last_modified'] = $last_modified;
+ }
+ } else {
+ $cached_files[$code] = array('total' => 1,
+ 'last_modified' => $last_modified);
+ }
+ }
+?>
+
+<h1><?php echo HEADING_TITLE; ?></h1>
+
+<table border="0" width="100%" cellspacing="0" cellpadding="2" class="dataTable">
+ <thead>
+ <tr>
+ <th><?php echo TABLE_HEADING_CACHE; ?></th>
+ <th><?php echo TABLE_HEADING_TOTAL; ?></th>
+ <th><?php echo TABLE_HEADING_LAST_MODIFIED; ?></th>
+ <th><?php echo TABLE_HEADING_ACTION; ?></th>
+ </tr>
+ </thead>
+ <tbody>
+<?php
+ foreach($cached_files as $cache => $stats) {
+?>
+ <tr onMouseOver="rowOverEffect(this);" onMouseOut="rowOutEffect(this);">
+ <td><?php echo $cache; ?></td>
+ <td align="center"><?php echo $stats['total']; ?></td>
+ <td align="right"><?php echo strftime(DATE_TIME_FORMAT, $stats['last_modified']); ?></td>
+ <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_CACHE, 'cache=' . $cache . '&action=reset') . '">' . tep_image('templates/' . $template . '/images/icons/16x16/delete.png', IMAGE_DELETE, '16', '16') . '</a>'; ?></td>
+ </tr>
+<?php
+ }
+?>
+ </tbody>
+</table>
+
+<p><?php echo TEXT_CACHE_DIRECTORY . ' ' . DIR_FS_WORK; ?></p>
CVSspam 0.2.9
-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285