4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: V@no on June 19, 2005, 07:50:33 PM

Title: [MOD] Cache System for 4images v1.7
Post by: V@no on June 19, 2005, 07:50:33 PM
This is an adopted for 4images v1.7 cache feature from 4images v1.7.1


Step 1
Create a new file includes/cache_utils.php[/color]
With this code:
Code: [Select]
<?php
/************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: cache_utils.php                                      *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan at 4homepages.de                                 *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.1                                                *
 *                                                                        *
 *    Adopted for 4images v1.7 by V@no                                    *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) fN?r weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
if (!defined('ROOT_PATH')) {
  die("Security violation");
}

function 
create_cache_id($group$params null){
  $cache_id $group;
  if (is_array($params)) {
    $cache_id .= '.' implode('.'$params);
  } elseif (is_string($params)) {
    $cache_id .= '.' $params;
  }
  return $cache_id;
}

function 
get_cache_file($cache_id$lifetime null) {
  global $cache_enable$cache_lifetime$cache_path;

  if (!$cache_enable) {
    return false;
  }

  if (!$lifetime) {
    $lifetime $cache_lifetime;
  }

  $file $cache_path '/' $cache_id;

  if (!@is_readable($file)) {
    return false;
  }

  if ($lifetime == -|| (filemtime($file) + $lifetime) > time()) {
    if (!$fp = @fopen($file'rb')) {
        return false;
    }

    $data = @fread($fpfilesize($file));
    @fclose($fp);

    if (defined('PRINT_CACHE_MESSAGES') && PRINT_CACHE_MESSAGES == 1) {
      echo "Cache file '$cache_id' <span style='color:green'>used</span><br>";
    }

    // Replace session ids
    global $site_sess;
    $replace $site_sess->mode == 'cookie' '' '\1\2'.SESSION_NAME.'='.$site_sess->session_id;
    $data preg_replace(
      '#([\?|&])+(amp;)?%%%SID%%%#',
      $replace,
      $data
    
);

    return $data;
  }

  if (defined('PRINT_CACHE_MESSAGES') && PRINT_CACHE_MESSAGES == 1) {
    echo "Cache file '$cache_id' <span style='color:purple'>expired</span><br>";
  }

  return false;
}

function 
save_cache_file($cache_id$data) {
  global $cache_enable$cache_lifetime$cache_path;

  if (!$cache_enable) {
    return false;
  }

  $file $cache_path '/' $cache_id;

  if ($fp = @fopen($file'wb')) {
    // Replace session ids
    global $site_sess;
    $data str_replace(
      SESSION_NAME.'='.$site_sess->session_id,
      '%%%SID%%%',
      $data
    
);

    @flock($fpLOCK_EX);
    @fwrite($fp$data);
    @flock($fpLOCK_UN);
    @fclose($fp);

    if (defined('PRINT_CACHE_MESSAGES') && PRINT_CACHE_MESSAGES == 1) {
      echo "Cache file '$cache_id' <span style='color:red'>stored</span><br>";
    }

    return true;
  }

  @fclose($fp);

  return false;
}

function 
delete_cache_file($cache_id) {
  global $cache_enable$cache_lifetime$cache_path;

  if (defined('PRINT_CACHE_MESSAGES') && PRINT_CACHE_MESSAGES == 1) {
    echo "Cache file '$cache_id' <span style='color:red'>deleted</span><br>";
  }

  return @unlink($cache_path '/' $cache_id);
}

function 
delete_cache_group($group) {
  global $cache_enable$cache_lifetime$cache_path;

  $handle = @opendir($cache_path); 

  while ($file = @readdir($handle)) { 
    if (is_dir($file) || $file{0} == ".") {
      continue;
    }

    if (strpos($file$group) === 0) {
      unlink($cache_path '/' $file);
    }
  }

  if (defined('PRINT_CACHE_MESSAGES') && PRINT_CACHE_MESSAGES == 1) {
    echo "Cache group '$group' <span style='color:red'>deleted</span><br>";
  }
}

function 
clear_cache() {
  global $cache_enable$cache_lifetime$cache_path;

  $handle opendir($cache_path);

  while ($file = @readdir($handle)) {
    if (is_dir($file) || $file{0} == ".") {
      continue;
    }

    unlink($cache_path '/' $file);
  }
}

?>



Step 2
Open global.php
Find:
Code: [Select]
@include(ROOT_PATH.'config.php');
Add above:
Code: [Select]
//-----------------------------------------------------
//--- Cache -------------------------------------------
//-----------------------------------------------------
include(ROOT_PATH.'includes/cache_utils.php');
// Initialize cache configuration
define('PRINT_CACHE_MESSAGES', 0); //show some debug messages
$cache_enable = 1;
$cache_lifetime = 3600; // 1 hour
$cache_path = ROOT_PATH.'cache';

$cache_page_index = 1; //index.php
$cache_page_categories = 1; //categories.php
$cache_page_top = 1; //top.php
//End Initialize cache configuration



Step 3
Open index.php
Find:
Code: [Select]
//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------

Add above:
Code: [Select]
$cache_id = create_cache_id(
  'cat.page.index',
  array(
    $user_info[$user_table_fields['user_id']],
    isset($user_info['lightbox_image_ids']) ? substr(md5($user_info['lightbox_image_ids']), 0, 8) : 0,
    $config['template_dir'],
    $config['language_dir']
  )
);
if (!$cache_page_index || !$content = get_cache_file($cache_id)) {
// Always append session id if cache is enabled
if ($cache_page_index) {
  $old_session_mode = $site_sess->mode;
  $site_sess->mode = 'get';
}

ob_start();


Step 3.1
Find:
Code: [Select]
$site_template->print_template($site_template->parse_template($main_template));(if u have more then one instance of this line, then find the last one, close to the end of the file)

Add below:
Code: [Select]
$content = ob_get_contents();
ob_end_clean();

if ($cache_page_index) {
  // Reset session mode
  $site_sess->mode = $old_session_mode;
  save_cache_file($cache_id, $content);
}
} // end if get_cache_file()
echo $content;



Step 4
Open categories.php
Find:
Code: [Select]
//-----------------------------------------------------
//--- Show Categories ---------------------------------
//-----------------------------------------------------

Add above:
Code: [Select]
$cache_id = create_cache_id(
  'cat.page.categories',
  array(
    $user_info[$user_table_fields['user_id']],
    $cat_id,
    $page,
    $perpage,
    isset($user_info['lightbox_image_ids']) ? substr(md5($user_info['lightbox_image_ids']), 0, 8) : 0,
    $config['template_dir'],
    $config['language_dir']
  )
);

if (!$cache_page_categories || !$content = get_cache_file($cache_id)) {
// Always append session id if cache is enabled
if ($cache_page_categories) {
  $old_session_mode = $site_sess->mode;
  $site_sess->mode = 'get';
}

ob_start();


Step 4.1
Find:
Code: [Select]
$site_template->print_template($site_template->parse_template($main_template));(if u have more then one instance of this line, then find the last one, close to the end of the file)

Add below:
Code: [Select]
$content = ob_get_contents();
ob_end_clean();

if ($cache_page_categories) {
  // Reset session mode
  $site_sess->mode = $old_session_mode;

  save_cache_file($cache_id, $content);
}

} // end if get_cache_file()

echo $content;



Step 5
Open top.php
Find:
Code: [Select]
include(ROOT_PATH.'includes/page_header.php');
Add below:
Code: [Select]
$cache_id = create_cache_id(
  'top',
  array(
    $user_info[$user_table_fields['user_id']],
    $cat_id,
    $config['template_dir'],
    $config['language_dir']
  )
);

if (!$cache_page_top || !$content = get_cache_file($cache_id)) {
if ($cache_page_top) {
  // Always append session id if cache is enabled
  $old_session_mode = $site_sess->mode;
  $site_sess->mode = 'get';
}

ob_start();


Step 5.1
Find:
Code: [Select]
$site_template->print_template($site_template->parse_template($main_template));(if u have more then one instance of this line, then find the last one, close to the end of the file)

Add below:
Code: [Select]
$content = ob_get_contents();
ob_end_clean();

if ($cache_page_top) {
  // Reset session mode
  $site_sess->mode = $old_session_mode;

  save_cache_file($cache_id, $content);
}

} // end if get_cache_file()

echo $content;



Step 6
Create a new folder cache[/color] in your 4images root directory. Make sure its writible (CHMOD 777)


Step 7 (optional)

Create a new file admin/plugins/clear_cache.php (create plugins folder if u dont have it yet) with the folowing code inside:
 
Code: [Select]
<?php // PLUGIN_TITLE: Clear Cache 
/************************************************************************** 
 *                                                                        * 
 *    4images - A Web Based Image Gallery Management System               * 
 *    ----------------------------------------------------------------    * 
 *                                                                        * 
 *             File: clear_cache.php                                      * 
 *        Copyright: (C) 2002 Jan Sorgalla                                * 
 *            Email: jan@4homepages.de                                    * 
 *              Web: http://www.4homepages.de                             * 
 *    Scriptversion: 1.7.1                                                * 
 *                                                                        * 
 *    Never released without support from: Nicky (http://www.nicky.net)   * 
 *                                                                        * 
 ************************************************************************** 
 *                                                                        * 
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       * 
 *    bedingungen (Lizenz.txt) f?tere Informationen.                 * 
 *    ---------------------------------------------------------------     * 
 *    This script is NOT freeware! Please read the Copyright Notice       * 
 *    (Licence.txt) for further information.                              * 
 *                                                                        * 
 *************************************************************************/ 

