Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/CustomPiwikJs/File.php')
-rw-r--r--plugins/CustomPiwikJs/File.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/CustomPiwikJs/File.php b/plugins/CustomPiwikJs/File.php
index 5ef1a13c6f..03d874e61d 100644
--- a/plugins/CustomPiwikJs/File.php
+++ b/plugins/CustomPiwikJs/File.php
@@ -38,7 +38,9 @@ class File
public function save($content)
{
- file_put_contents($this->file, $content);
+ if(false === file_put_contents($this->file, $content)) {
+ throw new AccessDeniedException(sprintf("Could not write to %s", $this->file));
+ }
}
public function getContent()
@@ -60,7 +62,10 @@ class File
*/
public function hasWriteAccess()
{
- return is_writable($this->file);
+ if (file_exists($this->file) && !is_writable($this->file)) {
+ return false;
+ }
+ return is_writable(dirname($this->file)) || is_writable($this->file);
}
/**