List of all uploaded files

Hello friends,

what are you thinking about some extra tab at the admin interface to keep control over the current disk usage, files sizes, click rates, filtering them after extension and searching for specific terms?

I wish, I could get more control over all attachments.

Best

7 Mi Piace

That’s something I definitely want done. Not sure when though.

11 Mi Piace

Sounds useful!

There is a bunch of product questions around how this could/should work in my mind. It looks like a problem that has been already figured out or solved in other forum software, but I wonder how will this be framed / built around Discourse’s philosophy.

I am also wondering more about the manifestations of providing uploads settings, e.g.: if you chose to introduce extension configuration, the composer needs to cater for this when users are selecting/uploading attachments, and so on. Also, whether this should be in core, or as a plugin.

On the bright side, if we ignore all questions / assumptions / product / design considerations, it doesn’t look like it is technically tricky, I made a one hour spike here (this is very immature implementation though :blush:).

You can definitely extend this with a bunch of useful features: settings, search / filtering, sorting, etc (and some other considerations like supporting pagination, …)

6 Mi Piace

If youbtalking about admin tools. You can considure usong plugin data explorer whic allows admins to query database. When I hunting free space I am querying db there is table uploads whic gives you size location and other useful things. Also one good thing is that deleating rows from uploads also dealeting files. Becouse ther is sidekiq job pruge oprhan uploads.

I am totally open to adding something here, but I feel a top level tab is a bit too much .

Conceptually this feels like a “report” to me with a drilldown vs a section for uploading things.

I would like to see this link to the new report

When I think about this problem I think the main use case is around admins trying to get a handle on the … upload problem…

  • Why do I have so many uploads?

  • Which users have the most/largest uploads ?

  • What are the 100 biggest uploads on my forum?

  • How many things were uploaded in the last month? That way I can keep track of trends.

@codinghorror / @j.jaffeux what are your thoughts here?

12 Mi Piace

Yes I agree it could be a report, we might have to start working on the filtering logic I talked with you months ago. But other than that it should be good.

3 Mi Piace

Great line of questioning @sam !

I think perhaps I lack some context on what is the admin’s job / use case for the upload problem, but it appears to be (if there is any research or perhaps admin opinions to confirm that, it would be great!) that it can be framed as: I am an Admin, I want to gain understanding of my instance’s uploads usage.

I wonder if there are any after actions when the job / use case is satisfied. For example, if the admin notices a problem or a trend, will the admin/site_settings/category/files is the place they can optimise their file uploading strategy?

Also, I agree that the Uploads section is heavy as a top level tab for this use case.

Any news about this topic?

Im looking for a option to look through the uploaded files.

3 Mi Piace

I guess, sorting and listing files isn’t as much as important for Discourse as for us. :see_no_evil:

Similar issue:

Ecco alcune query per Data Explorer per ottenere dettagli sui caricamenti dei post. Potrebbe essere utile aggiungere qualcosa di simile alla sezione dei report amministrativi per i siti che non hanno installato il plugin Data Explorer. Fammi sapere se questi dati non sono quelli che stai cercando.

Quali utenti hanno il maggior numero di caricamenti o i file più grandi?

Restituisce l’utente, il numero di caricamenti e il totale dei caricamenti in KB arrotondato a due decimali. La join sulla tabella users serve a evitare che vengano restituiti dati relativi a utenti eliminati. I risultati sono ordinati per dimensione totale dei caricamenti in ordine decrescente.

Includendo le immagini ottimizzate

WITH uploads_with_optimized AS (
SELECT
ul.user_id,
ROUND((SUM(COALESCE(oi.filesize, 0)) + SUM(ul.filesize)) / 1000.0, 2) AS total_kb
FROM post_uploads pul
JOIN uploads ul
ON ul.id = pul.upload_id
LEFT JOIN optimized_images oi
ON ul.id = oi.upload_id
GROUP BY ul.user_id
)

SELECT
uwo.user_id,
COUNT(uploads.user_id) AS upload_count,
total_kb
FROM uploads_with_optimized uwo
JOIN uploads
ON uploads.user_id = uwo.user_id
GROUP BY uploads.user_id, uwo.user_id, total_kb
ORDER BY total_kb DESC
LIMIT 50

Escludendo le immagini ottimizzate

SELECT
ul.user_id,
COUNT(ul.user_id) AS upload_count,
ROUND(SUM(ul.filesize) / 1000.0, 2) AS total_kb
FROM post_uploads pul
JOIN uploads ul
ON ul.id = pul.upload_id
GROUP BY ul.user_id
ORDER BY total_kb DESC
LIMIT 50

Quali sono i 100 caricamenti più grandi sul mio forum?

Restituisce l’utente, il post contenente il caricamento e la dimensione del file in KB. I risultati sono ordinati per dimensione del caricamento in ordine decrescente.

Includendo le immagini ottimizzate

