本文整理汇总了PHP中Piwik_Common::realpath方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_Common::realpath方法的具体用法?PHP Piwik_Common::realpath怎么用?PHP Piwik_Common::realpath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik_Common
的用法示例。
在下文中一共展示了Piwik_Common::realpath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkDirectoriesWritable
/**
* Checks if directories are writable and create them if they do not exist.
*
* @param array $directoriesToCheck array of directories to check - if not given default Piwik directories that needs write permission are checked
* @return array direcory name => true|false (is writable)
*/
public static function checkDirectoriesWritable($directoriesToCheck = null)
{
if ($directoriesToCheck == null) {
$directoriesToCheck = array('/config', '/tmp', '/tmp/templates_c', '/tmp/cache', '/tmp/latest');
}
$resultCheck = array();
foreach ($directoriesToCheck as $directoryToCheck) {
if (!preg_match('/^' . preg_quote(PIWIK_INCLUDE_PATH, '/') . '/', $directoryToCheck)) {
$directoryToCheck = PIWIK_INCLUDE_PATH . $directoryToCheck;
}
if (!file_exists($directoryToCheck)) {
Piwik_Common::mkdir($directoryToCheck, 0755, false);
}
$directory = Piwik_Common::realpath($directoryToCheck);
$resultCheck[$directory] = false;
if ($directory !== false && is_writable($directoryToCheck)) {
$resultCheck[$directory] = true;
}
}
return $resultCheck;
}
示例2: mkdir
public static function mkdir($path, $mode = 0755, $denyAccess = true)
{
if (!is_dir($path)) {
$directoryParent = Piwik_Common::realpath(dirname($path));
if (is_writable($directoryParent)) {
mkdir($path, $mode, true);
}
}
if ($denyAccess) {
self::createHtAccess($path);
}
}
示例3: getAutoUpdateMakeWritableMessage
/**
* Returns the help message when the auto update can't run because of missing permissions
*
* @return string
*/
public static function getAutoUpdateMakeWritableMessage()
{
$realpath = Piwik_Common::realpath(PIWIK_INCLUDE_PATH . '/');
$message = '';
$message .= "<code>chown -R www-data:www-data " . $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;
}
示例4: checkDirectoriesWritable
/**
* Checks if directories are writable and create them if they do not exist.
*
* @param array $directoriesToCheck array of directories to check - if not given default Piwik directories that needs write permission are checked
* @return array directory name => true|false (is writable)
*/
static public function checkDirectoriesWritable($directoriesToCheck = null)
{
if( $directoriesToCheck == null )
{
$directoriesToCheck = array(
'/config/',
'/tmp/',
'/tmp/templates_c/',
'/tmp/cache/',
'/tmp/assets/',
'/tmp/latest/',
'/tmp/tcpdf/',
);
}
$resultCheck = array();
foreach($directoriesToCheck as $directoryToCheck)
{
if( !preg_match('/^'.preg_quote(PIWIK_USER_PATH, '/').'/', $directoryToCheck) )
{
$directoryToCheck = PIWIK_USER_PATH . $directoryToCheck;
}
if(!file_exists($directoryToCheck))
{
Piwik_Common::mkdir($directoryToCheck);
}
$directory = Piwik_Common::realpath($directoryToCheck);
$resultCheck[$directory] = false;
if($directory !== false // realpath() returns FALSE on failure
&& is_writable($directoryToCheck))
{
$resultCheck[$directory] = true;
}
}
return $resultCheck;
}