X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FSubMirror%2FSubMirrorPlugin.php;h=578ef6607c5fc846d3156f5f25ab15652425a28f;hb=7c37aa802ba2bc0616c78f7490986af0051f7dc4;hp=8678cc3dd0be92bb57bc2eb51e98b5422e9aeb07;hpb=300ed65d301d21c33a5f0a196d6acfe762a34f29;p=quix0rs-gnu-social.git diff --git a/plugins/SubMirror/SubMirrorPlugin.php b/plugins/SubMirror/SubMirrorPlugin.php index 8678cc3dd0..578ef6607c 100644 --- a/plugins/SubMirror/SubMirrorPlugin.php +++ b/plugins/SubMirror/SubMirrorPlugin.php @@ -17,14 +17,12 @@ * along with this program. If not, see . */ +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } + /** * @package SubMirrorPlugin * @maintainer Brion Vibber */ - -if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } - - class SubMirrorPlugin extends Plugin { /** @@ -120,6 +118,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; } @@ -140,10 +141,26 @@ class SubMirrorPlugin extends Plugin $transports[] = 'mirror'; } - function onStartShowSubscriptionsContent($action) + /** + * Let the OStatus subscription garbage collection know if we're + * making use of a remote feed, so it doesn't get dropped out + * from under us. + * + * @param Ostatus_profile $oprofile + * @param int $count in/out + * @return mixed hook return value + */ + function onOstatus_profileSubscriberCount($oprofile, &$count) { - $action->element('a', - array('href' => common_local_url('mirrorsettings')), - _m('Set up mirroring options...')); + if ($oprofile->profile_id) { + $mirror = new SubMirror(); + $mirror->subscribed = $oprofile->profile_id; + if ($mirror->find()) { + while ($mirror->fetch()) { + $count++; + } + } + } + return true; } }