]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/AnonymousFave/Fave_tally.php
- Fix table name; add comments
[quix0rs-gnu-social.git] / plugins / AnonymousFave / Fave_tally.php
index 35ace6d01ba7514731edd179ae82afcef400f714..f48a1e82b313f7cf5e342a650b2f3eb7f423c16e 100644 (file)
@@ -44,7 +44,6 @@ require_once INSTALLDIR . '/classes/Memcached_DataObject.php';
  * @license  http://www.fsf.org/licensing/licenses/agpl.html AGPLv3
  * @link     http://status.net/
  */
-
 class Fave_tally extends Memcached_DataObject
 {
     ###START_AUTOCODE
@@ -85,7 +84,6 @@ class Fave_tally extends Memcached_DataObject
      *
      * @return array list of key field names
      */
-
     function keys()
     {
         return array_keys($this->keyTypes());
@@ -103,7 +101,6 @@ class Fave_tally 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');
@@ -119,8 +116,6 @@ class Fave_tally extends Memcached_DataObject
      *
      * @return array magic three-false array that stops auto-incrementing.
      */
-
-
     function sequenceKey()
     {
         return array(false, false, false);
@@ -133,7 +128,6 @@ class Fave_tally extends Memcached_DataObject
      *
      * @return User_flag_profile found object or null
      */
-
     function pkeyGet($kv)
     {
         return Memcached_DataObject::pkeyGet('Fave_tally', $kv);
@@ -146,10 +140,8 @@ class Fave_tally extends Memcached_DataObject
      *
      * @return Fave_tally $tally the tally data object
      */
-
     static function increment($noticeID)
     {
-        common_debug("XXXXXXXXX Fave_tally::increment()");
         $tally = Fave_tally::ensureTally($noticeID);
 
         $orig = clone($tally);
@@ -158,6 +150,8 @@ class Fave_tally extends Memcached_DataObject
 
         if (!$result) {
             $msg = sprintf(
+                // TRANS: Server exception.
+                // TRANS: %d is the notice ID (number).
                 _m("Couldn't update favorite tally for notice ID %d."),
                 $noticeID
             );
@@ -174,11 +168,8 @@ class Fave_tally extends Memcached_DataObject
      *
      * @return Fave_tally $tally the tally data object
      */
-
     static function decrement($noticeID)
     {
-        common_debug("XXXXXXXXX Fave_tally::decrement()");
-
         $tally = Fave_tally::ensureTally($noticeID);
 
         if ($tally->count > 0) {
@@ -188,6 +179,8 @@ class Fave_tally extends Memcached_DataObject
 
             if (!$result) {
                 $msg = sprintf(
+                    // TRANS: Server exception.
+                    // TRANS: %d is the notice ID (number).
                     _m("Couldn't update favorite tally for notice ID %d."),
                     $noticeID
                 );
@@ -206,19 +199,19 @@ class Fave_tally extends Memcached_DataObject
      *
      * @return Fave_tally the tally data object
      */
-
     static function ensureTally($noticeID)
     {
         $tally = Fave_tally::staticGet('notice_id', $noticeID);
 
         if (!$tally) {
-            common_debug("Fave_tally::ensureTally - creating tally for notice " . $noticeID);
             $tally = new Fave_tally();
             $tally->notice_id = $noticeID;
             $tally->count = Fave_tally::countExistingFaves($noticeID);
             $result = $tally->insert();
             if (!$result) {
                 $msg = sprintf(
+                    // TRANS: Server exception.
+                    // TRANS: %d is the notice ID (number).
                     _m("Couldn't create favorite tally for notice ID %d."),
                     $noticeID
                 );
@@ -237,15 +230,11 @@ class Fave_tally extends Memcached_DataObject
      *
      * @return integer $total total number of time the notice has been favored
      */
-
     static function countExistingFaves($noticeID)
     {
         $fave = new Fave();
         $fave->notice_id = $noticeID;
         $total = $fave->count();
-
-        common_debug("ZZZZZZZ notice " . $noticeID . ' has ' . $total . " faves");
-
         return $total;
     }
 }