merge 0.9.x into 1.0.x

This commit is contained in:
Evan Prodromou
2011-05-04 14:59:39 -07:00
13 changed files with 318 additions and 68 deletions

View File

@@ -230,8 +230,23 @@ class Bookmark extends Memcached_DataObject
if (array_key_exists('uri', $options)) {
$nb->uri = $options['uri'];
} else {
$nb->uri = common_local_url('showbookmark',
array('id' => $nb->id));
// FIXME: hacks to work around router bugs in
// queue daemons
$r = Router::get();
$path = $r->build('showbookmark',
array('id' => $nb->id));
if (empty($path)) {
$nb->uri = common_path('bookmark/'.$nb->id, false, false);
} else {
$nb->uri = common_local_url('showbookmark',
array('id' => $nb->id),
null,
null,
false);
}
}
$nb->insert();
@@ -313,11 +328,20 @@ class Bookmark extends Memcached_DataObject
$options['uri'] = $nb->uri;
}
$saved = Notice::saveNew($profile->id,
$content,
array_key_exists('source', $options) ?
$options['source'] : 'web',
$options);
try {
$saved = Notice::saveNew($profile->id,
$content,
array_key_exists('source', $options) ?
$options['source'] : 'web',
$options);
} catch (Exception $e) {
$nb->delete();
throw $e;
}
if (empty($saved)) {
$nb->delete();
}
return $saved;
}

View File

@@ -76,6 +76,12 @@ class DeliciousBackupImporter extends QueueHandler
$doc = $this->importHTML($body);
// If we can't parse it, it's no good
if (empty($doc)) {
return true;
}
$dls = $doc->getElementsByTagName('dl');
if ($dls->length != 1) {
@@ -110,9 +116,11 @@ class DeliciousBackupImporter extends QueueHandler
case 'dd':
$dd = $child;
// This <dd> contains a description for the bookmark in
// the preceding <dt> node.
$saved = $this->importBookmark($user, $dt, $dd);
if (!empty($dt)) {
// This <dd> contains a description for the bookmark in
// the preceding <dt> node.
$saved = $this->importBookmark($user, $dt, $dd);
}
$dt = null;
$dd = null;