当前位置: 首页>>代码示例>>PHP>>正文


PHP Piwik_Common::realpath方法代码示例

本文整理汇总了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;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:27,代码来源:Piwik.php

示例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);
     }
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:12,代码来源:Common.php

示例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;
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:14,代码来源:Piwik.php

示例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;
	}
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:44,代码来源:Piwik.php


注:本文中的Piwik_Common::realpath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。