summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorRobin Millette <millette@controlyourself.ca>2009-06-16 23:10:17 -0400
committerRobin Millette <millette@controlyourself.ca>2009-06-16 23:10:17 -0400
commitbefbfc9c73a75bac9d7dac4a4b7a21bd515ce1b4 (patch)
treed64e6097df26b79e470def55f670b7bc82e0d327 /classes
parentd3ee6eb05e8ac622a2fde5cba071a9ba8db7e9cf (diff)
Moved url handling to its proper place, from newnotice to Notice.php
Diffstat (limited to 'classes')
-rw-r--r--classes/Notice.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/classes/Notice.php b/classes/Notice.php
index 68602b1f7..770b5d78b 100644
--- a/classes/Notice.php
+++ b/classes/Notice.php
@@ -217,6 +217,7 @@ class Notice extends Memcached_DataObject
$notice->addToInboxes();
$notice->saveGroups();
+ $notice->saveUrls();
$notice->query('COMMIT');
@@ -231,6 +232,24 @@ class Notice extends Memcached_DataObject
return $notice;
}
+ /** save all urls in the notice to the db
+ *
+ * follow redirects and save all available file information
+ * (mimetype, date, size, oembed, etc.)
+ *
+ * @param class $notice Notice to pull URLs from
+ *
+ * @return void
+ */
+ function saveUrls() {
+ common_replace_urls_callback($this->content, array($this, 'saveUrl'), $this->id);
+ }
+
+ function saveUrl($data) {
+ list($url, $notice_id) = $data;
+ File::processNew($url, $notice_id);
+ }
+
static function checkDupes($profile_id, $content) {
$profile = Profile::staticGet($profile_id);
if (!$profile) {