* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
+
/**
* @package SubMirrorPlugin
* @maintainer Brion Vibber <brion@status.net>
*/
-
-if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
-
-
class SubMirrorPlugin extends Plugin
{
/**
{
$schema = Schema::get();
$schema->ensureTable('submirror', SubMirror::schemaDef());
+
+ // @hack until key definition support is merged
+ SubMirror::fixIndexes($schema);
return true;
}
$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;
}
}