Index: www/phpdaemon/Makefile =================================================================== --- /dev/null +++ www/phpdaemon/Makefile @@ -0,0 +1,40 @@ +# $FreeBSD$ + +PORTNAME= phpdaemon +DISTVERSIONPREFIX= v +DISTVERSION= 1.0-beta2 +CATEGORIES= www + +MAINTAINER= miguel@gocobachi.dev +COMMENT= Asynchronous server-side PHP framework + +LICENSE= LGPL3 +LICENSE_FILE= ${WRKSRC}/LICENSE + +RUN_DEPENDS= ${PHPBASE}/lib/php/${PHP_EXT_DIR}/eio.so:devel/pecl-eio@${PHP_FLAVOR} \ + ${PHPBASE}/lib/php/${PHP_EXT_DIR}/event.so:devel/pecl-event@${PHP_FLAVOR} \ + php:lang/${PHP_FLAVOR} + +USES= php shebangfix + +USE_GITHUB= yes +GH_ACCOUNT= kakserpom + +USE_PHP= ctype json openssl pcntl posix shmop sockets +SHEBANG_GLOB= bin/php-chroot bin/phpd + +NO_ARCH= yes +NO_BUILD= yes + +post-patch: + @${RM} ${WRKSRC}/PHPDaemon/Config/Object.php + +do-install: + ${INSTALL_SCRIPT} ${WRKSRC}/bin/phpd ${STAGEDIR}${PREFIX}/bin/phpdaemon + ${INSTALL_SCRIPT} ${WRKSRC}/bin/php-chroot ${STAGEDIR}${PREFIX}/bin/ + ${INSTALL_SCRIPT} ${WRKSRC}/init-scripts/phpd.freebsd ${STAGEDIR}${PREFIX}/etc/rc.d/phpdaemon + cd ${WRKSRC}/conf && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/etc/${PORTNAME}/ "! -name *\.orig" + cd ${WRKSRC} && ${COPYTREE_SHARE} PHPDaemon ${STAGEDIR}${PREFIX}/share/${PORTNAME}/ "! -name *\.orig" + ${INSTALL_DATA} ${WRKSRC}/VERSION ${STAGEDIR}${PREFIX}/share/${PORTNAME}/ + +.include Index: www/phpdaemon/distinfo =================================================================== --- /dev/null +++ www/phpdaemon/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1593499130 +SHA256 (kakserpom-phpdaemon-v1.0-beta2_GH0.tar.gz) = 909c2f200f1b0493aad875438e6d8e6841d136dbf91ae40713207a957b2a941d +SIZE (kakserpom-phpdaemon-v1.0-beta2_GH0.tar.gz) = 195573 Index: www/phpdaemon/files/patch-PHPDaemon_BoundSocket_Generic.php =================================================================== --- /dev/null +++ www/phpdaemon/files/patch-PHPDaemon_BoundSocket_Generic.php @@ -0,0 +1,11 @@ +--- PHPDaemon/BoundSocket/Generic.php.orig 2013-07-11 03:21:19 UTC ++++ PHPDaemon/BoundSocket/Generic.php +@@ -148,7 +148,7 @@ abstract class Generic { + * @return object + */ + public function __construct($uri) { +- $this->uri = is_array($uri) ? $uri : \PHPDaemon\Config\Object::parseCfgUri($uri); ++ $this->uri = is_array($uri) ? $uri : \PHPDaemon\Config\_Object::parseCfgUri($uri); + if (!$this->uri) { + return; + } Index: www/phpdaemon/files/patch-PHPDaemon_Config_Parser.php =================================================================== --- /dev/null +++ www/phpdaemon/files/patch-PHPDaemon_Config_Parser.php @@ -0,0 +1,20 @@ +--- PHPDaemon/Config/Parser.php.orig 2013-07-11 03:21:19 UTC ++++ PHPDaemon/Config/Parser.php +@@ -2,7 +2,7 @@ + namespace PHPDaemon\Config; + + use PHPDaemon\Config\Entry\Generic; +-use PHPDaemon\Config\Object; ++use PHPDaemon\Config\_Object; + use PHPDaemon\Config\Section; + use PHPDaemon\Core\Daemon; + use PHPDaemon\Core\Debug; +@@ -136,7 +136,7 @@ class Parser { + public function __construct($file, $target, $included = false) { + $this->file = $file; + $this->target = $target; +- $this->revision = ++Object::$lastRevision; ++ $this->revision = ++_Object::$lastRevision; + $this->data = file_get_contents($file); + + Daemon::log('Loaded config file: '. escapeshellarg($file)); Index: www/phpdaemon/files/patch-PHPDaemon_Config___Object.php =================================================================== --- /dev/null +++ www/phpdaemon/files/patch-PHPDaemon_Config___Object.php @@ -0,0 +1,528 @@ +--- PHPDaemon/Config/_Object.php.orig 2020-07-20 08:48:24 UTC ++++ PHPDaemon/Config/_Object.php +@@ -0,0 +1,525 @@ ++ ++ * @dynamic_fields ++ */ ++class _Object implements \ArrayAccess { ++ use \PHPDaemon\Traits\ClassWatchdog; ++ ++ /** ++ * Maximum memory usage ++ * @var size ++ */ ++ public $maxmemoryusage = '0b'; ++ ++ /** ++ * Maximum idle time ++ * @var time ++ */ ++ public $maxidle = '0s'; ++ ++ /** ++ * PID file ++ * @var string|Entry\Generic ++ */ ++ public $pidfile = '/var/run/phpdaemon/pid'; ++ ++ /** ++ * Default namespace ++ * @var path ++ */ ++ public $defaultns = 'PHPDaemon'; ++ ++ /** ++ * Default PID file ++ * @var path ++ */ ++ public $defaultpidfile = '/var/run/phpdaemon/pid'; ++ ++ /** ++ * Config file ++ * @var string|Entry\ConfigFile ++ */ ++ public $configfile = '/usr/local/etc/phpdaemon/phpd.conf;/usr/local/etc/phpd/phpd.conf;./conf/phpd.conf'; ++ ++ /** ++ * Application resolver ++ * @var string|Entry\Generic ++ */ ++ public $path = '/usr/local/etc/phpdaemon/AppResolver.php;./conf/AppResolver.php'; ++ ++ /** ++ * Additional include path ++ * @var string|Entry\Generic ++ */ ++ public $addincludepath = null; ++ ++ /** ++ * Multi-Process Manager delay ++ * @var time ++ */ ++ public $mpmdelay = '0.1s'; ++ ++ /** ++ * Max. requests before worker restart ++ * @var int|Entry\Number ++ */ ++ public $maxrequests = '10k'; ++ ++ /** ++ * Start workers ++ * @var int|Entry\Number ++ */ ++ public $startworkers = 4; ++ ++ /** ++ * Minimum number of workers ++ * @var int|Entry\Number ++ */ ++ public $minworkers = 4; ++ ++ /** ++ * Maximum number of workers ++ * @var int|Entry\Number ++ */ ++ public $maxworkers = 8; ++ ++ /** ++ * Minimum number of spare workes ++ * @var int|Entry\Number ++ */ ++ public $minspareworkers = 2; ++ ++ /** ++ * Maximum number of spare workes ++ * @var int|Entry\Number ++ */ ++ public $maxspareworkers = 0; ++ ++ /** ++ * Master thread priority ++ * @var integer ++ */ ++ public $masterpriority = 100; ++ ++ /** ++ * IPC thread priority ++ * @var integer ++ */ ++ public $ipcthreadpriority = 100; ++ ++ /** ++ * IPC thread priority ++ * @var boolean ++ */ ++ public $obfilterauto = 1; ++ ++ /** ++ * System user (setuid) ++ * @var string|Entry\Generic ++ */ ++ public $user = null; ++ ++ /** ++ * System group (setgid) ++ * @var string|Entry\Generic ++ */ ++ public $group = null; ++ ++ /** ++ * Automatic garbage collector, number of iterations between GC call ++ * @var int|Entry\Number ++ */ ++ public $autogc = '1k'; ++ ++ /** ++ * Chroot ++ * @var string|Entry\Generic ++ */ ++ public $chroot = '/'; ++ ++ /** ++ * Current directory ++ * @var string ++ */ ++ public $cwd = '.'; ++ ++ /** ++ * Autoreload interval. Time interval between checks. ++ * @var time ++ */ ++ public $autoreload = '0s'; ++ ++ /** ++ * Try to import updated code (runkit required) ++ * @var boolean|Entry\Generic ++ */ ++ public $autoreimport = 0; ++ ++ /** ++ * Worker thread priority ++ * @var integer ++ */ ++ public $workerpriority = 4; ++ ++ /** ++ * Throw exception on shutdown? ++ * @var boolean ++ */ ++ public $throwexceptiononshutdown = 0; ++ ++ /** ++ * Comma-separated list of locales ++ * @var string|Entry\Generic ++ */ ++ public $locale = ''; ++ ++ /** ++ * Restrict usage of error-control functions (like @ operator), useful in debugging ++ * @var boolean ++ */ ++ public $restricterrorcontrol = false; ++ ++ // Logging-related ++ ++ /** ++ * Logging? ++ * @var boolean ++ */ ++ public $logging = 1; ++ ++ /** ++ * Log storage ++ * @var boolean|Entry\Generic ++ */ ++ public $logstorage = '/var/log/phpdaemon.log'; ++ ++ /** ++ * Log errors? ++ * @var boolean ++ */ ++ public $logerrors = 1; ++ ++ /** ++ * Log Worker->setState() ? ++ * @var boolean ++ */ ++ public $logworkersetstate = 0; ++ ++ /** ++ * Log events? ++ * @var boolean ++ */ ++ public $logevents = 0; ++ ++ /** ++ * Log signals? ++ * @var boolean ++ */ ++ public $logsignals = 0; ++ ++ /** ++ * Do not close STDOUT and STDERR pipes and send log messages there ++ * @var boolean ++ */ ++ public $verbosetty = 0; ++ ++ /** ++ * EIO enabled? ++ * @var boolean ++ */ ++ public $eioenabled = 1; ++ ++ /** ++ * EIO maximum idle time ++ * @var time ++ */ ++ public $eiosetmaxidle = null; ++ ++ /** ++ * EIO maximum parallel threads ++ * @var int|Entry\Number ++ */ ++ public $eiosetmaxparallel = null; ++ ++ /** ++ * EIO maximum poll requests ++ * @var int|Entry\Number ++ */ ++ public $eiosetmaxpollreqs = null; ++ ++ /** ++ * EIO maximum poll time ++ * @var time ++ */ ++ public $eiosetmaxpolltime = null; ++ ++ /** ++ * EIO minimum parallel threads ++ * @var int|Entry\Number ++ */ ++ public $eiosetminparallel = null; ++ ++ /** @var int */ ++ public static $lastRevision = 0; ++ ++ /** ++ * Constructor ++ * @return object ++ */ ++ ++ public function __construct() { ++ static $sizes = ['maxmemoryusage']; ++ static $times = ['maxidle', 'autoreload', 'mpmdelay', 'eiosetmaxpolltime']; ++ static $numbers = [ ++ 'maxrequests', 'autogc', 'minworkers', 'maxworkers', 'minspareworkers', 'maxspareworkers', 'masterpriority', 'ipcthreadpriority', ++ 'eiosetmaxidle', 'eiosetmaxparallel', 'eiosetmaxpollreqs', 'eiosetminparallel', 'verbose', 'verbosetty' ++ ]; ++ ++ foreach ($this as $name => $value) { ++ if (in_array($name, $sizes)) { ++ $entry = new Size; ++ } ++ elseif (in_array($name, $times)) { ++ $entry = new Time; ++ } ++ elseif (in_array($name, $numbers)) { ++ $entry = new Number; ++ } ++ elseif ($name === 'configfile') { ++ $entry = new ConfigFile; ++ } ++ else { ++ $entry = new Entry\Generic; ++ } ++ ++ if (in_array($name, ['addincludepath'])) { ++ $entry->setStackable(); ++ } ++ ++ $entry->setDefaultValue($value); ++ $entry->setHumanValue($value); ++ $this->{$name} = $entry; ++ } ++ } ++ ++ /** ++ * @TODO DESCR ++ * @param $old ++ * @param $new ++ */ ++ public function renameSection($old, $new) { ++ Daemon::$config->{$new} = Daemon::$config->{$old}; ++ Daemon::log('Config section \'' . $old . '\' -> \'' . $new . '\''); ++ unset(Daemon::$config->{$old}); ++ } ++ ++ /** ++ * Load config file ++ * @param string Path ++ * @return boolean Success ++ */ ++ public function loadFile($path) { ++ $parser = new Parser($path, $this); ++ $this->onLoad(); ++ return !$parser->isErrorneous(); ++ } ++ ++ /** ++ * Called when config is loaded ++ * @return void ++ */ ++ protected function onLoad() { ++ if ( ++ isset($this->minspareworkers->value) ++ && $this->minspareworkers->value > 0 ++ && isset($this->maxspareworkers->value) ++ && $this->maxspareworkers->value > 0 ++ ) { ++ if ($this->minspareworkers->value > $this->maxspareworkers->value) { ++ Daemon::log('\'minspareworkers\' (' . $this->minspareworkers->value . ') cannot be greater than \'maxspareworkers\' (' . $this->maxspareworkers->value . ').'); ++ $this->minspareworkers->value = $this->maxspareworkers->value; ++ } ++ } ++ ++ if ( ++ isset($this->minworkers->value) ++ && isset($this->maxworkers->value) ++ ) { ++ if ($this->minworkers->value > $this->maxworkers->value) { ++ $this->minworkers->value = $this->maxworkers->value; ++ } ++ } ++ } ++ ++ /** ++ * Get real property name ++ * @param string Property name ++ * @return string Real property name ++ */ ++ public function getRealPropertyName($prop) { ++ return str_replace('-', '', strtolower($prop)); ++ } ++ ++ /** ++ * Checks if property exists ++ * @param string Property name ++ * @return boolean Exists? ++ */ ++ ++ public function offsetExists($prop) { ++ $prop = $this->getRealPropertyName($prop); ++ return property_exists($this, $prop); ++ } ++ ++ /** ++ * Get property by name ++ * @param string Property name ++ * @return mixed ++ */ ++ public function offsetGet($prop) { ++ $prop = $this->getRealPropertyName($prop); ++ return isset($this->{$prop}) ? $this->{$prop}->value : null; ++ } ++ ++ /** ++ * Set property ++ * @param string Property name ++ * @param mixed Value ++ * @return void ++ */ ++ public function offsetSet($prop, $value) { ++ $prop = $this->getRealPropertyName($prop); ++ $this->{$prop} = $value; ++ } ++ ++ /** ++ * Unset property ++ * @param string Property name ++ * @return void ++ */ ++ public function offsetUnset($prop) { ++ $prop = $this->getRealPropertyName($prop); ++ unset($this->{$prop}); ++ } ++ ++ /** ++ * Checks if property exists ++ * @param string Property name ++ * @return boolean Exists? ++ */ ++ public static function parseCfgUri($uri, $source = null) { ++ if (strpos($uri, '://') === false) { ++ if (strncmp($uri, 'unix:', 5) === 0) { ++ $e = explode(':', $uri); ++ if (sizeof($e) === 4) { ++ $uri = 'unix://' . $e[1] . ':' . $e[2] . '@localhost' . $e[3]; ++ } ++ elseif (sizeof($e) === 3) { ++ $uri = 'unix://' . $e[1] . '@localhost' . $e[2]; ++ } ++ else { ++ $uri = 'unix://localhost' . $e[1]; ++ } ++ } ++ else { ++ $uri = 'tcp://' . $uri; ++ } ++ } ++ if (stripos($uri, 'unix:///') === 0) { ++ $uri = 'unix://localhost/' . substr($uri, 8); ++ } ++ $u = parse_url($uri); ++ $u['uri'] = $uri; ++ if (!isset($u['scheme'])) { ++ $u['scheme'] = ''; ++ } ++ $u['params'] = []; ++ if (!isset($u['fragment'])) { ++ return $u; ++ } ++ $hash = '#' . $u['fragment']; ++ $error = false; ++ preg_replace_callback('~(#+)(.+?)(?=#|$)|(.+)~', function ($m) use (&$u, &$error, $uri) { // @TODO: refactoring ++ if ($error) { ++ return; ++ } ++ list (, $type, $value) = $m; ++ if ($type === '#') { // standard value ++ $e = explode('=', $value, 2); ++ if (sizeof($e) === 2) { ++ list ($key, $value) = $e; ++ } ++ else { ++ $key = $value; ++ $value = true; ++ } ++ $u['params'][$key] = $value; ++ } ++ elseif ($type === '##') { // Context name ++ $u['params']['ctxname'] = $value; ++ } ++ else { ++ Daemon::log('Malformed URI: ' . var_export($uri, true) . ', unexpected token \'' . $type . '\''); ++ $error = true; ++ } ++ }, $hash); ++ return $error ? false : $u; ++ } ++ ++ /** ++ * Imports parameters from command line args ++ * @param array Settings. ++ * @return boolean - Success. ++ */ ++ public static function loadCmdLineArgs($settings) { ++ $error = FALSE; ++ ++ static $ktr = [ ++ '-' => '', ++ ]; ++ ++ foreach ($settings as $k => $v) { ++ $k = strtolower(strtr($k, $ktr)); ++ ++ if ($k === 'config') { ++ $k = 'configfile'; ++ } ++ ++ if ( ++ ($k === 'user') ++ || ($k === 'group') ++ ) { ++ if ($v === '') { ++ $v = NULL; ++ } ++ } ++ if (isset(Daemon::$config->{$k})) { ++ Daemon::$config->{$k}->setHumanValue($v); ++ Daemon::$config->{$k}->source = 'cmdline'; ++ ++ } ++ else { ++ Daemon::log('Unrecognized parameter \'' . $k . '\''); ++ $error = TRUE; ++ } ++ } ++ ++ return !$error; ++ } ++ ++} Index: www/phpdaemon/files/patch-PHPDaemon_Core_AppInstance.php =================================================================== --- /dev/null +++ www/phpdaemon/files/patch-PHPDaemon_Core_AppInstance.php @@ -0,0 +1,11 @@ +--- PHPDaemon/Core/AppInstance.php.orig 2013-07-11 03:21:19 UTC ++++ PHPDaemon/Core/AppInstance.php +@@ -173,7 +173,7 @@ class AppInstance { + } + + /** +- * @return Config\Object ++ * @return Config\_Object + */ + public function getConfig() { + return $this->config; Index: www/phpdaemon/files/patch-PHPDaemon_Core_Bootstrap.php =================================================================== --- /dev/null +++ www/phpdaemon/files/patch-PHPDaemon_Core_Bootstrap.php @@ -0,0 +1,11 @@ +--- PHPDaemon/Core/Bootstrap.php.orig 2013-07-11 03:21:19 UTC ++++ PHPDaemon/Core/Bootstrap.php +@@ -577,7 +577,7 @@ class Bootstrap { + elseif (preg_match('~^-([a-zA-Z0-9]+)~', $args[$i], $match)) { + $key = null; + for ($j = 0, $jl = strlen($match[1]); $j < $jl; ++$j) { +- $key = $match[1]{$j}; ++ $key = $match[1][$j]; + $out[$key] = true; + } + Index: www/phpdaemon/files/patch-PHPDaemon_Core_Daemon.php =================================================================== --- /dev/null +++ www/phpdaemon/files/patch-PHPDaemon_Core_Daemon.php @@ -0,0 +1,20 @@ +--- PHPDaemon/Core/Daemon.php.orig 2013-07-11 03:21:19 UTC ++++ PHPDaemon/Core/Daemon.php +@@ -131,7 +131,7 @@ class Daemon { + public static $compatMode = FALSE; + /** @var string */ + public static $runName = 'phpdaemon'; +- /** @var Config\Object */ ++ /** @var Config\_Object */ + public static $config; + /** @var */ + public static $appResolverPath; +@@ -161,7 +161,7 @@ class Daemon { + public static function initSettings() { + Daemon::$version = file_get_contents('VERSION', true); + +- Daemon::$config = new Config\Object; ++ Daemon::$config = new Config\_Object; + + if (preg_match('~BSD~i', php_uname('s'))) { + Daemon::$reusePort = true; Index: www/phpdaemon/files/patch-PHPDaemon_FS_FileSystem.php =================================================================== --- /dev/null +++ www/phpdaemon/files/patch-PHPDaemon_FS_FileSystem.php @@ -0,0 +1,12 @@ +--- PHPDaemon/FS/FileSystem.php.orig 2013-07-11 03:21:19 UTC ++++ PHPDaemon/FS/FileSystem.php +@@ -471,7 +471,8 @@ class FileSystem { + call_user_func($cb, $path, file_get_contents($path)); + return true; + } +- return FileSystem::open($path, 'r!', function ($file) use ($path, $cb, $pri, $path) { ++ ++ return FileSystem::open($path, 'r!', function ($file) use ($path, $cb, $pri) { + if (!$file) { + call_user_func($cb, $path, false); + return; Index: www/phpdaemon/files/patch-PHPDaemon_Network_Connection.php =================================================================== --- /dev/null +++ www/phpdaemon/files/patch-PHPDaemon_Network_Connection.php @@ -0,0 +1,11 @@ +--- PHPDaemon/Network/Connection.php.orig 2013-07-11 03:21:19 UTC ++++ PHPDaemon/Network/Connection.php +@@ -453,7 +453,7 @@ abstract class Connection extends IOStream { + * @return boolean Success + */ + public function connect($url, $cb = null) { +- $this->uri = Config\Object::parseCfgUri($url); ++ $this->uri = Config\_Object::parseCfgUri($url); + $u =& $this->uri; + if (!$u) { + return false; Index: www/phpdaemon/files/patch-PHPDaemon_Network_Server.php =================================================================== --- /dev/null +++ www/phpdaemon/files/patch-PHPDaemon_Network_Server.php @@ -0,0 +1,11 @@ +--- PHPDaemon/Network/Server.php.orig 2013-07-11 03:21:19 UTC ++++ PHPDaemon/Network/Server.php +@@ -78,7 +78,7 @@ abstract class Server extends Pool { + * @return boolean Success + */ + public function bindSocket($uri) { +- $u = \PHPDaemon\Config\Object::parseCfgUri($uri); ++ $u = \PHPDaemon\Config\_Object::parseCfgUri($uri); + $scheme = $u['scheme']; + if ($scheme === 'unix') { + $socket = new \PHPDaemon\BoundSocket\UNIX($u); Index: www/phpdaemon/files/patch-bin_phpd =================================================================== --- /dev/null +++ www/phpdaemon/files/patch-bin_phpd @@ -0,0 +1,26 @@ +--- bin/phpd.orig 2013-07-11 03:21:19 UTC ++++ bin/phpd +@@ -1,4 +1,4 @@ +-#!/usr/bin/env php ++#!/usr/local/bin/php + =')) { + return; + } + +-foreach (array('/usr/share/phpdaemon', dirname(dirname(__FILE__))) as $d) { ++foreach (array('/usr/local/share/phpdaemon', dirname(dirname(__FILE__))) as $d) { + if (@chdir($d)) { + break; + } +@@ -23,7 +23,7 @@ foreach (array('/usr/share/phpdaemon', dirname(dirname + ini_set('include_path', get_include_path() + . ':' . dirname(dirname(__FILE__)) + . ':' . dirname(dirname(__FILE__)) . '/conf' +- . ':/usr/share/phpdaemon:/etc/phpdaemon' ++ . ':/usr/local/share/phpdaemon:/usr/local/etc/phpdaemon' + ); + $autoloader = function ($classname) { + $base = str_replace('\\', '/', $classname); Index: www/phpdaemon/files/patch-bin_sampleapp =================================================================== --- /dev/null +++ www/phpdaemon/files/patch-bin_sampleapp @@ -0,0 +1,8 @@ +--- bin/sampleapp.orig 2013-07-11 03:21:19 UTC ++++ bin/sampleapp +@@ -1,4 +1,4 @@ +-#!/usr/bin/env /opt/bin/php ++#!/usr/bin/env php + =5.4", +- "ext-event": "1.6.0", ++ "ext-event": ">=1.6.0", + "ext-pcntl": "*", + "ext-sockets": "*", + "ext-shmop": "*" Index: www/phpdaemon/files/patch-conf_phpd.conf.example =================================================================== --- /dev/null +++ www/phpdaemon/files/patch-conf_phpd.conf.example @@ -0,0 +1,19 @@ +--- conf/phpd.conf.example.orig 2020-07-20 08:48:24 UTC ++++ conf/phpd.conf.example +@@ -0,0 +1,16 @@ ++## Config file ++#user john; ++#group workgroup; ++ ++max-workers 8; ++min-workers 8; ++start-workers 8; ++max-idle 0; ++#add-include-path '/path/to/your/folder'; ++ ++#\Your\Application { ++ # config of your application which class is "\Your\Application", in ++#} ++ ++# other applications... ++include conf.d/*.conf; Index: www/phpdaemon/files/patch-init-scripts_phpd.freebsd =================================================================== --- /dev/null +++ www/phpdaemon/files/patch-init-scripts_phpd.freebsd @@ -0,0 +1,62 @@ +--- init-scripts/phpd.freebsd.orig 2020-07-20 08:48:24 UTC ++++ init-scripts/phpd.freebsd +@@ -0,0 +1,59 @@ ++#!/bin/sh ++# ++# phpdaemon - This script starts and stops the phpDaemon ++# ++# PROVIDE: phpdaemon ++# REQUIRE: DAEMON php ++# ++# description: phpDaemon - async. network framework for PHP. ++# ++# phpdaemon_enable="YES" ++# ++ ++. /etc/rc.subr ++ ++name=phpdaemon ++rcvar=phpdaemon_enable ++ ++app_bin="/usr/local/bin/phpdaemon" ++command=${phpdaemon_bin} ++pidfile="/var/run/phpdaemon/pid" ++ ++start_precmd="${name}_prestart" ++start_cmd="${name}_start" ++stop_cmd="${name}_stop" ++stop_postcmd="${name}_poststop" ++restart_cmd="${name}_restart" ++ ++phpdaemon_prestart() ++{ ++ mkdir -p /var/run/${name} ++} ++ ++phpdaemon_start() ++{ ++ checkyesno ${rcvar} \ ++ && echo "Starting ${name}." \ ++ && ${app_bin} start ++} ++ ++phpdaemon_stop() ++{ ++ checkyesno ${rcvar} \ ++ && echo "Stoppping ${name}." \ ++ && ${app_bin} stop ++} ++ ++phpdaemon_poststop() ++{ ++ rm -f $pidfile ++} ++ ++phpdaemon_restart() ++{ ++ echo "Restarting ${name}." \ ++ && ${app_bin} restart ++} ++ ++load_rc_config ${name} ++run_rc_command "$1" Index: www/phpdaemon/pkg-descr =================================================================== --- /dev/null +++ www/phpdaemon/pkg-descr @@ -0,0 +1,10 @@ +phpDaemon + +Unleash the Daemon + +Asynchronous server-side framework for Web +and network applications implemented in PHP +using libevent. phpDaemon can handle thousands +of simultaneous connections. + +WWW: https://daemon.io/ Index: www/phpdaemon/pkg-plist =================================================================== --- /dev/null +++ www/phpdaemon/pkg-plist @@ -0,0 +1,167 @@ +bin/php-chroot +bin/phpdaemon +%%ETCDIR%%/AppResolver.php +%%ETCDIR%%/conf.d/ExampleJabberBot.conf +%%ETCDIR%%/conf.d/FastCGI.conf +%%ETCDIR%%/conf.d/FlashpolicyServer.conf +%%ETCDIR%%/conf.d/HTTPServer.conf +%%ETCDIR%%/conf.d/IdentServer.conf +%%ETCDIR%%/conf.d/SSL-sample.conf +%%ETCDIR%%/conf.d/WebSocketServer.conf +%%ETCDIR%%/crossdomain.xml +%%ETCDIR%%/logrotate +%%ETCDIR%%/phpd.conf.example +etc/rc.d/phpdaemon +%%DATADIR%%/PHPDaemon/Applications/CGI.php +%%DATADIR%%/PHPDaemon/Applications/CGIRequest.php +%%DATADIR%%/PHPDaemon/Applications/FileReader.php +%%DATADIR%%/PHPDaemon/Applications/FileReaderRequest.php +%%DATADIR%%/PHPDaemon/Applications/ServerStatus.php +%%DATADIR%%/PHPDaemon/Applications/ServerStatusRequest.php +%%DATADIR%%/PHPDaemon/Applications/WebSocketOverCOMET.php +%%DATADIR%%/PHPDaemon/Applications/WebSocketOverCOMETRequest.php +%%DATADIR%%/PHPDaemon/Applications/WebSocketOverCOMETSession.php +%%DATADIR%%/PHPDaemon/BoundSocket/Generic.php +%%DATADIR%%/PHPDaemon/BoundSocket/TCP.php +%%DATADIR%%/PHPDaemon/BoundSocket/UDP.php +%%DATADIR%%/PHPDaemon/BoundSocket/UNIX.php +%%DATADIR%%/PHPDaemon/Cache/CappedStorage.php +%%DATADIR%%/PHPDaemon/Cache/CappedStorageHits.php +%%DATADIR%%/PHPDaemon/Cache/Item.php +%%DATADIR%%/PHPDaemon/Clients/Asterisk/Connection.php +%%DATADIR%%/PHPDaemon/Clients/Asterisk/ConnectionFinished.php +%%DATADIR%%/PHPDaemon/Clients/Asterisk/Pool.php +%%DATADIR%%/PHPDaemon/Clients/DNS/Connection.php +%%DATADIR%%/PHPDaemon/Clients/DNS/Pool.php +%%DATADIR%%/PHPDaemon/Clients/Gibson/Connection.php +%%DATADIR%%/PHPDaemon/Clients/Gibson/Pool.php +%%DATADIR%%/PHPDaemon/Clients/HTTP/Connection.php +%%DATADIR%%/PHPDaemon/Clients/HTTP/Pool.php +%%DATADIR%%/PHPDaemon/Clients/HTTP/UploadFile.php +%%DATADIR%%/PHPDaemon/Clients/ICMP/Connection.php +%%DATADIR%%/PHPDaemon/Clients/ICMP/Pool.php +%%DATADIR%%/PHPDaemon/Clients/IRC/Channel.php +%%DATADIR%%/PHPDaemon/Clients/IRC/ChannelParticipant.php +%%DATADIR%%/PHPDaemon/Clients/IRC/Connection.php +%%DATADIR%%/PHPDaemon/Clients/IRC/Pool.php +%%DATADIR%%/PHPDaemon/Clients/Lock/Connection.php +%%DATADIR%%/PHPDaemon/Clients/Lock/Pool.php +%%DATADIR%%/PHPDaemon/Clients/Memcache/Connection.php +%%DATADIR%%/PHPDaemon/Clients/Memcache/Pool.php +%%DATADIR%%/PHPDaemon/Clients/Mongo/Collection.php +%%DATADIR%%/PHPDaemon/Clients/Mongo/Connection.php +%%DATADIR%%/PHPDaemon/Clients/Mongo/ConnectionFinished.php +%%DATADIR%%/PHPDaemon/Clients/Mongo/Cursor.php +%%DATADIR%%/PHPDaemon/Clients/Mongo/Pool.php +%%DATADIR%%/PHPDaemon/Clients/MySQL/Connection.php +%%DATADIR%%/PHPDaemon/Clients/MySQL/ConnectionFinished.php +%%DATADIR%%/PHPDaemon/Clients/MySQL/Pool.php +%%DATADIR%%/PHPDaemon/Clients/PostgreSQL/Connection.php +%%DATADIR%%/PHPDaemon/Clients/PostgreSQL/ConnectionFinished.php +%%DATADIR%%/PHPDaemon/Clients/PostgreSQL/Pool.php +%%DATADIR%%/PHPDaemon/Clients/Redis/Connection.php +%%DATADIR%%/PHPDaemon/Clients/Redis/Pool.php +%%DATADIR%%/PHPDaemon/Clients/Valve/Connection.php +%%DATADIR%%/PHPDaemon/Clients/Valve/Pool.php +%%DATADIR%%/PHPDaemon/Clients/XMPP/Connection.php +%%DATADIR%%/PHPDaemon/Clients/XMPP/Pool.php +%%DATADIR%%/PHPDaemon/Clients/XMPP/XMPPRoster.php +%%DATADIR%%/PHPDaemon/Config/Entry/ArraySet.php +%%DATADIR%%/PHPDaemon/Config/Entry/Boolean.php +%%DATADIR%%/PHPDaemon/Config/Entry/ConfigFile.php +%%DATADIR%%/PHPDaemon/Config/Entry/ExtFunc.php +%%DATADIR%%/PHPDaemon/Config/Entry/Generic.php +%%DATADIR%%/PHPDaemon/Config/Entry/Number.php +%%DATADIR%%/PHPDaemon/Config/Entry/Size.php +%%DATADIR%%/PHPDaemon/Config/Entry/Time.php +%%DATADIR%%/PHPDaemon/Config/Parser.php +%%DATADIR%%/PHPDaemon/Config/Section.php +%%DATADIR%%/PHPDaemon/Config/_Object.php +%%DATADIR%%/PHPDaemon/Core/AppInstance.php +%%DATADIR%%/PHPDaemon/Core/AppResolver.php +%%DATADIR%%/PHPDaemon/Core/Bootstrap.php +%%DATADIR%%/PHPDaemon/Core/CallbackWrapper.php +%%DATADIR%%/PHPDaemon/Core/ClassFinder.php +%%DATADIR%%/PHPDaemon/Core/ComplexJob.php +%%DATADIR%%/PHPDaemon/Core/Daemon.php +%%DATADIR%%/PHPDaemon/Core/Debug.php +%%DATADIR%%/PHPDaemon/Core/DeferredEvent.php +%%DATADIR%%/PHPDaemon/Core/Pool.php +%%DATADIR%%/PHPDaemon/Core/ShellCommand.php +%%DATADIR%%/PHPDaemon/Core/Timer.php +%%DATADIR%%/PHPDaemon/Core/TransportContext.php +%%DATADIR%%/PHPDaemon/Exceptions/ClearStack.php +%%DATADIR%%/PHPDaemon/Exceptions/ConnectionFinished.php +%%DATADIR%%/PHPDaemon/Exceptions/UndefinedMethodCalled.php +%%DATADIR%%/PHPDaemon/Exceptions/UndefinedPropertySetting.php +%%DATADIR%%/PHPDaemon/Exceptions/UnsettingProperty.php +%%DATADIR%%/PHPDaemon/FS/File.php +%%DATADIR%%/PHPDaemon/FS/FileSystem.php +%%DATADIR%%/PHPDaemon/FS/FileWatcher.php +%%DATADIR%%/PHPDaemon/HTTPRequest/Generic.php +%%DATADIR%%/PHPDaemon/HTTPRequest/Input.php +%%DATADIR%%/PHPDaemon/IPCManager/IPCManager.php +%%DATADIR%%/PHPDaemon/IPCManager/MasterPool.php +%%DATADIR%%/PHPDaemon/IPCManager/MasterPoolConnection.php +%%DATADIR%%/PHPDaemon/IPCManager/WorkerConnection.php +%%DATADIR%%/PHPDaemon/Network/Client.php +%%DATADIR%%/PHPDaemon/Network/ClientConnection.php +%%DATADIR%%/PHPDaemon/Network/Connection.php +%%DATADIR%%/PHPDaemon/Network/IOStream.php +%%DATADIR%%/PHPDaemon/Network/Pool.php +%%DATADIR%%/PHPDaemon/Network/Server.php +%%DATADIR%%/PHPDaemon/PubSub/PubSub.php +%%DATADIR%%/PHPDaemon/PubSub/PubSubEvent.php +%%DATADIR%%/PHPDaemon/Request/Generic.php +%%DATADIR%%/PHPDaemon/Request/IRequestUpstream.php +%%DATADIR%%/PHPDaemon/Request/RequestHeadersAlreadySent.php +%%DATADIR%%/PHPDaemon/Request/RequestSleep.php +%%DATADIR%%/PHPDaemon/Request/RequestTerminated.php +%%DATADIR%%/PHPDaemon/Servers/DebugConsole/Connection.php +%%DATADIR%%/PHPDaemon/Servers/DebugConsole/Pool.php +%%DATADIR%%/PHPDaemon/Servers/FastCGI/Connection.php +%%DATADIR%%/PHPDaemon/Servers/FastCGI/Pool.php +%%DATADIR%%/PHPDaemon/Servers/FlashPolicy/Connection.php +%%DATADIR%%/PHPDaemon/Servers/FlashPolicy/Pool.php +%%DATADIR%%/PHPDaemon/Servers/HTTP/Connection.php +%%DATADIR%%/PHPDaemon/Servers/HTTP/Pool.php +%%DATADIR%%/PHPDaemon/Servers/IRCBouncer/Connection.php +%%DATADIR%%/PHPDaemon/Servers/IRCBouncer/Pool.php +%%DATADIR%%/PHPDaemon/Servers/Ident/Connection.php +%%DATADIR%%/PHPDaemon/Servers/Ident/Pool.php +%%DATADIR%%/PHPDaemon/Servers/Lock/Connection.php +%%DATADIR%%/PHPDaemon/Servers/Lock/Pool.php +%%DATADIR%%/PHPDaemon/Servers/Socks/Connection.php +%%DATADIR%%/PHPDaemon/Servers/Socks/Pool.php +%%DATADIR%%/PHPDaemon/Servers/Socks/SlaveConnection.php +%%DATADIR%%/PHPDaemon/Servers/WebSocket/Connection.php +%%DATADIR%%/PHPDaemon/Servers/WebSocket/Pool.php +%%DATADIR%%/PHPDaemon/Structures/ObjectStorage.php +%%DATADIR%%/PHPDaemon/Structures/PriorityQueueCallbacks.php +%%DATADIR%%/PHPDaemon/Structures/StackCallbacks.php +%%DATADIR%%/PHPDaemon/Thread/Collection.php +%%DATADIR%%/PHPDaemon/Thread/Generic.php +%%DATADIR%%/PHPDaemon/Thread/IPC.php +%%DATADIR%%/PHPDaemon/Thread/Master.php +%%DATADIR%%/PHPDaemon/Thread/Worker.php +%%DATADIR%%/PHPDaemon/Traits/ClassWatchdog.php +%%DATADIR%%/PHPDaemon/Traits/DeferredEventHandlers.php +%%DATADIR%%/PHPDaemon/Traits/EventHandlers.php +%%DATADIR%%/PHPDaemon/Traits/StaticObjectWatchdog.php +%%DATADIR%%/PHPDaemon/Traits/StrictStaticObjectWatchdog.php +%%DATADIR%%/PHPDaemon/Utils/Binary.php +%%DATADIR%%/PHPDaemon/Utils/Encoding.php +%%DATADIR%%/PHPDaemon/Utils/IRC.php +%%DATADIR%%/PHPDaemon/Utils/MIME.php +%%DATADIR%%/PHPDaemon/Utils/PPPDeflate.php +%%DATADIR%%/PHPDaemon/Utils/ShmEntity.php +%%DATADIR%%/PHPDaemon/Utils/Terminal.php +%%DATADIR%%/PHPDaemon/Utils/func.php +%%DATADIR%%/PHPDaemon/WebSocket/Protocol.php +%%DATADIR%%/PHPDaemon/WebSocket/ProtocolV0.php +%%DATADIR%%/PHPDaemon/WebSocket/ProtocolV13.php +%%DATADIR%%/PHPDaemon/WebSocket/ProtocolVE.php +%%DATADIR%%/PHPDaemon/WebSocket/Route.php +%%DATADIR%%/PHPDaemon/XMLStream/XMLStream.php +%%DATADIR%%/PHPDaemon/XMLStream/XMLStreamObject.php +%%DATADIR%%/VERSION