make URL analyzer save new info on URLs
This commit is contained in:
parent
34ce75c71d
commit
c0d03fc279
|
@ -85,7 +85,7 @@ class File extends Memcached_DataObject
|
||||||
return $x;
|
return $x;
|
||||||
}
|
}
|
||||||
|
|
||||||
function processNew($given_url, $notice_id) {
|
function processNew($given_url, $notice_id=null) {
|
||||||
if (empty($given_url)) return -1; // error, no url to process
|
if (empty($given_url)) return -1; // error, no url to process
|
||||||
$given_url = File_redirection::_canonUrl($given_url);
|
$given_url = File_redirection::_canonUrl($given_url);
|
||||||
if (empty($given_url)) return -1; // error, no url to process
|
if (empty($given_url)) return -1; // error, no url to process
|
||||||
|
@ -119,7 +119,9 @@ class File extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!empty($notice_id)) {
|
||||||
File_to_post::processNew($file_id, $notice_id);
|
File_to_post::processNew($file_id, $notice_id);
|
||||||
|
}
|
||||||
return $x;
|
return $x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
19
lib/util.php
19
lib/util.php
|
@ -544,19 +544,24 @@ function common_linkify($url) {
|
||||||
|
|
||||||
// Check to see whether this is a known "attachment" URL.
|
// Check to see whether this is a known "attachment" URL.
|
||||||
|
|
||||||
$localfile = File::staticGet('url', $longurl);
|
$f = File::staticGet('url', $longurl);
|
||||||
|
|
||||||
if (!empty($localfile)) {
|
if (empty($f)) {
|
||||||
if (isset($localfile->filename)) {
|
// XXX: this writes to the database. :<
|
||||||
|
$f = File::processNew($longurl);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($f)) {
|
||||||
|
if (isset($f->filename)) {
|
||||||
$is_attachment = true;
|
$is_attachment = true;
|
||||||
$attachment_id = $localfile->id;
|
$attachment_id = $f->id;
|
||||||
} else { // if it has OEmbed info, it's an attachment, too
|
} else { // if it has OEmbed info, it's an attachment, too
|
||||||
$foe = File_oembed::staticGet('file_id', $localfile->id);
|
$foe = File_oembed::staticGet('file_id', $f->id);
|
||||||
if (!empty($foe)) {
|
if (!empty($foe)) {
|
||||||
$is_attachment = true;
|
$is_attachment = true;
|
||||||
$attachment_id = $localfile->id;
|
$attachment_id = $f->id;
|
||||||
|
|
||||||
$thumb = File_thumbnail::staticGet('file_id', $localfile->id);
|
$thumb = File_thumbnail::staticGet('file_id', $f->id);
|
||||||
if (!empty($thumb)) {
|
if (!empty($thumb)) {
|
||||||
$has_thumb = true;
|
$has_thumb = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user