]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/SearchSub/searchsubtrackoffcommand.php
More info for a proper, fancy-url lighttpd setup
[quix0rs-gnu-social.git] / plugins / SearchSub / searchsubtrackoffcommand.php
1 <?php
2
3 class SearchSubTrackoffCommand extends Command
4 {
5     function handle($channel)
6     {
7         $cur = $this->user;
8         $all = new SearchSub();
9         $all->profile_id = $cur->id;
10         $all->find();
11
12         if ($all->N == 0) {
13             // TRANS: Error text shown a user tries to disable all a search subscriptions with track off command, but has none.
14             $channel->error($cur, _m('You are not tracking any searches.'));
15             return;
16         }
17
18         $profile = $cur->getProfile();
19         while ($all->fetch()) {
20             try {
21                 SearchSub::cancel($profile, $all->search);
22             } catch (Exception $e) {
23                 // TRANS: Message given having failed to cancel one of the search subs with 'track off' command.
24                 // TRANS: %s is the search for which the subscription removal failed.
25                 $channel->error($cur, sprintf(_m('Error disabling search subscription for query "%s".'),
26                                               $all->search));
27                 return;
28             }
29         }
30
31         // TRANS: Message given having disabled all search subscriptions with 'track off'.
32         $channel->output($cur, _m('Disabled all your search subscriptions.'));
33     }
34 }