Moved url handling to its proper place, from newnotice to Notice.php
This commit is contained in:
parent
d3ee6eb05e
commit
befbfc9c73
@ -231,7 +231,6 @@ class NewnoticeAction extends Action
|
|||||||
if (isset($mimetype)) {
|
if (isset($mimetype)) {
|
||||||
$this->storeFile($notice, $mimetype);
|
$this->storeFile($notice, $mimetype);
|
||||||
}
|
}
|
||||||
$this->saveUrls($notice);
|
|
||||||
common_broadcast_notice($notice);
|
common_broadcast_notice($notice);
|
||||||
|
|
||||||
if ($this->boolean('ajax')) {
|
if ($this->boolean('ajax')) {
|
||||||
@ -284,24 +283,6 @@ class NewnoticeAction extends Action
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 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($notice, $uploaded = null) {
|
|
||||||
common_replace_urls_callback($notice->content, array($this, 'saveUrl'), $notice->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
function saveUrl($data) {
|
|
||||||
list($url, $notice_id) = $data;
|
|
||||||
$zzz = File::processNew($url, $notice_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show an Ajax-y error message
|
* Show an Ajax-y error message
|
||||||
*
|
*
|
||||||
|
@ -217,6 +217,7 @@ class Notice extends Memcached_DataObject
|
|||||||
|
|
||||||
$notice->addToInboxes();
|
$notice->addToInboxes();
|
||||||
$notice->saveGroups();
|
$notice->saveGroups();
|
||||||
|
$notice->saveUrls();
|
||||||
|
|
||||||
$notice->query('COMMIT');
|
$notice->query('COMMIT');
|
||||||
|
|
||||||
@ -231,6 +232,24 @@ class Notice extends Memcached_DataObject
|
|||||||
return $notice;
|
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) {
|
static function checkDupes($profile_id, $content) {
|
||||||
$profile = Profile::staticGet($profile_id);
|
$profile = Profile::staticGet($profile_id);
|
||||||
if (!$profile) {
|
if (!$profile) {
|
||||||
|
Loading…
Reference in New Issue
Block a user