blob: 5663a5d540d1b791540de48c2cd526a768d734fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
<?php
/**
* Copyright (C) Piwik PRO - All rights reserved.
*
* Using this code requires that you first get a license from Piwik PRO.
* Unauthorized copying of this file, via any medium is strictly prohibited.
*
* @link http://piwik.pro
*/
namespace Piwik\Plugins\FileSynchronizer;
use Piwik\Container\StaticContainer;
use Piwik\DataTable;
use Piwik\DataTable\Row;
use Piwik\Piwik;
/**
* API for plugin FileSynchronizer
*
* @method static \Piwik\Plugins\FileSynchronizer\API getInstance()
*/
class API extends \Piwik\Plugin\API
{
/**
* Get all synced files whether they were successful or not.
*
* Latest synced files are listed first.
* @return array
*/
public function getAllSyncedFiles()
{
Piwik::checkUserHasSuperUserAccess();
$dao = new Dao();
$files = $dao->getAllSyncedFiles();
usort($files, function ($a, $b){
return $a['idfilesync'] > $b['idfilesync'] ? -1 : 1;
});
return $files;
}
/**
* Get all files that are currently syncing.
*
* @return array
*/
public function getAllSyncingFiles()
{
Piwik::checkUserHasSuperUserAccess();
$dao = new Dao();
$files = $dao->getAllSyncingFiles();
return $files;
}
/**
* Get a list of all files that can be synced and will be synced as soon as the next tasks run.
*
* @return array
*/
public function getFilesThatCanBeSynced()
{
Piwik::checkUserHasSuperUserAccess();
$syncFiles = StaticContainer::get('Piwik\Plugins\FileSynchronizer\SyncFiles');
return $syncFiles->getFilesThatCanBeSynced();
}
}
|