WordPress with Sqlite
I’m testing out wordpress with sqlite, it seems to work pretty well so far.
I’ve got it in a patch file format, and added some fixes to make it work with PHP4.
diff -Pbu -r /home/private/wordpress/data/.htaccess ./data/.htaccess
--- /home/private/wordpress/data/.htaccess Thu Jan 1 00:00:00 1970
+++ ./data/.htaccess Mon Sep 10 00:51:43 2007
@@ -0,0 +1,2 @@
+order deny,allow
+deny from all
Binary files /home/private/wordpress/data/wordpress.db and ./data/wordpress.db differ
diff -Pbu -r /home/private/wordpress/wp-admin/install.php ./wp-admin/install.php
--- /home/private/wordpress/wp-admin/install.php Fri Jun 15 17:45:21 2007
+++ ./wp-admin/install.php Mon Sep 10 00:17:47 2007
@@ -1,6 +1,8 @@
=') ) {
+// sqlite doesn't require this
+$SQLITE = TRUE;
+if ( !$SQLITE && version_compare(mysql_get_server_info(), '4.1.0', '>=') ) {
if ( ! empty($wpdb->charset) )
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
if ( ! empty($wpdb->collate) )
diff -Pbu -r /home/private/wordpress/wp-config.php ./wp-config.php
--- /home/private/wordpress/wp-config.php Mon Sep 10 00:57:23 2007
+++ ./wp-config.php Mon Sep 10 00:33:07 2007
@@ -7,7 +7,8 @@
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
-define('DB_FILE', '/var/www/htdocs/wordpress.db'); // The full path of the database
+$dbfile = dirname(__FILE__) . '/data/wordpress.db';
+define('DB_FILE', $dbfile); // The full path of the database
//make sure the directory and the file is **writeable** by the web server
// You can have multiple installations in one database if you give each a unique prefix
diff -Pbu -r /home/private/wordpress/wp-content/db.php ./wp-content/db.php
--- /home/private/wordpress/wp-content/db.php Mon Sep 10 00:57:37 2007
+++ ./wp-content/db.php Sun Sep 9 15:18:10 2007
@@ -688,4 +688,22 @@
}
$wpdb = new wpdb( DB_FILE );
-?>
+/* PHP 4 compatibility */
+if (!function_exists('sqlite_fetch_object'))
+{
+ function sqlite_fetch_object($resource, $classname=null, $ctor=array(), $decode_binary=FALSE)
+ {
+ $arr = sqlite_fetch_array($resource, SQLITE_ASSOC);
+ return is_array($arr)? (object) $arr: null;
+
+ }
+}
+
+if (!function_exists('str_ireplace')) {
+ function str_ireplace($needle, $str, $haystack) {
+ $needle = preg_quote($needle, '/');
+ return preg_replace("/$needle/i", $str, $haystack);
+ }
+}
+/* end PHP 4 compatibility */
+
About this entry
You’re currently reading “ WordPress with Sqlite ,” an entry on Chui's Counterpoint
- Published:
- 9.10.07 / 11am
- Category:
- General
1 Comment
Jump to comment form | comments rss [?] | trackback uri [?]