Is it possible to "reset" a smf installation but keeping all users, posts, etc?

Started by NiceLittleMonkey, February 13, 2013, 09:29:16 AM

Previous topic - Next topic

NiceLittleMonkey

New user here and in a bit of a predicament.

I am co-founder and co-admin of a smf forum started around 6 months ago with ~150 users and 4000 posts. My problem is that "the other" guy has been responsible for the technical part of the forum, and despite what we agreed it turns out he has installed all sorts of packages and mods and finally the site forum is starting to suffer and users are experiencing weird behavior from the forum, like "Wrong value type sent to the database. Integer expected. (id_msg)" when trying to open some threads, avatars disappearing, etc.

At this point, where the site hasn't been properly operational for more than a week, I am starting to get serious complaints from users and I myself am also very unhappy and displeased with the situation and I want to do something serious about it.

Since I have no clue what the "other guy" has done (no notes, no documentation, no info, no nothing from him...) I wanted to ask the smf community if there is any way I can "reset/default" my SMF to version 2.0.4, which our forum should currently be running, but keeping the core smf database and files intact (configuration, users, threads)? I am not a coder by trade, but I can work my way around the database, and I can read some code, and know the basics of how web sites/forums works.   I have admin access to everything (smf, database, files/FTP, etc).

I know the above is a bit vague, but before diving in to too many technical details I wanted to ask if it was even possible? What I am really afraid of is that some of the packages/mods he installed has made changes to the database. Files can be replaced or updated, but a "corrupt/changed" database is a different thing in my eyes.

Myself, and ~150 users, highly appreciate your inputs and suggestions as our forum was really starting to take off and we were getting a lot of positive feedback.

Thank you.

/G

UPDATE:

Decided to put a bit more info into this post after all.

- In the database I see that the version is "smfVersion   2.0.2"

- Number of tables (SELECT count(*) from information_schema.tables WHERE table_schema = 'dbName'): 129

- List of tables:

smf_2sichat
smf_2sichat_barlinks
smf_2sichat_gadgets
smf_admin_info_files
smf_approval_queue
smf_attachments
smf_ban_groups
smf_ban_items
smf_board_permissions
smf_boards
smf_calendar
smf_calendar_holidays
smf_categories
smf_class_bids
smf_class_cat
smf_class_cat_notify
smf_class_catperm
smf_class_comment
smf_class_credit_log
smf_class_credit_packages
smf_class_custom_field
smf_class_custom_field_data
smf_class_customprice
smf_class_durations
smf_class_listing
smf_class_listing_pic
smf_class_log_mark_view
smf_class_modules
smf_class_tags
smf_class_tags_log
smf_class_termsofuse
smf_class_transactions
smf_class_upgrade
smf_class_upgrade_log
smf_class_upgrade_type
smf_collapsed_categories
smf_custom_fields
smf_feedback
smf_gallery_cat
smf_gallery_catperm
smf_gallery_comment
smf_gallery_creport
smf_gallery_custom_field
smf_gallery_custom_field_data
smf_gallery_exif_data
smf_gallery_favorites
smf_gallery_groupquota
smf_gallery_log_mark_view
smf_gallery_notifyupdates
smf_gallery_pic
smf_gallery_pic_tagging
smf_gallery_rating
smf_gallery_related_pictures
smf_gallery_report
smf_gallery_settings
smf_gallery_tags
smf_gallery_tags_log
smf_gallery_title_cache
smf_gallery_usercat
smf_gallery_userprivate
smf_gallery_userquota
smf_gallery_usersettings
smf_group_moderators
smf_log_actions
smf_log_activity
smf_log_banned
smf_log_boards
smf_log_comments
smf_log_digest
smf_log_enotify_pms
smf_log_enotify_replies
smf_log_errors
smf_log_floodcontrol
smf_log_group_requests
smf_log_karma
smf_log_mark_read
smf_log_member_notices
smf_log_notify
smf_log_online
smf_log_packages
smf_log_polls
smf_log_reported
smf_log_reported_comments
smf_log_scheduled_tasks
smf_log_search_messages
smf_log_search_results
smf_log_search_subjects
smf_log_search_topics
smf_log_spider_hits
smf_log_spider_stats
smf_log_status_replies
smf_log_statuses
smf_log_subscribed
smf_log_topics
smf_mail_queue
smf_membergroups
smf_members
smf_message_icons
smf_messages
smf_moderators
smf_openid_assoc
smf_package_servers
smf_permission_profiles
smf_permissions
smf_personal_messages
smf_pm_recipients
smf_pm_rules
smf_poll_choices
smf_polls
smf_profile_comments
smf_related_topics
smf_scheduled_tasks
smf_search_terms
smf_sessions
smf_settings
smf_smileys
smf_sp_articles
smf_sp_blocks
smf_sp_categories
smf_sp_functions
smf_sp_pages
smf_sp_parameters
smf_sp_shoutboxes
smf_sp_shouts
smf_spiders
smf_subscriptions
smf_tapatalk_users
smf_themes
smf_topics


