-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor OC\Server::getDatabaseConnection
#40121
Refactor OC\Server::getDatabaseConnection
#40121
Conversation
6866e69
to
57ab25c
Compare
57ab25c
to
c613819
Compare
lib/private/Files/Cache/Cache.php
Outdated
@@ -123,7 +123,7 @@ public function __construct(IStorage $storage) { | |||
|
|||
$this->storageCache = new Storage($storage); | |||
$this->mimetypeLoader = \OC::$server->getMimeTypeLoader(); | |||
$this->connection = \OC::$server->getDatabaseConnection(); | |||
$this->connection = \OC::$server->get(IDBConnection::class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->connection = \OC::$server->get(IDBConnection::class); | |
$this->connection = \OCP\Server::get(IDBConnection::class); |
let's use the public server container API. same applies to most changes below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to make this change before pushing, and I'm currently running tests locally. I don't know if you can cancel the tests that are currently running to free up resources, but feel free.
Also, why the change to the public container? In general, when should this be used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, when should this be used?
In new code: always
In old code: when you touch it anyways
c613819
to
acaf690
Compare
I'm getting the following failure:
Since this has to do with the |
acaf690
to
2cd272a
Compare
Signed-off-by: Andrew Summers <18727110+summersab@users.noreply.github.com> implement suggested changes from nickvergessen Use the public server container API
2cd272a
to
e6f01b3
Compare
Too much conflicts, closing until this is done fresh again |
This PR refactors the deprecated method
OC\Server::getDatabaseConnection
and replaces it withOC\Server::get(\OCP\IDBConnection::class)
throughout the entire NC codebase (excluding./apps
and./3rdparty
).Additionally, where necessary, the
\OCP\IDBConnection
class is imported via theuse
directive.