$nozip 1
define('IN_CP'1); 
$root_path "./../../"
define('ROOT_PATH'$root_path); 
require(
ROOT_PATH.'admin/admin_global.php'); 

if (
$config['language_dir'] == 'deutsch') { 
  $lang_clear_cache   'Cache leeren'
  $lang_clear_confirm 'Wollen Sie das Cache-Verzeichnis leeren (%s)?'
  $lang_clear_success 'Cache-Verzeichnis geleert'
} else { 
  $lang_clear_cache   'Clear Cache'
  $lang_clear_confirm 'Do you want to clear the cache directory (%s)?'
  $lang_clear_success 'Cache directory cleared'


show_admin_header(); 

if (
$action == "clearcache") { 
    @set_time_limit(0); 
    clear_cache(); 
    $msg $lang_clear_success


if (
$msg != "") { 
    printf("<b>%s</b>n"$msg); 


show_form_header($HTTP_SERVER_VARS['PHP_SELF'], "clearcache"); 
show_table_header($lang_clear_cache); 
show_description_row(sprintf($lang_clear_confirmrealpath($cache_path))); 
show_form_footer($lang['submit'], ""); 


show_admin_footer(); 
?>

Title: Re: [MOD] Cache System for 4images v1.7
Post by: ID25 on August 15, 2005, 12:51:42 AM
4images working very slowly, when many images loaded to the base,
without this MOD - site not working

~ 7000 IP per day
~ 23000 files in database
Server: Pentium4 3.2mhz, Ram: 1Gb, linux
only one 4images script on this server!

I think, there is BUG on 4images..
crashing mysql this script
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on August 15, 2005, 03:28:23 AM
Well, since v1.7 was using mysql to store sessions, its no wonder that mysql couldnt handle so many requests.
I've experienced 7000+ unique visitors per day ones, and can tell you, the pages were opening in about 2-3 minutes! At first I thought someone is hacking the server...(server P4 3.0Ghz HT, 2Gb RAM on Linux FC3 smp)

P.S. please stop looking for bugs in v1.7 ;)
Title: Re: [MOD] Cache System for 4images v1.7
Post by: JensF on August 15, 2005, 03:36:37 PM
What do this Mod???
Title: Re: [MOD] Cache System for 4images v1.7
Post by: ID25 on August 15, 2005, 07:19:48 PM
What do this Mod???
cashing your site
from version 1.7.1 this mod installed
Title: Re: [MOD] Cache System for 4images v1.7
Post by: ID25 on August 15, 2005, 07:40:38 PM
At first I thought someone is hacking the server...

NO someone hacking server, but 4images(1.7 and 1.7.1) without this MOD working bad(page opening ~2-3min. or not responding)
i think there must be big bug somewhere in this script...
maybe need remove ~5 tables from mysql or something... i dont know, there you are professional with PHP scripting.

other scripts for images work faster and no crashing mysql, why? maybe you know that..

If you know why, maybe you can post there MOD or something, who made better for speed?
Title: Re: [MOD] Cache System for 4images v1.7
Post by: ID25 on August 15, 2005, 11:26:29 PM
V@no: exuse me, but there is true, that 4images working very slow..
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on August 15, 2005, 11:50:25 PM
v1.7 is outdated and u cant expect much out of it. Install v1.7.1 then we'll talk if it slow or not ;)
Title: Re: [MOD] Cache System for 4images v1.7
Post by: ID25 on August 16, 2005, 12:38:50 AM
v1.7 is outdated and u cant expect much out of it. Install v1.7.1 then we'll talk if it slow or not ;)
at this time i have 1.7.1 installed in my site(working slow), but planning to install 1.7(removing now bugs updeiting with mods)
because on this version many mods and etc
Title: Re: [MOD] Cache System for 4images v1.7
Post by: ID25 on August 16, 2005, 12:40:24 AM
on version 1.7.1 if i not caching any pages --> script crashing mysql
on version 1.7 i can install caching mod too.
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on August 16, 2005, 12:43:55 AM
well, then assume u didnt get my point in my first reply...:?
Title: Re: [MOD] Cache System for 4images v1.7
Post by: ID25 on August 16, 2005, 12:55:28 AM
Hmz..
after you make caching system, 4images woking slow,
much better, but slowly :(

why others scripts for images working not slow?
mysql tables many, but working in normal mode..
and there is no need caching system..
i don't know this why :(
this script beautiful, but need something..
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on August 16, 2005, 01:03:07 AM
ok, let me repeate it for u:
4images v1.7 was using MySQL database to store and handle sessions, thats why your mysql server is getting crashed by too many connections....
Title: Re: [MOD] Cache System for 4images v1.7
Post by: ID25 on August 16, 2005, 01:07:12 AM
i understand this, but i repeating.. this problem with 1.7.1 too :cry:
site working slowly, all caching are "on", but..
Title: Re: [MOD] Cache System for 4images v1.7
Post by: ID25 on August 16, 2005, 07:26:59 PM
Maybe you can post there, how i can change in 1.7 version
that MySQL database to NOT store and handle sessions ?

There is good feature to all 4images administrators, because
if you installed 20-50 MODS, you can't rewrite all php to 1.7
if you want new 1.7.1 script.

Thank you V@no for all helps and wonderfull script
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on August 17, 2005, 01:14:29 AM
well, see, v1.7.1 is not only optimized with session handlers, it also has new template engine, and the entire code was little bit tweaked and optimized.
Title: Re: [MOD] Cache System for 4images v1.7
Post by: mentally on August 17, 2005, 02:07:33 AM
is there a drastic speed difference after installing this mod?  :?:
Title: Re: [MOD] Cache System for 4images v1.7
Post by: ID25 on August 17, 2005, 07:34:39 PM
i tested this MOD on 1.7ver. with 7000 IP per day, nothing good..

+50% speed after you install 1.7.1 only.
Title: Re: [MOD] Cache System for 4images v1.7
Post by: Hein on August 28, 2005, 09:31:29 PM
Dear All,

is it normal, that the cache files have 0 Byte?

The files are saved by me in folder "cache" but they have all 0 Byte...

The gallery is also not really quicklier.

I have already check all my steps and can´t find a mistake...

Sorry for my bad english and thanks for your help.

André
Title: Re: [MOD] Cache System for 4images v1.7
Post by: JensF on October 22, 2005, 10:24:55 AM
Hi there,

is there a way to ignore the user_loginform.html from the cache???

It where better for the PM Mod....
Title: Re: [MOD] Cache System for 4images v1.7
Post by: Nasser on November 08, 2005, 05:33:52 PM
sorry .. but what does this MOD do ?
what do you mean by Cache system for 4images
Title: Re: [MOD] Cache System for 4images v1.7
Post by: Acidgod on November 08, 2005, 06:04:06 PM
do you have 4images 1.71?
then you don´t need this Mod... (o:

Read the Cache.english.txt in the Docs Folder...
Title: Re: [MOD] Cache System for 4images v1.7
Post by: Nasser on November 08, 2005, 06:10:48 PM
No I don't .. I have v1.7 only ..
and can't change it coz I have lots of changes inside it like MODs ..
Title: Re: [MOD] Cache System for 4images v1.7
Post by: Acidgod on November 08, 2005, 06:14:31 PM
And you don´t now caching?  8O

Taken from the Cache.english.txt
Quote
The caching system saves results generated by the
  script as static html files to the disk.
  The next time a visitor requests a page, the result can be
  fetched from the cache and must not be generated again.

  This also has some "disadvantages": Dynamic data such as
  hits, ratings, random images and the "who's online" list
  will also be cached. This dynamic data never changes
  until a cache file is invalidated and generated again.
Title: Re: [MOD] Cache System for 4images v1.7
Post by: Nasser on November 09, 2005, 07:18:49 PM
I don't untill you've told me :D
thanks for your reply
I am caching now ;)
Title: Re: [MOD] Cache System for 4images v1.7
Post by: JensF on January 06, 2006, 12:34:35 AM
After re-do the step 1 i have this problem on my site. With the old cache_utils.php i have not this problem...

(http://www.terraristik-galerie.de/sonstiges/umlaut.gif)


*EDIT*

and now i have see i can´t log in and logout....i have upload the old cache_utils.php
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on January 06, 2006, 01:31:52 AM
As I mentioned before, I dont think this problem is related directly to this mod. Try to uninstall this mod (at least undo Step 1, 2 and 3 - asuming you see this problem on index.php, if not undo the changes in the file where the problem is)

Second, I see no such problem on your site neither in IE nor in FF.
But, I've noticed another thing that only showed in FF: there are some characters showed on top of each page. . I've experienced such myself in the past, and it turned out caused by my php editor that saved files in Unicode (UTF-8) encoding and added "BOM" identifications at the beginning of each file. Normaly any editor that supports Unicode/UTF8 does not show these characters, but PHP seems to treat them as a plane text and send them to the browser as plain text.

So, make sure you save your files in 8-bit ecoding (ISO) and not in unicode.

P.S. if you copy text from a web page that uses Unicode or UTF-8 and then paste it into notepad/wordpad and save it, it will save the file in Unicode or UTF-8 encoding.
Title: Re: [MOD] Cache System for 4images v1.7
Post by: JensF on January 06, 2006, 01:43:10 AM
Hi,

you have not seen the Problem while i have upload the old cache_utils.php.

For you i upload the new with the problems. Please look again and see the german version of the site.....

Quote
P.S. if you copy text from a web page that uses Unicode or UTF-8 and then paste it into notepad/wordpad and save it, it will save the file in Unicode or UTF-8 encoding.

i use notepad for all the files.....
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on January 06, 2006, 02:05:28 AM
i use notepad for all the files.....
Make sure you save files in ANSI encoding. But be carefull, you might endup with a space after each letter...

Your site is using ISO-8859-1 (Western European) encoding, yet, the text comming from the server is in Unicode with the BOM identification.

Try to use some more relible php editor (i.e. http://www.mpsoftware.dk/phpdesigner.php) ;)
Title: Re: [MOD] Cache System for 4images v1.7
Post by: JensF on January 06, 2006, 02:26:16 AM
hhmm, i don´t understand this. i have install the php editor what you say and i have open the index.php with it. i have save it and upload to my site. but no changes i can see.

i have test wordpad and the same.

i don´t understand this all....
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on January 06, 2006, 02:37:46 AM
Its not only the index.php its all files that you've edited recently, including cache_utils.php
Title: Re: [MOD] Cache System for 4images v1.7
Post by: JensF on January 06, 2006, 02:42:21 AM
you mean i must open all my php files with the new editor, save it and upload it and then it works????

i have test it with the index,php, cache_utils.php and the lang/main.php

*EDIT*

i have open the index.php with the notepad and i have save the file in unicode....

this is the result...

(http://www.terraristik-galerie.de/sonstiges/unicode.gif)
Title: Re: [MOD] Cache System for 4images v1.7
Post by: michi-w. on February 08, 2006, 11:04:46 PM
Hallo,

ich habe den Grund und die Funktion des Mods nicht verstanden, könnte mir das jemand erklären?

I not yet understood the reason and the function, could explain that someone to myself?

Gruß
michi-w.

Title: Re: [MOD] Cache System for 4images v1.7
Post by: JensF on February 09, 2006, 02:44:12 PM
Hallo,

ich habe den Grund und die Funktion des Mods nicht verstanden, könnte mir das jemand erklären?

I not yet understood the reason and the function, could explain that someone to myself?

Gruß
michi-w.



Der Mod speichert relevante Sachen in einem Ordner deines Webspace. Diese Sachen werden eine Zeitlang gespeichert und wenn ein User innerhalb dieser Zeit deine Seite wieder besucht werden diese Dinge aus diesem Ordner geholt und nicht neu geladen. Das beschleunigt den Seitenaufbau.
Title: Re: [MOD] Cache System for 4images v1.7
Post by: michi-w. on February 09, 2006, 10:41:17 PM
Danke!
Title: Re: [MOD] Cache System for 4images v1.7
Post by: kief24 on March 18, 2006, 09:20:42 AM
would it be possible to empty the cache directory automaticly ?
Like every 24 hrs ?
Otherwise i think this directory can grow to immense proportions if you don't empty it from ACP regulary.

Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on March 18, 2006, 02:11:50 PM
will a script for cronjob satisfy you?
Title: Re: [MOD] Cache System for 4images v1.7
Post by: kief24 on March 18, 2006, 08:54:48 PM
yes, that would be very nice !
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on March 18, 2006, 09:54:05 PM
Ok, here is a unix command that will remove any files that were modifyed more then 24 hours ago:[qcode] find /full/local/path/to/your/4images/folder/cache -maxdepth 1 -type f -daystart -ctime +1 -delete[/qcode] but before you do that, fist test it with this command:[qcode] find /full/local/path/to/your/4images/folder/cache -maxdepth 1 -type f -daystart -ctime +1 -print[/qcode]make sure it printed the correct files ;)
Title: Re: [MOD] Cache System for 4images v1.7
Post by: kief24 on March 19, 2006, 09:02:14 AM
works perfect ! thx a lot !
Title: Re: [MOD] Cache System for 4images v1.7
Post by: kief24 on March 20, 2006, 09:37:58 AM
the test with the -print worked fine, but when i use -delete i get an email with :

find: invalid predicate `-delete'


i suppose this means '-delete' is not valid ?

----------------------------------------------------------------------
find /home/*****/public_html/cache -maxdepth 1 -type f -daystart -ctime +1 -delete
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on March 20, 2006, 02:27:11 PM
Ok, then first try this:[qcode] find /full/local/path/to/your/4images/folder/cache -maxdepth 1 -type f -daystart -ctime +1 -exec rm {} \; -print[/qcode]

If that doesnt work, then try this:[qcode] find /full/local/path/to/your/4images/folder/cache -maxdepth 1 -type f -daystart -ctime +1 | xargs rm[/qcode]
Title: Re: [MOD] Cache System for 4images v1.7
Post by: ciprianmp on April 01, 2006, 01:17:30 PM
I apologize for this stupid question, but this is the first time I use a cron job (in cpanel, right?).
Please tell me if this path would be correct (I have the 4images installed in gallery folder on my home directory):
Code: [Select]
/public_html/gallery/cache or it has to be like this?
Code: [Select]
full/local/public_html/gallery/cache Addition: Ok! I got it it should have been /home/cpanelusername/public_html/gallery/chache.

How do I actually see the -print results? Is there a page where I should check? Or it should be in the cpanel?
Addition: Well, I didn't notice there is an email address you can set to receive the output. Thanks!
Thank you V@no!
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on April 01, 2006, 06:29:42 PM
There are two options:
1) you must have SSH access to your server and run that command from the shell.
2) use this command instead:[qcode] find /full/local/path/to/your/4images/folder/cache -maxdepth 1 -type f -daystart -ctime +1 -print > /tmp/cronoutput.txt[/qcode]
The /tmp/cronoutput.txt file must be exists before you execute the command. Once cronjob executed this command, it should save output into the /tmp/cronoutput.txt file.
Title: Re: [MOD] Cache System for 4images v1.7
Post by: ciprianmp on April 03, 2006, 10:01:55 AM
I've tryed all your commands. Only the print ones worked for me. There is a documentation about cronjob cpanel UNIX commands syntaxes?
How do I use SSH on my site? Can you teach me please?
Title: Re: [MOD] Cache System for 4images v1.7
Post by: ciprianmp on April 04, 2006, 12:48:18 AM
 :wink:
For me, this is your code it finally worked!
Code: [Select]
find /home/cpanelusername/public_html/gallery/chache -maxdepth 1 -type f -daystart -ctime +1 -exec rm {} \; -print
Thank you V@no!

PS: any hints about documentation and SSH? (previous post)
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on April 04, 2006, 01:03:53 AM
Can you teach me please?
You are misstaken if you think I know alot about linux...I'm total lamer and know only what I had to do once, nothin beyond that.
Title: Re: [MOD] Cache System for 4images v1.7
Post by: waleed on April 07, 2006, 02:44:44 AM
would it be possible to empty the cache directory automaticly ?
without doing that from ACP ?  and without cronjon ?
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on April 07, 2006, 02:46:39 AM
no
Title: Re: [MOD] Cache System for 4images v1.7
Post by: sigma. on April 15, 2006, 05:35:17 PM
Installed this mod but something odd happens after a couple of tries.

my index page comes up blank. any ideas? Just a white page for the index.
Title: Re: [MOD] Cache System for 4images v1.7
Post by: aletapety on June 06, 2006, 10:54:04 PM
Hello

I have 1.7.2 when i set activate Mod Limit Category Per Page doesn't work  :? ,work only first page ,i see second page but when i click do ex. 2 or 3 i'm redirect to first  :cry:
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on June 07, 2006, 01:20:30 AM
I hope you didnt install this mod on v1.7.2....this mod is only for v1.7 and v1.7.2 already comes with cache system build-in. If you have problem with build-in cache system, then start a new topic in troubleshooting section.
Title: Re: [MOD] Cache System for 4images v1.7
Post by: aletapety on June 07, 2006, 01:27:39 AM
I hope you didnt install this mod on v1.7.2....this mod is only for v1.7 and v1.7.2 already comes with cache system build-in. If you have problem with build-in cache system, then start a new topic in troubleshooting section.

I now is already comes but this topic is for Cache  :wink: , ok new topic http://www.4homepages.de/forum/index.php?topic=13251.new#new
Title: Re: [MOD] Cache System for 4images v1.7
Post by: Naveen on July 02, 2006, 03:25:57 PM
Thankyou for this Mod V@no, You have been great as ever :)

I was able to bring down my server load from 90% to 0.90%

Thank you  :mrgreen:
Title: Re: [MOD] Cache System for 4images v1.7
Post by: tradenet on July 02, 2006, 09:27:18 PM
It appears Firefox browser doesn't like it with Gzip compression enabled.
You have to disable compression for it to work in your settings.
IE doesn't seem to have an issue with this.


Installed this mod but something odd happens after a couple of tries.

my index page comes up blank. any ideas? Just a white page for the index.
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on July 02, 2006, 10:06:42 PM
FF and any other modern browser have no issues with Gzip compression, unless the Gzip compressed page is corrupted (i.e. it has some non-compressed data before or after compressed data)
Title: Re: [MOD] Cache System for 4images v1.7
Post by: tradenet on July 03, 2006, 01:34:13 AM
Interesting.  8O
When I disable this mod it works fine with compression. When I enable this MOD I get the "blank page" in FF. I disable compression it works fine. IE has no issues either way.


FF and any other modern browser have no issues with Gzip compression, unless the Gzip compressed page is corrupted (i.e. it has some non-compressed data before or after compressed data)
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on July 03, 2006, 02:23:49 AM
as I said, different browsers handle differently corrupted pages...so, basicaly what I'm trying to say, is that your gallery most probably produces corrupted gzip compressed data...
Title: Re: [MOD] Cache System for 4images v1.7
Post by: tradenet on July 03, 2006, 02:31:24 AM
What I'm saying is without this MOD in place Gzip enabled compression works fine across all browsers.
However, when I install this MOD it doesn't.  :?

as I said, different browsers handle differently corrupted pages...so, basicaly what I'm trying to say, is that your gallery most probably produces corrupted gzip compressed data...
Title: Re: [MOD] Cache System for 4images v1.7
Post by: V@no on July 03, 2006, 03:21:56 AM
can I test it?
Title: Re: [MOD] Cache System for 4images v1.7
Post by: tradenet on July 12, 2006, 05:14:41 PM
rss feeds mods break too.
Title: Re: [MOD] Cache System for 4images v1.7
Post by: alekseyn1 on February 02, 2007, 03:49:15 AM
this mod helps me a lot (i am still on 1.7 within runcms 1.5)! Thanks! I had trouble with video categories. Now it's much better! Thanks a lot again.