This repository was archived by the owner on Dec 1, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Expand file tree Collapse file tree 2 files changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,27 @@ public static function create($config = [])
6666 */
6767 public function addConnection ($ alias , $ uri , ConfigInterface $ config = null )
6868 {
69+ //small hack for drupal
70+ if (substr ($ uri , 0 , 7 ) === 'bolt:// ' ) {
71+ $ parts = explode ('bolt:// ' , $ uri );
72+ if (count ($ parts ) === 2 ) {
73+ $ splits = explode ('@ ' , $ parts [1 ]);
74+ $ split = $ splits [count ($ splits )-1 ];
75+ if (substr ($ split , 0 , 4 ) === 'ssl+ ' ) {
76+ $ up = count ($ splits ) > 1 ? $ splits [0 ] : '' ;
77+ $ ups = explode (': ' , $ up );
78+ $ u = $ ups [0 ];
79+ $ p = $ ups [1 ];
80+ $ uri = 'bolt:// ' .str_replace ('ssl+ ' , '' , $ split );
81+ $ config = \GraphAware \Bolt \Configuration::newInstance ()
82+ ->withCredentials ($ u , $ p )
83+ ->withTLSMode (\GraphAware \Bolt \Configuration::TLSMODE_REQUIRED );
84+ }
85+ }
86+ }
87+
6988 $ this ->config ['connections ' ][$ alias ]['uri ' ] = $ uri ;
89+
7090 if (null !== $ config ) {
7191 if ($ this ->config ['connections ' ][$ alias ]['config ' ] = $ config );
7292 }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace GraphAware \Neo4j \Client \Tests ;
4+
5+ /**
6+ * Class DrupalIssueTest
7+ * @package GraphAware\Neo4j\Client\Tests
8+ *
9+ * @group drupal
10+ */
11+ class DrupalIssueTest extends \PHPUnit_Framework_TestCase
12+ {
13+ public function testDrupalConversion ()
14+ {
15+ $ this ->addConnection ('default ' , 'bolt://neo4j:sfadfewfn;kewvljnfd@ssl+graphene.com ' , null );
16+ }
17+
18+ private function addConnection ($ alias , $ uri , $ config )
19+ {
20+ if (substr ($ uri , 0 , 7 ) === 'bolt:// ' ) {
21+ $ parts = explode ('bolt:// ' , $ uri );
22+ if (count ($ parts ) === 2 ) {
23+ $ splits = explode ('@ ' , $ parts [1 ]);
24+ $ split = $ splits [count ($ splits )-1 ];
25+ if (substr ($ split , 0 , 4 ) === 'ssl+ ' ) {
26+ $ up = count ($ splits ) > 1 ? $ splits [0 ] : '' ;
27+ $ ups = explode (': ' , $ up );
28+ $ u = $ ups [0 ];
29+ $ p = $ ups [1 ];
30+ $ uri = 'bolt:// ' .str_replace ('ssl+ ' , '' , $ split );
31+ $ config = \GraphAware \Bolt \Configuration::newInstance ()
32+ ->withCredentials ($ u , $ p )
33+ ->withTLSMode (\GraphAware \Bolt \Configuration::TLSMODE_REQUIRED );
34+ }
35+ }
36+ }
37+
38+ var_dump ($ uri );
39+ var_dump ($ config );
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments