]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/SubMirror/classes/SubMirror.php
merge 0.9.x into 1.0.x
[quix0rs-gnu-social.git] / plugins / SubMirror / classes / SubMirror.php
index 4e7e005db261d637742711074151113c9b6c1747..b39af918d5ddb2e073199c07a373ab190e77de75 100644 (file)
@@ -76,6 +76,22 @@ class SubMirror extends Memcached_DataObject
                                    null, false));
     }
 
+    /**
+     * Temporary hack to set up the compound index, since we can't do
+     * it yet through regular Schema interface. (Coming for 1.0...)
+     *
+     * @param Schema $schema
+     * @return void
+     */
+    static function fixIndexes($schema)
+    {
+        try {
+            $schema->createIndex('submirror', array('subscribed', 'subscriber'));
+        } catch (Exception $e) {
+            common_log(LOG_ERR, __METHOD__ . ': ' . $e->getMessage());
+        }
+    }
+
     /**
      * return key definitions for DB_DataObject
      *
@@ -129,7 +145,7 @@ class SubMirror extends Memcached_DataObject
         $mirror->created = common_sql_now();
         $mirror->modified = common_sql_now();
         $mirror->insert();
-        
+
         return $mirror;
     }
 
@@ -157,7 +173,7 @@ class SubMirror extends Memcached_DataObject
      * This retains attribution within the site, and other nice things,
      * but currently ends up looking like 'RT @foobar bla bla' when
      * bridged out over OStatus or TwitterBridge.
-     * 
+     *
      * @param Notice $notice
      * @return mixed Notice on successful repeat, true if already repeated, false on failure
      */
@@ -176,7 +192,7 @@ class SubMirror extends Memcached_DataObject
      * Mirror a notice by emitting a new notice with the same contents.
      * Kind of dirty, but if pulling an external data feed into an account
      * that may be what you want.
-     * 
+     *
      * @param Notice $notice
      * @return mixed Notice on successful repeat, true if already repeated, false on failure
      */
@@ -200,7 +216,7 @@ class SubMirror extends Memcached_DataObject
 
     /**
      * Get the mirroring setting for a pair of profiles, if existing.
-     * 
+     *
      * @param Profile $subscriber
      * @param Profile $subscribed
      * @return mixed Profile or empty