]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/TwitterBridge/Notice_to_status.php
Merge branch '1.0.x' into 1.1.x
[quix0rs-gnu-social.git] / plugins / TwitterBridge / Notice_to_status.php
index 0d94927e4271e78bb97654fe39ddd3dd17d97fd5..313adaeafc0eb229a41c14cc2ade134645fc71e0 100644 (file)
@@ -71,7 +71,6 @@ class Notice_to_status extends Memcached_DataObject
      * @return Notice_to_status object found, or null for no hits
      *
      */
-
     function staticGet($k, $v=null)
     {
         return Memcached_DataObject::staticGet('Notice_to_status', $k, $v);
@@ -85,7 +84,6 @@ class Notice_to_status extends Memcached_DataObject
      *
      * @return array array of column definitions
      */
-
     function table()
     {
         return array('notice_id' => DB_DATAOBJECT_INT + DB_DATAOBJECT_NOTNULL,
@@ -102,7 +100,6 @@ class Notice_to_status extends Memcached_DataObject
      *
      * @return array list of key field names
      */
-
     function keys()
     {
         return array_keys($this->keyTypes());
@@ -120,7 +117,6 @@ class Notice_to_status extends Memcached_DataObject
      *         'K' for primary key: for compound keys, add an entry for each component;
      *         'U' for unique keys: compound keys are not well supported here.
      */
-
     function keyTypes()
     {
         return array('notice_id' => 'K', 'status_id' => 'U');
@@ -136,7 +132,6 @@ class Notice_to_status extends Memcached_DataObject
      *
      * @return array magic three-false array that stops auto-incrementing.
      */
-
     function sequenceKey()
     {
         return array(false, false, false);
@@ -144,27 +139,35 @@ class Notice_to_status extends Memcached_DataObject
 
     /**
      * Save a mapping between a notice and a status
+     * Warning: status_id values may not fit in 32-bit integers.
      *
      * @param integer $notice_id ID of the notice in StatusNet
      * @param integer $status_id ID of the status in Twitter
      *
      * @return Notice_to_status new object for this value
      */
-
     static function saveNew($notice_id, $status_id)
     {
+        if (empty($notice_id)) {
+            throw new Exception("Invalid notice_id $notice_id");
+        }
         $n2s = Notice_to_status::staticGet('notice_id', $notice_id);
 
         if (!empty($n2s)) {
             return $n2s;
         }
 
+        if (empty($status_id)) {
+            throw new Exception("Invalid status_id $status_id");
+        }
         $n2s = Notice_to_status::staticGet('status_id', $status_id);
 
         if (!empty($n2s)) {
             return $n2s;
         }
 
+        common_debug("Mapping notice {$notice_id} to Twitter status {$status_id}");
+
         $n2s = new Notice_to_status();
 
         $n2s->notice_id = $notice_id;