~ubuntu-branches/ubuntu/wily/phabricator/wily

« back to all changes in this revision

Viewing changes to phabricator/src/applications/notification/setup/PhabricatorSetupCheckAphlict.php

  • Committer: Package Import Robot
  • Author(s): Richard Sellam
  • Date: 2015-01-29 00:15:58 UTC
  • mfrom: (0.14.1) (0.13.1) (0.10.2) (2.1.4 sid)
  • Revision ID: package-import@ubuntu.com-20150129001558-7qklhtcc043y9mog
Tags: 0~git20150129-1
* New snapshot release
* restricted access to local config file (closes: #775479)
* moved local config file to /var/lib/phabricator (closes: #775478)
* switched mysql-server dependency to recommends (closes: #773536)
* use /run instead of /var/run (closes: #775803)
* prevent package reinstall from overwritting local changes (closes: #776288)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?php
2
 
 
3
 
final class PhabricatorSetupCheckAphlict extends PhabricatorSetupCheck {
4
 
 
5
 
  protected function executeChecks() {
6
 
    $enabled = PhabricatorEnv::getEnvConfig('notification.enabled');
7
 
    if (!$enabled) {
8
 
      // Notifications aren't set up, so just ignore all of these checks.
9
 
      return;
10
 
    }
11
 
 
12
 
    try {
13
 
      $status = PhabricatorNotificationClient::getServerStatus();
14
 
    } catch (Exception $ex) {
15
 
      $message = pht(
16
 
        'Phabricator is configured to use a notification server, but '.
17
 
        'is unable to connect to it. You should resolve this issue or '.
18
 
        'disable the notification server. It may be helpful to double check '.
19
 
        'your configuration or restart the server using the command below.'.
20
 
        "\n\n".
21
 
        "%s",
22
 
        phutil_tag(
23
 
          'pre',
24
 
          array(),
25
 
          array(
26
 
            get_class($ex),
27
 
            "\n",
28
 
            $ex->getMessage(),
29
 
          )));
30
 
 
31
 
 
32
 
      $this->newIssue('aphlict.connect')
33
 
        ->setShortName(pht('Notification Server Down'))
34
 
        ->setName(pht('Unable to Connect to Notification Server'))
35
 
        ->setMessage($message)
36
 
        ->addRelatedPhabricatorConfig('notification.enabled')
37
 
        ->addRelatedPhabricatorConfig('notification.server-uri')
38
 
        ->addCommand(
39
 
          pht(
40
 
            "(To start the server, run this command.)\n".
41
 
            "phabricator/ $ sudo ./bin/aphlict start"));
42
 
 
43
 
      return;
44
 
    }
45
 
 
46
 
    $expect_version = PhabricatorNotificationClient::EXPECT_VERSION;
47
 
    $have_version = idx($status, 'version', 1);
48
 
    if ($have_version != $expect_version) {
49
 
      $message = pht(
50
 
        'The notification server is out of date. You are running server '.
51
 
        'version %d, but Phabricator expects version %d. Restart the server '.
52
 
        'to update it, using the command below:',
53
 
        $have_version,
54
 
        $expect_version);
55
 
 
56
 
      $this->newIssue('aphlict.version')
57
 
        ->setShortName(pht('Notification Server Version'))
58
 
        ->setName(pht('Notification Server Out of Date'))
59
 
        ->setMessage($message)
60
 
        ->addCommand('phabricator/ $ sudo ./bin/aphlict restart');
61
 
    }
62
 
 
63
 
  }
64
 
}