Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: sam casey on January 19, 2018, 12:13:00 PM

Title: smf upgrade patch errors
Post by: sam casey on January 19, 2018, 12:13:00 PM
hi guys IM BACK . ive been very lucky and ive had excellent help here on some issues just recently on two of three sites that my friend owns and that im helping him with . and with the excellent help ive received and the top information on this site ive managed to put right issues with two of the three sites .

so now im just wanting to upgrade the third site to the latest smf patch . its currently got smf 2.0.13 and it works ok , id like to upgrade to 2.0.14 and then to 2.0.15 as i understand from what ive read that you have to install each patch in sequence , unless my understanding is not correct . so my thinking is i must install the 2.0.14 patch and after that the 2.0.15 patch .

so i downloaded the 2.0.14 patch , and its ready for install . i never install anything if im not certain its safe to do so . so i clicked install to to install the patch , as you will know smf runs tests and all being well it shows no errors and you can carry on with the patch upgrade .

so the upshot is i have gotten errors , so i did not carry on with the install of the patch . here is the main errors

   19.    Execute Modification    ./Sources/ManageSettings.php    Test failed
      1.    Replace    ./Sources/ManageSettings.php    Test failed
      2.    Replace    ./Sources/ManageSettings.php    Test successful

there are errors after that which are theme errors

*       Execute Modification    /home3/boxkings/public_html/Themes/redzone88/index.template.php    Test failed
      1.    Replace    /home3/boxkings/public_html/Themes/redzone88/index.template.php    Test successful
      2.    Replace    /home3/boxkings/public_html/Themes/redzone88/index.template.php    Test failed
      Execute Modification    /home3/boxkings/public_html/Themes/redzone88/Login.template.php    Test failed
      1.    Replace    /home3/boxkings/public_html/Themes/redzone88/Login.template.php    Test failed (Ignore Errors)
      2.    Replace    /home3/boxkings/public_html/Themes/redzone88/Login.template.php    Test failed
      3.    Replace    /home3/boxkings/public_html/Themes/redzone88/Login.template.php    Test failed
      4.    Replace    /home3/boxkings/public_html/Themes/redzone88/Login.template.php    Test failed


      Execute Modification    ./Themes/Reseller/index.template.php    Test failed
      1.    Replace    ./Themes/Reseller/index.template.php    Test successful
      2.    Replace    ./Themes/Reseller/index.template.php    Test failed


so i am just looking for information about the errors and also any help and advice in regards how to fix them . would any or all of the above errors preclude a successful install ? . are there such errors that are minor and can be ignored as they have no affect on a patch upgrade or the site after the upgrade . are there some errors that may pop up that one should never ignore and not carry on with the install ? . i must state again that i have not as yet installed the patch only ran the initial test , so the site runs ok . i just dont want to install the patch and give a working site problems .

i would appreciate any help and advice . thanks in advance .
Title: Re: smf upgrade patch errors
Post by: Sir Osis of Liver on January 19, 2018, 12:22:36 PM
There's an edit icon left of the test failed message, click on that it will show you the target code and replacement code.  Test fails because package manager cannot find the exact target code, it's been changed by a mod or theme edit.  If you can find the code, you can do the edit manually, then proceed with install.  If you don't fix the errors, bad things may happen.

Title: Re: smf upgrade patch errors
Post by: Arantor on January 19, 2018, 12:26:29 PM
In the case of manage members, it's almost certainly Stop Spammer - please see the stop spammer thread.

As for the theme, it's almost certainly because it can't find the place in the theme to put the upgraded security. Either figure it out manually by editing the code, or ignoring it and just installing the 2.0.14 Login Fix mod from the mod site.
Title: Re: smf upgrade patch errors
Post by: Sir Osis of Liver on January 19, 2018, 12:29:50 PM
Some themes don't have a header login, that will cause test failed because package manager wants to install session check, but code's not there.  In this case, error can be ignored.

Title: Re: smf upgrade patch errors
Post by: Arantor on January 19, 2018, 01:20:23 PM
Quote from: Sir Osis of Liver on January 19, 2018, 12:29:50 PM
Some themes don't have a header login, that will cause test failed because package manager wants to install session check, but code's not there.  In this case, error can be ignored.



