Log in

View Full Version : Why build_datastore with no arguments?


futureal
06-26-2005, 02:21 AM
While tinkering around in vB3's code, I noticed many places that do something like (in pseudo-pseudocode):

$DB_site->query("UPDATE datastore SET ... ");
build_datastore();

Since the build_datastore function takes two arguments (title and data) and does nothing if the arguments aren't given...what's the point?

Were these calls added for stylistic reasons, or...? Perhaps future development?

I know this is an oddball question, just looking for an answer to satisfy my curiosity. :)

Link14716
06-26-2005, 03:37 AM
While tinkering around in vB3's code, I noticed many places that do something like (in pseudo-pseudocode):

$DB_site->query("UPDATE datastore SET ... ");
build_datastore();

Since the build_datastore function takes two arguments (title and data) and does nothing if the arguments aren't given...what's the point?

Were these calls added for stylistic reasons, or...? Perhaps future development?

I know this is an oddball question, just looking for an answer to satisfy my curiosity. :)
That's an interesting question. It doesn't make a whole lot of sense, does it? ;)

Xenon
06-26-2005, 05:20 PM
very good question.

maybe it was planned to update the datastore chache when running it without parameters, but they forgot it or decided otherwise..

Revan
06-26-2005, 06:52 PM
Um, have you all been smoking crack or something? build_datastore without arguments CLEARLY rebuilds the $vboptions/$vbulletin->options array.
I've been using that in my installers since I learned of the function, and the array has always been updated just like it should.

Andreas
06-26-2005, 06:58 PM
At least in 3.0.7 and 3.5.0 Beta 2 a call to build_datastore() without arguments does nothing.

Paul M
06-26-2005, 07:11 PM
At least in 3.0.7 and 3.5.0 Beta 2 a call to build_datastore() without arguments does nothing.It does nothing in any version of 3.0.x I have (3.0.1 +) the code is the same in all - basically ;

function build_datastore($title = '', $data = '')
{

if ($title != '')
{
* DO STUFF *
}

}

So if no parameters are supplied, it does nothing.

futureal
06-26-2005, 08:52 PM
Yea, pretty sure I'm not smoking crack. :)

I was writing a quick hack involving the datastore and happened to take a look at that function, just thought it was weird. My best guess is that it used to have some sort of debugging trace in there that they removed for the actual release.

Link14716
06-26-2005, 10:24 PM
I checked the 3.0.0 Beta 3 code and the function didn't even exist then. In fact, it didn't appear until 3.0.0 Release Candidate 4. The function is the same then as it is in 3.0.7. It looks to have changed a bit in 3.5.0, though, but not much.

Paul M
06-26-2005, 10:27 PM
I checked the 3.0.0 Beta 3 code and the function didn't even exist then. In fact, it didn't appear until 3.0.0 Release Candidate 4. The function is the same then as it is in 3.0.7. It looks to have changed a bit in 3.5.0, though, but not much.Yep - but the change in 3.5.0 is still inside the IF - so it still will do nothing if no arguments are supplied.

tamarian
06-26-2005, 10:37 PM
Note that there are a couple of functions called build_datastore, so keep an eye for the require_once line. :)

futureal
06-26-2005, 11:43 PM
The ones I was thinking of were all in the includes/functions.php file, which is also where the build_datastore(title, data) function is defined. I am fairly sure that they are calling that function.

tamarian
06-27-2005, 12:04 AM
The ones I was thinking of were all in the includes/functions.php file, which is also where the build_datastore(title, data) function is defined. I am fairly sure that they are calling that function.

I don't see any in functions.php, except the function definition.

From a quick grep, it's class_bitfield_builder.php that has a build_datastore with no parameters.

Note, I only checked 3.5 beta2

futureal
06-27-2005, 01:38 AM
I haven't taken a look at 3.5 yet, I am only talking 3.0.x here. There really probably is no reason for its existence, especially if they removed those calls in 3.5. Okay, where are the 3.0 devs...? :)

Xenon
06-27-2005, 09:56 AM
in 3.5 the dev make use of oop more often, so there it might make differences, but in 3.0.x the call without parameters is doing nothing.

let's wait until a dev comes by ^^