Merge pull request #3246 from nextcloud/fix-sqlite-dependency

Remove useless dependency on SQLite (non-PDO)
This commit is contained in:
Morris Jobke 2017-01-26 15:41:11 -06:00 committed by GitHub
commit e21170bd1a
2 changed files with 5 additions and 19 deletions

View File

@ -125,8 +125,8 @@ class Setup {
public function getSupportedDatabases($allowAllDatabases = false) { public function getSupportedDatabases($allowAllDatabases = false) {
$availableDatabases = array( $availableDatabases = array(
'sqlite' => array( 'sqlite' => array(
'type' => 'class', 'type' => 'pdo',
'call' => 'SQLite3', 'call' => 'sqlite',
'name' => 'SQLite' 'name' => 'SQLite'
), ),
'mysql' => array( 'mysql' => array(
@ -163,9 +163,7 @@ class Setup {
$type = $availableDatabases[$database]['type']; $type = $availableDatabases[$database]['type'];
$call = $availableDatabases[$database]['call']; $call = $availableDatabases[$database]['call'];
if($type === 'class') { if ($type === 'function') {
$working = $this->class_exists($call);
} elseif ($type === 'function') {
$working = $this->is_callable($call); $working = $this->is_callable($call);
} elseif($type === 'pdo') { } elseif($type === 'pdo') {
$working = in_array($call, $this->getAvailableDbDriversForPdo(), TRUE); $working = in_array($call, $this->getAvailableDbDriversForPdo(), TRUE);

View File

@ -53,10 +53,6 @@ class SetupTest extends \Test\TestCase {
->will($this->returnValue( ->will($this->returnValue(
array('sqlite', 'mysql', 'oci') array('sqlite', 'mysql', 'oci')
)); ));
$this->setupClass
->expects($this->once())
->method('class_exists')
->will($this->returnValue(true));
$this->setupClass $this->setupClass
->expects($this->once()) ->expects($this->once())
->method('is_callable') ->method('is_callable')
@ -64,7 +60,7 @@ class SetupTest extends \Test\TestCase {
$this->setupClass $this->setupClass
->expects($this->any()) ->expects($this->any())
->method('getAvailableDbDriversForPdo') ->method('getAvailableDbDriversForPdo')
->will($this->returnValue([])); ->will($this->returnValue(['sqlite']));
$result = $this->setupClass->getSupportedDatabases(); $result = $this->setupClass->getSupportedDatabases();
$expectedResult = array( $expectedResult = array(
'sqlite' => 'SQLite' 'sqlite' => 'SQLite'
@ -80,10 +76,6 @@ class SetupTest extends \Test\TestCase {
->will($this->returnValue( ->will($this->returnValue(
array('sqlite', 'mysql', 'oci', 'pgsql') array('sqlite', 'mysql', 'oci', 'pgsql')
)); ));
$this->setupClass
->expects($this->any())
->method('class_exists')
->will($this->returnValue(false));
$this->setupClass $this->setupClass
->expects($this->any()) ->expects($this->any())
->method('is_callable') ->method('is_callable')
@ -104,10 +96,6 @@ class SetupTest extends \Test\TestCase {
->will($this->returnValue( ->will($this->returnValue(
array('sqlite', 'mysql', 'pgsql', 'oci') array('sqlite', 'mysql', 'pgsql', 'oci')
)); ));
$this->setupClass
->expects($this->any())
->method('class_exists')
->will($this->returnValue(true));
$this->setupClass $this->setupClass
->expects($this->any()) ->expects($this->any())
->method('is_callable') ->method('is_callable')
@ -115,7 +103,7 @@ class SetupTest extends \Test\TestCase {
$this->setupClass $this->setupClass
->expects($this->any()) ->expects($this->any())
->method('getAvailableDbDriversForPdo') ->method('getAvailableDbDriversForPdo')
->will($this->returnValue(['mysql', 'pgsql'])); ->will($this->returnValue(['sqlite', 'mysql', 'pgsql']));
$result = $this->setupClass->getSupportedDatabases(); $result = $this->setupClass->getSupportedDatabases();
$expectedResult = array( $expectedResult = array(
'sqlite' => 'SQLite', 'sqlite' => 'SQLite',