Recent Topics

1 Nov 15, 2009 21:46    

My b2evolution Version: 3.3.2

OK so this is the problem. I've upgraded to 3.x you you know the latest version. The problem? Well I was very ambitious and put too many categories on my old install. So I'm asking: is there a way to use SQL and just consolidate the categories? I have a map of what I would like to do, I just don't think forwarding or any methods would help. Also, I created a few blogs since I have since deleted. and Now the blogs on the system are 1 and 9 (i know again with the ambition)

thanks in advance for any help. Still love it over all others.

2 Nov 16, 2009 04:00

You can move posts between categories, just activate this setting in conf/_admin.php

3 Nov 16, 2009 05:47

thanks but that's not exactly as helpful to my situation as you can't really move the posts, just the categories. Plus, doesn't give the comfort of deleting the category forever.

4 Nov 16, 2009 06:45

Actually you [u]can[/u] move the posts, and after you done you can delete the category.

5 Nov 16, 2009 15:08

Renumbering blogs in 247 was pretty easy once I figured it out. For me the goal was to get a numerical bloglist into the order I wanted them to show up in. IF you do this you better have a backup handy so that you can undo whatever damage happens, as I've no idea if this will be cool in 3.*

MAKE WAS BECOME WILLBE

UPDATE `evo_blogs` SET `blog_ID` = WILLBE WHERE `blog_ID` = WAS;
UPDATE `evo_bloggroups` SET `bloggroup_blog_ID` = WILLBE WHERE `bloggroup_blog_ID` = WAS;
UPDATE `evo_blogusers` SET `bloguser_blog_ID` = WILLBE WHERE `bloguser_blog_ID` = WAS;
UPDATE `evo_categories` SET `cat_blog_ID` = WILLBE WHERE `cat_blog_ID` = WAS;
UPDATE `evo_coll_settings` SET `cset_coll_ID` = WILLBE WHERE `cset_coll_ID` = WAS;
UPDATE `evo_files` SET `file_root_ID` = WILLBE WHERE `file_root_ID` = WAS AND `file_root_type` = 'collection';
UPDATE `evo_hitlog` SET `hit_blog_ID` = WILLBE WHERE `hit_blog_ID` = WAS;
UPDATE `evo_widget` SET `wi_coll_ID` = WILLBE WHERE `wi_coll_ID` = WAS;

DON'T FORGET ABOUT STUB FILES!
DON'T FORGET ABOUT LINKBLOG WIDGETS!

I've no doubt one could whip up some sql to automagically make all posts that have category N suddenly become category Y, but I never needed it so I didn't do it. For sure editing posts one by one and selecting a different category until category N is empty then deleting category N will get the same job done. Just gonna be slow if you got a lot of posts to work through.

6 Nov 16, 2009 15:09

Oops. Obviously the first and last two lines aren't code. Notes from me to me in my little text file of easy cheats :)

7 Nov 17, 2009 18:50

thank you EdB, I will backup and try today!

sam2kb, I might be a idiot today because I can't figure this out. Can you please explain to me a little more? I'm asking you to explain very slowly, my brain is prolly mush after all the code i've been looking at. Thanks again.

8 Nov 17, 2009 21:25

sam2kb wrote:

Actually you [u]can[/u] move the posts, and after you done you can delete the category.

One by one huh? ;)

Used to be able to move a category to another parent, delete the category and move all posts up to parent ... dunno if that still works ;)

¥

9 Nov 17, 2009 21:29

[offtopic]
mochababy wrote:

Now the blogs on the system are 1 and 9

I must have higher, deluded, aspirations ... I have a dozen blogs that range from blog 4 to 157 .... blogs 1 - 3 died a horrible death ages ago :P
[/offtopic]

¥

10 Nov 18, 2009 04:47

That does not work anymore, but good try. I guess I'll just have to stay with the categories

11 Nov 18, 2009 14:23

Guess you'll just have to brute force it :

$sql = 'UPDATE T_postcats SET postcat_cat_ID=/* new ID*/ WHERE postcat_cat_ID=/* old ID*/';
$DB->query( $sql );
$sql = 'UPDATE T_items__item SET post_main_cat_ID=/*new ID*/ WHERE post_main_cat_ID=/*old ID*/';
$DB->query($sql);
$sql = 'DELETE FROM T_categories WHERE cat_ID=/* old ID*/';
$DB->query($sql);

Don't forget to backup your db first huh? ;)

¥

12 Nov 29, 2009 08:35

¥åßßå wrote:

Guess you'll just have to brute force it :

$sql = 'UPDATE T_postcats SET postcat_cat_ID=/* new ID*/ WHERE postcat_cat_ID=/* old ID*/';
$DB->query( $sql );
$sql = 'UPDATE T_items__item SET post_main_cat_ID=/*new ID*/ WHERE post_main_cat_ID=/*old ID*/';
$DB->query($sql);
$sql = 'DELETE FROM T_categories WHERE cat_ID=/* old ID*/';
$DB->query($sql);

Don't forget to backup your db first huh? ;)

¥

I tried this doing the raw mysql queries because I didn't know where I would place the coded and I still did not work. Don't know why. Where would I place such code by the way. Snippet of what I used:

UPDATE `evoblog_items__item` SET `post_main_cat_ID`='6' WHERE `post_main_cat_ID`='10';
UPDATE `evoblog_postcats` SET `postcat_cat_ID`='6' WHERE `postcat_cat_ID`='10';
DELETE FROM `evoblog_categories` WHERE `cat_ID`='10';

EDIT: i figured that it did work up to a point. It changed all the posts_main_cat_IDs but I don't know where to change the extra cat ID so it won't let me proceed to do anything else.

13 Nov 29, 2009 09:05

The evoblog_postcats is the "extra cat ID" bit ... although it's a tad "untidy" ( you can end up with dupe extra cats )

¥

14 Nov 29, 2009 09:19

I found a solution to my dilema. Thanks for the push in the right direction but I wasn't looking at the schema correctly.

I kept trying to find out why it was failing, took a look and saw the database would not execute because it would be a duplicate entry and because of that, then I realized it already had the maincat set so I didn't need to replace the nubers in the postcats table. It's already taken care of with the first statement so I don't need to do anything other than delete it from the other tables.

UPDATE `T_postcats` SET `postcat_cat_ID`='*newID*' WHERE `postcat_cat_ID`='*oldID*';
DELETE FROM `T_postcats` WHERE `postcat_cat_ID`='*oldID*';
DELETE FROM `T_categories` WHERE `cat_ID`='*oldID*';

*if you understand my garble that's a miracle but thank you and hopefully if anyone else looks for this info they will see it.


Form is loading...