Page 3 of 3

Re: Minor errors in 5 Beta 25

Posted: 11 Mar 2024, 21:04
by lpatrick
Thank you Jan
Jan wrote: 11 Mar 2024, 14:19 ...
several ten thousands of subfolders in one folder, holding only one file each is not very practical to say the least.
Yes, having a lot of folders/files is always not good, but in last time I solve problems where some extensions just store all possible files into one folder and there are many thousands of files in one folder and such cannot be read by any tool, because such large amount of files is not loaded in time.
...
Jan
My idea is indeed to have a main folder with some subfolder per gallery.
Each would not hold more than 1500 images I suppose so that should be doable.

Better than the 75000 unique folders in phocacartdownload, each for one file.

I don't suppose you saw this question in one of my long posts above:

However, my files aren't being deleted although the code says they are. I debugged like this in file.php

Code: Select all

if(Folder::exists($path['orig_abs_ds'] . $v['download_folder'])) {
   Factory::getApplication()->enqueueMessage('Deleting: ' .$path['orig_abs_ds'] . $v['download_file'], 'success');
   if (File::exists($pathAttributes['orig_abs_ds'] . $v['download_file'])) {
    // File::delete($pathAttributes['orig_abs_ds'] . $v['download_file']);
    unlink($pathAttributes['orig_abs_ds'] . $v['download_file']);
}
if (File::exists($pathAttributes['orig_abs_ds'] . $v['download_file'])) {
   Factory::getApplication()->enqueueMessage($path['orig_abs_ds'] . $v['download_file'].' not deleted', 'error');
} else {
   Factory::getApplication()->enqueueMessage($path['orig_abs_ds'] . $v['download_file'].' deleted', 'success');
}
When I run this, I get these messages:
Deleting: /var/www/html/joomla/phocacartdownload/
/var/www/html/joomla/phocacartdownload/ deleted
Deleting: /var/www/html/joomla/phocacartdownload/AZFCoH3du2OQ8biW7/m/image-7777m.jpg
/var/www/html/joomla/phocacartdownload/AZFCoH3du2OQ8biW7/m/image-7777m.jpg deleted
Deleting: /var/www/html/joomla/phocacartdownload/AZFCoH3du2OQ8biW7/l/image-7777l.jpg
/var/www/html/joomla/phocacartdownload/AZFCoH3du2OQ8biW7/l/image-7777l.jpg deleted
Deleting: /var/www/html/joomla/phocacartdownload/AZFCoH3du2OQ8biW7/s/image-7777s.jpg
/var/www/html/joomla/phocacartdownload/AZFCoH3du2OQ8biW7/s/image-7777s.jpg deleted

So I inserted that second File::exists to verify if the file is properly deleted and it confirmed it is but it's still on disk. What am I missing here?
Do I still need to do some Purge or delete Trash before the files are really deleted? I don't know enough of Joomla and couldn't find it.
Would be good to know, thank you.

Re: Minor errors in 5 Beta 25

Posted: 11 Mar 2024, 21:32
by Jan
Hi, hard to say what can be wrong there, I usually use Joomla methods in conditions which return true or false:

if(Folder::delete($path['orig_abs_ds'] . $v)) {

the same for File::delete

So then I am sure, the file was really deleted. If not there can be more problems like problems with ownership or rights but in such case, the Joomla methods should return false. In the mentioned code, there is no check on unlink function.

Jan