Hi Jan,
Thanks a lot for your reply and sorry for my delay.
I had a look at the file admin/models/phocadownloadfile.php and the code is there as you have expected, but the problem still remains.
Is it possible that the database is 'corrupted' and if so, is there a way to check the database for errors or to reset/clean the statistics table?
Some time before, I mentioned that there are some entries in the statistics table but the fileids do not exist.
See this screenshot of the database table.
The corresponding files are no longer present on my machine and in the screenshot you can see that 'count' was reset but the entries were not removed after I deleted the files.
I really don't know what else I can do.
BTW I put a 'trap' in your code in order to see if anything happens when I click 'Reset' - but nothing happend.
In line 421 of phocadownloadfile.php the function starts with: if (count( $cid )) {...
That's possibly the reason for this. I don't know where '$cid' comes from.
Regards Mike
Phoca Download - Faulty behavior of 'reset downloads' function in control center
- madmetz
- Phoca Member
- Posts: 34
- Joined: 08 Apr 2019, 16:20
- Jan
- Phoca Hero
- Posts: 48550
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Download - Faulty behavior of 'reset downloads' function in control center
Hi, reset only changes the existing items to get zero insteand of some set value. It just doesn't delete or manage the files (detect if they are exists or not). This is managed by deleting function. If you delete a file in Phoca Download, it will take a look at statistics table and will delete all information auch such file. If there are some obsolete items included, I think the statistics table should be truncated directly in the database (be aware all statistics data will be removed) or if you need to remove only specific files, then it should be done manually in the e.g. phpMaAdmin. When you remove the obsolete data, this should no more happen because all statistics data will be deleted when deleting a file for now.
Jan
Jan
If you find Phoca extensions useful, please support the project
- madmetz
- Phoca Member
- Posts: 34
- Joined: 08 Apr 2019, 16:20
Re: Phoca Download - Faulty behavior of 'reset downloads' function in control center
Hi Jan,
The problem seems to be solved now, because your fix worked only for the admin part of the issue.
I tried it every time with users from frontend. - Anyway
Now I put the following code in "components/com_phocadownload/models/user.php" @line 557
Please let me know if this is ok for you (and the next version).
Regards Mike
The problem seems to be solved now, because your fix worked only for the admin part of the issue.
I tried it every time with users from frontend. - Anyway
Now I put the following code in "components/com_phocadownload/models/user.php" @line 557
Code: Select all
//Delete record from statistics table
$query = 'DELETE FROM #__phocadownload_user_stat WHERE fileid='.(int)$id;
$this->_db->setQuery( $query );
if(!$this->_db->query()) {
throw new Exception('Database Error - Delete User Stats (Files)', 500);
return false;
}
Regards Mike
- Jan
- Phoca Hero
- Posts: 48550
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Download - Faulty behavior of 'reset downloads' function in control center
Hi, OK, thank you very much for the info, yes, I will set it for the next version.
Thank you, Jan
Thank you, Jan
If you find Phoca extensions useful, please support the project
- Jan
- Phoca Hero
- Posts: 48550
- Joined: 10 Nov 2007, 18:23
- Location: Czech Republic
- Contact:
Re: Phoca Download - Faulty behavior of 'reset downloads' function in control center
If you find Phoca extensions useful, please support the project