Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-29-2008, 04:51 AM
VodkaFish VodkaFish is offline
 
Join Date: Oct 2003
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default trouble accessing datastore

Recently I moved my site to new servers. I have the latest versino of vb 3.6.

In the process, I also upgraded from PHP4 to PHP5, and also upgraded to MySQL 5.0.x.

In general, things are going well.

However, I cannot access the datastore like I used to.

I would set something like this:
build_datastore('mystuff', $parsing_cache, 1);

I would then access it like this:
$myvariable = $vbulletin->datastore->registry->mystuff;

However, $vbulletin->datastore->registry->mystuff is empty (and I checked with empty() ).

I look inside my db. mystuff is in the datastore table. The info looks correct.

What can I look for or tweak to access mystuff?
Reply With Quote
  #2  
Old 01-29-2008, 06:27 AM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

First your need to fetch it from the database, you can do this by creating a new Plugin with Hook Location init_startup.

Then for the PHP code you have:
PHP Code:
// Notice the single quotes inside the double quotes
// These are required so don't remove them
$datastore_fetch[] = "'mystuff'"'; 
Then to access your data later on in the script you can use, $vbulletin->mystuff

An alternative method is just to fetch the item when you need it, using this piece of PHP:
PHP Code:
$vbulletin->datastore->do_db_fetch("'mystuff'"); 
Again your data should be available through: $vbulletin->mystuff .

I prefer the first method as it means that if I'm fetching more then one thing from the datastore, they are all fetched in a single query as opposed to single queries dotted around the place.
Reply With Quote
  #3  
Old 01-29-2008, 02:03 PM
VodkaFish VodkaFish is offline
 
Join Date: Oct 2003
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Opserty, thanks for the response.

Unfortunately, I still can't access what I'm trying to get (with either method). Somehow it's blank.

It's very puzzling. I can see the build_datastore is working, as it's in the db. I'm just not sure why I can't pull it from there.
Reply With Quote
  #4  
Old 01-29-2008, 05:14 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try running this in a plugin like global_start or forumhome_start:
PHP Code:
$vbulletin->datastore->do_db_fetch("'mystuff'");  
var_dump($vbulletin->mystuff);
echo 
'-------------------------------------------------';
$dataitems $db->query_first("
            SELECT *
            FROM " 
TABLE_PREFIX "datastore
            WHERE title = 'mystuff'
        "
);
var_dump($dataitems); 
What do you get outputted? (near the top of the page, view the source to get the proper formatting)
Reply With Quote
  #5  
Old 01-29-2008, 05:47 PM
VodkaFish VodkaFish is offline
 
Join Date: Oct 2003
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Interesting results:

NULL -------------------------------------------------array(3) { ["title"]=> string(15) "mystuff" ["data"]=> string(192718)
Then it continues with a good amount of data.
Reply With Quote
  #6  
Old 01-29-2008, 06:02 PM
Opserty Opserty is offline
 
Join Date: Apr 2007
Posts: 4,103
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm so it is fetching it then, you can remove the code I posted in my previous post. The only place I'm guessing the error could lie is when the data is unserialize()'d. Maybe the data has been somehow changed? Not sure how or why.

$parsing_cache has been serialize()'d hasn't it?

Try this:
PHP Code:
if($vbulletin->datastore->do_db_fetch("'mystuff'"))
{
    echo 
'YEY!';
}
else
{
    echo 
'BOO!';

What do you get outputted? (Yey or Boo?)
Reply With Quote
  #7  
Old 01-29-2008, 07:16 PM
VodkaFish VodkaFish is offline
 
Join Date: Oct 2003
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ha, that's exactly what I did at first.

It was "BOO!"
(I did nuffin/sumpin)

It's just odd that I can't access it. Is there any way I can clear all caches safely?

--------------- Added [DATE]1201643105[/DATE] at [TIME]1201643105[/TIME] ---------------

I tried renaming mystuff to somethingstuff and it had no effect (just seeing if I could clear some cache that way).
Reply With Quote
  #8  
Old 01-31-2008, 12:25 AM
VodkaFish VodkaFish is offline
 
Join Date: Oct 2003
Posts: 125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

An update to my situation:

PHP Code:
var_dump($vbulletin->mystuff); 
Nothing happens.
PHP Code:
$lots $vbulletin->datastore->do_db_fetch("'mystuff'");
echo 
$lots
Nothing happens.
PHP Code:
$lots $vbulletin->datastore->do_db_fetch("'mystuff'");
var_dump($vbulletin->mystuff); 
That will give me the data I want in a test file. The custom mod I use that code in still isn't working, but that could be from another part of it.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:29 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.05219 seconds
  • Memory Usage 2,239KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (7)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete