hasWriteAccess() public method

public hasWriteAccess ( ) : boolean
return boolean
示例#1
0
 public function update()
 {
     if (!$this->toFile->hasWriteAccess() || !$this->fromFile->hasReadAccess()) {
         return;
     }
     $newContent = $this->getUpdatedTrackerFileContent();
     if ($newContent !== $this->getCurrentTrackerFileContent()) {
         $this->toFile->save($newContent);
     }
 }
示例#2
0
 public function update()
 {
     if (!$this->toFile->hasWriteAccess() || !$this->fromFile->hasReadAccess()) {
         return;
     }
     $trackingCode = new PiwikJsManipulator($this->fromFile->getContent(), $this->trackerFiles);
     $newContent = $trackingCode->manipulateContent();
     if ($newContent !== $this->toFile->getContent()) {
         $this->toFile->save($newContent);
     }
 }
示例#3
0
 public function execute()
 {
     $label = $this->translator->translate('CustomPiwikJs_DiagnosticPiwikJsWritable');
     $file = new File(PIWIK_DOCUMENT_ROOT . '/piwik.js');
     if ($file->hasWriteAccess()) {
         return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK, ''));
     }
     $comment = $this->translator->translate('CustomPiwikJs_DiagnosticPiwikJsNotWritable');
     if (!SettingsServer::isWindows()) {
         $realpath = Filesystem::realpath(PIWIK_INCLUDE_PATH . '/piwik.js');
         $command = "<br/><code> chmod +w {$realpath}<br/> chown " . Filechecks::getUserAndGroup() . " " . $realpath . "</code><br />";
         $comment .= $this->translator->translate('CustomPiwikJs_DiagnosticPiwikJsMakeWritable', $command);
     }
     return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment));
 }