1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- class SearchSubTrackoffCommand extends Command
- {
- function handle($channel)
- {
- $cur = $this->user;
- $all = new SearchSub();
- $all->profile_id = $cur->id;
- $all->find();
- if ($all->N == 0) {
-
- $channel->error($cur, _m('You are not tracking any searches.'));
- return;
- }
- $profile = $cur->getProfile();
- while ($all->fetch()) {
- try {
- SearchSub::cancel($profile, $all->search);
- } catch (Exception $e) {
-
-
- $channel->error($cur, sprintf(_m('Error disabling search subscription for query "%s".'),
- $all->search));
- return;
- }
- }
-
- $channel->output($cur, _m('Disabled all your search subscriptions.'));
- }
- }
|