Jump to content

iversonm

Members
  • Posts

    195
  • Joined

  • Last visited

About iversonm

  • Birthday 03/21/1990

Profile Information

  • Gender
    Male
  • Location
    Wisconsin

iversonm's Achievements

Member

Member (2/5)

0

Reputation

  1. Your stuff is not properly formatted. Please post the actual code and please post the class(es) that you are calling.
  2. Please post the php code and please post the form html.
  3. OK I guess I am not sure if this is the right thing to do but I changed it SELECT wowbb_topics.topic_id FROM ultra.wowbb_topics LEFT JOIN Rabbitry.wowbb_converted_topics USING (topic_id) WHERE wowbb_converted_topics.topic_id IS NULL LIMIT 100 and then I select the variables if I need them. It is executing in under a second now.
  4. iversonm

    Slow Query

    Hello. Just wondering if someone can tell me how to make this run faster. I need all the fields I am selecting. I am doing a conversion for a forum so what I did was create a table that stores the topic_ids that I have transferred and that is why I call a left join. I am not very good with mysql, just enough to make mistakes. SELECT wowbb_topics.topic_id, wowbb_topics.forum_id, wowbb_topics.poll_id, wowbb_topics.topic_name, wowbb_topics.topic_description, wowbb_topics.topic_views, wowbb_topics.topic_starter_id, wowbb_topics.topic_date_time, wowbb_converted_topics.topic_id AS old_id FROM ultra.wowbb_topics LEFT JOIN Rabbitry.wowbb_converted_topics ON wowbb_topics.topic_id = wowbb_converted_topics.topic_id WHERE wowbb_converted_topics.topic_id IS NULL LIMIT 1 We are look at around 30 seconds to execute this query.
  5. Christian, there will be an insert within the loop
  6. From the standpoint of coding. Pulling topics then posts for each topics then inserting, is that the best way to program that?
  7. Hey peoples I need some advice, I am working on converting a forum for someone as a favor. It is a forum with 70,000 topics and almost 1kk posts. I have already figured out how to convert the users to phpbb. Also forum data is extremely dirty. The guy who wrote the software didn't put in any validation. This forum has been going down lately for no reason and I am sure its due to issues with database info / structure. <?PHP $sql = 'SELECT forum_id, forum_name FROM Rabbitry.phpbb_forums WHERE parent_id != 0'; $query = MySQL::query($sql); while($row = mysqli_fetch_array($query)){ $forums_id[$row['forum_id']] = $row['forum_name']; $forum_name[$row['forum_name']] = $row['forum_id']; } $sql = 'SELECT topic_id, forum_id, poll_id, topic_name, topic_description, topic_views, topic_starter_id, topic_date_time FROM ultra.wowbb_topics'; $result = MySQL::query($sql); while($row = mysqli_fetch_array($result)){ foreach($row as $key=>$value){ $row[$key] = MySQL::escape($value); } $row['topic_date_time'] = strtotime($row['topic_date_time']); if($row['topic_date_time'] < 0){ $row['topic_date_time'] = NULL; } if($row['poll_id'] !== 0){ //get poll info } $sql_posts = 'SELECT wowbb_posts.post_id, post_text, attachment_id, user_id, post_date_time, post_ip, post_last_edited_on, post_last_edited_by FROM ultra.wowbb_posts INNER JOIN ultra.wowbb_post_texts USING (post_id) WHERE topic_id = \''.$row['topic_id'].'\''; MySQL::query($sql_posts); ?> I ran this, and it doesn't even have any insert statements and I let it go for 5 -6 minutes and it was still running. Any recommendations would be really appreciated !! I have never done anything this large from a conversion process. Matt
  8. OK so I am one step closed. First step is filtering out duplicates and organizing by level. Essentially sorting by rank without having a column for rank. This way it knows if you don't inherit anyone you are on the bottom of the chain...... $unsorted = $group_i; do{ foreach($unsorted as $Key=>$Value){ if(is_array($Value) && !empty($Value)){ foreach($Value as $K=>$V){ if(!array_key_exists($V, $unsorted)){ $array[] = $V; if(count($Key) === 1 && count($K) === 1 && count($V) === 1 && count($Value) && count($unsorted) === 1){ $array[] = $Key; } if(count($V) === 1){ unset($unsorted[$Key]); } unset($unsorted[$Key][$K]); } } }else{ unset($unsorted[$Key]); } } }while(count($unsorted) > 0); It executes pretty fast and I can't think of a better way. Now just have to loop through the results in this order to figure out the rest.
  9. Also I would like to add that at some point someone might make multiple permissions under one group. So Admin inherits Moderator and inherits Side_group. So this won't be a singular chain thus making it more complicated.
  10. I can't add to the table permissions_inheritance due to the fact it is used by an external java application. I can add another table for the ranks but for simplicity purposes I would rather not manage that too
  11. Basically what I want to do is create an array of inheritance. so here is the levels Owner->Admin->moderator->User->guest owner has all the abilities of admin, moderator, user and guest.. So I want to be able to sort through them and end with an array like this $array['Owner'] = array('Admin', 'Moderator', 'User', 'Guest'); Currently my code works sort of. Basically Admin is only set to inherit Moderator. Moderator only inherits User. So this code works but only to 2 levels. I don't want to add a billion foeachs within each other for each level(currently 4) but I might add more roils so then I would have to add more foreachs. There must be a magic way to do this. Any feedback is appreciated! <?PHP $sql = 'SELECT * FROM '.self::$Config['PERMISSIONS']['Database'].'.permissions_inheritance'; $result = DB::Query($sql); while($row = DB::fetch($result)){ if($row['type'] == '0'){ $group_i[$row['child']][] = $row['parent']; }elseif($row['type'] == '1'){ $user_i[$row['child']][] = $row['parent']; } } //echo count($group_i); print_r($group_i); $groups = array(); foreach($group_i as $Key=>$Value){ foreach($Value as $K=>$V){ $new_array[$Key][] = $V; if(isset($group_i[$V]) && is_array($group_i[$V])){ foreach($group_i[$V] as $Q=>$A){ if(is_array($A)){ foreach($A as $C=>$X){ $new_array[$Key][] = $X; } }else{ $new_array[$Key][] = $A; } } } } } Let me know if you have any questions! I hope you enjoy the challenge lolol
  12. BOOM. Exactly what I was looking for. I just had to add to $the_string on line 3(so it would use the right column for the mysql data) it works exactly as I wanted. I will let you know if I have any thing else that comes up. Thank you for your help
  13. Yeah that is very close. It just needs to know sort by where the periods are vs characters. some strings are essentials.admin.all where as some are hc.chat.all so the string length varies. they need to be broken up based on the periods because that is the breaking point for the different levels.
  14. OK so here is what I want to do. I have a bunch of strings stored in a table. The strings are like this grandparent.parent.child. some are just parent.child What I want to do is Select all and then put them into an array. soooo x.y.z would become $Var['x']['y']['z'] and a.b would become $Var['a']['b'] It has to be dynamic because some strings are just 2 levels, and it goes all the way up to 6 levels. I have different plans for setting the variably to something but I can handle that. Any ideas?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.