EllisLab text mark
Advanced Search
     
Multiple DB connections and caching
Posted: 13 November 2012 12:45 AM   [ Ignore ]
Avatar
Joined: 2009-05-17
1415 posts

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:

$CR = new CI_DB_result(); 

Should this be changed to:

$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().

 

 Signature 

Brian
Brian’s Web Design - Temecula
Community Auth - CodeIgniter Authentication Application

 
Posted: 13 November 2012 04:59 AM   [ Ignore ]   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2012-01-09
117 posts

https://github.com/EllisLab/CodeIgniter/commit/83b2b1cd75d85d78ddcae1f9716984d8acdd7ca6

How about now?

 
Posted: 13 November 2012 11:58 AM   [ Ignore ]   [ # 2 ]   [ Rating: 0 ]
Avatar
Joined: 2009-05-17
1415 posts
Narf - 13 November 2012 04:59 AM

https://github.com/EllisLab/CodeIgniter/commit/83b2b1cd75d85d78ddcae1f9716984d8acdd7ca6

How about now?

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:

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.

 Signature 

Brian
Brian’s Web Design - Temecula
Community Auth - CodeIgniter Authentication Application

 
Posted: 13 November 2012 03:21 PM   [ Ignore ]   [ # 3 ]   [ Rating: 0 ]
Avatar
Joined: 2012-01-09
117 posts

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.

 
Posted: 13 November 2012 04:04 PM   [ Ignore ]   [ # 4 ]   [ Rating: 0 ]
Avatar
Joined: 2009-05-17
1415 posts
Narf - 13 November 2012 03:21 PM

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.

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.

 Signature 

Brian
Brian’s Web Design - Temecula
Community Auth - CodeIgniter Authentication Application