This is why I suggested that mod. Solves the problem either way.
Title: Re: smf upgrade patch errors
Post by: sam casey on January 21, 2018, 11:02:26 AM
hi guys sorry for the delay in replying . and thanks to all who replied here .

ok i selected install again (for the 2.0.14 smf patch ) , naturally the same errors popped up . i then as per the instructions above clicked on the edit option to the left of the line with the error , here is the first error

1.    Replace    ./Sources/ManageSettings.php    Test failed

so upon clicking on edit i am being told that i have @version 2.0.6 and that i must replace this with @version 2.0.14

that wouldnt be a problem , sadly when you click on edit (as above ) it doesnt give you a line number where the code is located .

so i went to the host , went to the manage settings.php file and i selected code editor . the i clicked on search , and a small search / replace box pops up , i typed in @version 2.0.6 in the search box and @version 2.0.14 in the replace box  . now the thing is there are 3 options  , FIND NEXT , REPLACE , REPLACE ALL . so i clicked on find next , it came back with a message @version 2.0.6 not found . and i did likewise with the second option REPLACE and again im being told @version 2.0.6 is not being found .

so i am getting an error telling me that i have a line of code with @version 2.0.6 in it and that i need to replace it with @version 2.0.14 , and a code editor telling me that the line of code is not found or not there . the same seems to be the case for the second error , so it would seem that i am being told there is an error in code that i have to replace but the code isnt there . so i am at a bit of a loss here .
Title: Re: smf upgrade patch errors
Post by: Aleksi "Lex" Kilpinen on January 21, 2018, 11:13:45 AM
The package manager is telling you that it is searching for that code, in order to replace it with the new one. It is not telling you the code is there. The error may be because the code is not there at all ( either because of modifications, or manual edits to the file ).
In case of errors like this, it is not a good idea to try to search for 1:1 match in the file, because likely there is none.
Title: Re: smf upgrade patch errors
Post by: sam casey on January 21, 2018, 11:30:32 AM
ok , if im understanding you correctly even tho the error is telling me i need to replace a certain bit of code , that in fact the code may not be there at all , and that that may be the problem .

so how do i know where the new line of code goes ? , the error does not specify the particular line or lines where the code should be .

so what should my next move be .
Title: Re: smf upgrade patch errors
Post by: Aleksi "Lex" Kilpinen on January 21, 2018, 11:45:00 AM
That specific edit should be at the very beginning of the file, like this:


<?php

/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines http://www.simplemachines.org
 * @copyright 2011 Simple Machines
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.0.14
 */


If it isn't there, it isn't really a problem and you can skip that edit - though I would be curious as to why it isn't there.
Title: Re: smf upgrade patch errors
Post by: sam casey on January 21, 2018, 12:04:11 PM
ok thanks .

there were two seperate error messages in sources/managesettings.php

again as above its replace one bit of code with another


Code: (Find) [Select]

// By default do the basic settings.
   $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : (!empty($defaultAction) ? $defaultAction : array_pop(array_keys($subActions)));
   $context['sub_action'] = $_REQUEST['sa'];

Code: (Replace) [Select]

