Skip to content

Commit 84ee525

Browse files
committed
Only update attdirs when there are updates
Signed by Shawn Bulen, [email protected]
1 parent 04ccab2 commit 84ee525

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

repair_settings.php

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,33 +1055,33 @@ function set_settings()
10551055
}
10561056
}
10571057

1058-
// In SMF 2.1, its always an array.
1059-
if ($context['smfVersion'] == '2.1')
1060-
{
1061-
$setString[] = array('attachmentUploadDir', json_encode($attach_dirs));
1062-
}
1063-
// Only one dir...or maybe nothing at all
1064-
elseif (count($attach_dirs) > 1)
1058+
// Build the update string for attachment dirs
1059+
if (!empty($attach_dirs))
10651060
{
1066-
$setString[] = array('attachmentUploadDir', @serialize($attach_dirs));
1067-
// If we want to (re)set currentAttachmentUploadDir here is a good place
1068-
// foreach ($attach_dirs as $id => $attach_dir)
1069-
// if (is_dir($attach_dir) && is_writable($attach_dir))
1070-
// $setString[] = array('currentAttachmentUploadDir', $id + 1);
1071-
}
1072-
elseif (!$context['is_legacy'] && isset($attach_dirs[1]))
1073-
{
1074-
$setString[] = array('attachmentUploadDir', $attach_dirs[1]);
1075-
$setString[] = array('currentAttachmentUploadDir', 0);
1076-
}
1077-
elseif ($context['is_legacy'] && isset($attach_dirs[0]))
1078-
{
1079-
$setString[] = array('attachmentUploadDir', $attach_dirs[0]);
1080-
}
1081-
else
1082-
{
1083-
$setString[] = array('attachmentUploadDir', '');
1084-
$setString[] = array('currentAttachmentUploadDir', 0);
1061+
// In SMF 2.1, its always an array.
1062+
if ($context['smfVersion'] == '2.1')
1063+
{
1064+
$setString[] = array('attachmentUploadDir', json_encode($attach_dirs));
1065+
}
1066+
// Only one dir...or maybe nothing at all
1067+
elseif (count($attach_dirs) > 1)
1068+
{
1069+
$setString[] = array('attachmentUploadDir', @serialize($attach_dirs));
1070+
}
1071+
elseif (!$context['is_legacy'] && isset($attach_dirs[1]))
1072+
{
1073+
$setString[] = array('attachmentUploadDir', $attach_dirs[1]);
1074+
$setString[] = array('currentAttachmentUploadDir', 0);
1075+
}
1076+
elseif ($context['is_legacy'] && isset($attach_dirs[0]))
1077+
{
1078+
$setString[] = array('attachmentUploadDir', $attach_dirs[0]);
1079+
}
1080+
else
1081+
{
1082+
$setString[] = array('attachmentUploadDir', '');
1083+
$setString[] = array('currentAttachmentUploadDir', 0);
1084+
}
10851085
}
10861086

10871087
if (!empty($setString))

0 commit comments

Comments
 (0)