Piwigo Bugtracker

Viewing Issue Advanced Details Jump to Notes ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0001762 [Piwigo] database minor always 2010.07.04 19:24 2010.07.05 22:55
Reporter madman View Status public  
Assigned To nikrou
Priority normal Resolution fixed Platform Postgresql
Status closed   OS CentOS 5.4
Projection none   OS Version Postgresql 8.4.2
ETA none Fixed in Version 2.1.3 Product Version 2.1.2
  Target Version Product Build Trunk r6656
Summary 0001762: Compleet RSS Feed returns notice
Description When the compleet RSS Feed is openend for the first time, it returns a PHP Notice This is due to an different date/time format returned by the now() function of PostgreSQL. Note that there is no Notice when the page is refreshed.

This date/time is queried on line 104 of feed.php and notice appears in mysqldt_to_ts() function.

I would suggest to create a pwg_db_date_to_ts() function, which should be implemented for all databases.

The PostgreSQL implementation could be like this:

function pwg_db_date_to_ts($date_string)
{
  $date = explode_db_date($date_string)

  return mktime($date['hour'], $date['minute'], $date['second'],
                $date['month'], $date['day'], $date['year']);
}

function explode_db_date($date_string)
{
  $date = array();
  list($date['year'],
       $date['month'],
       $date['day'],
       $date['hour'],
       $date['minute'],
       $date['second'],
       $date['milisecond'])
    = preg_split('/[-: .+]/', $date_string);

  return $date;
}

Note that the timezone parameter is dropped. This is because the last_check field of the USER_FEED_TABLE is 'timestamp without time zone'. This means that the date format in this table differs from the now() function. To prevent a notice that the preg_split function is returning less elements than the array, the timezone should be dropped or the database should be changed.
Steps To Reproduce
Additional Information [root@www piwigo_svn]# psql piwigo
psql (8.4.2)
Type "help" for help.

piwigo=# SELECT NOW();
              now
-------------------------------
 2010-07-04 18:34:01.861436+02
(1 row)

piwigo=# select * from piwigo_user_feed;
                         id | user_id | last_check
----------------------------------------------------+---------+----------------------------
 90uZmU3BDwfct709JQv721g4o23fvc7v8L4xv9xhUyF5H1k0t8 | 1 | 2010-07-04 19:16:30.445963
 Q4Xk524KNhGFI1Q85bLJuo995l1y186986N236QZ7RgB99SnNm | 1 | 2010-07-04 19:17:16.234485
(2 rows)

piwigo=# \d piwigo_user_feed;
                          Table "public.piwigo_user_feed"
   Column | Type | Modifiers
------------+-----------------------------+----------------------------------------
 id | character varying(50) | not null default ''::character varying
 user_id | integer | not null default 0
 last_check | timestamp without time zone |
Indexes:
    "piwigo_user_feed_pkey" PRIMARY KEY, btree (id)

piwigo=# \q
Tags No tags attached.
browser Mozilla
Database engine and version Postgresql 8.4.2
PHP version 5.3.2
Web server Apache 2.2.3
Attached Files

- Relationships

-  Notes
(0004028)
svn (reporter)
2010.07.05 22:46

[Subversion] r6662 by nikrou on trunk

-----[Subversion commit log]----------------------------------------------------
Bug 1762 fixed : Compleet RSS Feed returns notice
Remove mysql specific function
(0004029)
svn (reporter)
2010.07.05 22:54

[Subversion] r6663 by nikrou on branch 2.1

-----[Subversion commit log]----------------------------------------------------
Bug 1762 fixed : Compleet RSS Feed returns notice
Remove mysql specific function
Merge from trunk

- Issue History
Date Modified Username Field Change
2010.07.04 19:24 madman New Issue
2010.07.04 19:24 madman browser => Mozilla
2010.07.04 19:24 madman Database engine and version => Postgresql 8.4.2
2010.07.04 19:24 madman PHP version => 5.3.2
2010.07.04 19:24 madman Web server => Apache 2.2.3
2010.07.05 09:56 nikrou Status new => assigned
2010.07.05 09:56 nikrou Assigned To => nikrou
2010.07.05 22:46 svn Checkin
2010.07.05 22:46 svn Note Added: 0004028
2010.07.05 22:54 svn Checkin
2010.07.05 22:54 svn Note Added: 0004029
2010.07.05 22:55 nikrou Status assigned => closed
2010.07.05 22:55 nikrou Resolution open => fixed
2010.07.05 22:55 nikrou Fixed in Version => 2.1.3


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Contact
Powered by Mantis Bugtracker