- List of installed packages:

SMF 2.0.4 Update   1.0   
Scrolling Buttons   0.3   
Optimus Brave   1.8.5   
reCAPTCHA for SMF   0.9.8a   
Global Headers Footers   2.0.1   
ENotify   2.0.2   
Admin Notepad   2.0.2   
SMF Gallery Pro   4.0.9a   
SMF Gallery Pro Profile Link   1.1   
Registered Links   3.0   
YouTube BBCode   2.6   
Default Avatar   2.2   
SimplePortal   2.3.5   
Tapatalk SMF 2.0 RC5/Final Plugin   3.2.1

kat

Sure it is!

BACKUP FIRST!!!

Get the large upgrade archive for the version of SMF that you're using.

Dearchive it.

Upload everything EXCEPT UPGRADE.PHP, overwriting what's there, now.

Voila! Virgin forum with posts, members, etc. intact.

ALL mods will be screwed. You can either reapply them, or delete them, from Package Manager.

:)

NanoSector

Easier:

Backup.

Delete EVERYTHING from your forum directory EXCEPT for the following files:
./Settings.php
./Settings-bak.php
./attachments
./avatars
./Smileys

Then upload the Large Upgrade package, leaving out upgrade.php and any of the upgrade-*.sql files.

I find myself more comfortable with this, since it gets rid of any obsolete files.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."


NiceLittleMonkey

Very cool, Gentlemen. Thank you!

That covers most of my "forum rescue" if I understand you correctly. :)

What about the database? 'Not quite sure how to verify the integrity of the database.

NanoSector

Once you've wiped out your files, you may compare the database to a fresh one and remove any tables which aren't included by default.
My Mods / Mod Builder - A tool to easily create mods / Blog
"I've heard from a reliable source that the Answer is 42. But, still no word on what the question is."

NiceLittleMonkey

Couple of more questions:

Quote from: K@ on February 13, 2013, 10:47:44 AM
Get the large upgrade archive for the version of SMF that you're using.

- The database says "smfVersion 2.0.2" but the package manager says "SMF 2.0.4 Update 1.0". I am unsure which large upgrade archive to download; smf_2-0-2_upgrade.zip or smf_2-0-4_upgrade.zip?

Quote from: K@ on February 13, 2013, 10:47:44 AM
ALL mods will be screwed. You can either reapply them, or delete them, from Package Manager.

So, they will still be available in the package manager because they are listed in the database, but in reality all the code files are no longer there. Is that correctly understood?

Quote from: Yoshi2889 on February 13, 2013, 11:03:48 AM
Once you've wiped out your files, you may compare the database to a fresh one and remove any tables which aren't included by default.

That's true. I can then only hope that none of the packages or mods installed has made any changes to the core smf tables.

Matthew K.

None of those modifications should have touched any of the original database tables in an SMF installation. Most that do anything to the database add rows to {db_prefix}settings and two or three of them add their own tables which will be distinguishable by subprefixes.

kat

The version of SMF that you'll want is the one shown at the bottom of your pages, where the copyright is. :)