// If no fallback was specified, use the first subaction.
   $defaultAction = !empty($defaultAction) ? $defaultAction : key($subActions);

   // I want...
   $_REQUEST['sa'] = isset($_REQUEST['sa'], $subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : $defaultAction;

again it would seem that the code in question is not there as i get the not found message . so would you know where (on what line ) the new code should go ?. thanks
Title: Re: smf upgrade patch errors
Post by: Aleksi "Lex" Kilpinen on January 21, 2018, 12:11:32 PM
Around line 85.

This is from a 2.0.15 file, rows 75-95


// You need to be an admin to edit settings!
isAllowedTo('admin_forum');

loadLanguage('Help');
loadLanguage('ManageSettings');

// Will need the utility functions from here.
require_once($sourcedir . '/ManageServer.php');

$context['sub_template'] = 'show_settings';

// If no fallback was specified, use the first subaction.
$defaultAction = !empty($defaultAction) ? $defaultAction : key($subActions);

// I want...
$_REQUEST['sa'] = isset($_REQUEST['sa'], $subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : $defaultAction;
}

// This function passes control through to the relevant tab.
function ModifyFeatureSettings()
{
Title: Re: smf upgrade patch errors
Post by: sam casey on January 21, 2018, 01:54:10 PM
thanks . i just checked and its line 97 to line 99 in the file on the host .

so just so i understand correctly

do i only replace this (which is line 98 and 99 )

$_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : (!empty($defaultAction) ? $defaultAction : array_pop(array_keys($subActions)));
   $context['sub_action'] = $_REQUEST['sa'];

with this

$_REQUEST['sa'] = isset($_REQUEST['sa'], $subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : $defaultAction;


or do i have to replace the entire thing as in do i also include the // by default do the basic settings (see just below ) and replace that with the // if no fallback was specified , use the first subaction etc etc ?

// By default do the basic settings.
   $_REQUEST['sa'] = isset($_REQUEST['sa']) && isset($subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : (!empty($defaultAction) ? $defaultAction : array_pop(array_keys($subActions)));
   $context['sub_action'] = $_REQUEST['sa'];



// If no fallback was specified, use the first subaction.
   $defaultAction = !empty($defaultAction) ? $defaultAction : key($subActions);

   // I want...
   $_REQUEST['sa'] = isset($_REQUEST['sa'], $subActions[$_REQUEST['sa']]) ? $_REQUEST['sa'] : $defaultAction;


oh wait a tick the above is saying test successful , so what i thought was an error being shown to me is not ? is that correct ? . its got the edit option on the left but it is saying test successful , so can i assume from that that the above requires no change ? .


if so im back to the first error , this error does say test failed . its just a version number error


Code: (Find) [Select]

@version 2.0.6

Code: (Replace) [Select]

@version 2.0.14


aleksi the bit of code you posted in regard the version error just above is

<?php

/**
* Simple Machines Forum (SMF)
*
* @package SMF
* @author Simple Machines http://www.simplemachines.org
* @copyright 2011 Simple Machines
* @license http://www.simplemachines.org/about/smf/license.php BSD
*
* @version 2.0.14
*/

if i had the above lines of code i could fix the error easily im sure . however on looking i seem to have quite different code , here is the code i have

<?php
/**********************************************************************************
* ManageSettings.php                                                              *
***********************************************************************************
* SMF: Simple Machines Forum                                                      *
* Open-Source Project Inspired by Zef Hemel ([email protected])                    *
* =============================================================================== *
* Software Version:           SMF 2.0 RC1                                         *
* Software by:                Simple Machines (http://www.simplemachines.org)     *
* Copyright 2006-2009 by:     Simple Machines LLC (http://www.simplemachines.org) *
*           2001-2006 by:     Lewis Media (http://www.lewismedia.com)             *
* Support, News, Updates at:  http://www.simplemachines.org                       *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under   *
* the terms of the provided license as published by Simple Machines LLC.          *
*                                                                                 *
* This program is distributed in the hope that it is and will be useful, but      *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
* or FITNESS FOR A PARTICULAR PURPOSE.                                            *
*                                                                                 *
* See the "license.txt" file for details of the Simple Machines license.          *
* The latest version can always be found at http://www.simplemachines.org.        *
**********************************************************************************/

the above code is line number 1 to line number 23 . as you can see its different to the code you posted . thanks for your help so far
Title: Re: smf upgrade patch errors
Post by: Aleksi "Lex" Kilpinen on January 21, 2018, 02:07:58 PM
Oh wow. RC1. That's old. I wonder how this is the first time you run in to problems updating. :)

How I would do this, is make a copy of the file(s) showing failed edits, make ALL the edits to the copied file(s) manually, then install the patch, and last upload the manually updated file(s) overwriting the one(s) on the server.
Title: Re: smf upgrade patch errors
Post by: Illori on January 21, 2018, 02:16:12 PM
if the file is from SMF 2.1 RC1, you need to grab the file from the 2.0.15 install or upgrade and upload a new file, of course any mods that have modified that file will have the edits removed but you will have the correct file in place. pretty good change the edits will not match as the file is too old.
Title: Re: smf upgrade patch errors
Post by: Aleksi "Lex" Kilpinen on January 21, 2018, 02:25:25 PM
Well, if the forum is really up to 2.0.13 as said - then it is possible it has been manually updated in the past, and the copyright section is just a leftover from the days of old...
Title: Re: smf upgrade patch errors
Post by: Illori on January 21, 2018, 02:26:47 PM
to upgrade to SMF 2.0 from RC1 you had to override all the files as there was no patch to 2.0. so something did not get overwritten.
Title: Re: smf upgrade patch errors
Post by: sam casey on January 21, 2018, 02:32:23 PM
the forum owner has had a few guys (admin / code guys ) taking care of updating patches etc etc over the years . the original guy is gone a few years ,there is another guy that has been helping my friend on and off when he can , but he hasnt been available recently . im an admin and i can usually learn things , but im not a code expert . i can usually pick things up and ive learned quite a bit lately thanks to you guys and from reading a lot . if its a simple enough bit of code change im probably ok with that , but i am always reluctant to mess with code beyond that . but as i said our other admin is not available , so ive been trying to sort things out as best i can , i had a few hiccups but ive now got two of the 3 sites up to date and running fine , i just want to update the last one if i can .

so that is why im only now just running into the problems and the rc 1 which you say is old . as ive seen an error to replace 2.0.6 with 2.0.14 can i take it that some files or some code goes back to smf version 2.0.6 ? if so i can understand what you mean when you say its quite old .

its just one file showing 1 error at this point . there are theme errors but im not that worried about them at the minute .

exporting a copy of the manage settings.php file as a backup copy , but also to have a copy to edit is not a problem . but the problem is what to edit ? , what to remove ? , what to add ? .

if i open a copy of managesettings.php from smf 2.0.14 will that show me in essence what is different and what i have to edit or add to the current file ? .

Title: Re: smf upgrade patch errors
Post by: Aleksi "Lex" Kilpinen on January 21, 2018, 02:39:44 PM
All of the edits each patch does is available here https://custom.simplemachines.org/upgrades/

The ones in 2.0.14 are here https://custom.simplemachines.org/upgrades/index.php?action=upgrade;file=smf_patch_2.0.14.tar.gz;smf_version=2.0.13

RC1 was in february 2009, and before 2.0's final release there were 3 more RC versions released.
There is a high change that if your files really are from RC1 the code hasn't been properly updated like Illori suggested, unless your original admins did a lot of manual work to keep up.
Title: Re: smf upgrade patch errors
Post by: sam casey on January 21, 2018, 02:41:22 PM
Quote from: Illori on January 21, 2018, 02:16:12 PM
if the file is from SMF 2.1 RC1, you need to grab the file from the 2.0.15 install or upgrade and upload a new file, of course any mods that have modified that file will have the edits removed but you will have the correct file in place. pretty good change the edits will not match as the file is too old.

so if i get the managesettings.php file from smf 2.0.15 and replace my current file on the host with the new file the problem should be resolved ? . i understand that some mods might be affected , as long as there would be no serious error caused to the forum i could do that .
Title: Re: smf upgrade patch errors
Post by: Aleksi "Lex" Kilpinen on January 21, 2018, 02:43:51 PM
Do you have a lot of mods or custom code in your forum? If not, it could be a good idea to do it the Large Upgrade way.
Upgrading SMF (https://wiki.simplemachines.org/smf/Upgrading)
Title: Re: smf upgrade patch errors
Post by: sam casey on January 21, 2018, 02:48:43 PM
might the simple solution be to make a new smf 2.0.15 install on the host , and then point it at the forums database ? . i did that with one of the sites as nothing we tried fixed the problem that we had , and installing a new smf install and pointing it at the database worked and that site works perfectly now .

using the above method means that any old smf files / old code wont be a factor , and the site will be up to date . what do you think ? .
Title: Re: smf upgrade patch errors
Post by: sam casey on January 21, 2018, 02:52:08 PM
Quote from: Aleksi "Lex" Kilpinen on January 21, 2018, 02:43:51 PM
Do you have a lot of mods or custom code in your forum? If not, it could be a good idea to do it the Large Upgrade way.
Upgrading SMF (https://wiki.simplemachines.org/smf/Upgrading)

i could lists the installed mods for you if you want . regarding code or custom code i just dont know , as i said the original admin / code guy hasnt been with us for a few years now , and our current guy hasnt been available to help us , so i cant say what if any code is custom or not .
Title: Re: smf upgrade patch errors
Post by: Aleksi "Lex" Kilpinen on January 21, 2018, 02:53:02 PM
In essence the large upgrade does the same, brings you to up to date files, but by overwriting the old code in place.
Title: Re: smf upgrade patch errors
Post by: sam casey on January 21, 2018, 03:11:48 PM
ok thanks for all your help . its really appreciated .
Title: Re: smf upgrade patch errors
Post by: Illori on January 21, 2018, 03:45:01 PM
Quote from: Aleksi "Lex" Kilpinen on January 21, 2018, 02:43:51 PM
Do you have a lot of mods or custom code in your forum? If not, it could be a good idea to do it the Large Upgrade way.
Upgrading SMF (https://wiki.simplemachines.org/smf/Upgrading)

actually i would recommend https://wiki.simplemachines.org/smf/How_to_upload_a_fresh_set_of_files instead.
Title: Re: smf upgrade patch errors
Post by: Aleksi "Lex" Kilpinen on January 22, 2018, 02:18:32 AM
Sorry Illori, but I think when we are obviously talking about skipping multiple versions, (this time the forum being originally based on RC1) I think it's illogical to suggest a more complex procedure not actually meant for updating.

For the end user I think it is easier to keep three things separate; update, upgrade, and reverting to a clean install.

But that being said, if the database is OK and works with 2.0.15, that would work just as well.
Title: Re: smf upgrade patch errors
Post by: Illori on January 22, 2018, 05:10:02 AM
the issue is that you can upgrade all you want, but that will not remove any hooks mods may have installed, so you need to include that step that is part of the clean install. [which is fixed in SMF 2.1]
Title: Re: smf upgrade patch errors
Post by: Aleksi "Lex" Kilpinen on January 22, 2018, 05:11:09 AM
Actually a point to consider perhaps, why doesn't the upgrade script do that - or offer the option?
Title: Re: smf upgrade patch errors
Post by: Illori on January 22, 2018, 05:42:44 AM
the devs have not considered it for SMF 2.0. i am not sure if it is worth adding it at this point.
Title: Re: smf upgrade patch errors
Post by: sam casey on January 25, 2018, 04:36:04 PM
Quote from: Illori on January 21, 2018, 03:45:01 PM
Quote from: Aleksi "Lex" Kilpinen on January 21, 2018, 02:43:51 PM
Do you have a lot of mods or custom code in your forum? If not, it could be a good idea to do it the Large Upgrade way.
Upgrading SMF (https://wiki.simplemachines.org/smf/Upgrading)

actually i would recommend https://wiki.simplemachines.org/smf/How_to_upload_a_fresh_set_of_files instead.


a big thank you to illori and everyone who has helped me here . ive uploaded a fresh set of files as per the instructions in the link above . all went ok and ive installed the 2.0.14 patch and then the 2.0.15 patch . no problems to report guys . so thank you very much to all  .
Title: Re: smf upgrade patch errors
Post by: Aleksi "Lex" Kilpinen on January 25, 2018, 04:52:28 PM
Quote from: sam casey on January 25, 2018, 04:36:04 PM
Quote from: Illori on January 21, 2018, 03:45:01 PM
Quote from: Aleksi "Lex" Kilpinen on January 21, 2018, 02:43:51 PM
Do you have a lot of mods or custom code in your forum? If not, it could be a good idea to do it the Large Upgrade way.
Upgrading SMF (https://wiki.simplemachines.org/smf/Upgrading)

actually i would recommend https://wiki.simplemachines.org/smf/How_to_upload_a_fresh_set_of_files instead.


a big thank you to illori and everyone who has helped me here . ive uploaded a fresh set of files as per the instructions in the link above . all went ok and ive installed the 2.0.14 patch and then the 2.0.15 patch . no problems to report guys . so thank you very much to all  .

Well  that's good to hear :)