ok, the real problem was '', not '1' as '1' is implicitly cast to the
integer 1, but no such mapping exists for the empty string.
in acl.php's get_user_token_access(), I have inserted a simple
*if ($token_id == '') { $token_id = '0'; }
*
just before any database-related functions are called
generally speaking, I have made only a few harmless changes to the code and
habari seems to work just fine with postgresql as the backend (I am using
standard debian lenny packages: postgresql 8.3, PHP 5.2.6-1 and lighttpd).
Just to make sure, I deleted all files, checked out 3507 from scratch and
applied my patchfile. installation was a breeze and there are no error
messages/warnings.
it looks like we might be postgresql-ready (I suppose I could also try a
habari installation using the recent first beta of the postgresql 8.4 series
-- not today, though)
I'm going to try to migrate a couple of personal blogs over to habari, play
a little with themes etc until the next incompatibility issue comes along
:-) I am serious about supporting you guys, so please let me know if you
encounter any postgresql-related issues and I'll try to help.
I have attached a patch file vs 3507
cheers, Michael
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/habari-dev
-~----------~----~----~----~------~----~------~--~---
Index: system/schema/pgsql/connection.php
===================================================================
--- system/schema/pgsql/connection.php (revision 3507)
+++ system/schema/pgsql/connection.php (working copy)
@@ -23,7 +23,7 @@
if( !parent::connect( $connect_string, $db_user, $db_pass ) ) {
return false;
}
- $this->pdo->setAttribute( PDO::ATTR_EMULATE_PREPARES, true );
+ # $this->pdo->setAttribute( PDO::ATTR_EMULATE_PREPARES, true );
return true;
}
Index: system/plugins/coredashmodules/dash_latestentries.php
===================================================================
--- system/plugins/coredashmodules/dash_latestentries.php (revision 3507)
+++ system/plugins/coredashmodules/dash_latestentries.php (working copy)
@@ -1,6 +1,6 @@
<ul class="items">
- <?php foreach($recent_posts as $post): ?>
+ <?php foreach((array)$recent_posts as $post): ?>
<li class="item clear">
<span class="date pct15 minor"><a href="<?php echo URL::get('display_entries_by_date', array('year' => $post->pubdate->get( 'Y' ), 'month' => $post->pubdate->get( 'm' ), 'day' => $post->pubdate->get( 'd' ) ) ); ?>" title="<?php printf(_t('Posted at %1$s'), $post->pubdate->get( 'g:m a \o\n F jS, Y' ) ); ?>"><?php $post->pubdate->out( 'M j' ); ?></a></span>
<span class="title pct75"><a href="<?php URL::out('admin', 'page=publish&id=' . $post->id); ?>" title="<?php printf( _t('Edit \'%s\''), $post->title ); ?>"><?php echo $post->title; ?></a> <a class="minor" href="<?php Site::out_url('habari'); ?>/admin/user/<?php echo $post->author->username; ?>"> <?php _e('by'); ?> <?php echo $post->author->displayname; ?></a></span>
Index: system/classes/acl.php
===================================================================
--- system/classes/acl.php (revision 3507)
+++ system/classes/acl.php (working copy)
@@ -447,6 +447,8 @@
ORDER BY access_mask ASC
SQL;
+ if ($token_id == '') { $token_id = '0'; }
+
$accesses = DB::get_column( $sql, array( $user_id, $token_id, $user_id, $token_id ) );
$accesses = Plugins::filter( 'user_token_access', $accesses, $user_id, $token_id );
@@ -457,7 +459,7 @@
}
else {
$result = 0;
- foreach ( $accesses as $access ) {
+ foreach ( (array)$accesses as $access ) {
if ( $access == 0 ) {
$result = 0;
break;
@@ -526,7 +528,7 @@
$post_tokens = DB::get_column('SELECT token_id FROM {post_tokens} GROUP BY token_id');
}
- foreach ( $result as $token ) {
+ foreach ( (array)$result as $token ) {
$bitmask->value = $token->access_mask;
if ( $access == 'deny' && $bitmask->value == 0 ) {
$tokens[] = $token->token_id;
@@ -853,4 +855,4 @@
}
}
-?>
\ No newline at end of file
+?>
Index: system/classes/posts.php
===================================================================
--- system/classes/posts.php (revision 3507)
+++ system/classes/posts.php (working copy)
@@ -471,6 +471,7 @@
}
$master_perm_where = implode( ' AND ', $where );
+ $master_perm_where = preg_replace('/\(1\)/m', '(1=1)', $master_perm_where);
}
// Extract the remaining parameters which will be used onwards
@@ -561,7 +562,7 @@
/**
* DEBUG: Uncomment the following line to display everything that happens in this function
*/
- //print_R('<pre>'.$query.'</pre>');
+ //print_R('<pre>nacos '.$query.'</pre>');
//Utils::debug( $paramarray, $fetch_fn, $query, $params );
//Session::notice($query);
@@ -930,4 +931,4 @@
return 'posts';
}
}
-?>
\ No newline at end of file
+?>
Index: system/classes/databaseconnection.php
===================================================================
--- system/classes/databaseconnection.php (revision 3507)
+++ system/classes/databaseconnection.php (working copy)
@@ -259,7 +259,7 @@
// Allow plugins to modify the query after it has been processed
$query = Plugins::filter( 'query_postprocess', $query, $args );
- if ( $this->pdo_statement = $this->pdo->prepare( $query ) ) {
+ if ( $this->pdo_statement = $this->pdo->prepare( $query, array(PDO::ATTR_EMULATE_PREPARES => true) ) ) {
if ( $this->fetch_mode == PDO::FETCH_CLASS ) {
/* Try to get the result class autoloaded. */
if ( ! class_exists( strtolower( $this->fetch_class_name ) ) ) {
@@ -334,7 +334,7 @@
$query.= ' )';
$query = $this->sql_t( $query, $args );
- if ( $pdo_statement = $pdo->prepare( $query ) ) {
+ if ( $pdo_statement = $pdo->prepare( $query, array(PDO::ATTR_EMULATE_PREPARES => true) ) ) {
/* If we are profiling, then time the query */
if ( $this->keep_profile ) {
$profile = new QueryProfile( $query );
Index: system/classes/comments.php
===================================================================
--- system/classes/comments.php (revision 3507)
+++ system/classes/comments.php (working copy)
@@ -285,6 +285,7 @@
}
$master_perm_where = implode( ' AND ', $where );
+ $master_perm_where = preg_replace('/\(1\)/m', '(1=1)', $master_perm_where);
}
// Get any full-query parameters