]> source.dussan.org Git - nextcloud-server.git/commitdiff
Remove useless dependency on SQLite (non-PDO) 3246/head
authorMorris Jobke <hey@morrisjobke.de>
Tue, 24 Jan 2017 22:14:20 +0000 (16:14 -0600)
committerMorris Jobke <hey@morrisjobke.de>
Thu, 26 Jan 2017 04:23:05 +0000 (22:23 -0600)
* we only require the PDO driver
* fixes #481

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
lib/private/Setup.php
tests/lib/SetupTest.php

index 81a5343fe2103b1412128ff0419f5efbb9c18ac7..d99977676846a6eaf7ce002d9e9f3aafd23572ee 100644 (file)
@@ -125,8 +125,8 @@ class Setup {
        public function getSupportedDatabases($allowAllDatabases = false) {
                $availableDatabases = array(
                        'sqlite' =>  array(
-                               'type' => 'class',
-                               'call' => 'SQLite3',
+                               'type' => 'pdo',
+                               'call' => 'sqlite',
                                'name' => 'SQLite'
                        ),
                        'mysql' => array(
@@ -163,9 +163,7 @@ class Setup {
                                $type = $availableDatabases[$database]['type'];
                                $call = $availableDatabases[$database]['call'];
 
-                               if($type === 'class') {
-                                       $working = $this->class_exists($call);
-                               } elseif ($type === 'function') {
+                               if ($type === 'function') {
                                        $working = $this->is_callable($call);
                                } elseif($type === 'pdo') {
                                        $working = in_array($call, $this->getAvailableDbDriversForPdo(), TRUE);
index a8389eaaf563652c68c264ca8c0017eb2d31d30f..acbce938a25d43f452ab8f93bee3eec7f642cb48 100644 (file)
@@ -53,10 +53,6 @@ class SetupTest extends \Test\TestCase {
                        ->will($this->returnValue(
                                array('sqlite', 'mysql', 'oci')
                        ));
-               $this->setupClass
-                       ->expects($this->once())
-                       ->method('class_exists')
-                       ->will($this->returnValue(true));
                $this->setupClass
                        ->expects($this->once())
                        ->method('is_callable')
@@ -64,7 +60,7 @@ class SetupTest extends \Test\TestCase {
                $this->setupClass
                        ->expects($this->any())
                        ->method('getAvailableDbDriversForPdo')
-                       ->will($this->returnValue([]));
+                       ->will($this->returnValue(['sqlite']));
                $result = $this->setupClass->getSupportedDatabases();
                $expectedResult = array(
                        'sqlite' => 'SQLite'
@@ -80,10 +76,6 @@ class SetupTest extends \Test\TestCase {
                        ->will($this->returnValue(
                                array('sqlite', 'mysql', 'oci', 'pgsql')
                        ));
-               $this->setupClass
-                       ->expects($this->any())
-                       ->method('class_exists')
-                       ->will($this->returnValue(false));
                $this->setupClass
                        ->expects($this->any())
                        ->method('is_callable')
@@ -104,10 +96,6 @@ class SetupTest extends \Test\TestCase {
                        ->will($this->returnValue(
                                array('sqlite', 'mysql', 'pgsql', 'oci')
                        ));
-               $this->setupClass
-                       ->expects($this->any())
-                       ->method('class_exists')
-                       ->will($this->returnValue(true));
                $this->setupClass
                        ->expects($this->any())
                        ->method('is_callable')
@@ -115,7 +103,7 @@ class SetupTest extends \Test\TestCase {
                $this->setupClass
                        ->expects($this->any())
                        ->method('getAvailableDbDriversForPdo')
-                       ->will($this->returnValue(['mysql', 'pgsql']));
+                       ->will($this->returnValue(['sqlite', 'mysql', 'pgsql']));
                $result = $this->setupClass->getSupportedDatabases();
                $expectedResult = array(
                        'sqlite' => 'SQLite',