SELECT
ul.user_id,
pul.post_id,
ROUND((SUM(oi.filesize) + ul.filesize) / 1000.0, 2) AS total_kb
FROM post_uploads pul
JOIN uploads ul
ON ul.id = pul.upload_id
JOIN optimized_images oi
ON ul.id = oi.upload_id
GROUP BY oi.upload_id, ul.user_id, pul.post_id, ul.filesize
ORDER BY total_kb DESC
LIMIT 100

Escludendo le immagini ottimizzate

SELECT
ul.user_id,
pul.post_id,
ROUND(ul.filesize / 1000.0, 2) AS total_kb
FROM post_uploads pul
JOIN uploads ul
ON ul.id = pul.upload_id
ORDER BY total_kb DESC
LIMIT 100

Caricamenti negli ultimi 30 giorni

La query richiede di fornire un parametro :end_date. La data deve essere nel formato ‘aaaa-mm-gg’, ad esempio ‘2020-01-08’. Restituisce i risultati per il periodo di 30 giorni che termina con la end_date. Restituisce il giorno, il numero di caricamenti e il totale dei caricamenti del giorno in KB per tutti i giorni del periodo che contengono caricamenti di post. I risultati sono ordinati per giorno.

Includendo le immagini ottimizzate

--[params]
-- date :end_date

SELECT
ul.created_at::date AS day,
COUNT(1) AS upload_count,
ROUND((SUM(COALESCE(oi.filesize, 0)) + SUM(ul.filesize)) / 1000.0, 2) AS total_kb
FROM post_uploads pul
JOIN uploads ul
ON ul.id = pul.upload_id
LEFT JOIN optimized_images oi
ON ul.id = oi.upload_id
WHERE ul.created_at::date BETWEEN :end_date::date - INTERVAL '30 days' AND :end_date
GROUP BY ul.created_at::date
ORDER BY ul.created_at::date DESC

Escludendo le immagini ottimizzate

--[params]
-- date :end_date

SELECT
ul.created_at::date AS day,
COUNT(1) AS upload_count,
ROUND(SUM(ul.filesize) / 1000.0, 2) AS daily_upload_kb
FROM post_uploads pul
JOIN uploads ul
ON ul.id = pul.upload_id
WHERE ul.created_at::date BETWEEN :end_date::date - INTERVAL '30 days' AND :end_date
GROUP BY ul.created_at::date
ORDER BY ul.created_at::date DESC

11 Mi Piace

Sono un nuovo membro della community (meta) e ho recentemente assunto le responsabilità di amministrazione per un’altra community che utilizza Discourse (e ospitata da Discourse). Sulla dashboard, ho appena notato un “salto” nello spazio occupato dai file caricati (da circa 0,7 GB a 1,2 GB). Sembra che Data Explorer sia disponibile solo per i piani Business o superiori… Esiste un altro modo per scoprire quali file recenti stanno occupando gli ulteriori 0,5 GB?

2 Mi Piace

È interamente colpa mia.

In passato avevamo un grosso bug per cui non calcolavamo correttamente la dimensione di tutti i caricamenti.

Quando un utente carica un’immagine, spesso la ridimensioniamo da 3 a 4 volte per varie risoluzioni e ottimizzazioni. Queste immagini ottimizzate sono archiviate nel cloud e continuano a occupare spazio di archiviazione.

Per visualizzare le immagini reali, puoi eseguire:

SELECT * FROM optimized_images

@simon, forse dovresti aggiornare la query sopra per includere anche optimized_images?

5 Mi Piace

Ah, ha molto senso. Ho pensato brevemente che potesse essere così, dopo aver scritto il post qui :wink:

Hmmm, forse varrebbe la pena aggiungere una breve frase a questo proposito al misuratore di archiviazione nella dashboard, così le persone non pensano che qualcuno stia sottraendo spazio di archiviazione con dati sconosciuti :wink:

E se mai creaste un “Ispezione caricamenti” che non richieda i plugin del piano Business, sarebbe molto apprezzato!!

Saluti!

4 Mi Piace

Infine, non ho capito come posso vedere l’elenco dei caricamenti dei membri in diversi argomenti e post!!??

1 Mi Piace

Vorrei sfogliare la directory dei file caricati. Il mio caso d’uso specifico è investigare i dettagli di questo URL rotto:

Qualsiasi supporto amministrativo interpretato per farlo sarebbe di grande aiuto. O ho perso qualcosa? Con i migliori saluti, R

1 Mi Piace

Un altro workaround consiste nel:

  • creare e scaricare un backup del sito con “include uploads”
  • navigare fino a quell’archivio e decomprimerlo, ad esempio dalla riga di comando: $ tar -xvzf xxxx.tar.gz
  • passare alla directory uploads: $ cd uploads
  • selezionare tra le sezioni originali e ottimizzate ed esplorare l’albero dei file risultante
  • nessuno dei nomi di upload è presente, tutti i nomi utilizzano stringhe casuali (o codificate)

Un’interfaccia GUI sul portale di amministrazione fornirebbe una migliore esperienza utente (UX). Quindi il mio voto va a quella funzionalità. R

1 Mi Piace