chamilo / chamilo-lms

Chamilo is a learning management system focused on ease of use and accessibility
https://chamilo.org
GNU General Public License v3.0
804 stars 480 forks source link

track_e_downloads cleaning-archiving #2975

Closed marshel closed 4 years ago

marshel commented 5 years ago

Is your feature request related to a problem? Please describe. Database table track_e_downlodas gets bigger and bigger with info that is just space hogging, for example, SCORM packages that contains small images and UI elements, animations... got all logged, causing the database inflation in size and possible slowdowns. In my use case, a 10k users system in 1 month got a 13 million rows.

Describe the solution you'd like A cron to or archive on a file/other table or, truncate the data beyond XX days.

Additional context This table seems only a way to get statistical data about what tools are being used by students and this resources it uses are too expensive for just that. Its use should be analysed for future. Maybe another database or no SQL database would fare better for this kind of task.

opensourcecompany commented 5 years ago

+1

Coursenligne commented 5 years ago

I do agree :)

ywarnier commented 4 years ago

I have added the main/cron/archive_table_records.php script. It can only be started from the command line (or a cron script that doesn't use HTTP) and is fairly easy to use:

Warning: this will indeed remove the $archiveNumber number of records from the original table(s) to the new archive table(s) suffixed with the current year number.

For example, if only "track_e_downloads" is present in $tables, the script will:

There is enough space to improve this script in the future, but for now I believe it fills the need described in this issue.

Please give us feedback in the next 7 days or this issue will be considered closed.

ywarnier commented 4 years ago

Don't run it before you configure it, as you might accidentally move 10M records...