Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Spuds on March 06, 2012, 10:49:56 AM

Title: Admin Toolbox
Post by: Spuds on March 06, 2012, 10:49:56 AM
Link to Mod (http://custom.simplemachines.org/mods/index.php?mod=3309)



Admin Toolbox Mod
By Spuds (http://custom.simplemachines.org/mods/index.php?action=search;author=11359)



License
o This Modifications Source Code is subject to the terms of the Mozilla Public License version 2.0 (the "License"). You can obtain a copy of the License at http://mozilla.org/MPL/2.0/.

Introduction
This modification adds several new admin maintenance functions including

This mod is compatible with SMF 2.0 Only.

Support
Please use the admin toolbox modification thread for support with this modification.

Changelog
1.0 - 14 Jan 2012
+ Initial Release
Title: Re: Admin Toolbox
Post by: 4Kstore on March 07, 2012, 03:07:13 AM
Merge 2 users !! FANTASTIC IDEA!!!
Congratulations  for this mod
Title: Re: Admin Toolbox
Post by: viulian on March 10, 2012, 05:52:47 PM
Hello :)

I've been curios about the daily activity (since my forum is running from 2003 or something) but after a while - I get this error:

Column count doesn't match value count at row 123
File: H:\xampp\htdocs\community\Sources\AdminToolbox.php
Line: 840


The comment on top is great though :))

// Purples may not want to look at what I'm doing here, just move along, its all good, nothing to see here :)

Indeed, nothing to see, its a bit too generic to spot immediatly what's the issue without some debug statements..
Title: Re: Admin Toolbox
Post by: Spuds on March 10, 2012, 08:45:45 PM
I'm not sure what you are trying to say or ask to be honest ... lost  :-\

What version of SQL are you running
Do you have any existing data in the log_activity table
Does the log_activity table exist at all
What option did you choose for the data rebuild
etc ....
Title: Re: Admin Toolbox
Post by: distante on March 11, 2012, 12:05:53 AM
wow, really great mod!
Title: Re: Admin Toolbox
Post by: Game.ruler on March 11, 2012, 02:02:05 PM
If i mark inactive users as read all post then will it reduce my database size?
Title: Re: Admin Toolbox
Post by: distante on March 11, 2012, 02:05:55 PM
Quote from: Game.ruler on March 11, 2012, 02:02:05 PM
If i mark inactive users as read all post then will it reduce my database size?

yes
Title: Re: Admin Toolbox
Post by: Spuds on March 11, 2012, 09:23:45 PM
Quote from: Game.ruler on March 11, 2012, 02:02:05 PM
If i mark inactive users as read all post then will it reduce my database size?
Short answer is generally yes ... if you are not using / converted those tables to innodb from myisam.   

Longer answer is this depends on how many users you have, if they were ever active,  number of boards and topics, how big the forum is, etc etc  ... Basically the function moves the multiple tracking entries from the log_topics table which stores the position that each member is in each topic  ....... to 'single' entries in the log_board and log_mark_read tables.  So one table will go down in size, two other may increase (but that increase is less than the reduction of the other).

Title: Re: Admin Toolbox
Post by: Nitesh Kunnath on March 12, 2012, 06:18:08 PM
An Awesome mod ever...It helped me a lot :)
Title: Re: Admin Toolbox
Post by: Game.ruler on March 13, 2012, 03:20:31 PM
Thanx for the reply guys.
I've 5,000 users but nearly 4,000 of them are inactive now. So i think it will reduce much database size na
Title: Re: Admin Toolbox
Post by: whatevah on March 25, 2012, 11:31:25 PM
Would love this if I could get it to work :)

Keeps throwing up an error during Step 4 of merging two accounts.   Instead of showing the progress screen I get this error:
Database Error
Duplicate entry '27665-996' for key 1
File: /htdocs/forum/Sources/AdminToolbox.php
Line: 1127


Using the latest coding, downloaded an hour ago.   Any suggestions?  I'm going over the file now, but I haven't done any coding in a while and I'm pretty rusty.
Title: Re: Admin Toolbox
Post by: Sapozhnik on March 28, 2012, 01:50:17 PM
Great mod, thanks :)
But it has small problem ;)
It counts messages in boards where the counting of posts is disabled.
Title: Re: Admin Toolbox
Post by: Spuds on March 28, 2012, 08:52:15 PM
In which function
Title: Re: Admin Toolbox
Post by: Sapozhnik on March 29, 2012, 01:39:08 PM
Quote from: Spuds on March 28, 2012, 08:52:15 PM
In which function
Recount User Posts
Title: Re: Admin Toolbox
Post by: Spuds on March 29, 2012, 05:55:22 PM
Well that is odd ...

The query specifically only loads boards that has post count enable and makes sure it does not count anything in the recycle board for those that have that enabled. 

