Merge branch 'master' of gitorious.org:statusnet/mainline

This commit is contained in:
Evan Prodromou 2010-06-03 14:50:52 -04:00
commit 135b398d4b
3 changed files with 45 additions and 28 deletions

View File

@ -99,19 +99,27 @@ class ApiStatusesDestroyAction extends ApiAuthAction
parent::handle($args); parent::handle($args);
if (!in_array($this->format, array('xml', 'json'))) { if (!in_array($this->format, array('xml', 'json'))) {
$this->clientError(_('API method not found.'), $code = 404); $this->clientError(
_('API method not found.'),
404
);
return; return;
} }
if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) { if (!in_array($_SERVER['REQUEST_METHOD'], array('POST', 'DELETE'))) {
$this->clientError(_('This method requires a POST or DELETE.'), $this->clientError(
400, $this->format); _('This method requires a POST or DELETE.'),
400,
$this->format
);
return; return;
} }
if (empty($this->notice)) { if (empty($this->notice)) {
$this->clientError(_('No status found with that ID.'), $this->clientError(
404, $this->format); _('No status found with that ID.'),
404, $this->format
);
return; return;
} }
@ -122,8 +130,11 @@ class ApiStatusesDestroyAction extends ApiAuthAction
$this->notice->delete(); $this->notice->delete();
$this->showNotice(); $this->showNotice();
} else { } else {
$this->clientError(_('You may not delete another user\'s status.'), $this->clientError(
403, $this->format); _('You may not delete another user\'s status.'),
403,
$this->format
);
} }
} }

View File

@ -115,9 +115,12 @@ class Inbox extends Memcached_DataObject
*/ */
static function insertNotice($user_id, $notice_id) static function insertNotice($user_id, $notice_id)
{ {
$inbox = DB_DataObject::staticGet('inbox', 'user_id', $user_id); // Going straight to the DB rather than trusting our caching
// during an update. Note: not using DB_DataObject::staticGet,
if (empty($inbox)) { // 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); $inbox = Inbox::initialize($user_id);
} }

View File

@ -81,10 +81,13 @@ abstract class Installer
{ {
$pass = true; $pass = true;
if (file_exists(INSTALLDIR.'/config.php')) { $config = INSTALLDIR.'/config.php';
if (file_exists($config)) {
if (!is_writable($config) || filesize($config) > 0) {
$this->warning('Config file "config.php" already exists.'); $this->warning('Config file "config.php" already exists.');
$pass = false; $pass = false;
} }
}
if (version_compare(PHP_VERSION, '5.2.3', '<')) { if (version_compare(PHP_VERSION, '5.2.3', '<')) {
$errors[] = 'Require PHP version 5.2.3 or greater.'; $errors[] = 'Require PHP version 5.2.3 or greater.';