Welcome Guest, Not a member yet? Register   Sign In
Multiple DB connections and caching
#1

[eluser]skunkbad[/eluser]
When I use multiple DB connections and caching with CI 3.0, I get an error that says the construct of DB_Results is missing it's first parameter. The call to the construct happens in the DB_Driver on line 695:

Code:
$CR = new CI_DB_result();

Should this be changed to:

Code:
$CR = new CI_DB_result( $RES );

It seems to work when I do this, but I don't want to break anything.

Also related to caching, it seems that when DB_Cache checks to see if a file exists, it has no suppression of error for file_get_contents() on line 125. Perhaps there should be an is_file() or @file_get_contents().

#2

[eluser]Narf[/eluser]
https://github.com/EllisLab/CodeIgniter/...d8acdd7ca6

How about now?
#3

[eluser]skunkbad[/eluser]
[quote author="Narf" date="1352797159"]https://github.com/EllisLab/CodeIgniter/...d8acdd7ca6

How about now?[/quote]

Hey, cool. I knew I was on to something there. I've never used caching, so I thought I'd play around with it and see how it works (and doesn't work).

I do have a suggestion. In the check_path method of DB_Cache, where the if statement checks if the path is a dir and is writable, it would be nice if those were separated out, and if there was a log_message, show_error, or something to make it more obvious which failed. In my own testing, I found this useful:

Code:
if ( ! is_dir($path) )
{
\CI\DB::log('Cache Path Error: ' . $path );

// If the path is wrong we'll turn off caching
return $this->db->cache_off();
}

if ( ! is_really_writable($path) )
{
\CI\DB::log('Cache Dir Not Writable: ' . $path );

// If the path is not really writable we'll turn off caching
return $this->db->cache_off();
}

I've obviously been playing around with some customization, but it was helpful when setting up caching, and other people might think so too.
#4

[eluser]Narf[/eluser]
I don't know ... I guess it could be useful. As I previously said on your last issue thread on github - you should submit a pull request if you feel that something needs or could use a change.
#5

[eluser]skunkbad[/eluser]
[quote author="Narf" date="1352834473"]I don't know ... I guess it could be useful. As I previously said on your last issue thread on github - you should submit a pull request if you feel that something needs or could use a change.[/quote]

I only have a basic understanding of git and have only used it and hg privately. I know pull requests makes it easier on your end, but I have no experience working with git when other people are involved. So, maybe someday soon I will learn. It certainly couldn't hurt.




Theme © iAndrew 2016 - Forum software by © MyBB