Phraseanet icon indicating copy to clipboard operation
Phraseanet copied to clipboard

Probleme de date /lib/classes/cache/databox.php

Open tomamplius opened this issue 4 years ago • 1 comments

La version mysl de debian 10 (mariadb) n'accepte pas le format de date ISO8601 (ie https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_get-format)

Fonctionne sur une vielle version de debian 8 Server version: 5.5.62-0+deb8u1 (Debian)

mysql> UPDATE sitepreff SET memcached_update = '2019-08-19T15:49:39+0200'; Query OK, 0 rows affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 0 Warnings: 1

Ne fonctionne plus sur debian 10

Server version: 5.5.5-10.3.15-MariaDB-1 Debian 10

mysql> UPDATE sitepreff SET memcached_update = '2019-08-19T15:49:39+0200'; ERROR 1292 (22007): Incorrect datetime value: '2019-08-19T15:49:39+0200' for column db_phrasea.sitepreff.memcached_update at row 1

Le code en cause est : /lib/classes/cache/databox.php 117 à 126

        $date = new \DateTime();
        $now = $date->format(DATE_ISO8601);
        $app->getApplicationBox()->set_data_to_cache($now, 'memcached_update_' . $sbas_id);
        $conn = $app->getApplicationBox()->get_connection();
        $sql = 'UPDATE sitepreff SET memcached_update = :date';
        $stmt = $conn->prepare($sql);
        $stmt->execute([':date' => $now]);

tomamplius avatar Aug 19 '19 14:08 tomamplius

I solve this issue with

        $date = new \DateTime();
        $now = $date->format(DATE_ISO8601);
        $app->getApplicationBox()->set_data_to_cache($now, 'memcached_update_' . $sbas_id);
        $conn = $app->getApplicationBox()->get_connection();
        $sql = 'UPDATE sitepreff SET memcached_update = current_timestamp()';
        $stmt = $conn->prepare($sql);
        $stmt->execute();

tomamplius avatar Aug 20 '19 09:08 tomamplius