summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-03-05 03:14:40 +0000
committerZach Copley <zach@status.net>2010-03-05 03:55:56 +0000
commite3c4b0c85d3fbae9604b22d3666fe36a3c1c7551 (patch)
treeaf8c84cfed48cf79ead3ffe5e44c69f244c3b9e4 /plugins
parent6aac7cc6cd011b3c86f3f4c8e00a14f992a78306 (diff)
A better way to safely delete Foreign_links
Diffstat (limited to 'plugins')
-rw-r--r--plugins/TwitterBridge/twitter.php11
-rw-r--r--plugins/TwitterBridge/twitterauthorization.php2
-rw-r--r--plugins/TwitterBridge/twittersettings.php11
3 files changed, 3 insertions, 21 deletions
diff --git a/plugins/TwitterBridge/twitter.php b/plugins/TwitterBridge/twitter.php
index 90805bfc4..2805b3ab5 100644
--- a/plugins/TwitterBridge/twitter.php
+++ b/plugins/TwitterBridge/twitter.php
@@ -273,16 +273,7 @@ function remove_twitter_link($flink)
common_log(LOG_INFO, 'Removing Twitter bridge Foreign link for ' .
"user $user->nickname (user id: $user->id).");
- $result = false;
-
- // Be extra careful to make sure we have a good flink
- // before deleting
- if (!empty($flink->user_id)
- && !empty($flink->foreign_id)
- && !empty($flink->service))
- {
- $result = $flink->delete();
- }
+ $result = $flink->safeDelete();
if (empty($result)) {
common_log(LOG_ERR, 'Could not remove Twitter bridge ' .
diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php
index bce679622..e20731e5c 100644
--- a/plugins/TwitterBridge/twitterauthorization.php
+++ b/plugins/TwitterBridge/twitterauthorization.php
@@ -278,7 +278,7 @@ class TwitterauthorizationAction extends Action
$result = $flink->find(true);
if (!empty($result)) {
- $flink->delete();
+ $flink->safeDelete();
}
$flink->user_id = $user_id;
diff --git a/plugins/TwitterBridge/twittersettings.php b/plugins/TwitterBridge/twittersettings.php
index f22a059f7..631b29f52 100644
--- a/plugins/TwitterBridge/twittersettings.php
+++ b/plugins/TwitterBridge/twittersettings.php
@@ -250,16 +250,7 @@ class TwittersettingsAction extends ConnectSettingsAction
$user = common_current_user();
$flink = Foreign_link::getByUserID($user->id, TWITTER_SERVICE);
- $result = false;
-
- // Be extra careful to make sure we have a good flink
- // before deleting
- if (!empty($flink->user_id)
- && !empty($flink->foreign_id)
- && !empty($flink->service))
- {
- $result = $flink->delete();
- }
+ $result = $flink->safeDelete();
if (empty($result)) {
common_log_db_error($flink, 'DELETE', __FILE__);