Camera slideshow patch for SQLite Integration

Japanese version is available in Camera slideshow パッチ・国際化

When activated, database error is output in the PHP log file. MySQL or SQLite, the same message is seen. On MySQL we can finish activating, but on SQLite we can’t. And this plugin uses MySQL specific functions. So we’ve got to rewrite some codes to use it with SQLite Integration.

camera-slideshow/index.php and camera-slideshow/lib/camera_functions.php are our target files. First we rewrite index.php as follows:

We have no means to override PHP built-in functions like mysql_get_server_info() at least under standard server settings. We replace this function with $wpdb->db_version(), which returns the version number required by WordPress.

Next we rewrite camera_add_option() function in camera_functions.php whose definition is below.

I rewrote the line 19 and those that follow as follows:

This is the same as above, MySQL specific function. In this case, the return value of mysql_query() is not the same as $wpdb->query() and simple replacement is not enough. mysql_query() return resource when connection succeeds, false when connection fails, while $wpdb->query() returns the number of data (if there’s none, it returns 0), and false when error occurred. If the table exists and $wpdb->query() returns the number other than zero (more than one data is stored), this script execute die(). So I changed the if statement that follows.

And another change:

This global variable $current_user is empty, so I added get_currentuserinfo() function.

I also included the correction posted in the Forums Possible Bug With Pattern Overlay. This plugin is hard-coded in English language. I also made gettext work and pot file.

Patch file can be used in the dashboard of SQLite Integration. Languages folder in the archive must be placed in the folder WP_PLUGIN_DIR/camera-slideshow/. If you use WordPress with MySQL, this archive may help.

Leave a Reply