本文整理汇总了PHP中Piwik\Filesystem::realpath方法的典型用法代码示例。如果您正苦于以下问题:PHP Filesystem::realpath方法的具体用法?PHP Filesystem::realpath怎么用?PHP Filesystem::realpath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Filesystem
的用法示例。
在下文中一共展示了Filesystem::realpath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
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));
}
示例2: getAutoUpdateMakeWritableMessage
/**
* 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;
}
示例3: getOwnerOfPiwikFiles
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}";
}