News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

2.0.18 upgrade test failing

Started by Andres08, April 16, 2021, 08:51:00 PM

Previous topic - Next topic

Andres08

I just try to install, update to 2.0.18 from 2.0.17.  Somehow I got fail in test, so I'm asking if I should continue or better stop with upgrade? 
In attachment is a picture of critical files.

Andres

shadav

no don't just continue...you'll need to fix the issue

if you click on the pencil icon it should tell you what it is looking for and what it is replacing with

you'll need to find those lines in your ManageAttachments.php file
more than likely some mod that you installed changed the line it is looking for

Andres08

#2
Quote from: shadav on April 16, 2021, 09:02:05 PM
no don't just continue...you'll need to fix the issue

if you click on the pencil icon it should tell you what it is looking for and what it is replacing with

you'll need to find those lines in your ManageAttachments.php file
more than likely some mod that you installed changed the line it is looking for

Thank you Shadaw for this info.  I clicked to pencil, and it opens avatar.  Avatars in that lines are unchanged from beginning so I am not sure at all.   Will paste here codes from erorr pencil nad upload attachment of same one.

Thank you

Andres




Code: (Find) [Select]

'function' => create_function('$rowData', '
global $modSettings, $context, $scripturl;

$link = \'<a href="\';

// In case of a custom avatar URL attachments have a fixed directory.
if ($rowData[\'attachment_type\'] == 1)
$link .= sprintf(\'%1$s/%2$s\', $modSettings[\'custom_avatar_url\'], $rowData[\'filename\']);

// By default avatars are downloaded almost as attachments.
elseif ($context[\'browse_type\'] == \'avatars\')
$link .= sprintf(\'%1$s?action=dlattach;type=avatar;attach=%2$d\', $scripturl, $rowData[\'id_attach\']);

// Normal attachments are always linked to a topic ID.
else
$link .= sprintf(\'%1$s?action=dlattach;topic=%2$d.0;attach=%3$d\', $scripturl, $rowData[\'id_topic\'], $rowData[\'id_attach\']);

$link .= \'"\';

// Show a popup on click if it\'s a picture and we know its dimensions.
if (!empty($rowData[\'width\']) && !empty($rowData[\'height\']))
$link .= sprintf(\' onclick="return reqWin(this.href\' . ($rowData[\'attachment_type\'] == 1 ? \'\' : \' + \\\';image\\\'\') . \', %1$d, %2$d, true);"\', $rowData[\'width\'] + 20, $rowData[\'height\'] + 20);

$link .= sprintf(\'>%1$s</a>\', preg_replace(\'~&amp;#(\\\\d{1,7}|x[0-9a-fA-F]{1,6});~\', \'&#\\\\1;\', htmlspecialchars($rowData[\'filename\'])));

// Show the dimensions.
if (!empty($rowData[\'width\']) && !empty($rowData[\'height\']))
$link .= sprintf(\' <span class="smalltext">%1$dx%2$d</span>\', $rowData[\'width\'], $rowData[\'height\']);

return $link;
'),
),
'sort' => array(

Code: (Replace) [Select]

'function' => function($rowData) use ($modSettings, $context, $scripturl)
{
$link = '<a href="';

// In case of a custom avatar URL attachments have a fixed directory.
if ($rowData['attachment_type'] == 1)
$link .= sprintf('%1$s/%2$s', $modSettings['custom_avatar_url'], $rowData['filename']);

// By default avatars are downloaded almost as attachments.
elseif ($context['browse_type'] == 'avatars')
$link .= sprintf('%1$s?action=dlattach;type=avatar;attach=%2$d', $scripturl, $rowData['id_attach']);

// Normal attachments are always linked to a topic ID.
else
$link .= sprintf('%1$s?action=dlattach;topic=%2$d.0;attach=%3$d', $scripturl, $rowData['id_topic'], $rowData['id_attach']);

$link .= '"';

// Show a popup on click if it's a picture and we know its dimensions.
if (!empty($rowData['width']) && !empty($rowData['height']))
$link .= sprintf(' onclick="return reqWin(this.href' . ($rowData['attachment_type'] == 1 ? '' : '+ \';image\'') . ', %1$d, %2$d, true);"', $rowData['width'] + 20, $rowData['height'] + 20);

$link .= sprintf('>%1$s</a>', preg_replace('~&amp;#(\\\\d{1,7}|x[0-9a-fA-F]{1,6});~', '&#\\\\1;', htmlspecialchars($rowData['filename'])));

// Show the dimensions.
if (!empty($rowData['width']) && !empty($rowData['height']))
$link .= sprintf(' <span class="smalltext">%1$dx%2$d</span>', $rowData['width'], $rowData['height']);

return $link;
},
),
'sort' => array(



*added code tags for easier reading - Shadav

shadav

you'll need to find in your ManageAttachments.php

the lines that it's looking for or something similar
probably look for the line
// In case of a custom avatar URL attachments have a fixed directory.

as stated more than likely a mod that was installed changed these lines
you will either have to uninstall the mod or make the changes yourself.

if you still need help, then please attach your ManageAttachments.php

and list any mods that are installed

Andres08

I didn´t find this file on forum admin so I loged on server and there it is. Actually I have two that kind of files.  That text
Quote// In case of a custom avatar URL attachments have a fixed directory.
I found in file.  Will attach picture and file at all.

Thank you

Andres

shadav

the file with the ~ at the end is just a backup file...whenever a mod is installed it creates a backup of the file before installing and naming it with a ~ at the end

a list of mods would be helpful as well
because something that you installed changed the code it was looking for

it changed this line
$link .= sprintf(\'%1$s?action=dlattach;topic=%2$d.0;attach=%3$d\', $scripturl, $rowData[\'id_topic\'], $rowData[\'id_attach\']);
to this
{
$time = filemtime(getAttachmentFilename($rowData[\'filename\'], $rowData[\'id_attach\'], $rowData[\'id_folder\'], false, $rowData[\'file_hash\']));
$link .= sprintf(\'%1$s?action=dlattach;topic=%2$d.0;attach=%3$d;ts=%4$d\', $scripturl, $rowData[\'id_topic\'], $rowData[\'id_attach\'], $time);
}


easiest way would to be to uninstall the mod then do the upgrade then reinstall the mod (making sure that you have the newest version of the mod)

otherwise, if this is the only error you have, you can
find in the file ManageAttachment.php
'function' => create_function('$rowData', '
global $modSettings, $context, $scripturl;

$link = \'<a href="\';

// In case of a custom avatar URL attachments have a fixed directory.
if ($rowData[\'attachment_type\'] == 1)
$link .= sprintf(\'%1$s/%2$s\', $modSettings[\'custom_avatar_url\'], $rowData[\'filename\']);

// By default avatars are downloaded almost as attachments.
elseif ($context[\'browse_type\'] == \'avatars\')
$link .= sprintf(\'%1$s?action=dlattach;type=avatar;attach=%2$d\', $scripturl, $rowData[\'id_attach\']);

// Normal attachments are always linked to a topic ID.
else
{
$time = filemtime(getAttachmentFilename($rowData[\'filename\'], $rowData[\'id_attach\'], $rowData[\'id_folder\'], false, $rowData[\'file_hash\']));
$link .= sprintf(\'%1$s?action=dlattach;topic=%2$d.0;attach=%3$d;ts=%4$d\', $scripturl, $rowData[\'id_topic\'], $rowData[\'id_attach\'], $time);
}

$link .= \'"\';

// Show a popup on click if it\'s a picture and we know its dimensions.
if (!empty($rowData[\'width\']) && !empty($rowData[\'height\']))
$link .= sprintf(\' onclick="return reqWin(this.href\' . ($rowData[\'attachment_type\'] == 1 ? \'\' : \' + \\\';image\\\'\') . \', %1$d, %2$d, true);"\', $rowData[\'width\'] + 20, $rowData[\'height\'] + 20);

$link .= sprintf(\'>%1$s</a>\', preg_replace(\'~&amp;#(\\\\d{1,7}|x[0-9a-fA-F]{1,6});~\', \'&#\\\\1;\', htmlspecialchars($rowData[\'filename\'])));

// Show the dimensions.
if (!empty($rowData[\'width\']) && !empty($rowData[\'height\']))
$link .= sprintf(\' <span class="smalltext">%1$dx%2$d</span>\', $rowData[\'width\'], $rowData[\'height\']);

return $link;
'),
),
'sort' => array(


and replace it with
'function' => create_function('$rowData', '
global $modSettings, $context, $scripturl;

$link = \'<a href="\';

// In case of a custom avatar URL attachments have a fixed directory.
if ($rowData[\'attachment_type\'] == 1)
$link .= sprintf(\'%1$s/%2$s\', $modSettings[\'custom_avatar_url\'], $rowData[\'filename\']);

// By default avatars are downloaded almost as attachments.
elseif ($context[\'browse_type\'] == \'avatars\')
$link .= sprintf(\'%1$s?action=dlattach;type=avatar;attach=%2$d\', $scripturl, $rowData[\'id_attach\']);

// Normal attachments are always linked to a topic ID.
else
$link .= sprintf(\'%1$s?action=dlattach;topic=%2$d.0;attach=%3$d\', $scripturl, $rowData[\'id_topic\'], $rowData[\'id_attach\']);

$link .= \'"\';

// Show a popup on click if it\'s a picture and we know its dimensions.
if (!empty($rowData[\'width\']) && !empty($rowData[\'height\']))
$link .= sprintf(\' onclick="return reqWin(this.href\' . ($rowData[\'attachment_type\'] == 1 ? \'\' : \' + \\\';image\\\'\') . \', %1$d, %2$d, true);"\', $rowData[\'width\'] + 20, $rowData[\'height\'] + 20);

$link .= sprintf(\'>%1$s</a>\', preg_replace(\'~&amp;#(\\\\d{1,7}|x[0-9a-fA-F]{1,6});~\', \'&#\\\\1;\', htmlspecialchars($rowData[\'filename\'])));

// Show the dimensions.
if (!empty($rowData[\'width\']) && !empty($rowData[\'height\']))
$link .= sprintf(\' <span class="smalltext">%1$dx%2$d</span>\', $rowData[\'width\'], $rowData[\'height\']);

return $link;
'),
),
'sort' => array(


then run the update, making sure there are no other errors

after you do the update go back into ManageAttachments.php

find
'function' => function($rowData) use ($modSettings, $context, $scripturl)
{
$link = '<a href="';

// In case of a custom avatar URL attachments have a fixed directory.
if ($rowData['attachment_type'] == 1)
$link .= sprintf('%1$s/%2$s', $modSettings['custom_avatar_url'], $rowData['filename']);

// By default avatars are downloaded almost as attachments.
elseif ($context['browse_type'] == 'avatars')
$link .= sprintf('%1$s?action=dlattach;type=avatar;attach=%2$d', $scripturl, $rowData['id_attach']);

// Normal attachments are always linked to a topic ID.
else
$link .= sprintf('%1$s?action=dlattach;topic=%2$d.0;attach=%3$d', $scripturl, $rowData['id_topic'], $rowData['id_attach']);

$link .= '"';

// Show a popup on click if it's a picture and we know its dimensions.
if (!empty($rowData['width']) && !empty($rowData['height']))
$link .= sprintf(' onclick="return reqWin(this.href' . ($rowData['attachment_type'] == 1 ? '' : '+ \';image\'') . ', %1$d, %2$d, true);"', $rowData['width'] + 20, $rowData['height'] + 20);

$link .= sprintf('>%1$s</a>', preg_replace('~&amp;#(\\\\d{1,7}|x[0-9a-fA-F]{1,6});~', '&#\\\\1;', htmlspecialchars($rowData['filename'])));

// Show the dimensions.
if (!empty($rowData['width']) && !empty($rowData['height']))
$link .= sprintf(' <span class="smalltext">%1$dx%2$d</span>', $rowData['width'], $rowData['height']);

return $link;
},
),
'sort' => array(


and try replacing it with this, I think it should work but not completely sure

'function' => function($rowData) use ($modSettings, $context, $scripturl)
{
$link = '<a href="';

// In case of a custom avatar URL attachments have a fixed directory.
if ($rowData['attachment_type'] == 1)
$link .= sprintf('%1$s/%2$s', $modSettings['custom_avatar_url'], $rowData['filename']);

// By default avatars are downloaded almost as attachments.
elseif ($context['browse_type'] == 'avatars')
$link .= sprintf('%1$s?action=dlattach;type=avatar;attach=%2$d', $scripturl, $rowData['id_attach']);

// Normal attachments are always linked to a topic ID.
else
{
$time = filemtime(getAttachmentFilename($rowData['filename'], $rowData['id_attach'], $rowData['id_folder'], false, $rowData['file_hash']));
$link .= sprintf('%1$s?action=dlattach;topic=%2$d.0;attach=%3$d;ts=%4$d', $scripturl, $rowData['id_topic'], $rowData['id_attach'], $time);
}

$link .= '"';

// Show a popup on click if it's a picture and we know its dimensions.
if (!empty($rowData['width']) && !empty($rowData['height']))
$link .= sprintf(' onclick="return reqWin(this.href' . ($rowData['attachment_type'] == 1 ? '' : '+ \';image\'') . ', %1$d, %2$d, true);"', $rowData['width'] + 20, $rowData['height'] + 20);

$link .= sprintf('>%1$s</a>', preg_replace('~&amp;#(\\\\d{1,7}|x[0-9a-fA-F]{1,6});~', '&#\\\\1;', htmlspecialchars($rowData['filename'])));

// Show the dimensions.
if (!empty($rowData['width']) && !empty($rowData['height']))
$link .= sprintf(' <span class="smalltext">%1$dx%2$d</span>', $rowData['width'], $rowData['height']);

return $link;
},
),
'sort' => array(

Andres08

Thank you for this. I will make it when I found better time than saturday evening.    It is maybe one of mods automatic atachment and resize. Will attach it here as screenshot.


Andres

@rjen

Very possible: there is an updated version of that mod for 2.0.18.

Uninstall the mod, then upgrade. After the upgrade you Neede to upload and install the latest version of that mod
Running SMF 2.1 with latest TinyPortal at www.fjr-club.nl

Andres08

It is more than that I think.  Found here https://www.simplemachines.org/community/index.php?topic=544111.280  users already complained about this mod. 

Now am I lost a little what is going on, and who takes responsibilites, since I can´t uninstall that mod and based on that I can´t upgrade forum.   Humm

Thank you

Andres


Sir Osis of Liver

Upload clean set of 2.0.18 files.  That will give you clean install, you'll have to reinstall mods and customizations.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Andres08

Quote from: Sir Osis of Liver on April 18, 2021, 09:40:24 PM
Upload clean set of 2.0.18 files.  That will give you clean install, you'll have to reinstall mods and customizations.

I somehow do not trust myself when it comes to manual upgrade.  Just in case if something get wrong I rather wouldn't try it.  Years ago I used some CMS which was very good at the beginning.    Later on I messed up something with manual uploading  since on that time automatic upgrade didn't exist.   Probably it stays in me since that time.

Andres

Sir Osis of Liver

Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Andres08

Sir Osis,

Sorry for this late reply. I simply can´t do anything in months.  Well.  Now already is 2.0.19 version but my forum is still on 2.0.17.  Automatic installation on admin area failing in attachment directory. Would it work anyway if I run
new version 2.0.19 and if necessary after installation upload director attachment manually?
Or simply upload one by one directory manually in CP file manager since FTP on my side doesn´t work as it need to do?

Andres

Sir Osis of Liver

What happens when you try to upgrade to 2.0.18 in package manager?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Advertisement: