2 sam2kb Nov 16, 2009 04:00

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.
Actually you [u]can[/u] move the posts, and after you done you can delete the category.
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.
Oops. Obviously the first and last two lines aren't code. Notes from me to me in my little text file of easy cheats :)
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.
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 ;)
¥
[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]
¥
That does not work anymore, but good try. I guess I'll just have to stay with the categories
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? ;)
¥
¥åßßå 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.
The evoblog_postcats is the "extra cat ID" bit ... although it's a tad "untidy" ( you can end up with dupe extra cats )
¥
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.
You can move posts between categories, just activate this setting in conf/_admin.php