vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   if (!isset($GLOBALS['vbulletin']->db)) (https://vborg.vbsupport.ru/showthread.php?t=296305)

Captain Tycoon 03-19-2013 10:20 PM

if (!isset($GLOBALS['vbulletin']->db))
 
Can anyone tell me what that means?
Quote:

if (!isset($GLOBALS['vbulletin']->db))

kh99 03-19-2013 10:29 PM

Do you want the full explanation or the bottom line? Basically it's saying "if the vbulletin database connection hasn't been initialized". Seems most likely that's it just a "safety" check rather than something that's expected to happen.

Captain Tycoon 03-19-2013 10:51 PM

Thank you,

I asked because it does happen which stumped me and I wasn't sure what it meant. Although what I don't understand is the database connection is fine on all other pages except the includes/paymentapi/class_2checkout.php and the other class files in the same folder - this only recently started happening so I'm not really sure what's causing it (visiting the link directly).

kh99 03-19-2013 11:24 PM

Oh, yeah, that script is not meant to be visited directly. It's only meant to be included by other scripts, which would have the database object created already. But to be honest I don't really understand the reasoning behind doing that check since the only thing in the file is a class definition.

ETA: I notice that it's at the top of many files, so I guess it's a standard thing that they decided to put at the top of each file that's meant to only be included, to head off any unforseen issues if someone accesses it directly.

Paul M 03-20-2013 09:52 PM

Its actually checking if the database class exists, not if you have a connection, but yes, its just a sanity check.


All times are GMT. The time now is 07:06 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.00987 seconds
  • Memory Usage 1,713KB
  • 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_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