1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-22 21:40:55 +01:00

Automatically create the Aphlict log directory

Summary: Fixes T6944. Attempt to automatically create the log directory for the Aphlict server. If the directory can't be created, throw a helpful exception.

Test Plan:
# Set `notification.log` to `/var/log/aphlict/aphlict.log`.
# Ran `./bin/aphlict debug` and saw an exception (because the user doesn't have permissions to create the `/var/log/aphlict` directory).
# Ran `sudo chmod 777 /var/log`.
# Ran `./bin/aphlict debug` and saw the `/var/log/aphlict` directory created.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T6944

Differential Revision: https://secure.phabricator.com/D11387
This commit is contained in:
Joshua Spence 2015-01-15 06:54:25 +11:00
parent b711407b17
commit 1f09e05c68

View file

@ -34,6 +34,22 @@ abstract class PhabricatorAphlictManagementWorkflow
return PhabricatorEnv::getEnvConfig('notification.pidfile');
}
final public function getLogPath() {
$path = PhabricatorEnv::getEnvConfig('notification.log');
try {
$dir = dirname($path);
Filesystem::createDirectory($dir, 0755, true);
} catch (FilesystemException $ex) {
throw new Exception(
pht(
"Failed to create '%s'. You should manually create this directory.",
$dir));
}
return $path;
}
final public function getPID() {
$pid = null;
if (Filesystem::pathExists($this->getPIDPath())) {
@ -128,7 +144,7 @@ abstract class PhabricatorAphlictManagementWorkflow
$client_uri = PhabricatorEnv::getEnvConfig('notification.client-uri');
$client_uri = new PhutilURI($client_uri);
$log = PhabricatorEnv::getEnvConfig('notification.log');
$log = $this->getLogPath();
$server_argv = array();
$server_argv[] = '--client-port='.coalesce(