From a98a4f8bb56eacffff1765ff09dd29af26e5fc12 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Wed, 27 Aug 2014 17:45:21 +0200 Subject: Remove 3rd party libs from our repository and define the dependencies in composer.json-dist. Also remove the ancient utf8 lib and replace it with 'Patchwork UTF-8 for PHP'. For direct git checkouts, copy composer.json-dist into composer.json and run `php composer.phar install` to install the dependencies. --- program/lib/Crypt/GPG/ProcessControl.php | 150 ------------------------------- 1 file changed, 150 deletions(-) delete mode 100644 program/lib/Crypt/GPG/ProcessControl.php (limited to 'program/lib/Crypt/GPG/ProcessControl.php') diff --git a/program/lib/Crypt/GPG/ProcessControl.php b/program/lib/Crypt/GPG/ProcessControl.php deleted file mode 100644 index d6dae0325..000000000 --- a/program/lib/Crypt/GPG/ProcessControl.php +++ /dev/null @@ -1,150 +0,0 @@ - - * @copyright 2013 silverorange - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @version CVS: $Id$ - * @link http://pear.php.net/package/Crypt_GPG - */ - -// {{{ class Crypt_GPG_ProcessControl - -/** - * A class for monitoring and terminating processes by PID - * - * This is used to safely terminate the gpg-agent for GnuPG 2.x. This class - * is limited in its abilities and can only check if a PID is running and - * send a PID SIGTERM. - * - * @category Encryption - * @package Crypt_GPG - * @author Michael Gauthier - * @copyright 2013 silverorange - * @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1 - * @link http://pear.php.net/package/Crypt_GPG - */ -class Crypt_GPG_ProcessControl -{ - // {{{ protected properties - - /** - * The PID (process identifier) being monitored - * - * @var integer - */ - protected $pid; - - // }}} - // {{{ __construct() - - /** - * Creates a new process controller from the given PID (process identifier) - * - * @param integer $pid the PID (process identifier). - */ - public function __construct($pid) - { - $this->pid = $pid; - } - - // }}} - // {{{ public function getPid() - - /** - * Gets the PID (process identifier) being controlled - * - * @return integer the PID being controlled. - */ - public function getPid() - { - return $this->pid; - } - - // }}} - // {{{ isRunning() - - /** - * Checks if the process is running - * - * Uses ps on UNIX-like systems and tasklist on - * Windows. - * - * @return boolean true if the process is running, false if not. - */ - public function isRunning() - { - $running = false; - - if (PHP_OS === 'WINNT') { - $command = 'tasklist /fo csv /nh /fi ' - . escapeshellarg('PID eq ' . $this->pid); - - $result = exec($command); - $parts = explode(',', $result); - $running = (count($parts) > 1 && trim($parts[1], '"') == $this->pid); - } else { - $result = exec('ps -p ' . escapeshellarg($this->pid) . ' -o pid='); - $running = (trim($result) == $this->pid); - } - - return $running; - } - - // }}} - // {{{ terminate() - - /** - * Ends the process gracefully - * - * The signal SIGTERM is sent to the process. The gpg-agent process will - * end gracefully upon receiving the SIGTERM signal. Upon 3 consecutive - * SIGTERM signals the gpg-agent will forcefully shut down. - * - * If the posix extension is available, posix_kill() - * is used. Otherwise kill is used on UNIX-like systems and - * taskkill is used in Windows. - * - * @return void - */ - public function terminate() - { - if (function_exists('posix_kill')) { - posix_kill($this->pid, 15); - } elseif (PHP_OS === 'WINNT') { - exec('taskkill /PID ' . escapeshellarg($this->pid)); - } else { - exec('kill -15 ' . escapeshellarg($this->pid)); - } - } - - // }}} -} - -// }}} - -?> -- cgit v1.2.3