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

Cleanup   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 13 1
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