download-monitor icon indicating copy to clipboard operation
download-monitor copied to clipboard

Multisite - other downloads path

Open razvanaldea89 opened this issue 1 year ago • 1 comments

Describe the bug The other downloads path option should either be disabled in a multisite installation or should not be shown and only allow the Network Admin to modify this option.

razvanaldea89 avatar Jan 16 '24 11:01 razvanaldea89

:-)

acesuares avatar Jan 17 '24 15:01 acesuares

Modified the way Other Downloads Paths are defined for each site. Now, they can be added by editing the site in the Network Admin area and going to the DLM Downloads Paths tab, where paths can be defined.

Based on these paths, visitors can be restricted to download files only from the defined paths.

image

image

image

razvanaldea89 avatar Jun 05 '24 14:06 razvanaldea89

cand am multisite, intru in network si dau disable la approved download path la un site, dupa intru in dashboard la acel site si uploadez un fisier imi da mesajul asta: Screenshot 2024-07-10 at 10 26 02 desi path-ul de la fisier e listat: Screenshot 2024-07-10 at 10 31 47

andrei-l-cristea avatar Jul 10 '24 07:07 andrei-l-cristea

Hello, thank you so much for fixing that, but we have the Lite (not Pro) version and I don't see the tab in the network site list... it's just nog there... i can edit it in settings but doesn't seem to help. Is this a pro feature now?

acesuares avatar Aug 28 '24 14:08 acesuares

I tried to install pro, but this happenend and it could not be installed Fatal error: Uncaught Error: Class "DLM_Product" not found in /usr/share/wordpress/wp-content/plugins/dlm-pro/includes/extensions/class-dlm-pro-extensions-handler.php:80 Stack trace: #0 /usr/share/wordpress/wp-content/plugins/dlm-pro/dlm-pro.php(239): DLM_PRO_Extensions_Handler->handle_extension_action() #1 /usr/share/wordpress/wp-includes/class-wp-hook.php(324): dlm_pro_activate_plugin() #2 /usr/share/wordpress/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #3 /usr/share/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action() #4 /usr/share/wordpress/wp-admin/plugins.php(196): do_action() #5 {main} thrown in /usr/share/wordpress/wp-content/plugins/dlm-pro/includes/extensions/class-dlm-pro-extensions-handler.php on line 80

acesuares avatar Aug 28 '24 14:08 acesuares

Hello @acesuares ,

It's not a PRO feature, the tab should be there: Network Admin > My Sites > Edit {problematic site} > DLM Downloads Paths. The PRO version needs the LITE version to work, seems that the check for LITE is not working for some reason.

Warmly, Razvan

razvanaldea89 avatar Aug 29 '24 08:08 razvanaldea89

Hi Razvan, thanks for the quick answer. What I understand, and correct me if I am wrong, is that since the last update, the path is NOT the standard download path anymore, but you have to set it in settings of the specific site. This is confusing me. It used to work WITHOUT setting the path.

Also, when I open one of the existing downloads, there is a warning about the path, and then it suggests a path all the way down to ../files/2023/11 (for example). But that can't be right because all the other files are in 2023/10, 2024/02, etc.

So what path needs to be set? Because if I set ../files it still doesn't work.

acesuares avatar Aug 29 '24 11:08 acesuares

This is the warning:

You're trying to serve files from your server that are not in the enabled allowed paths. Please contact the network administrator to add or enable the path(s) for your website. If you want to learn more about this, click here

Recommended path: /usr/share/wordpress/wp-content/blogs.dir/202/files/dlm_uploads/2023/11/

acesuares avatar Aug 29 '24 11:08 acesuares

Could you please let me know what it says in your network admin DLM Downloads Paths? You can use our content form here if you are not comfortable showing it here.

razvanaldea89 avatar Aug 29 '24 13:08 razvanaldea89

We don't have the TAB DLM_Download_Paths. In Settings for that site, it was EMPTY. I tried various paths but none of them worked.

So I tried any form of the path in my previous post, removing the last part until '202'.

acesuares avatar Aug 29 '24 13:08 acesuares

What do you suppose I should put there? It was empty.

acesuares avatar Aug 29 '24 13:08 acesuares

Oh, I understand. It should not have been empty, so this is weird. You should add : /usr/share/wordpress/wp-content/blogs.dir/, if there are other folders inside the blogs.dir folder that server files. Please keep in mind that this is per site, so if you have other sites in your network you should update add paths to them also.

Do you have some kind of special installation of WordPress, symlinked folders, or any other modifications? In the DLM Downloads Paths there should have been at least the path to the uploads folder.

Warmly, Razvan

razvanaldea89 avatar Aug 29 '24 13:08 razvanaldea89

Screenshot of settings. Also, the upload_path (wordpress) variable is set correctly to the correct path. Why doesn't DLM use that... just asking. Screenshot from 2024-08-29 09-08-41

acesuares avatar Aug 29 '24 13:08 acesuares

Hi,

Oh, I understand. It should not have been empty, so this is weird. You should add : /usr/share/wordpress/wp-content/blogs.dir/, if there are other folders inside the blogs.dir folder that server files. Please keep in mind that this is per site, so if you have other sites in your network you should update add paths to them also.

Well, that path would give access to all sites.... so I would expect to have to use the same as the upload_path: wp-content/blogs.dir/xxx/files where xxx is the blog_id.

But I tried that (and just tried it again) and it does NOT work.

Do you have some kind of special installation of WordPress, symlinked folders, or any other modifications? In the DLM Downloads Paths there should have been at least the path to the uploads folder.

I don't think I have a special installation. No symlinked folders. The weird thing is: it always worked, maybe the last or last 2 updates changed to to not working.

So, the dlm_download_path is empty, and if I enter the same as @upload_path, still access denied.

Cheers,

Ace

Warmly, Razvan

acesuares avatar Aug 29 '24 13:08 acesuares

I downgraded to 4.9.14 and the files are accessible again. The bug was definately introduced in 5.0

acesuares avatar Aug 29 '24 13:08 acesuares

Think I've misread what you've said before. For some reason, I thought you've found the tab, and it was empty. So, that option, dlm_downloads_path, is a serialized two-dimensional array, where each array in the array is like so:

array(
'id' => $id // Path ID,
'path_val' => $path // The actual path
'enabled' => bool // Whether the path is enabled or not
);

Example of info in DB from a local installation:

a:3:{i:0;a:3:{s:2:"id";i:2;s:8:"path_val";s:35:"/Users/users/Local Sites/multisite/";s:7:"enabled";b:0;}i:1;a:3:{s:2:"id";i:3;s:8:"path_val";s:45:"/Users/users/Local Sites/multisite/test/pishu";s:7:"enabled";b:1;}i:2;a:3:{s:2:"id";i:4;s:8:"path_val";s:40:"/Users/users/Local Sites/multisite/trut/";s:7:"enabled";b:1;}}

I am interested in the reason why the tab is missing in your installation.

razvanaldea89 avatar Aug 29 '24 13:08 razvanaldea89

I am interested too :-) How could we troubleshoot that.

acesuares avatar Aug 29 '24 13:08 acesuares

I updated to 5.0.9 again, but no tab Screenshot from 2024-08-29 10-25-44

acesuares avatar Aug 29 '24 14:08 acesuares

Can I help in any way?

acesuares avatar Sep 08 '24 15:09 acesuares

@razvanaldea89

cristianraiber avatar Sep 08 '24 19:09 cristianraiber

Created a new issue here : https://github.com/WPChill/download-monitor/issues/1538

razvanaldea89 avatar Sep 10 '24 12:09 razvanaldea89