News:

Wondering if this will always be free?  See why free is better.

Main Menu

Resetting Forum...

Started by Kindred, February 14, 2012, 01:17:08 PM

Previous topic - Next topic

Kindred

So, as you may have heard - I set up a test forum in which I installed over 160 mods.

Now... I can manually reset the forum using the large upgrade archive - but that doesn't clean everything.

So, I wrote a script which does.
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

it does NOT:
delete mod specific installed files (i.e. mymod.php)
remove mod specific installed tables or columns from the database

BEWARE: the does only a minimal security check for admin - it is NOT recommended to leave the file sitting in an accessible place on your server

BEWARE EVEN MORE - this script does NOT ask for validation...  it WILL delete settings, directories and files without asking you. It assumes that you intended to run it....

Assumptions:
A- The reset script has been uploaded to the forum root (i.e. where Settings.php and SSI.php are)
B- you have also uploaded a file called "test_reset.zip" which has the clean forum files. (my test_reset.zip file is the large upgrade package with the avatars, the smileys, the upgrade files and core theme directory removed)

FINAL WARNING - the actions in this script are NOT recoverable without a full backup of your database AND files. If you don't have a backup, then take one!
Сл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."

Matthew K.

Also might be good to note that this is for SMF 2.0x only, and not the 1.1x branch. Great idea, Kindred.

4Kstore

thanks, this is a good tool to have in mind

¡¡NEW MOD: Sparkles User Names!!!

Bigguy

Very nice. :) I like it. Was there not another one that did the same thing in the works or is this it. ???

Matthew K.

Quote from: Bigguy on February 16, 2012, 12:22:20 AM
Very nice. :) I like it. Was there not another one that did the same thing in the works or is this it. ???
No...Yoshi wanted one developed, and I said I'd do it, but only started a little bit today.

Bigguy

I started a topic about something like this in the team boards about a database reset. This isn't the place for this discussion but check the team boards.

Adrek

This is great, but I have one small problem.
I sent this file to /root_smf/dodatki and changed
require_once($reset_path . '/SSI.php');
to
require_once($reset_path . '/../SSI.php');

Now what is the problem.
I run this script, and this is what it shows me


List of installed mods is clear, but modifications are still there, source or theme files was not replaced by files from test_reset.zip
Polskie wsparcie SMF na simplemachines.org

the simplest solution is most likely the right one

Kindred

#7
Well, of course not...

1- your attempt failed when it hit the theme removal.... Which is before the new file overwrite.
2- removing the installed packages removes the from the installed list. It does not remove the actual code.. that is done when the new file overwrite happens, as the final step.


I did not test with any other directory... I only tested with this reset file in the actual SMF directory. Why did you pt it somewhere else?
Сл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."

!RFAN

cool but we want these

delete mod specific installed files (i.e. mymod.php)
remove mod specific installed tables or columns from the database

Kindred

nope.... not going to do that because I don't see any easy way to do it.

It would be complicated to try and find that data and not worth the time to code.

Besides... this resets the forum but does not delete any mod data... which was my goal.
Сл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."

NanoSector

Thanks for creating this, I'll bookmark this so I can link people which need a forum reset :)

(@bigguy: I was indeed the guy which started this idea by some people)
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."

Bigguy

There is another topic in the team boards I think it is about one that is a bit more in depth. I think it is still around anyway.

Kindred

Just for the record... :D

I had no knowledge of previous commentary on this....  I needed it for my test forum, so I created it and decided to share it. :P
Сл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."

MESWEB

WARNING:
This script have error:
Quotepublic_html/reset_site_2.php on line 77

Colin

Could you please post the full error message? That will help the dev locate the issue.
"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin

Robert.

Have you set the file permissions to 755 or 775?

MESWEB

Chmod 755
QuoteThis script resets all files to the default installation from the file "test_reset.zip" (which is a pared down version of the "Large Upgrade Package" from SMF.)
This script will also remove all installed themes other than the default, reset all packages to "not installed" and reset all member options to the default settings for the default theme.
Remember: This will not remove any mod DATA from the database, nor will it delete the mod-specific FILES

Resetting error logs

Resetting installed packages

Finding and removing all themes except for the default theme (Curve)

Removing (6) Extreme6 Final
from /home/messiah/public_html/Themes/extreme6_2_0_texture

Fatal error: Call to undefined function deltree() in /home/messiah/public_html/reset_site_2.php on line 77

Kindred

looks like you host won't allow deltree to run (or you're on a windows host?)
Сл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."

MESWEB

My host is unix non windows. How to check - info about deltree?

Kindred

Сл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."

Advertisement: