Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Forced site cleaning
You don't have permission for this action!
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Support

2023-10-04 11:44:32



Bonjour et pouvez vous me dire si il y a un moyen ou un code a ajouter dans le fichier cleanup.php afin de faire automatiquement  le nettoyage du site toute les heures pour ne pas devoir cliqué" sur Forced site cleaning dans admin.cp.php, merci d'avance

Last cleanup performed: 0 days, 0 hrs, 5 minutes, 27 seconds ago. [Nettoyage forcé du site]




Hello and can you tell me if there is a way or a code to add in the cleanup.php file in order to automatically clean the site every hour so as not to have to click on Forced site cleaning in admin.cp.php , thanks in advance

Last cleanup performed: 0 days, 0 hrs, 5 minutes, 27 seconds ago. [Forced site cleaning]
Last edited by niki on 2023-10-04 11:46:19
2023-10-04 21:07:46
Hi niki,
in config.php is option to make it every hour:

$site_config['autoclean_interval'] = '3600';


www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2023-10-05 08:30:43
thank you botanicar but there is a problem I did tests with several configurations by modifying the temp and it is not up to date??

$site_config['autoclean_interval'] = '3600';

$site_config['autoclean_interval'] = '600';

$site_config['autoclean_interval'] = '60';

$site_config['autoclean_interval'] = '6';
2023-10-05 16:44:24
functions.php


//== Start of Main Cleanup
function autoclean() {
   global $site_config;
   require_once("cleanup.php");

   $now = gmtime();

   $res = SQL_Query_exec("SELECT last_time FROM tasks WHERE task='cleanup'");
   $row = mysqli_fetch_row($res);
   if (!$row) {
       SQL_Query_exec("INSERT INTO tasks (task, last_time) VALUES ('cleanup',$now)");
       return;
   }
   $ts = $row[0];
   if ($ts + $site_config["autoclean_interval"] > $now)
       return;
   SQL_Query_exec("UPDATE tasks SET last_time=$now WHERE task='cleanup' AND last_time = $ts");
   if (!mysqli_affected_rows($GLOBALS["DBconnector"]))
       return;

   do_cleanup();
}
//== End of Main Cleanup



www.exyusubs.com
TorrentTrader V3.8.3 (SE)
OS: AlmaLinux 9.9 (BC)
Apache version: 2.4.71
PHP version: 8.5.13 (PHP-FPM)
MySQL version: 10.11.18-MariaDB
2023-10-05 17:43:51
thank you but there is already this part of code and it does not work I have to click manually in admin-cp because the automatic update does not work???
2023-10-06 04:03:29
is dbconn set to true on index.php cleanup is only run on index on TT
dbconn(true);

i would try remove times from sql where as well
SQL_Query_exec("UPDATE tasks SET last_time=$now WHERE task='cleanup'");

check if table task updates
Last edited by M-jay warn on 2023-10-06 04:06:21
2023-10-06 06:34:28

thank you for your help m-jay and can you tell me where to put this part of code??

SQL_Query_exec("UPDATE tasks SET last_time=$now WHERE task='cleanup'");
Last edited by niki on 2023-10-06 06:53:09
2023-10-06 10:52:16
replace
SQL_Query_exec("UPDATE tasks SET last_time=$now WHERE task='cleanup' AND last_time = $ts");

with
SQL_Query_exec("UPDATE tasks SET last_time=$now WHERE task='cleanup'");


for test only remove after
i would maybe try write_log so you can see in admin log -
   if ($ts + $site_config["autoclean_interval"] > $now)
      return;
  SQL_Query_exec("UPDATE tasks SET last_time=$now WHERE task='cleanup' AND last_time = $ts");
  if (!mysqli_affected_rows($GLOBALS["DBconnector"]))
      return;


replace with
   if ($ts + $site_config["autoclean_interval"] > $now)
       write_log("$ts below time");
return;
  SQL_Query_exec("UPDATE tasks SET last_time=$now WHERE task='cleanup'");
  if (!mysqli_affected_rows($GLOBALS["DBconnector"]))
      write_log("$ts not updated");
      return;
Last edited by M-jay warn on 2023-10-06 10:53:45
2023-10-06 12:15:23
thanks m-jay I made the changes and still the same thing??
2023-10-06 18:48:20
Instead of $now (depending on how timezones are treated) you should use NOW() in place of $now, or for compatibility across different engines, use CURRENT_TIMESTAMP
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 2
  • Members: 0
  • Guests online: 2
  • Comments: 3
  • Messages: 1,728