From what you've said, it'll be 2.0.4.

NiceLittleMonkey

Thank you again, Gentlemen.

This is the forum in question: http://www.rc-forum.dk

I searched through all the settings in the admin panel but I couldn't figure out where to enable showing the smf version, so it must have been un-commented in the code somewhere. Can you please point me in the right direction where to look?  :)

Using "Core theme" by the way, and I now see these changes:

function template_body_below()
{
   global $context, $settings, $options, $scripturl, $txt, $modSettings;

   echo '
   </div>';

   // Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
   echo '
   <div id="footerarea" class="headerpadding topmargin clearfix">
      <ul class="reset smalltext">
         <center>&copy RC-Forum.dk 2012</center>
         <a href="http://www.i123.dk/" target="_blank">
          <img src="http://www.rc-forum.dk/logo.png"</a>
      </ul>';

   // Show the load time?
   if ($context['show_load_time'])
      echo '
      <p class="smalltext" id="show_loadtime">', $txt['page_created'], $context['load_time'], $txt['seconds_with'], $context['load_queries'], $txt['queries'], '</p>';

   echo '
   </div>
</div>';
}

kat

There, you've got me. There's no copyright, at the bottom.

Normally, that means no support. ;)

What you have showing, for guests, doesn't help.

Have a look at the packages you've installed. Any patches/updates should be showing, there.

Shambles

Quote
... "the other" guy has been responsible for the technical part of the forum ...


Quote
Since I have no clue what the "other guy" has done (no notes, no documentation, no info, no nothing from him...)

Isn't he speaking to you about this 'reset' request? He visits sm.org regularly as user "Maloxan", I think...

NiceLittleMonkey

Okay, so here's the story (short version):

The person you mentioned I have asked today to resign as co-admin and technical responsible for the forum. It just didn't work out and now users are threatening to the leave the forum. I am the "founder" of the forum and decided to take control before the forum died. I do not own the forum and have no commercial interests in it - it's a free and member driven site and all the content is written by, and belongs to, the members. I simply try to do my best managing it as admin.

I see - so the obligatory copyright was removed. Hmmm...  :-[ I will try to get that back. Should happen anyway when I apply the large upgrade archive.

In my first post I wrote the below. It confuses me a bit that the database says version 2.0.2 and the package manager says 2.0.4 update?:

- In the database I see that the version is "smfVersion 2.0.2"

- List of installed packages:

SMF 2.0.4 Update   1.0   
Scrolling Buttons   0.3   
Optimus Brave   1.8.5   
reCAPTCHA for SMF   0.9.8a   
Global Headers Footers   2.0.1   
ENotify   2.0.2   
Admin Notepad   2.0.2   
SMF Gallery Pro   4.0.9a   
SMF Gallery Pro Profile Link   1.1   
Registered Links   3.0   
YouTube BBCode   2.6   
Default Avatar   2.2   
SimplePortal   2.3.5   
Tapatalk SMF 2.0 RC5/Final Plugin   3.2.1



NiceLittleMonkey

There. I restored the original footer. It now says 2.0.4, but why does the database then say 2.0.2?

kat

Because updating the software doesn't always need the database updating, if nothing has changed, there.

If you look, you'll notice that a lot of the files aren't 2.0.2, either. :)



Kindred

BTW: Doing the reset by overwirintg the files does leave some tail ends hanging out with mods in 2.0.x...  because some mods use the integration hooks, and thus leave the hooks still in the database, even after you remove the files.

I actually wrote a reset script to handle it on my test fourm, which continually needed to be reset as I tested all sorts of crap mods.
http://www.simplemachines.org/community/index.php?topic=468497.0
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."



NiceLittleMonkey

Kindred > Thank you for the input. Some questions for you:

