-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Helper.php
28 lines (24 loc) · 825 Bytes
/
Helper.php
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
<?php
namespace Piwik\Plugins\PerformanceAudit;
require PIWIK_INCLUDE_PATH . '/plugins/PerformanceAudit/vendor/autoload.php';
use Piwik\Plugins\PerformanceAudit\Exceptions\DirectoryNotWriteableException;
class Helper
{
/**
* Check if certain directories are writeable.
*
* @param array $directories
* @return void
* @throws DirectoryNotWriteableException
*/
public static function checkDirectoriesWriteable(array $directories)
{
clearstatcache();
foreach ($directories as $directory) {
$directoryPath = realpath(__DIR__ . DIRECTORY_SEPARATOR . $directory);
if (!is_writable($directoryPath)) {
throw new DirectoryNotWriteableException($directoryPath . ' needs to be a writeable directory.');
}
}
}
}