php forum
php mysql forum
php mysql smarty
 
Topic Options
#280844 - 10/15/04 04:30 AM Finished-[] Repairing damaged threads
autoua.net/elia Offline
Lurker

Registered: 10/14/04
Posts: 2
Loc: Kiev region, Ukraine
Mod Name / Version: Repairing damaged threads <br /><br />Description: This script check correspondence of fields `B_Main`, `B_Parent`, `B_Board`, `B_Status` of answer posts to values of root post of the thread. I am using this script via cron every hour. <br /><br />Working Under: UBB.Threads <br /><br />Mod Status: Finished <br /><br />Any pre-requisites: <br /><br />Author(s): autoua elia <br /><br />Date: 10/15/04 <br /><br />Credits: <br /><br />Files Altered: none <br /><br />New Files: #! /usr/bin/php<br /><?<br /><br />// Require the threadss library<br /> require ("../includes/main.inc.php");<br /> <br />//Selecting starting number of records for correcting<br /> $counterquery = "SELECT count(m1.B_Number) FROM {$config['tbprefix']}Posts m1, {$config['tbprefix']}Posts m2<br />WHERE m2.B_Number = m1.B_Parent<br />AND m1.B_Parent > 0<br />AND (m1.B_Board != m2.B_Board or m1.B_Main != m2.B_Main or m1.B_Status != m2.B_Status)<br />";<br /><br />$query = $counterquery;<br />$sth = $dbh -> do_query($query);<br /><br />list($errcounter) = $dbh -> fetch_array($sth);<br /><br />// step-by-step correcting errors in three<br />while ($errcounter > 0)<br />{<br /><br /> $query = "SELECT m1.B_Number, m2.B_Main, m2.B_Board, m2.B_Status FROM {$config['tbprefix']}Posts m1, {$config['tbprefix']}Posts m2<br />WHERE m2.B_Number = m1.B_Parent<br />AND m1.B_Parent > 0<br />AND (m1.B_Board != m2.B_Board or m1.B_Main != m2.B_Main or m1.B_Status != m2.B_Status)<br />";<br /><br /> $sth = <br /> $dbh -> do_query($query);<br /> <br /> while (list($B_Number1, $B_Main1, $B_Board1, $B_Status1) = $dbh -> fetch_array($sth) )<br /> {<br /><br /> $B_Number_q = addslashes($B_Number1);<br /> $B_Main_q = addslashes($B_Main1);<br /> $B_Board_q = addslashes($B_Board1);<br /> $B_Status_q = addslashes($B_Status1);<br /> <br /> $query = "UPDATE {$config['tbprefix']}Posts SET B_Topic = 0, B_Main = '$B_Main_q', B_Board = '$B_Board_q', B_Status = '$B_Status_q'<br /> WHERE B_Number = '$B_Number_q'<br /> ";<br /> <br /> $dbh -> do_query($query);<br /> }<br /><br /> <br /> $query = $counterquery;<br /> $sth = <br /> $dbh -> do_query($query);<br /> list($errcounter) = $dbh -> fetch_array($sth);<br /><br /><br />}<br /> <br /> $dbh -> finish_sth($sth);<br /><br />?> <br /><br />Database Altered: no <br /><br />Info/Instructions: In forums with the big activity we usually have such problem:<br />- moderator has moved a topic in another forum, but somebody from users has already opened reply window and his post will be placed in forum on old location (value of field `B_Board` for this post will be different from analogous field of root post)<br />- moderator had closed the tread, but someone user already have opened answer window. And his post will be not "closed", because value of field B_Status will not be "C". So other users have pocibility to continue discussion <img src="http://www.ubbdev.com/forum/images/graemlins/wink.gif" alt="" /> in closed thread.<br />- Topic had been split, subtopic was moved to separate topic, however some of "her" posts has old value of fields `B_Main` or `B_Parent`. <br /><br />Disclaimer: Please backup every file that you intend to modify. <br />If the modification modifies the database, it's a good idea to backup your database before doing so. <br /><br />Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.

