You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello Tareq, thank you for this wonderful project, it's been a great help!
I have an issue however that I haven't been able to solve in almost a day which is very unusual for me. Basically what's going on is that I have to pull some statistical data from multiple wordpress sites. I've created a csv config file listing all databases I need to access and so on.
I'm looping over all these dbs creating new $wpdb object at the top of my loop like so:
and so on. At the end of my loop I unset all database objects I created by using unset() and setting them to null to top it off.
Problem is the data I get back for each individual host and it's database is from the very first connection, so it looks like $wpdb stays static since first being created even though I unset() it and create a new one. I'm positive I'm using new db creds on each iteration so It's completely flabbergasting why this is happening.
All the databases are on separate hosts, and I watched tcpdump traffice to these hosts when I run my script, it's totally fine. I also setup query logging on these boxen, and I see my source host connecting but it's not running any queries these model requests should generate, so $wpdb object is created but it's not being used by /tareq1988/wp-eloquent/src/Eloquent/Database.php, only the first one is, not any of the new ones created at each loop iteration.
Please let me know if you have any ideas on how I can get this fixed.
Thank you so much!!!
The text was updated successfully, but these errors were encountered:
Hello Tareq, thank you for this wonderful project, it's been a great help!
I have an issue however that I haven't been able to solve in almost a day which is very unusual for me. Basically what's going on is that I have to pull some statistical data from multiple wordpress sites. I've created a csv config file listing all databases I need to access and so on.
I'm looping over all these dbs creating new $wpdb object at the top of my loop like so:
$wpdb = new wpdb( $host['dbuser'], $host['dbpass'], $host['dbname'], $host['host'] );
$GLOBALS['wpdb'] = $wpdb;
I then use my eloquent models to access some data along these lines:
$options = WPOptions::where('option_name','=','blah')->first();
$vehicles = Vehicles::all();
and so on. At the end of my loop I unset all database objects I created by using unset() and setting them to null to top it off.
Problem is the data I get back for each individual host and it's database is from the very first connection, so it looks like $wpdb stays static since first being created even though I unset() it and create a new one. I'm positive I'm using new db creds on each iteration so It's completely flabbergasting why this is happening.
All the databases are on separate hosts, and I watched tcpdump traffice to these hosts when I run my script, it's totally fine. I also setup query logging on these boxen, and I see my source host connecting but it's not running any queries these model requests should generate, so $wpdb object is created but it's not being used by /tareq1988/wp-eloquent/src/Eloquent/Database.php, only the first one is, not any of the new ones created at each loop iteration.
Please let me know if you have any ideas on how I can get this fixed.
Thank you so much!!!
The text was updated successfully, but these errors were encountered: