Simple Machines Community Forum

Archived Boards and Threads... => Archived Boards => SMF Feedback and Discussion => Topic started by: NinaSay on August 05, 2012, 09:52:36 PM

Title: I apologize for the absurd question, but...
Post by: NinaSay on August 05, 2012, 09:52:36 PM
What is the difference between SMF 2.0 RC5 and SMF 2.0.2?

I am running SMF 2.0 RC5, and was wondering if there is any reason to upgrade and if there are any tutorials for it?

Thanks so much!
Title: Re: I apologize for the absurd question, but...
Post by: Arantor on August 05, 2012, 09:58:27 PM
2.0 RC5 is a beta version, released prior to 2.0 (and since 2.0.2). There are some bugs in 2.0 RC5 that were fixed in later versions as well as multiple security vulnerabilities that have also been fixed.
Title: Re: I apologize for the absurd question, but...
Post by: NinaSay on August 05, 2012, 10:00:10 PM
Would running the large upgrade to 2.0.2 work? Would you know by any chance if mods/theme I'm using will still work?

Thank you for such a quick response.
Title: Re: I apologize for the absurd question, but...
Post by: Arantor on August 05, 2012, 10:03:01 PM
Running the large upgrade would likely remove your mods. Your theme will require some changes, there's no way around that.
Title: Re: I apologize for the absurd question, but...
Post by: Kindred on August 05, 2012, 11:05:34 PM
However, most mods and themes for RC5 will work just fine on 2.0.2
(you might want to check if the mods themselves have actually been upgraded in the mean time as well - if you are so far behind on keeping to forum up-to-date, you probably missed mod updates as well. :)
Title: Re: I apologize for the absurd question, but...
Post by: Arantor on August 05, 2012, 11:13:22 PM
Yes, most mods will work. Except they need to be removed first before doing the upgrade because with hooks, it's possible things will be left behind that shouldn't be and so on.

It's a complicated, and slightly messy, situation.
Title: Re: I apologize for the absurd question, but...
Post by: Kindred on August 06, 2012, 06:41:08 AM
hmmmmmm... I thought that the upgrade.php removed installed mods and hooks during the process....   I don't recall removing any mods during my site upgrade.
Title: Re: I apologize for the absurd question, but...
Post by: Arantor on August 06, 2012, 07:21:25 AM
upgrade.php nukes the installed list but AFAIK it does not clear hooks.
Title: Re: I apologize for the absurd question, but...
Post by: Kindred on August 06, 2012, 07:48:51 AM
ah...


  echo 'Remove any hooks for the removed mods<br /><br />';
  $integrate_columns = array('integrate_actions', 'integrate_admin_areas', 'integrate_bbc_buttons', 'integrate_bbc_codes', 'integrate_core_features', 'integrate_load_permissions', 'integrate_menu_buttons', 'integrate_pre_include', 'integrate_profile_areas');
  foreach ($integrate_columns as $column)
    $request = $smcFunc['db_query']('', 'DELETE FROM {db_prefix}settings WHERE variable LIKE {string:variable}', array('variable' => $column));



add this as a php file in your forum directory and run it...   that should take care of the hooks
Title: Re: I apologize for the absurd question, but...
Post by: Arantor on August 06, 2012, 07:52:49 AM
Also send a call to cache_put_data('modsettings', null) while you're at it (or use updateSettings to do it properly)
Title: Re: I apologize for the absurd question, but...
Post by: Kindred on August 06, 2012, 08:07:11 AM
hmmm.... I don't know that one. I threw this together as part of a "reset my forum" script.

but, in this case, do we really want to reset the modsettings? Wouldn't we want to preserve them for when the mod gets reinstalled?
Title: Re: I apologize for the absurd question, but...
Post by: Arantor on August 06, 2012, 08:12:25 AM
>_>

That instruction clears the cache, not the actual items.
Title: Re: I apologize for the absurd question, but...
Post by: emanuele on August 06, 2012, 09:33:27 AM
Also the list of hooks in that code is rather short and will not remove all the hooks present in 2.0.