Top
#280845 - 10/15/04 09:57 AM Re: Finished-[] Repairing damaged threads [Re: LNK]
AllenAyres Administrator Offline
I type Like navaho

Registered: 03/10/00
Posts: 25448
Loc: Texas
<img src="http://www.ubbdev.com/forum/images/graemlins/cool.gif" alt="" /> Thanks for sharing <img src="http://www.ubbdev.com/forum/images/graemlins/smile.gif" alt="" />
_________________________
- Allen wavey
- What Drives You?

Top
#280846 - 10/15/04 10:48 AM Re: Finished-[] Repairing damaged threads [Re: SurfMinister]
autoua.net/elia Offline
Lurker

Registered: 10/14/04
Posts: 2
Loc: Kiev region, Ukraine
Any time <img src="http://www.ubbdev.com/forum/images/graemlins/wink.gif" alt="" /><br /><br />Constantly I see the problems happen from logic problems of the current UBBT realisation and limitation MySQL (especially absence of triggers). <br />For example, these scripts resolve problems with value of fields B_Board, B_Main, B_Status and so on. <br />On Oracle, Interbase etc. I prefer to fill these fields by trigger "BeforeInsert" or "AfterInsert" according to values of equal fields of parent post - this variant is fully "automatic" and don`t add big advantage on server or client. You may realise in addpost.php checking current values of this fields in parent post before recording in table answer post...<br /><br /> So I am trying to correct hot problems with available for me tools. <img src="http://www.ubbdev.com/forum/images/graemlins/wink.gif" alt="" /><br /><br />PS<br />Sorry for my terrible English <img src="http://www.ubbdev.com/forum/images/graemlins/wink.gif" alt="" />

Top
#280847 - 10/16/04 09:25 AM Re: Finished-[] Repairing damaged threads [Re: LNK]
Astaran Offline
Addict

Registered: 12/21/00
Posts: 1545
Loc: Germany
Thx for sharing. <img src="http://www.ubbdev.com/forum/images/graemlins/smile.gif" alt="" />
_________________________
Running a community? -> Keep informed and take it to the next level

Top
#280848 - 10/17/04 12:26 PM Re: Finished-[] Repairing damaged threads [Re: -Fusion-]
Pasqualist Offline
Member

Registered: 01/30/03
Posts: 285
Loc: Amsterdam, The Netherlands
Thanks a lot for this mod! Super <img src="http://www.ubbdev.com/forum/images/graemlins/laugh.gif" alt="" />

Top


Moderator:  Ian_W 
Who's Online
1 registered (Gizmo), 23 Guests and 12 Spiders online.
Key: Admin, Global Mod, Mod
Shout Box

Latest Posts
Forum 'Trader Ratings'.
by blaaskaak
11/20/08 08:27 AM
Problems reading a lot of old posts here
by Ruben Rocha
11/18/08 04:33 PM
PhotoPost BB Code Popup
by Iann128
11/15/08 01:24 PM
Customization needed
by Gizmo
11/12/08 12:28 PM
Team UBBDev Rides Again!
by AllenAyres
11/11/08 02:16 PM
Active Topics.
by AllenAyres
11/11/08 02:13 PM
Looking for a simple upload script
by AllenAyres
11/11/08 02:12 PM
New Mods
Forum 'Trader Ratings'.
by McLemore
11/19/08 02:14 PM
[7.4] Keep log of custom title changes
by blaaskaak
10/27/08 07:51 AM
User Authentication Class
by
01/19/07 02:59 PM
Multiple Identity Detector
by
12/30/06 06:39 PM
PhotoPost BB Code Popup
by
11/06/06 05:43 PM
Newest Members
Begbie, cenk, MATTO, DougMMcts, tim Anderson
13361 Registered Users
Top Posters
AllenAyres 25448
JoshPet 11330
Rick 8372
LK 7396
Lord Dexter 6503
Greg Hard 5533
Charles Capps 5438

 

 

 
fusionbb message board php hacks