I just did a quick test on my test forum and it did not count any user posts in a board with post count off .... so not sure why its not working for you. I'll do some more poking around but ATM there is nothing obvious.  Was it adding posts or not subtracting posts?  MySQL? PHP version? main board or a child board?  Just looking for clues.
Title: Re: Admin Toolbox
Post by: Sapozhnik on March 30, 2012, 03:52:28 AM
Thanks a lot,
I'll check the mode some times yet and describe in this topic
Title: Re: Admin Toolbox
Post by: Sapozhnik on March 30, 2012, 02:09:59 PM
User has:
Summary  70 messages
==================
1st board - 4 pcs (child board, count off)
2nd board - 5 pcs (child board, count off)
3rd board - 61 pcs (child board, count off)
After recounting, I see the quantity 32 messages in the his profile

PHP Version 5.3.10-pl0-gentoo
SQL    5.1.61-log

???

Updated:
Possibly... If user doesn't have any posts in the board with count, counter doesn't change.
Early, the counter in these boards was enable, then I disabled counter.
Title: Re: Admin Toolbox
Post by: Spuds on March 30, 2012, 02:52:03 PM
I'm trying to understand what you are doing ...

So a user had 70 posts in 3 boards ... you went in and disabled the post count in those boards and it dropped to 32 and you were expecting it to be zero?  Are you sure they only had 70 posts in total to begin with?  ... You can try show users posts and see or do it via phpmyadmin.

One thing to try  .... in AdminToolbox.php, at around line 175

Code (find) Select
SELECT m.id_member, COUNT(m.id_member) AS posts

Code (replace) Select
SELECT /*!40001 SQL_NO_CACHE */ m.id_member, COUNT(m.id_member) AS posts

just in case its some cache problem going on with mysql.
Title: Re: Admin Toolbox
Post by: Sapozhnik on March 30, 2012, 03:20:31 PM
sorry for my english.  :-[

Yes, user has only 70 posts. (Maybe i disabled counter when he had 32 posts)
I've tried to move one post to boards where counter is enabled and after recounting quantity of posts was changed to 1.
If all posts of user are placed in boards where counter is disabled, the counter of posts doesn't changed after recounting.
Try on your forum: move all posts of test-user to board where posts don't count and re-count them.
I think the quantity of posts won't change.

Sorry, I'm can't try replace the code now. I'll try it tomorow. I don't have full access to the forum now :(
Title: Re: Admin Toolbox
Post by: Spuds on March 30, 2012, 09:41:27 PM
OK ... I think I understand now!

Hummmm ... need to think about how to properly detect that case.  I do have some processing after the main recount to zero members who have no posts (in countable boards) but it must be getting tripped up by this case of only posts in non countable boards.   The cache thing above is not going to help (but it will not hurt either)

I'lll see what I can do over the next couple of days.
Title: Re: Admin Toolbox
Post by: Sapozhnik on April 12, 2012, 02:01:41 PM
Quote from: Spuds on March 30, 2012, 09:41:27 PM
I'lll see what I can do over the next couple of days.
Do you have any news?  ;)
Title: Re: Admin Toolbox
Post by: thernlund on June 02, 2012, 03:15:00 PM
Quote from: whatevah on March 25, 2012, 11:31:25 PM
Would love this if I could get it to work :)

Keeps throwing up an error during Step 4 of merging two accounts.   Instead of showing the progress screen I get this error:
Database Error
Duplicate entry '27665-996' for key 1
File: /htdocs/forum/Sources/AdminToolbox.php
Line: 1127


Using the latest coding, downloaded an hour ago.   Any suggestions?  I'm going over the file now, but I haven't done any coding in a while and I'm pretty rusty.

I've seen this problem too.  Ended up finishing the merge by hand.  Not THAT big of an issue, but certainly less than ideal.


-T.
Title: Re: Admin Toolbox
Post by: Spuds on June 08, 2012, 11:11:33 AM
QuoteDatabase Error
Duplicate entry '27665-996' for key 1
I believe the duplicate index collision is caused when you are merging two users, and both of them have received the same PM ... it can't move it over since its already there.  I've put in some extra checks to look for this condition.

Quotetry on your forum: move all posts of test-user to board where posts don't count and re-count them.
I think the quantity of posts won't change.
I took a user with all of the posts in a board, i changed that board settings to not count posts and the total went to zero as expected.  I turned the post count back on and the total when back to the correct number of posts.  tried it as no post counting child boards of a regular board as well ... Still unable to reproduce the reported issue.

updated the package.

Title: Re: Admin Toolbox
Post by: InfoStrides on July 22, 2012, 03:34:44 PM
Found this mod interesting but while "Rebuilding Daily Stats", the following error returned:

QuoteDatabase Error
Column count doesn't match value count at row 1
File: /home/ssssklsls/public_html/Sources/AdminToolbox.php
Line: 899