Skip to content
Browse files

Removed "return new <appname>" from headers of applications. Backward…

… compatibility.
  • Loading branch information...
1 parent 2a489cf commit 03cf6d0abf8068dc2d2cfdde226b0b0edd891981 @kakserpom committed
View
3 app-clients/GearmanNode.php
@@ -1,7 +1,4 @@
<?php
-
-return new GearmanNode;
-
class GearmanNode extends AppInstance {
public $client;
View
3 app-clients/LockClient.php
@@ -1,7 +1,4 @@
<?php
-
-return new LockClient;
-
class LockClient extends AsyncServer {
public $sessions = array(); // Active sessions
View
3 app-clients/MemcacheClient.php
@@ -1,7 +1,4 @@
<?php
-
-return new MemcacheClient;
-
class MemcacheClient extends AsyncServer {
public $sessions = array(); // Active sessions
View
3 app-clients/MongoClient.php
@@ -1,7 +1,4 @@
<?php
-
-return new MongoClient;
-
class MongoClient extends AsyncServer {
public $sessions = array(); // Active sessions
public $servers = array(); // Array of servers
View
3 app-clients/MySQLClient.php
@@ -1,7 +1,4 @@
<?php
-
-return new MySQLClient;
-
class MySQLClient extends AsyncServer {
public $sessions = array(); // Active sessions
View
3 app-clients/PostgreSQLClient.php
@@ -1,7 +1,4 @@
<?php
-
-return new PostgreSQLClient;
-
class PostgreSQLClient extends AsyncServer {
public $sessions = array(); // Active sessions
View
3 app-clients/RTEPClient.php
@@ -1,7 +1,4 @@
<?php
-
-return new RTEPClient;
-
class RTEPClient extends AppInstance {
public $client;
View
3 app-examples/Example.php
@@ -1,7 +1,4 @@
<?php
-
-return new Example;
-
class Example extends AppInstance {
public $counter = 0;
View
3 app-examples/ExampleAsyncProcess.php
@@ -1,7 +1,4 @@
<?php
-
-return new ExampleAsyncProcess;
-
class ExampleAsyncProcess extends AppInstance {
/**
View
3 app-examples/ExampleAsyncStream.php
@@ -1,7 +1,4 @@
<?php
-
-return new ExampleAsyncStream;
-
class ExampleAsyncStream extends AppInstance {
/**
View
3 app-examples/ExampleRTEP.php
@@ -1,7 +1,4 @@
<?php
-
-return new ExampleRTEP;
-
class ExampleRTEP extends AppInstance {
public $RTEPClient;
View
3 app-examples/ExampleSandbox.php
@@ -1,7 +1,4 @@
<?php
-
-return new ExampleSandbox;
-
class ExampleSandbox extends AppInstance {
public $counter = 0;
View
3 app-examples/ExampleWebSocket.php
@@ -1,7 +1,4 @@
<?php
-
-return new ExampleWebSocket;
-
class ExampleWebSocket extends AppInstance {
/**
* @method onReady
View
3 app-examples/ExampleWithMySQL.php
@@ -1,7 +1,4 @@
<?php
-
-return new ExampleWithMySQL;
-
class ExampleWithMySQL extends AppInstance {
/**
View
3 app-examples/ExampleWithPostgreSQL.php
@@ -1,7 +1,4 @@
<?php
-
-return new ExampleWithPostgreSQL;
-
class ExampleWithPostgreSQL extends AppInstance {
/**
View
3 app-servers/DebugConsole.php
@@ -1,7 +1,4 @@
<?php
-
-return new DebugConsole;
-
class DebugConsole extends AsyncServer {
public $sessions = array(); // Active sessions
View
3 app-servers/FastCGI.php
@@ -1,7 +1,4 @@
<?php
-
-return new FastCGI;
-
class FastCGI extends AsyncServer {
public $initialLowMark = 8; // initial value of the minimal amout of bytes in buffer
View
3 app-servers/FlashPolicy.php
@@ -1,7 +1,4 @@
<?php
-
-return new FlashPolicy;
-
class FlashPolicy extends AsyncServer {
public $sessions = array(); // Active sessions
View
3 app-servers/HTTP.php
@@ -1,7 +1,4 @@
<?php
-
-return new HTTP;
-
class HTTP extends AsyncServer {
public $initialLowMark = 1; // initial value of the minimal amout of bytes in buffer
View
3 app-servers/LockServer.php
@@ -1,7 +1,4 @@
<?php
-
-return new LockServer;
-
class LockServer extends AsyncServer {
public $sessions = array(); // Active sessions
View
1 app-servers/MongoNode.php
@@ -1,5 +1,4 @@
<?php
-return new MongoNode;
class MongoNode extends AppInstance
{
public $db; // MongoClient
View
3 app-servers/MySQLProxy.php
@@ -1,7 +1,4 @@
<?php
-
-return new MySQLProxy;
-
class MySQLProxy extends AsyncServer {
public $sessions = array();
View
3 app-servers/RTEP.php
@@ -1,7 +1,4 @@
<?php
-
-return new RTEP;
-
class RTEP extends AsyncServer {
public $sessions = array(); // Active sessions
View
3 app-servers/SocksServer.php
@@ -1,7 +1,4 @@
<?php
-
-return new SocksServer;
-
class SocksServer extends AsyncServer {
public $sessions = array(); // Active sessions
View
3 app-servers/TelnetHoneypot.php
@@ -1,7 +1,4 @@
<?php
-
-return new TelnetHoneypot;
-
class TelnetHoneypot extends AsyncServer {
public $sessions = array(); // Active sessions
View
3 app-servers/WebSocketServer.php
@@ -1,7 +1,4 @@
<?php
-
-return new WebSocketServer;
-
class WebSocketServer extends AsyncServer
{
public $sessions = array();
View
3 app-web/CGI.php
@@ -1,7 +1,4 @@
<?php
-
-return new CGI;
-
class CGI extends AppInstance {
public $binPath = 'php-cgi'; // Default bin-path
View
3 app-web/FileReader.php
@@ -1,7 +1,4 @@
<?php
-
-return new FileReader;
-
class FileReader extends AppInstance {
/**
View
3 app-web/InteractivePHP.php
@@ -1,7 +1,4 @@
<?php
-
-return new InteractivePHP;
-
class InteractivePHP extends AppInstance {
public $db;
View
5 app-web/ServerStatus.php
@@ -1,8 +1,5 @@
<?php
-
-return new ServerStatus_AppInstance;
-
-class ServerStatus_AppInstance extends AppInstance {
+class ServerStatus extends AppInstance {
/**
* @method beginRequest
View
3 app-web/WebSocketOverCOMET.php
@@ -1,7 +1,4 @@
<?php
-
-return new WebSocketOverCOMET;
-
class WebSocketOverCOMET extends AsyncServer {
const IPCPacketType_C2S = 0x01;
View
34 lib/AppResolver.class.php
@@ -83,25 +83,33 @@ public function getAppPath($app) {
* @return object AppInstance.
*/
public function appInstantiate($app) {
- $p = $this->getAppPath($app);
-
- if (
- !$p
- || !is_file($p)
- ) {
- Daemon::log('appInstantiate(' . $app . ') failed: application doesn\'t exist.');
- return FALSE;
- }
-
if (!isset(Daemon::$appInstances[$app])) {
Daemon::$appInstances[$app] = array();
}
- $appInstance = include $p;
+ if (class_exists($app)) {
+ $appInstance = new $app;
+ }
+ else {
+ $p = $this->getAppPath($app);
+ if (
+ !$p
+ || !is_file($p)
+ ) {
+ Daemon::log('appInstantiate(' . $app . ') failed: application doesn\'t exist.');
+ return FALSE;
+ }
+ $appInstance = include $p;
+ }
+ if (!is_object($appInstance)) {
+ if (class_exists($app)) {
+ $appInstance = new $app;
+ }
+ }
if (!is_object($appInstance)) {
- Daemon::log('appInstantiate(' . $app . ') failed: catched application is n\'t an object.');
- return FALSE;
+ Daemon::log('appInstantiate(' . $app . ') failed. Class not exists.');
+ return FALSE;
}
Daemon::$appInstances[$app][] = $appInstance;

0 comments on commit 03cf6d0

Please sign in to comment.
Something went wrong with that request. Please try again.