Advice on mass category update. Does this code logic and plan look correct?
I want move discussions to one distinct category based on criteria
must meet all these criteria.
- discussions has 0 comments
- discussion is not an announcement
- discussion is older than two days
the guts of the plugins are this. admin clicks button in dashboard that calls this routine.
Does anyone see an issue with this logic., or did I miss something if I do this. meaning can you just change the categorid to a different number this way and run the dba/counts and will this update all the necessary tables and linkages.
$deldays = 2; SQL->Update('Discussion') ->Set('CategoryID',"70") ->Where(array('CommentCounts<' => "1", 'DateInserted <' => Gdn_Format::ToDateTime(strtotime($deldays), 'Announcement<' => "1" )) ->Put(); Redirect('dashboard/dba/counts');
essentially category id is changed in discussion table and the dba counts is run (theoretically to update counters.).
there are no file attachments in any discussions.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.