Browse Source

Improve debug mode

Maurits van der Schee 5 years ago
parent
commit
5d056adfeb
5 changed files with 28 additions and 14 deletions
  1. 8
    7
      api.php
  2. 6
    2
      docker/debian9/run.sh
  3. 2
    1
      docker/debug.sh
  4. 6
    2
      docker/ubuntu16/run.sh
  5. 6
    2
      docker/ubuntu18/run.sh

+ 8
- 7
api.php View File

@@ -1774,15 +1774,16 @@ class GenericDB
1774 1774
         $options = array(
1775 1775
             \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
1776 1776
             \PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
1777
-            \PDO::ATTR_PERSISTENT => true,
1778 1777
         );
1779 1778
         switch ($this->driver) {
1780 1779
             case 'mysql':return $options + [
1781 1780
                     \PDO::ATTR_EMULATE_PREPARES => false,
1782 1781
                     \PDO::MYSQL_ATTR_FOUND_ROWS => true,
1782
+                    \PDO::ATTR_PERSISTENT => true,
1783 1783
                 ];
1784 1784
             case 'pgsql':return $options + [
1785 1785
                     \PDO::ATTR_EMULATE_PREPARES => false,
1786
+                    \PDO::ATTR_PERSISTENT => true,
1786 1787
                 ];
1787 1788
             case 'sqlsrv':return $options + [
1788 1789
                     \PDO::SQLSRV_ATTR_FETCHES_NUMERIC_TYPE => true,
@@ -2803,7 +2804,7 @@ class AuthorizationMiddleware extends Middleware
2803 2804
         $this->reflection = $reflection;
2804 2805
     }
2805 2806
 
2806
-    private function handleColumns(String $method, String $path, String $databaseName, String $tableName/*: void*/
2807
+    private function handleColumns(String $method, String $path, String $databaseName, String $tableName) /*: void*/
2807 2808
     {
2808 2809
         $columnHandler = $this->getProperty('columnHandler', '');
2809 2810
         if ($columnHandler) {
@@ -2817,7 +2818,7 @@ class AuthorizationMiddleware extends Middleware
2817 2818
         }
2818 2819
     }
2819 2820
 
2820
-    private function handleTable(String $method, String $path, String $databaseName, String $tableName/*: void*/
2821
+    private function handleTable(String $method, String $path, String $databaseName, String $tableName) /*: void*/
2821 2822
     {
2822 2823
         if (!$this->reflection->hasTable($tableName)) {
2823 2824
             return;
@@ -2833,7 +2834,7 @@ class AuthorizationMiddleware extends Middleware
2833 2834
         }
2834 2835
     }
2835 2836
 
2836
-    private function handleJoinTables(String $method, String $path, String $databaseName, array $joinParameters/*: void*/
2837
+    private function handleJoinTables(String $method, String $path, String $databaseName, array $joinParameters) /*: void*/
2837 2838
     {
2838 2839
         $uniqueTableNames = array();
2839 2840
         foreach ($joinParameters as $joinParameter) {
@@ -2847,7 +2848,7 @@ class AuthorizationMiddleware extends Middleware
2847 2848
         }
2848 2849
     }
2849 2850
 
2850
-    private function handleAllTables(String $method, String $path, String $databaseName/*: void*/
2851
+    private function handleAllTables(String $method, String $path, String $databaseName) /*: void*/
2851 2852
     {
2852 2853
         $tableNames = $this->reflection->getTableNames();
2853 2854
         foreach ($tableNames as $tableName) {
@@ -3231,7 +3232,7 @@ class OpenApiDefinition extends DefaultOpenApiDefinition
3231 3232
         $current = $value;
3232 3233
     }
3233 3234
 
3234
-    public function setPaths(DatabaseDefinition $database/*: void*/
3235
+    public function setPaths(DatabaseDefinition $database) /*: void*/
3235 3236
     {
3236 3237
         $result = [];
3237 3238
         foreach ($database->getTables() as $database) {
@@ -3847,7 +3848,7 @@ class PathTree implements \JsonSerializable
3847 3848
 
3848 3849
     private $tree;
3849 3850
 
3850
-    public function __construct(object &$tree = null)
3851
+    public function __construct( /* object */&$tree = null)
3851 3852
     {
3852 3853
         if (!$tree) {
3853 3854
             $tree = $this->newTree();

+ 6
- 2
docker/debian9/run.sh View File

@@ -44,8 +44,12 @@ echo "skipped"
44 44
 
45 45
 echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
46 46
 # install software
47
-git clone --quiet https://github.com/mevdschee/php-crud-api.git
48
-echo "done"
47
+if [ -d /php-crud-api ]; then
48
+  echo "skipped"
49
+else
50
+  git clone --quiet https://github.com/mevdschee/php-crud-api.git
51
+  echo "done"
52
+fi
49 53
 
50 54
 echo "------------------------------------------------"
51 55
 

+ 2
- 1
docker/debug.sh View File

@@ -16,5 +16,6 @@ select f in "${options[@]}"; do
16 16
 	exit
17 17
     fi
18 18
 done
19
+dir=$(pwd)/..
19 20
 docker rm "php-crud-api_$f" > /dev/null 2>&1
20
-docker run -ti --name "php-crud-api_$f" "php-crud-api:$f" /bin/bash -c '/usr/sbin/docker-run && cd php-crud-api && /bin/bash'
21
+docker run -ti -v $dir:/php-crud-api --name "php-crud-api_$f" "php-crud-api:$f" /bin/bash -c '/usr/sbin/docker-run && cd php-crud-api && /bin/bash'

+ 6
- 2
docker/ubuntu16/run.sh View File

@@ -59,8 +59,12 @@ echo "done"
59 59
 
60 60
 echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
61 61
 # install software
62
-git clone --quiet https://github.com/mevdschee/php-crud-api.git
63
-echo "done"
62
+if [ -d /php-crud-api ]; then
63
+  echo "skipped"
64
+else
65
+  git clone --quiet https://github.com/mevdschee/php-crud-api.git
66
+  echo "done"
67
+fi
64 68
 
65 69
 echo "------------------------------------------------"
66 70
 

+ 6
- 2
docker/ubuntu18/run.sh View File

@@ -46,8 +46,12 @@ echo "skipped"
46 46
 
47 47
 echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
48 48
 # install software
49
-git clone --quiet https://github.com/mevdschee/php-crud-api.git
50
-echo "done"
49
+if [ -d /php-crud-api ]; then
50
+  echo "skipped"
51
+else
52
+  git clone --quiet https://github.com/mevdschee/php-crud-api.git
53
+  echo "done"
54
+fi
51 55
 
52 56
 echo "------------------------------------------------"
53 57
 

Loading…
Cancel
Save