summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--classes/Inbox.php30
-rw-r--r--db/rc2torc3.sql17
-rw-r--r--index.php2
-rw-r--r--lib/common.php3
4 files changed, 40 insertions, 12 deletions
diff --git a/classes/Inbox.php b/classes/Inbox.php
index e14d4f4e7..83cfe8ef8 100644
--- a/classes/Inbox.php
+++ b/classes/Inbox.php
@@ -57,6 +57,22 @@ class Inbox extends Memcached_DataObject
static function initialize($user_id)
{
+ $inbox = Inbox::fromNoticeInbox($user_id);
+
+ unset($inbox->fake);
+
+ $result = $inbox->insert();
+
+ if (!$result) {
+ common_log_db_error($inbox, 'INSERT', __FILE__);
+ return null;
+ }
+
+ return $inbox;
+ }
+
+ static function fromNoticeInbox($user_id)
+ {
$ids = array();
$ni = new Notice_inbox();
@@ -80,13 +96,7 @@ class Inbox extends Memcached_DataObject
$inbox->user_id = $user_id;
$inbox->notice_ids = call_user_func_array('pack', array_merge(array('N*'), $ids));
-
- $result = $inbox->insert();
-
- if (!$result) {
- common_log_db_error($inbox, 'INSERT', __FILE__);
- return null;
- }
+ $inbox->fake = true;
return $inbox;
}
@@ -95,7 +105,7 @@ class Inbox extends Memcached_DataObject
{
$inbox = Inbox::staticGet('user_id', $user_id);
- if (empty($inbox)) {
+ if (empty($inbox) || $inbox->fake) {
$inbox = Inbox::initialize($user_id);
}
@@ -133,9 +143,11 @@ class Inbox extends Memcached_DataObject
$inbox = Inbox::staticGet('user_id', $user_id);
if (empty($inbox)) {
- $inbox = Inbox::initialize($user_id);
+ $inbox = Inbox::fromNoticeInbox($user_id);
if (empty($inbox)) {
return array();
+ } else {
+ $inbox->encache();
}
}
diff --git a/db/rc2torc3.sql b/db/rc2torc3.sql
new file mode 100644
index 000000000..886b9adf2
--- /dev/null
+++ b/db/rc2torc3.sql
@@ -0,0 +1,17 @@
+create table user_location_prefs (
+ user_id integer not null comment 'user who has the preference' references user (id),
+ share_location tinyint default 1 comment 'Whether to share location data',
+ created datetime not null comment 'date this record was created',
+ modified timestamp comment 'date this record was modified',
+
+ constraint primary key (user_id)
+) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
+
+create table inbox (
+
+ user_id integer not null comment 'user receiving the notice' references user (id),
+ notice_ids blob comment 'packed list of notice ids',
+
+ constraint primary key (user_id)
+
+) ENGINE=InnoDB CHARACTER SET utf8 COLLATE utf8_bin;
diff --git a/index.php b/index.php
index 59805f600..b5edc0f94 100644
--- a/index.php
+++ b/index.php
@@ -150,7 +150,7 @@ function checkMirror($action_obj, $args)
{
global $config;
- static $alwaysRW = array('session', 'remember_me', 'inbox');
+ static $alwaysRW = array('session', 'remember_me');
if (common_config('db', 'mirror') && $action_obj->isReadOnly($args)) {
if (is_array(common_config('db', 'mirror'))) {
diff --git a/lib/common.php b/lib/common.php
index 00e80373e..243ac3e79 100644
--- a/lib/common.php
+++ b/lib/common.php
@@ -22,7 +22,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
//exit with 200 response, if this is checking fancy from the installer
if (isset($_REQUEST['p']) && $_REQUEST['p'] == 'check-fancy') { exit; }
-define('STATUSNET_VERSION', '0.9.0rc2');
+define('STATUSNET_VERSION', '0.9.0rc3');
define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility
define('STATUSNET_CODENAME', 'Stand');
@@ -136,7 +136,6 @@ try {
exit;
}
-
// XXX: other formats here
define('NICKNAME_FMT', VALIDATE_NUM.VALIDATE_ALPHA_LOWER);