realpath() public static method

Get canonicalized absolute path See http://php.net/realpath
public static realpath ( string $path ) : string
$path string
return string canonicalized absolute path
Beispiel #1
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));
 }
Beispiel #2
0
 /**
  * Returns the help message when the auto update can't run because of missing permissions
  *
  * @return string
  */
 public static function getAutoUpdateMakeWritableMessage()
 {
     $realpath = Filesystem::realpath(PIWIK_INCLUDE_PATH . '/');
     $message = '';
     $message .= "<code>chown -R " . self::getUserAndGroup() . " " . $realpath . "</code><br />";
     $message .= "<code>chmod -R 0755 " . $realpath . "</code><br />";
     $message .= 'After you execute these commands (or change permissions via your FTP software), refresh the page and you should be able to use the "Automatic Update" feature.';
     return $message;
 }
Beispiel #3
0
 public static function getOwnerOfPiwikFiles()
 {
     $index = Filesystem::realpath(PIWIK_INCLUDE_PATH . '/index.php');
     $stat = stat($index);
     if (!$stat) {
         return '';
     }
     $group = posix_getgrgid($stat[5]);
     $group = $group['name'];
     $user = posix_getpwuid($stat[4]);
     $user = $user['name'];
     return "{$user}:{$group}";
 }