]> git.mxchange.org Git - friendica.git/commitdiff
Add the creation date to the cache tables
authorMichael Vogel <icarus@dabo.de>
Thu, 14 Jan 2016 23:58:57 +0000 (00:58 +0100)
committerMichael Vogel <icarus@dabo.de>
Thu, 14 Jan 2016 23:58:57 +0000 (00:58 +0100)
include/dbstructure.php
include/oembed.php
mod/parse_url.php

index 35bacd7f834bd5c6b628eae34e57ed1b8e19ce52..43dfbd7b353185d9ad5f87ab19a82fbb7b061316 100644 (file)
@@ -1025,9 +1025,11 @@ function db_definition() {
                        "fields" => array(
                                        "url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
                                        "content" => array("type" => "text", "not null" => "1"),
+                                       "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("url"),
+                                       "created" => array("created"),
                                        )
                        );
        $database["parsed_url"] = array(
@@ -1036,9 +1038,11 @@ function db_definition() {
                                        "guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
                                        "oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
                                        "content" => array("type" => "text", "not null" => "1"),
+                                       "created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        ),
                        "indexes" => array(
                                        "PRIMARY" => array("url", "guessing", "oembed"),
+                                       "created" => array("created"),
                                        )
                        );
        $database["pconfig"] = array(
index 51130645812965977066bdbf0e99c5c621019ae1..b1770f68903408034053997dff8a0495081d89aa 100755 (executable)
@@ -75,8 +75,8 @@ function oembed_fetch_url($embedurl, $no_rich_type = false){
                else {  //save in cache
                        $j = json_decode($txt);
                        if ($j->type != "error")
-                               q("INSERT INTO `oembed` (`url`, `content`) VALUES ('%s', '%s')",
-                                       dbesc(normalise_link($embedurl)), dbesc($txt));
+                               q("INSERT INTO `oembed` (`url`, `content`, `created`) VALUES ('%s', '%s', '%s')",
+                                       dbesc(normalise_link($embedurl)), dbesc($txt), dbesc(datetime_convert()));
 
                        Cache::set($a->videowidth . $embedurl,$txt, CACHE_DAY);
                }
index 8aa0c17ee1db0fa2ac011177ee6afd2945703c2f..1ca5dc1dacfe60cac9646b6adc913a6a565b26a5 100644 (file)
@@ -72,8 +72,8 @@ function parseurl_getsiteinfo_cached($url, $no_guessing = false, $do_oembed = tr
 
        $data = parseurl_getsiteinfo($url, $no_guessing, $do_oembed);
 
-       q("INSERT INTO `parsed_url` (`url`, `guessing`, `oembed`, `content`) VALUES ('%s', %d, %d, '%s')",
-               dbesc(normalise_link($url)), intval(!$no_guessing), intval($do_oembed), dbesc(serialize($data)));
+       q("INSERT INTO `parsed_url` (`url`, `guessing`, `oembed`, `content`, `created`) VALUES ('%s', %d, %d, '%s', '%s')",
+               dbesc(normalise_link($url)), intval(!$no_guessing), intval($do_oembed), dbesc(serialize($data)), dbesc(datetime_convert()));
 
        return $data;
 }