Quote from: Kindred on February 14, 2012, 01:17:08 PM
1- truncates/removes the error logs from the DB
2- truncates/removes the package list from the DB (thus marking all packages as "uninstalled")
3- removes (via delTree) any themes installed, other than default
4- removes all installed themes (other than default) and all member options from the smf_themes tables
5- removes the backup tar.gz files from Packages/backups
6- removes *.php~ files from the forum root, /Sources, /Themes/default and /Themes/default/languages
7- removes *.css~ files from Themes/default/css
8- removes most of the common hooks

- Would I run your script after restoring all the core files with the large update archive?

- (2) So now I don't need to do it manually?

- (3) We are currently using the "Core Theme". That will remain, correct?

- (6) Not quite sure I understand why?

- (7) Not quite sure I understand why?

Kindred

my script will restore all files from a ZIP called test_reset.zip.

I took the large upgrade archive file and removed things like the avatars and smilies directories and the actual upgrade files (upgrade.php and all of the .sql and other database files) and renamed it test_reset.zip

item 2 gets rid of the log of installed packages... item 8 gets rid of the commnly used hooks which packages use.

item 3 and 4---  I honestly don't recall... I only use the default theme (curve). I neve rliked core, so it is always the first thing that I delete...
Do note...   my script **DOES** remove all member-set options. They will be reset to the default options. This includes ALL member options and preferences...

items 6 and 7...   why? to clean up all the extra backup files that mods make when they install (but the mods are no longer installed, so why do you need the backup versions of those files?) same goes for item 5


Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

NiceLittleMonkey

I have to admit that I didn't take my time to read your script before asking my questions last night. I have now downloaded and read your reset_site_21.php script. Couple of questions, if you don't mind:

1. This would be step one using the large upgrade file smf_2-0-4_upgrade.zip in my case, right?:

QuoteI took the large upgrade archive file and removed things like the avatars and smilies directories and the actual upgrade files (upgrade.php and all of the .sql and other database files) and renamed it test_reset.zip

2. About 1. By removing e.g. avatars and smilies directories I take it this means that the original directories will be preserved/left untouched, correct?

3. I see you are extracting the test_reset.zip to a specific folder. This would be the www root of the forum, correct?:

zip_extract('test_reset.zip','/home/turtleshell/www/test/');

On our host the root path is /var/www/web16/web/ so I'd modify your script to the below, correct?:

zip_extract('test_reset.zip','/var/www/web16/web/');

4. I now see you are removing the *.php~ and *.css~ files and obviously not the the *.php and *.css which was what I thought at first...  ::)




Kindred

1- yes
2- yes
3 yes...  (and oops... iddn't mean to hardcode my directory in there.  I'll have to fix that)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Arantor

-sigh- Remind me why we're doing this when it won't even fix the problem in question?

NiceLittleMonkey


Arantor

Back to the other topic. Resetting all the files won't actually fix anything, you're still going to have the situation you already have where the topic doesn't apparently have any messages, which is what causes the failure and that your first step should be to run the find/repair in the forum admin panel having done a backup.

NiceLittleMonkey

That is only the case for very few dead threads left in the forum. Everything about that is back in working order with threads and posts now. I just wanted to see if there was an easy way to delete threads in the database to clean up the remainders.

I have a copy of the forum up and running on a different host now, and it will stay there untouched.

I am now trying to get a copy of the forum up and running on a third host so I can perform a full reset test there. Want to see it succeed before doing it on the live forum.


Arantor


NiceLittleMonkey

I hear you. As soon as I have the third host up and running I'll update the other thread about the few dead threads. ;)

Arantor

I also wouldn't directly edit *anything* in the database. Well... that's not entirely accurate. *I* might edit things in the database but then again I know where all the related tangents are, where all the relations to topics and messages are, so I could go away and edit all those changes manually as well. It's not just in a single place.

NiceLittleMonkey

There. Problem with "dead threads" is solved. Thank you. Onwards with the "reset".  :)

NiceLittleMonkey

I marked this thread as solved, as the reset of the forum was successful.

I am now bugging Kindred in his thread about "removing most of the common hooks" in the database.  ;D


NiceLittleMonkey

If I didn't already say thanks for the support, then I'm doing it now:

Thank you all. Highly appreciated. :)

Advertisement: