blob: aa3a7b8dfb752f1e7d509733bdae43fca9af2665 (
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
|
<?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\SyncFiles;
use Piwik\Db;
use Piwik\Filesystem;
use Piwik\Plugins\FileSynchronizer\Settings;
class FileList
{
/**
* @var Settings
*/
private $settings;
public function __construct(Settings $settings)
{
$this->settings = $settings;
}
/**
* @return string[]
*/
public function findFilesToSync()
{
$path = $this->settings->sourceDirectory->getValue();
$pattern = $this->settings->filePattern->getValue();
if (!$this->settings->enabled->getValue()) {
return array();
}
if (empty($path) || !file_exists($path) || !is_readable($path) || !is_dir($path)) {
// case when plugin not configured yet
return array();
}
if (empty($pattern)) {
$pattern = '*';
}
return Filesystem::globr($path, $pattern);
}
}
|