Skip to content

Commit

Permalink
Merge pull request #3246 from nextcloud/fix-sqlite-dependency
Browse files Browse the repository at this point in the history
Remove useless dependency on SQLite (non-PDO)
  • Loading branch information
MorrisJobke authored Jan 26, 2017
2 parents 43315e2 + 4536ead commit e21170b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
8 changes: 3 additions & 5 deletions lib/private/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ protected function getAvailableDbDriversForPdo() {
public function getSupportedDatabases($allowAllDatabases = false) {
$availableDatabases = array(
'sqlite' => array(
'type' => 'class',
'call' => 'SQLite3',
'type' => 'pdo',
'call' => 'sqlite',
'name' => 'SQLite'
),
'mysql' => array(
Expand Down Expand Up @@ -163,9 +163,7 @@ public function getSupportedDatabases($allowAllDatabases = false) {
$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);
Expand Down
16 changes: 2 additions & 14 deletions tests/lib/SetupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,14 @@ public function testGetSupportedDatabasesWithOneWorking() {
->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')
->will($this->returnValue(false));
$this->setupClass
->expects($this->any())
->method('getAvailableDbDriversForPdo')
->will($this->returnValue([]));
->will($this->returnValue(['sqlite']));
$result = $this->setupClass->getSupportedDatabases();
$expectedResult = array(
'sqlite' => 'SQLite'
Expand All @@ -80,10 +76,6 @@ public function testGetSupportedDatabasesWithNoWorking() {
->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')
Expand All @@ -104,18 +96,14 @@ public function testGetSupportedDatabasesWithAllWorking() {
->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')
->will($this->returnValue(true));
$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',
Expand Down

0 comments on commit e21170b

Please sign in to comment.