summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2016-01-07 10:26:00 +0100
committerMorris Jobke <hey@morrisjobke.de>2016-01-07 14:54:55 +0100
commit190cc2bb6762c5f505e1e90bd582caa4fecb9cce (patch)
treee758dbc6da9f106d07146838507988b6a7d9bda1 /lib
parentfddece9552a4b194cdce8c3916e33fa8597c9008 (diff)
downloadnextcloud-server-190cc2bb6762c5f505e1e90bd582caa4fecb9cce.tar.gz
nextcloud-server-190cc2bb6762c5f505e1e90bd582caa4fecb9cce.zip
Remove OC_DB::getConnection
Diffstat (limited to 'lib')
-rw-r--r--lib/private/db.php7
-rw-r--r--lib/private/files/cache/storage.php4
-rw-r--r--lib/private/repair.php5
-rw-r--r--lib/private/repair/innodb.php2
-rw-r--r--lib/private/repair/searchlucenetables.php4
-rw-r--r--lib/private/server.php4
-rw-r--r--lib/private/share/share.php2
-rw-r--r--lib/private/tags.php2
8 files changed, 12 insertions, 18 deletions
diff --git a/lib/private/db.php b/lib/private/db.php
index 14d9ba0a493..d47b7d4f31a 100644
--- a/lib/private/db.php
+++ b/lib/private/db.php
@@ -36,13 +36,6 @@
class OC_DB {
/**
- * @return \OCP\IDBConnection
- */
- static public function getConnection() {
- return \OC::$server->getDatabaseConnection();
- }
-
- /**
* get MDB2 schema manager
*
* @return \OC\DB\MDB2SchemaManager
diff --git a/lib/private/files/cache/storage.php b/lib/private/files/cache/storage.php
index e5235d1ca92..4998c622e84 100644
--- a/lib/private/files/cache/storage.php
+++ b/lib/private/files/cache/storage.php
@@ -58,10 +58,10 @@ class Storage {
if ($row = self::getStorageById($this->storageId)) {
$this->numericId = $row['numeric_id'];
} else {
- $connection = \OC_DB::getConnection();
+ $connection = \OC::$server->getDatabaseConnection();
$available = $isAvailable ? 1 : 0;
if ($connection->insertIfNotExist('*PREFIX*storages', ['id' => $this->storageId, 'available' => $available])) {
- $this->numericId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*storages');
+ $this->numericId = $connection->lastInsertId('*PREFIX*storages');
} else {
if ($row = self::getStorageById($this->storageId)) {
$this->numericId = $row['numeric_id'];
diff --git a/lib/private/repair.php b/lib/private/repair.php
index d870b472c4f..269fe4c5f09 100644
--- a/lib/private/repair.php
+++ b/lib/private/repair.php
@@ -136,10 +136,11 @@ class Repair extends BasicEmitter {
* @return array of RepairStep instances
*/
public static function getBeforeUpgradeRepairSteps() {
+ $connection = \OC::$server->getDatabaseConnection();
$steps = [
new InnoDB(),
- new Collation(\OC::$server->getConfig(), \OC_DB::getConnection()),
- new SqliteAutoincrement(\OC_DB::getConnection()),
+ new Collation(\OC::$server->getConfig(), $connection),
+ new SqliteAutoincrement($connection),
new SearchLuceneTables(),
];
diff --git a/lib/private/repair/innodb.php b/lib/private/repair/innodb.php
index ab94c79468d..4bbfdcea20a 100644
--- a/lib/private/repair/innodb.php
+++ b/lib/private/repair/innodb.php
@@ -37,7 +37,7 @@ class InnoDB extends BasicEmitter implements \OC\RepairStep {
* Fix mime types
*/
public function run() {
- $connection = \OC_DB::getConnection();
+ $connection = \OC::$server->getDatabaseConnection();
if (!$connection->getDatabasePlatform() instanceof MySqlPlatform) {
$this->emit('\OC\Repair', 'info', array('Not a mysql database -> nothing to do'));
return;
diff --git a/lib/private/repair/searchlucenetables.php b/lib/private/repair/searchlucenetables.php
index 5ae8a300246..52d41083c45 100644
--- a/lib/private/repair/searchlucenetables.php
+++ b/lib/private/repair/searchlucenetables.php
@@ -52,10 +52,10 @@ class SearchLuceneTables extends BasicEmitter implements \OC\RepairStep {
* search_lucene will then reindex the fileids without a status when the next indexing job is executed
*/
public function run() {
- if (\OC_DB::tableExists('lucene_status')) {
+ $connection = \OC::$server->getDatabaseConnection();
+ if ($connection->tableExists('lucene_status')) {
$this->emit('\OC\Repair', 'info', array('removing duplicate entries from lucene_status'));
- $connection = \OC_DB::getConnection();
$query = $connection->prepare('
DELETE FROM `*PREFIX*lucene_status`
WHERE `fileid` IN (
diff --git a/lib/private/server.php b/lib/private/server.php
index 7efe78b7c37..a21ff58f355 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -242,8 +242,8 @@ class Server extends ServerContainer implements IServerContainer {
$this->registerService('SystemConfig', function ($c) use ($config) {
return new \OC\SystemConfig($config);
});
- $this->registerService('AppConfig', function ($c) {
- return new \OC\AppConfig(\OC_DB::getConnection());
+ $this->registerService('AppConfig', function (Server $c) {
+ return new \OC\AppConfig($c->getDatabaseConnection());
});
$this->registerService('L10NFactory', function ($c) {
return new \OC\L10N\Factory();
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 2b251dba1e0..db27fa6a891 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -436,7 +436,7 @@ class Share extends Constants {
// TODO: inject connection, hopefully one day in the future when this
// class isn't static anymore...
- $conn = \OC_DB::getConnection();
+ $conn = \OC::$server->getDatabaseConnection();
$result = $conn->executeQuery(
'SELECT ' . $select . ' FROM `*PREFIX*share` ' . $where,
$arguments,
diff --git a/lib/private/tags.php b/lib/private/tags.php
index 09cb7618c02..c621aa3cf8f 100644
--- a/lib/private/tags.php
+++ b/lib/private/tags.php
@@ -215,7 +215,7 @@ class Tags implements \OCP\ITags {
$entries = array();
try {
- $conn = \OC_DB::getConnection();
+ $conn = \OC::$server->getDatabaseConnection();
$chunks = array_chunk($objIds, 900, false);
foreach ($chunks as $chunk) {
$result = $conn->executeQuery(