summaryrefslogtreecommitdiff
path: root/plugins/SubMirror
diff options
context:
space:
mode:
authorBrion Vibber <brion@status.net>2010-08-10 11:45:34 -0700
committerBrion Vibber <brion@status.net>2010-08-10 11:45:34 -0700
commit6a2659ed67577b3f33c5c4d55067744a4b812a06 (patch)
tree6b89c07e28031f1740d5b1a2e494f7f86eb5a9de /plugins/SubMirror
parent09dee24cbeadfb1fef797d38265e2ece09266bb0 (diff)
Workaround for index setup on SubMirror until I'm done w/ arbitrary index support for Schema setup.
Diffstat (limited to 'plugins/SubMirror')
-rw-r--r--plugins/SubMirror/SubMirrorPlugin.php3
-rw-r--r--plugins/SubMirror/classes/SubMirror.php16
2 files changed, 19 insertions, 0 deletions
diff --git a/plugins/SubMirror/SubMirrorPlugin.php b/plugins/SubMirror/SubMirrorPlugin.php
index 7289e7793..80c6c5a88 100644
--- a/plugins/SubMirror/SubMirrorPlugin.php
+++ b/plugins/SubMirror/SubMirrorPlugin.php
@@ -120,6 +120,9 @@ class SubMirrorPlugin extends Plugin
{
$schema = Schema::get();
$schema->ensureTable('submirror', SubMirror::schemaDef());
+
+ // @hack until key definition support is merged
+ SubMirror::fixIndexes($schema);
return true;
}
diff --git a/plugins/SubMirror/classes/SubMirror.php b/plugins/SubMirror/classes/SubMirror.php
index 4e7e005db..bd8fc80a5 100644
--- a/plugins/SubMirror/classes/SubMirror.php
+++ b/plugins/SubMirror/classes/SubMirror.php
@@ -77,6 +77,22 @@ class SubMirror extends Memcached_DataObject
}
/**
+ * 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
*
* DB_DataObject needs to know about keys that the table has; this function