vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   bridge vbulletin $db conflict with existing $GLOBALS['db'] (https://vborg.vbsupport.ru/showthread.php?t=252725)

foxfirediego 10-27-2010 06:55 PM

bridge vbulletin $db conflict with existing $GLOBALS['db']
 
Hi there, I'm trying to bridge a software with vB, but if I include the './global.php' file, I get the following:

Quote:

Fatal error: Call to a member function query_read_slave() on a non-object in .\vbulletin\includes\functions.php on line 3205
This is the code I was trying to use to be able to avoid that, no success tought:
PHP Code:

$_SESSION['original_db'] = $GLOBALS['db'];
unset(
$GLOBALS['db']);
//here the $GLOBALS['db'] doesn't exist
require_once('class.vbulletin-bridge.php');
//my vb functions/methods/etc
$GLOBALS['db'] = $_SESSION['original_db']; 

Running vBulletin 3.8.6

Here is the file I'm using which works pretty well:
http://www.phpclasses.org/browse/file/28845.html

Any help is appreciated.
Thanks
Diego

kh99 10-27-2010 07:46 PM

I'm not sure what your code is doing, but I think that error indicates that $vbulletin->db is not set.

foxfirediego 10-27-2010 10:59 PM

Hi kh99, thanks for your reply.
I think that it's conflicting with the existing $db that's set already for the main app which I'm trying to brigde with.

Anyway, thank you, I'll try to figure it out with what you said.

kh99 10-27-2010 11:14 PM

No, I get it now - $vbulletin->db is a reference to the global $db, so you're trying to make sure that doesn't get clobbered.


Quote:

Originally Posted by foxfirediego (Post 2115043)
Anyway, thank you, I'll try to figure it out with what you said.

Hmm...probably best to ignore what I said. :)

foxfirediego 10-27-2010 11:33 PM

exactly hehe
the issue happens just after including the global.php file
maybe I'll just use curl to post to that file, but it will not be a correct thing to do - oh wel


All times are GMT. The time now is 11:12 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01220 seconds
  • Memory Usage 1,721KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete