News:

SMF 2.1.2 has been released! Take it for a spin! Read more.

Main Menu

Automanage attachments

Started by emanuele, May 19, 2011, 10:20:51 PM

Previous topic - Next topic

emanuele

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


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.

kokett

Hello,

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

Greetings

emanuele

#2
"Unfortunately" it would be a "lot" of work. So the answer is: no.


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.

kak2z

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


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. Популярные рецепты в рубрике Что приготовить

emanuele

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:
foreach ($_SESSION['temp_attachments_dir'] as $dir)
if(file_exists($dir . '/' . $attachID))
return $dir;


try to replace it with:
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.

tarantula901


Advertisement: