Advertisement:

Author Topic: Automanage attachments  (Read 3211 times)

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Automanage attachments
« on: May 19, 2011, 10:20:51 PM »
Link to Mod

Automatically create and change active attachments directory depending on settings.

The mod can create a directory structure based on post date (subdividing attachments by year, or by year and month or by year, month and day) or simply adding a new directory when the space limit is reached.

Settings
  • Choose the method for the management of attachments, it can be set to:
    • Normal: default SMF management (i.e. the admin must take care to change directory)
    • Subdivide by years: a directory corresponding to the current year is created and the attachments are stored there
    • Subdivide by years and months: as before but a subdirectory for each month is created too
    • Subdivide by years, months and days: as before but a subdirectory for each day is created too
    • Change directory when run out of space: every time the attachment directory reach the space limit a new directory is created
  • Create as subdirectory within a directory: if you want to keep all the attachments directories within a certain directory tick this check
  • Main directory for attachments: if the previous check is ticked then you can specify here the path to the directory (if it's not specified the board directory will be used)

Known issues
  • When the option Change directory when run out of space is active the check on the directory size is not 100% accurate

Change log
  • 0.1.10 fixed utf8 files
  • 0.1.9 compatibility updated to 2.0
  • 0.1.8 fixed Italian translation
  • 0.1.7 fixed the error returned when the upload directory changes while posting
  • 0.1.6 fixed a couple of obscure log errors, additional use of hooks
  • 0.1.5 initial release
« Last Edit: July 07, 2011, 04:11:35 PM by emanuele »


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline kokett

  • Semi-Newbie
  • *
  • Posts: 48
Re: Automanage attachments
« Reply #1 on: June 10, 2011, 04:48:13 AM »
Hello,

great Mod! It would be nice having this Feature in SMF 1.1.13. Is it possible to backport this MOD?

Greetings

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: Automanage attachments
« Reply #2 on: June 10, 2011, 11:22:58 AM »
"Unfortunately" it would be a "lot" of work. So the answer is: no.
« Last Edit: June 11, 2011, 04:09:06 PM by emanuele »


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline kak2z

  • Semi-Newbie
  • *
  • Posts: 49
  • Gender: Male
    • Дом 2
Re: Automanage attachments
« Reply #3 on: August 26, 2012, 11:06:02 AM »
Great mod! Thank you!
But I get an error!

Quote
http://kak2z.ru/index.php?action=post2;start=0;board=18: Undefined index: temp_attachments_dir
Файл: /**************/Sources/Subs-AutoManageAttachments.php
Строка: 343

Code: [Select]
337: {
338: $already_uploaded = preg_match('~^post_tmp_' . $posterID . '_\d+$~', $attachID) != 0;
339:
340: if (!$already_uploaded)
341: return $current_attach_dir;
342:
==>343: foreach ($_SESSION['temp_attachments_dir'] as $dir)
344: if(file_exists($dir . '/' . $attachID))
345: return $dir;
346:
347: return $current_attach_dir;
348: }


help me please)))  :)
Новости и слухи Дом 2. Популярные рецепты в рубрике Что приготовить

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: Automanage attachments
« Reply #4 on: August 26, 2012, 01:17:12 PM »
yups...it's a while I don't touch this one...

Guessing a bit, I'd say in Subs-AutoManageAttachments.php, at the end you find:
Code: [Select]
foreach ($_SESSION['temp_attachments_dir'] as $dir)
if(file_exists($dir . '/' . $attachID))
return $dir;

try to replace it with:
Code: [Select]
if (!empty($_SESSION['temp_attachments_dir']))
foreach ($_SESSION['temp_attachments_dir'] as $dir)
if(file_exists($dir . '/' . $attachID))
return $dir;

Not sure though if it is the right thing to do...but should be safe.


Take a peek at what I'm doing! ;D



Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Offline tarantula901

  • Jr. Member
  • **
  • Posts: 368
Re: Automanage attachments
« Reply #5 on: December 19, 2020, 12:32:04 PM »

Can anyone update this mod?