-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Query Music app class from the \OC::$server instead of creating directly
This prevents error log spamming on NC18+ when the debug mode has been enabled with `'debug' => true` and PHP version older than 7.4 is used. Probably this also might have a positive performance impact. refs #849
- Loading branch information
Showing
7 changed files
with
18 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,12 +11,12 @@ | |
* @author Pauli Järvinen <[email protected]> | ||
* @copyright Leizh 2014 | ||
* @copyright Morris Jobke 2014 | ||
* @copyright Pauli Järvinen 2017 | ||
* @copyright Pauli Järvinen 2017 - 2021 | ||
*/ | ||
|
||
use \OCA\Music\App\Music; | ||
|
||
$app = new Music(); | ||
$app = \OC::$server->query(Music::class); | ||
$c = $app->getContainer(); | ||
|
||
$application->add(new OCA\Music\Command\Scan( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,14 +9,14 @@ | |
* @author Morris Jobke <[email protected]> | ||
* @author Pauli Järvinen <[email protected]> | ||
* @copyright Morris Jobke 2014 | ||
* @copyright Pauli Järvinen 2017 - 2020 | ||
* @copyright Pauli Järvinen 2017 - 2021 | ||
*/ | ||
|
||
namespace OCA\Music; | ||
|
||
use \OCA\Music\App\Music; | ||
|
||
$app = new Music(); | ||
$app = \OC::$server->query(Music::class); | ||
|
||
$app->registerRoutes($this, ['routes' => [ | ||
// page | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,9 @@ | |
* later. See the COPYING file. | ||
* | ||
* @author Morris Jobke <[email protected]> | ||
* @author Pauli Järvinen <[email protected]> | ||
* @copyright Morris Jobke 2013, 2014 | ||
* @copyright Pauli Järvinen 2017 - 2021 | ||
*/ | ||
|
||
namespace OCA\Music\Backgroundjob; | ||
|
@@ -20,7 +22,7 @@ class Cleanup { | |
* Run background cleanup task | ||
*/ | ||
public static function run() { | ||
$app = new Music(); | ||
$app = \OC::$server->query(Music::class); | ||
|
||
$container = $app->getContainer(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
* @author Morris Jobke <[email protected]> | ||
* @author Pauli Järvinen <[email protected]> | ||
* @copyright Morris Jobke 2014 | ||
* @copyright Pauli Järvinen 2017 - 2020 | ||
* @copyright Pauli Järvinen 2017 - 2021 | ||
*/ | ||
|
||
namespace OCA\Music\Hooks; | ||
|
@@ -32,7 +32,7 @@ public function __construct($filesystemRoot) { | |
* @param Node $node pointing to the file or folder | ||
*/ | ||
public static function deleted(Node $node) { | ||
$app = new Music(); | ||
$app = \OC::$server->query(Music::class); | ||
$container = $app->getContainer(); | ||
$scanner = $container->query('Scanner'); | ||
|
||
|
@@ -56,7 +56,7 @@ public static function updated(Node $node) { | |
// File::fopen, this hook gets triggered immediately after the opening succeeds, | ||
// before anything is actually written and while the file is *exlusively locked | ||
// because of the write mode*. See #638. | ||
$app = new Music(); | ||
$app = \OC::$server->query(Music::class); | ||
$container = $app->getContainer(); | ||
try { | ||
self::handleUpdated($node, $container); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
* @author Morris Jobke <[email protected]> | ||
* @author Pauli Järvinen <[email protected]> | ||
* @copyright Morris Jobke 2014 | ||
* @copyright Pauli Järvinen 2017 - 2020 | ||
* @copyright Pauli Järvinen 2017 - 2021 | ||
*/ | ||
|
||
namespace OCA\Music\Hooks; | ||
|
@@ -38,7 +38,7 @@ private static function removeSharedItem($app, $itemType, $nodeId, $owner, $remo | |
*/ | ||
public static function itemUnshared(array $params) { | ||
$shareType = $params['shareType']; | ||
$app = new Music(); | ||
$app = \OC::$server->query(Music::class); | ||
|
||
// react only on user and group shares | ||
if ($shareType == \OCP\Share::SHARE_TYPE_USER) { | ||
|
@@ -63,7 +63,7 @@ public static function itemUnshared(array $params) { | |
public static function itemUnsharedFromSelf(array $params) { | ||
// The share recipient may be an individual user or a group, but the item is always removed from | ||
// the current user alone. | ||
$app = new Music(); | ||
$app = \OC::$server->query(Music::class); | ||
$removeFromUsers = [ $app->getContainer()->query('UserId') ]; | ||
|
||
self::removeSharedItem($app, $params['itemType'], $params['itemSource'], $params['uidOwner'], $removeFromUsers); | ||
|
@@ -79,7 +79,7 @@ public static function itemShared(array $params) { | |
// user will be prompted to update database the next time she opens the Music app. | ||
// Similarly, do not auto-update on group shares. | ||
if ($params['itemType'] === 'file' && $params['shareType'] == \OCP\Share::SHARE_TYPE_USER) { | ||
$app = new Music(); | ||
$app = \OC::$server->query(Music::class); | ||
$container = $app->getContainer(); | ||
$scanner = $container->query('Scanner'); | ||
$sharerFolder = $container->query('UserFolder'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ | |
* @author Pauli Järvinen <[email protected]> | ||
* @copyright Morris Jobke 2013, 2014 | ||
* @copyright Leizh 2014 | ||
* @copyright Pauli Järvinen 2018 - 2020 | ||
* @copyright Pauli Järvinen 2018 - 2021 | ||
*/ | ||
|
||
namespace OCA\Music\Search; | ||
|
@@ -38,7 +38,7 @@ class Provider extends \OCP\Search\Provider { | |
private $logger; | ||
|
||
public function __construct() { | ||
$app = new Music(); | ||
$app = \OC::$server->query(Music::class); | ||
$c = $app->getContainer(); | ||
|
||
$this->artistMapper = $c->query('ArtistMapper'); | ||
|