diff options
author | Evan Prodromou <evan@status.net> | 2010-06-03 14:50:52 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-06-03 14:50:52 -0400 |
commit | 135b398d4bfd1d680c5ea3600337f79c113ed681 (patch) | |
tree | c3a253361491d0df0ee1854adda63acb104fb382 | |
parent | a5de2152672f49ad95f114033ef6bf00ece9a0ab (diff) | |
parent | 4bbb259baf93780556db398f50a22b6f245071e4 (diff) |
Merge branch 'master' of gitorious.org:statusnet/mainline
-rw-r--r-- | actions/apistatusesdestroy.php | 59 | ||||
-rw-r--r-- | classes/Inbox.php | 9 | ||||
-rw-r--r-- | lib/installer.php | 9 |
3 files changed, 47 insertions, 30 deletions
diff --git a/actions/apistatusesdestroy.php b/actions/apistatusesdestroy.php index 0bfcdd060..749f72e68 100644 --- a/actions/apistatusesdestroy.php +++ b/actions/apistatusesdestroy.php @@ -99,32 +99,43 @@ class ApiStatusesDestroyAction extends ApiAuthAction parent::handle($args); if (!in_array($this->format, array('xml', 'json'))) { - $this->clientError(_('API method not found.'), $code = 404); - return; + $this->clientError( + _('API method not found.'), + 404 + ); + return; } - if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) { - $this->clientError(_('This method requires a POST or DELETE.'), - 400, $this->format); - return; - } - - if (empty($this->notice)) { - $this->clientError(_('No status found with that ID.'), - 404, $this->format); - return; - } - - if ($this->user->id == $this->notice->profile_id) { - $replies = new Reply; - $replies->get('notice_id', $this->notice_id); - $replies->delete(); - $this->notice->delete(); - $this->showNotice(); - } else { - $this->clientError(_('You may not delete another user\'s status.'), - 403, $this->format); - } + if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) { + $this->clientError( + _('This method requires a POST or DELETE.'), + 400, + $this->format + ); + return; + } + + if (empty($this->notice)) { + $this->clientError( + _('No status found with that ID.'), + 404, $this->format + ); + return; + } + + if ($this->user->id == $this->notice->profile_id) { + $replies = new Reply; + $replies->get('notice_id', $this->notice_id); + $replies->delete(); + $this->notice->delete(); + $this->showNotice(); + } else { + $this->clientError( + _('You may not delete another user\'s status.'), + 403, + $this->format + ); + } } /** diff --git a/classes/Inbox.php b/classes/Inbox.php index 2533210b7..430419ba5 100644 --- a/classes/Inbox.php +++ b/classes/Inbox.php @@ -115,9 +115,12 @@ class Inbox extends Memcached_DataObject */ static function insertNotice($user_id, $notice_id) { - $inbox = DB_DataObject::staticGet('inbox', 'user_id', $user_id); - - if (empty($inbox)) { + // Going straight to the DB rather than trusting our caching + // during an update. Note: not using DB_DataObject::staticGet, + // which is unsafe to use directly (in-process caching causes + // memory leaks, which accumulate in queue processes). + $inbox = new Inbox(); + if (!$inbox->get('user_id', $user_id)) { $inbox = Inbox::initialize($user_id); } diff --git a/lib/installer.php b/lib/installer.php index 58ffbfef7..7936d5d5d 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -81,9 +81,12 @@ abstract class Installer { $pass = true; - if (file_exists(INSTALLDIR.'/config.php')) { - $this->warning('Config file "config.php" already exists.'); - $pass = false; + $config = INSTALLDIR.'/config.php'; + if (file_exists($config)) { + if (!is_writable($config) || filesize($config) > 0) { + $this->warning('Config file "config.php" already exists.'); + $pass = false; + } } if (version_compare(PHP_VERSION, '5.2.3', '<')) { |