That one is probably a bit drastic but it should remove all the hooks (along with any kind of setting that starts with "integrate_", but it should be unlikely that a mod introduced a setting whose name starts with "integrate_"...I hope)

  echo 'Remove any hooks for the removed mods<br /><br />';
  $smcFunc['db_query']('', 'DELETE FROM {db_prefix}settings WHERE variable LIKE {string:variable}%', array('variable' => 'integrate_'));
Title: Re: I apologize for the absurd question, but...
Post by: Arantor on August 06, 2012, 09:35:13 AM
And that still doesn't clear the cache ;)
Title: Re: I apologize for the absurd question, but...
Post by: Kindred on August 06, 2012, 09:41:58 AM
lol... sorry Nina, We seem to have gone off on a tangent.

To re-state, unless you run the script provided by me or emanuele, you should probably uninstall your mods before upgrading.
Then download the large upgrade package, upload and unzip it and run upgrade.php

you can then re-install mods. The themes (other than the default) will likely be unaffected.
Title: Re: I apologize for the absurd question, but...
Post by: Sorck on August 06, 2012, 09:48:12 AM
You know what, I have a feeling Arantor knows that the cache needs emptying for that to work properly. :P

<?php
require_once('SSI.php');
echo 
'Remove any hooks for the removed mods<br /><br />';
$smcFunc['db_query']('''DELETE FROM {db_prefix}settings WHERE variable LIKE {string:variable}%', array('variable' => 'integrate_'));
echo 
'Now fixing the cache...<br /><br />';
cache_put_data('modsettings'null0);
?>



Quote from: Kindred on August 06, 2012, 09:41:58 AM
you can then re-install mods. The themes (other than the default) will likely be unaffected.
Just remember that version emulation might be needed. :)

You can find information about that via Package Manager (http://wiki.simplemachines.org/smf/Packages).
Title: Re: I apologize for the absurd question, but...
Post by: Arantor on August 06, 2012, 09:53:22 AM
Either that or just uninstall mods before using the upgrade...

Also, SimpleDesk won't play nicely with that approach because it declares its own hooks that don't have the integrate_ prefix, which is why uninstalling mods is simply the cleanest way to do it.
Title: Re: I apologize for the absurd question, but...
Post by: Sorck on August 06, 2012, 10:06:39 AM
smCore has a much nicer setup with a separate hooks table.

Clearing things out will be much nicer in the future. :P

But yes, clearing the mods is safer for most purposes. And unless you have a lot of mods it won't take very long.
Title: Re: I apologize for the absurd question, but...
Post by: Arantor on August 06, 2012, 10:09:23 AM
The separate hooks table does add a performance penalty ;) Though I have an architecture around hooks that I particularly like, like automatically disabling all the hooks a plugin uses if I just rename or remove the folder a plugin is in ;)
Title: Re: I apologize for the absurd question, but...
Post by: Sorck on August 06, 2012, 10:33:44 AM
Quote from: Arantor on August 06, 2012, 10:09:23 AM
The separate hooks table does add a performance penalty ;) Though I have an architecture around hooks that I particularly like, like automatically disabling all the hooks a plugin uses if I just rename or remove the folder a plugin is in ;)
Yes, there is an extra database query per page load/an extra cache hit.

This hooks thing seems interesting... I've never really looked through them in any detail in SMF 2.x or smCore. Am I right in assuming that the hook deletion things is related to smCore?

EDIT: on a side note this is getting more off-topic. :P There should be a place for discussing smCore beyond git and the smCore website as both of them are fairly quiet...
Title: Re: I apologize for the absurd question, but...
Post by: emanuele on August 06, 2012, 10:35:21 AM
Quote from: Arantor on August 06, 2012, 09:35:13 AM
And that still doesn't clear the cache ;)
Yes of course, but you already posted about that so I didn't add the thing. :P

Yeah, I know, I should have... O:)
Title: Re: I apologize for the absurd question, but...
Post by: Kindred on August 06, 2012, 10:40:23 AM
Sorck,

No...   what Arantor is discussing if the code done for Wedge.
Title: Re: I apologize for the absurd question, but...
Post by: Arantor on August 06, 2012, 10:44:05 AM
QuoteYes, there is an extra database query per page load/an extra cache hit.

Yes, and that's over and above what you're already doing for mod settings anyway.

QuoteThis hooks thing seems interesting... I've never really looked through them in any detail in SMF 2.x or smCore. Am I right in assuming that the hook deletion things is related to smCore?

Nope. As Kindred says it's what I did for Wedge, after a serious amount of benchmarking and testing, and thinking about it. I have no idea what smCore does, and to be honest I don't really care either.

There is another issue that hasn't been touched on directly in this debate - but it is the reason why the hooks must be cleared: if you do the upgrade files may be removed but the hooks that reference them may not have been.

My approach is to not actually engage the hooks until you know for certain the files etc are present - meaning that you have the overhead of doing that per page load, but the trade-off of being able to delete a plugin by merely deleting a folder and never having to worry about anything else is a serious bonus for me.

It's more to illustrate the deficiencies in the current process and one route that they can be solved by - something that I think SMF 2.1 should take into account a bit more than I understand it does currently.
Title: Re: I apologize for the absurd question, but...
Post by: NinaSay on September 12, 2012, 05:13:04 PM
I know it has been a while since I replied, but thank you for the information. I will be attempting the upgrade this week.
Title: Re: I apologize for the absurd question, but...
Post by: emanuele on September 21, 2012, 06:18:13 AM
Quote from: Sorck on August 06, 2012, 09:48:12 AM
You know what, I have a feeling Arantor knows that the cache needs emptying for that to work properly. :P

<?php
require_once('SSI.php');
echo 
'Remove any hooks for the removed mods<br /><br />';
$smcFunc['db_query']('''DELETE FROM {db_prefix}settings WHERE variable LIKE {string:variable}%', array('variable' => 'integrate_'));
echo 
'Now fixing the cache...<br /><br />';
cache_put_data('modsettings'null0);
?>


Hope you don't mind if I have stolen your query for repair settings... O:)
https://github.com/emanuele45/tools/commit/db9a843b0a3ccafc889668ccb27a6d8d8cf95377
Title: Re: I apologize for the absurd question, but...
Post by: Sorck on September 28, 2012, 06:31:58 PM
Quote from: emanuele on September 21, 2012, 06:18:13 AM
Quote from: Sorck on August 06, 2012, 09:48:12 AM
You know what, I have a feeling Arantor knows that the cache needs emptying for that to work properly. :P

<?php
require_once('SSI.php');
echo 
'Remove any hooks for the removed mods<br /><br />';
$smcFunc['db_query']('''DELETE FROM {db_prefix}settings WHERE variable LIKE {string:variable}%', array('variable' => 'integrate_'));
echo 
'Now fixing the cache...<br /><br />';
cache_put_data('modsettings'null0);
?>


Hope you don't mind if I have stolen your query for repair settings... O:)
https://github.com/emanuele45/tools/commit/db9a843b0a3ccafc889668ccb27a6d8d8cf95377
Yep, you're fine to do so - it's nothing special. :P

Though I do hope you tested to see if it works before committing it...
Title: Re: I apologize for the absurd question, but...
Post by: TheListener on September 28, 2012, 06:35:55 PM
Emanuele test something before he uses it?

How do ya think he breaks so many things?

:D
Title: Re: I apologize for the absurd question, but...
Post by: emanuele on September 28, 2012, 07:01:00 PM
Quote from: Old Fossil on September 28, 2012, 06:35:55 PM
Emanuele test something before he uses it?
^^ This!

/me likes use others to do tests! >:D

BTW since it's only in my repo for now it's not a big issue. Sooner or later I'll test it... lol
Title: Re: I apologize for the absurd question, but...
Post by: Arantor on September 29, 2012, 11:40:09 AM
*cough* Look at the commit...
Title: Re: I apologize for the absurd question, but...
Post by: emanuele on September 30, 2012, 05:07:06 AM
Yep, thanks! ;D

Fixed it yesterday:
https://github.com/emanuele45/tools/commit/2c2a0e4d819b7d2f5e45a1f5afd4be80b1a273cb
Title: Re: I apologize for the absurd question, but...
Post by: Sorck on September 30, 2012, 05:55:25 AM
Out of interest, will SMF not escape the '%' character if it's being put in as type string?
Title: Re: I apologize for the absurd question, but...
Post by: Arantor on September 30, 2012, 01:19:58 PM
No, it won't. And if you put it outside as you had it, you'd end up with LIKE 'integrate_'% which is invalid.