Passed
Push — master ( edf700...b67c20 )
by Pauli
02:34
created

Cleanup::run()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 13
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
/**
4
 * ownCloud - Music app
5
 *
6
 * This file is licensed under the Affero General Public License version 3 or
7
 * later. See the COPYING file.
8
 *
9
 * @author Morris Jobke <[email protected]>
10
 * @copyright Morris Jobke 2013, 2014
11
 */
12
13
namespace OCA\Music\Backgroundjob;
14
15
use \OCA\Music\App\Music;
16
17
class Cleanup {
18
19
	/**
20
	 * Run background cleanup task
21
	 */
22
	public static function run() {
23
		$app = new Music();
24
25
		$container = $app->getContainer();
26
27
		// remove orphaned entities
28
		$container->query('Maintenance')->cleanUp();
29
30
		// remove expired sessions
31
		$container->query('AmpacheSessionMapper')->cleanUp();
32
33
		// find covers - TODO performance stuff - maybe just call this once in an hour
34
		$container->query('Scanner')->findAlbumCovers();
35
	}
36
}
37