The user Brajmohan_Kumar is experiencing an issue where their logo appears broken after uploading it again following the deletion of uploaded files via FTP. pfaffman explains that Discourse tracks uploads via the database and uses file hashes to prevent duplicates, so re-uploading the same file results in a broken link. zogstrip confirms this and advises deleting the upload records in the database using rails c and Upload.where("id > 0").destroy_all, warning that this is a destructive operation. Brajmohan_Kumar seeks clarification on the process and how to manage the database via GUI, to which zogstrip suggests using rails db and pfaffman recommends the Data Explorer plugin for GUI access. Brajmohan_Kumar thanks the team for their help.
To refresh everything I tried to delete all the logo uploaded by me previously. I connected my site through FTP and deleted all the image from /var/discourse/shared/standalone/uploads/default/original/1X
Now, I am trying to upload the same logo that I deleted from the setting panel. But after upload, it is showing broken. http://prntscr.com/nimekp
Can anyone tell me what is happening here? I also tried uploading through Installation Wizard but the same issue.
Why would you delete the logo via and not via the ui?
You might be able to put it back via ftp. You’ll need to use the same filename and path.
You’ll need to upload a different logo. My guess is that Discourse knows that you’ve uploaded the file and won’t take a duplicate. You could try making a trivial change to the logo so that it’ll have a new hash.
You’ve delete all the uploaded files but Discourse also keeps track of the Uploads in the database.
Since we use the SHA1 of the files to prevent duplicates, when you upload the same exact file, Discourse thinks it already has it.
If you want to fix it, you’ll have to delete all the uploads records. SSH into your server and then
cd /var/discourse
./launcher enter app
rails c
Upload.where("id > 0").destroy_all
Be sure to take a backup before as this is a destructive operation.
FYI: There’s no need to delete uploaded file in Discourse as we’ll automatically delete unused files after a little while.
Please check and tell me if I have done everything correctly:-
Also, tell me how can I view and edit the database as we see in phpmyadmin (GUI). If it is not possible to view the database then how can I access it through the terminal?
rails c puts you in the Rails console. It’s generally safest to use the console as you’re using the Discourse code itself rather than blindly making changes to a database that you don’t understand.