Permalink
Browse files

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

… compatibility.
  • Loading branch information...
kakserpom committed Sep 26, 2010
1 parent 2a489cf commit 03cf6d0abf8068dc2d2cfdde226b0b0edd891981
@@ -1,7 +1,4 @@
<?php
-
-return new GearmanNode;
-
class GearmanNode extends AppInstance {
public $client;
@@ -1,7 +1,4 @@
<?php
-
-return new LockClient;
-
class LockClient extends AsyncServer {
public $sessions = array(); // Active sessions
@@ -1,7 +1,4 @@
<?php
-
-return new MemcacheClient;
-
class MemcacheClient extends AsyncServer {
public $sessions = array(); // Active sessions
@@ -1,7 +1,4 @@
<?php
-
-return new MongoClient;
-
class MongoClient extends AsyncServer {
public $sessions = array(); // Active sessions
public $servers = array(); // Array of servers
@@ -1,7 +1,4 @@
<?php
-
-return new MySQLClient;
-
class MySQLClient extends AsyncServer {
public $sessions = array(); // Active sessions
@@ -1,7 +1,4 @@
<?php
-
-return new PostgreSQLClient;
-
class PostgreSQLClient extends AsyncServer {
public $sessions = array(); // Active sessions
@@ -1,7 +1,4 @@
<?php
-
-return new RTEPClient;
-
class RTEPClient extends AppInstance {
public $client;
View
@@ -1,7 +1,4 @@
<?php
-
-return new Example;
-
class Example extends AppInstance {
public $counter = 0;
@@ -1,7 +1,4 @@
<?php
-
-return new ExampleAsyncProcess;
-
class ExampleAsyncProcess extends AppInstance {
/**
@@ -1,7 +1,4 @@
<?php
-
-return new ExampleAsyncStream;
-
class ExampleAsyncStream extends AppInstance {
/**
@@ -1,7 +1,4 @@
<?php
-
-return new ExampleRTEP;
-
class ExampleRTEP extends AppInstance {
public $RTEPClient;
@@ -1,7 +1,4 @@
<?php
-
-return new ExampleSandbox;
-
class ExampleSandbox extends AppInstance {
public $counter = 0;
@@ -1,7 +1,4 @@
<?php
-
-return new ExampleWebSocket;
-
class ExampleWebSocket extends AppInstance {
/**
* @method onReady
@@ -1,7 +1,4 @@
<?php
-
-return new ExampleWithMySQL;
-
class ExampleWithMySQL extends AppInstance {
/**
@@ -1,7 +1,4 @@
<?php
-
-return new ExampleWithPostgreSQL;
-
class ExampleWithPostgreSQL extends AppInstance {
/**
@@ -1,7 +1,4 @@
<?php
-
-return new DebugConsole;
-
class DebugConsole extends AsyncServer {
public $sessions = array(); // Active sessions
View
@@ -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
@@ -1,7 +1,4 @@
<?php
-
-return new FlashPolicy;
-
class FlashPolicy extends AsyncServer {
public $sessions = array(); // Active sessions
View
@@ -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
@@ -1,7 +1,4 @@
<?php
-
-return new LockServer;
-
class LockServer extends AsyncServer {
public $sessions = array(); // Active sessions
@@ -1,5 +1,4 @@
<?php
-return new MongoNode;
class MongoNode extends AppInstance
{
public $db; // MongoClient
@@ -1,7 +1,4 @@
<?php
-
-return new MySQLProxy;
-
class MySQLProxy extends AsyncServer {
public $sessions = array();
View
@@ -1,7 +1,4 @@
<?php
-
-return new RTEP;
-
class RTEP extends AsyncServer {
public $sessions = array(); // Active sessions
@@ -1,7 +1,4 @@
<?php
-
-return new SocksServer;
-
class SocksServer extends AsyncServer {
public $sessions = array(); // Active sessions
@@ -1,7 +1,4 @@
<?php
-
-return new TelnetHoneypot;
-
class TelnetHoneypot extends AsyncServer {
public $sessions = array(); // Active sessions
@@ -1,7 +1,4 @@
<?php
-
-return new WebSocketServer;
-
class WebSocketServer extends AsyncServer
{
public $sessions = array();
View
@@ -1,7 +1,4 @@
<?php
-
-return new CGI;
-
class CGI extends AppInstance {
public $binPath = 'php-cgi'; // Default bin-path
View
@@ -1,7 +1,4 @@
<?php
-
-return new FileReader;
-
class FileReader extends AppInstance {
/**
@@ -1,7 +1,4 @@
<?php
-
-return new InteractivePHP;
-
class InteractivePHP extends AppInstance {
public $db;
View
@@ -1,8 +1,5 @@
<?php
-
-return new ServerStatus_AppInstance;
-
-class ServerStatus_AppInstance extends AppInstance {
+class ServerStatus extends AppInstance {
/**
* @method beginRequest
@@ -1,7 +1,4 @@
<?php
-
-return new WebSocketOverCOMET;
-
class WebSocketOverCOMET extends AsyncServer {
const IPCPacketType_C2S = 0x01;
View
@@ -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.