Преглед на файлове

Move swoole implementation to its own directory (#3801)

Swoole seems to be a framework and it doesn't share any code with the
PHP/php directory, which is for "raw", framework-less PHP.
Michael Hixson преди 7 години
родител
ревизия
12106eff64

+ 0 - 23
frameworks/PHP/php/benchmark_config.json

@@ -126,29 +126,6 @@
       "display_name": "PHP-raw",
       "notes": "",
       "versus": "php-php5"
-    },
-    "swoole": {
-      "json_url": "/json",
-      "plaintext_url": "/plaintext",
-      "db_url": "/db",
-      "query_url": "/db?queries=",
-      "fortune_url": "/fortunes",
-      "update_url": "/updates?queries=",    
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Platform",
-      "database": "MySQL",
-      "framework": "None",
-      "language": "PHP",
-      "flavor": "PHP7",
-      "orm": "Raw",
-      "platform": "None",
-      "webserver": "swoole",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "PHP-swool",
-      "notes": "",
-      "versus": "php"
     }
   }]
 }

+ 28 - 0
frameworks/PHP/swoole/benchmark_config.json

@@ -0,0 +1,28 @@
+{
+  "framework": "swoole",
+  "tests": [{
+    "default": {
+      "json_url": "/json",
+      "plaintext_url": "/plaintext",
+      "db_url": "/db",
+      "query_url": "/db?queries=",
+      "fortune_url": "/fortunes",
+      "update_url": "/updates?queries=",
+      "port": 8080,
+      "approach": "Realistic",
+      "classification": "Platform",
+      "database": "MySQL",
+      "framework": "None",
+      "language": "PHP",
+      "flavor": "PHP7",
+      "orm": "Raw",
+      "platform": "None",
+      "webserver": "swoole",
+      "os": "Linux",
+      "database_os": "Linux",
+      "display_name": "Swoole",
+      "notes": "",
+      "versus": "php"
+    }
+  }]
+}

+ 3 - 3
frameworks/PHP/php/swoole-server.php → frameworks/PHP/swoole/swoole-server.php

@@ -69,13 +69,13 @@ $server->on('request', function ($req, $res) {
             $fortune = [];
             // Define query
             $arr = $db->query('SELECT id, message FROM Fortune');
-            foreach ($arr as $row) 
+            foreach ($arr as $row)
                 $fortune[$row['id']] = $row['message'];
-            $fortune[0] = 'Additional fortune added at request time.';           
+            $fortune[0] = 'Additional fortune added at request time.';
             asort($fortune);
 
             $html = "<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>";
-            foreach ($fortune as $id => $message)     
+            foreach ($fortune as $id => $message)
                 $html .= "<tr><td>" . $id . "</td><td>" . htmlspecialchars($message, ENT_QUOTES, 'UTF-8') . "</td></tr>";
 
             $html .= "</table></body></html>";

+ 1 - 1
frameworks/PHP/php/php-swoole.dockerfile → frameworks/PHP/swoole/swoole.dockerfile

@@ -9,8 +9,8 @@ RUN cd /tmp && curl -sSL "https://github.com/swoole/swoole-src/archive/v${SWOOLE
 
 RUN docker-php-ext-install pdo_mysql > /dev/null
 
-ADD ./ /swoole
 WORKDIR /swoole
+COPY swoole-server.php swoole-server.php
 
 CMD sed -i 's|NUMCORES|'"$(nproc)"'|g' swoole-server.php && \
     php swoole-server.php