Facebook  Twitter 

SMFHacks.com

+- +-

SMFHacks.com

+- User Information

Welcome, Guest.
Please login or register.
 
 
 
Forgot your password?

+- Forum Stats

Members
Total Members: 12400
Latest: mikel
New This Month: 5
New This Week: 1
New Today: 1
Stats
Total Posts: 40609
Total Topics: 7132
Most Online Today: 180
Most Online Ever: 2482
(April 09, 2011, 07:02:45 pm)
Users Online
Members: 0
Guests: 94
Total: 94

Author Topic: $folderid = floor  (Read 254 times)

0 Members and 1 Guest are viewing this topic.

Offline davejo

  • Downloads Pro Customer
  • Full Member
  • *****
  • Posts: 116
    • View Profile
$folderid = floor
« on: December 25, 2020, 04:50:43 am »
Hi and Merry Christmas.

I am a little confused. A couple of weeks ago I changed the
Code: [Select]
$folderid = floor from 1000 to 380. The properties of the folder now show the folder is 383MB but it hasn't created a new folder yet.

Should I have put a '0' in front of the 380? Also where in the database is the info stored showing which folder is currently used?

The reason I ask is because I want to eliminate the folder from the regular backup file (this runs 3 times a week) so as to reduce the size of the backup. I have XCloner installed and in the config you can opt out of certain folders, which I have already done with the 'Attachments' folder and the others in the downloads folder.

[ Guests cannot view attachments ]
« Last Edit: December 25, 2020, 04:55:19 am by davejo »

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15291
    • View Profile
Re: $folderid = floor
« Reply #1 on: December 25, 2020, 07:50:43 am »
Can you attach the file you changed. I want to see the line of code you changed plus the code around it.
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline davejo

  • Downloads Pro Customer
  • Full Member
  • *****
  • Posts: 116
    • View Profile
Re: $folderid = floor
« Reply #2 on: December 25, 2020, 09:19:20 am »
Thanks for the reply.

Here's the file.

I would be grateful if you can modify that one, if you need to, as I have modified it to allow 8 previews rather than the default 4

Thank you
« Last Edit: December 25, 2020, 09:21:25 am by davejo »

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15291
    • View Profile
Re: $folderid = floor
« Reply #3 on: December 25, 2020, 10:44:10 am »
the 1000 or 380 is the number of files before it creates another folder. So in your case requires 380 files before making the next folder
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline davejo

  • Downloads Pro Customer
  • Full Member
  • *****
  • Posts: 116
    • View Profile
Re: $folderid = floor
« Reply #4 on: December 25, 2020, 11:04:24 am »
Ah ok, I thought it was MB....that's where I was going wrong.

Checking the folder and it says there are 6125 files in the folder.

So even if I left it too 1000 it should have changed it a long time ago.

Thanks again for the reply, especially on Chritsmas day.
« Last Edit: December 25, 2020, 11:23:25 am by davejo »

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15291
    • View Profile
Re: $folderid = floor
« Reply #5 on: December 25, 2020, 08:33:35 pm »
Did you have the setting "Enable multiple folders for downloads storage" enabled?
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline davejo

  • Downloads Pro Customer
  • Full Member
  • *****
  • Posts: 116
    • View Profile
Re: $folderid = floor
« Reply #6 on: December 26, 2020, 01:39:42 am »
Hi yes it is enabled and has been enabled all the time. You might see from the first image posted that there are other folders, so it has worked in the past just don't know why it isn't now.

I know this is a stretch but is it possible that the folder size could be included in the 'Settings' page of the mod?


Offline davejo

  • Downloads Pro Customer
  • Full Member
  • *****
  • Posts: 116
    • View Profile
Re: $folderid = floor
« Reply #7 on: December 26, 2020, 05:52:28 am »
OK I have found out what the issue is. After creating a test site and installing the mod I changed the folder limit to 5 then added 6 'Upload File' posts which did change the folder from 0 to 1.

After that I added 6 'Upload Url:' posts which did not change the folder to 2 which is what I expected to happen because of the image files that are added with it.

Therefore if you predominantly only post url links with photos then the 'Downloads' does not add the images to the download count.

This means that if you only add links to your downloads you will never change the storage folder which, as I have shown can total up to over 6k of photos which can add up to a lot of MBs in storage space.

So now I have to think again about how to resolve this.

Is it possible to manually change the folder via the database, although as I mentioned in my first post I can't see where the data for the folder is stored...maybe I didn't look hard enough.

Any ideas are welcome  ;D

Offline SMFHacks

  • Administrator
  • Hero Member
  • *****
  • Posts: 15291
    • View Profile
Re: $folderid = floor
« Reply #8 on: December 26, 2020, 12:45:52 pm »
Changing it in the database does not affect much since it is caculated each time.

You could modify
Code: [Select]
function Downloads_ComputeNextFolderID($ID_FILE)
{
global $modSettings;

$folderid = floor($ID_FILE / 380);

// If the current folder ID does not match the new folder ID update the settings
if ($modSettings['down_folder_id'] != $folderid)
updateSettings(array('down_folder_id' => $folderid));

}
To hard code a specific folder.
 And maybe do the folder size calc with a little bit of work https://gist.github.com/eusonlito/5099936
Get your Forum Ranked! at https://www.forumrankings.net - find out how your forum compares with others!

Like What I do? Support me at https://www.patreon.com/vbgamer45/

Offline davejo

  • Downloads Pro Customer
  • Full Member
  • *****
  • Posts: 116
    • View Profile
Re: $folderid = floor
« Reply #9 on: December 26, 2020, 04:22:00 pm »
Thanks for the help.

What I did is to make folder limit 2 and then make 3 posts to create the new folder.

The limit can stay as 2 as no one ever uploads files to the site anyway only links photos.

That way when the size of the folder gets too big again all I have to do is post another 3 files to get a new folder.

 

+- Recent Topics

Forum ToolBox by Monocero
Today at 11:47:48 am

Gallery Pro v8.0 and PHP 7.4 by SMFHacks
January 20, 2021, 10:21:25 pm

[Mod] Tagging System by SMFHacks
January 13, 2021, 08:43:33 pm

Using Alternate PayPal Address by KKOG
January 13, 2021, 07:24:46 pm

Assigning a BuyNow Button to a product by SMFHacks
January 12, 2021, 04:59:32 pm

SMF Links by Nicole
January 10, 2021, 12:02:39 pm

Error on the latest version by davejo
January 06, 2021, 08:04:05 am

Recent topics on board index by eugen
January 01, 2021, 11:08:16 am

Parser by swayforth
December 31, 2020, 12:24:23 am

Show Gallery in Users Profile by swayforth
December 29, 2020, 10:37:17 pm

Powered by EzPortal