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


PHP Piwik::checkDirectoriesWritable方法代码示例

本文整理汇总了PHP中Piwik::checkDirectoriesWritable方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::checkDirectoriesWritable方法的具体用法?PHP Piwik::checkDirectoriesWritable怎么用?PHP Piwik::checkDirectoriesWritable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Piwik的用法示例。


在下文中一共展示了Piwik::checkDirectoriesWritable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkDirectoriesWritableOrDie

 /**
  * Checks that the directories Piwik needs write access are actually writable
  * Displays a nice error page if permissions are missing on some directories
  * 
  * @return void
  */
 public static function checkDirectoriesWritableOrDie($directoriesToCheck = null)
 {
     $resultCheck = Piwik::checkDirectoriesWritable($directoriesToCheck);
     if (array_search(false, $resultCheck) !== false) {
         $directoryList = '';
         foreach ($resultCheck as $dir => $bool) {
             $realpath = Piwik_Common::realpath($dir);
             if (!empty($realpath) && $bool === false) {
                 $directoryList .= "<code>chmod 777 {$realpath}</code><br>";
             }
         }
         $directoryList .= '';
         $directoryMessage = "<p><b>Piwik couldn't write to some directories</b>.</p> <p>Try to Execute the following commands on your Linux server:</P>";
         $directoryMessage .= $directoryList;
         $directoryMessage .= "<p>If this doesn't work, you can try to create the directories with your FTP software, and set the CHMOD to 777 (with your FTP software, right click on the directories, permissions).";
         $directoryMessage .= "<p>After applying the modifications, you can <a href='index.php'>refresh the page</a>.";
         $directoryMessage .= "<p>If you need more help, try <a href='misc/redirectToUrl.php?url=http://piwik.org'>Piwik.org</a>.";
         Piwik_ExitWithMessage($directoryMessage, false, true);
     }
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:26,代码来源:Piwik.php

示例2: getSystemInformation

	/**
	 * Get system information
	 */
	public static function getSystemInformation()
	{
		global $piwik_minimumPHPVersion;
		$minimumMemoryLimit = Zend_Registry::get('config')->General->minimum_memory_limit;

		$infos = array();

		$infos['general_infos'] = array();
		$infos['directories'] = Piwik::checkDirectoriesWritable();
		$infos['can_auto_update'] = Piwik::canAutoUpdate();
		
		if(Piwik_Common::isIIS())
		{
			Piwik::createWebConfigFiles();
		}
		else
		{
			Piwik::createHtAccessFiles();
		}
		Piwik::createWebRootFiles();

		$infos['phpVersion_minimum'] = $piwik_minimumPHPVersion;
		$infos['phpVersion'] = PHP_VERSION;
		$infos['phpVersion_ok'] = version_compare( $piwik_minimumPHPVersion, $infos['phpVersion']) === -1;

		// critical errors
		$extensions = @get_loaded_extensions();
		$needed_extensions = array(
			'zlib',
			'SPL',
			'iconv',
			'Reflection',
		);
		$infos['needed_extensions'] = $needed_extensions;
		$infos['missing_extensions'] = array();
		foreach($needed_extensions as $needed_extension)
		{
			if(!in_array($needed_extension, $extensions))
			{
				$infos['missing_extensions'][] = $needed_extension;
			}
		}

		$infos['pdo_ok'] = false;
		if(in_array('PDO', $extensions))
		{
			$infos['pdo_ok'] = true;
		}

		$infos['adapters'] = Piwik_Db_Adapter::getAdapters();

		$needed_functions = array(
			'debug_backtrace',
			'create_function',
			'eval',
			'gzcompress',
			'gzuncompress',
			'pack',
		);
		$infos['needed_functions'] = $needed_functions;
		$infos['missing_functions'] = array();
		foreach($needed_functions as $needed_function)
		{
			if(!self::functionExists($needed_function))
			{
				$infos['missing_functions'][] = $needed_function;
			}
		}

		// warnings
		$desired_extensions = array(
			'json',
			'libxml',
			'dom',
			'SimpleXML',
		);
		$infos['desired_extensions'] = $desired_extensions;
		$infos['missing_desired_extensions'] = array();
		foreach($desired_extensions as $desired_extension)
		{
			if(!in_array($desired_extension, $extensions))
			{
				$infos['missing_desired_extensions'][] = $desired_extension;
			}
		}

		$desired_functions = array(
			'set_time_limit',
			'mail',
			'parse_ini_file',
			'glob',
		);
		$infos['desired_functions'] = $desired_functions;
		$infos['missing_desired_functions'] = array();
		foreach($desired_functions as $desired_function)
		{
			if(!self::functionExists($desired_function))
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:101,代码来源:Controller.php

示例3: getSystemInformation

	public static function getSystemInformation()
	{
		$minimumPhpVersion = Zend_Registry::get('config')->General->minimum_php_version;
		$minimumMemoryLimit = Zend_Registry::get('config')->General->minimum_memory_limit;

		$infos = array();

		$infos['directories'] = Piwik::checkDirectoriesWritable();
		$infos['phpVersion_minimum'] = $minimumPhpVersion;
		$infos['phpVersion'] = phpversion();
		$infos['phpVersion_ok'] = version_compare( $minimumPhpVersion, $infos['phpVersion']) === -1;

		// critical errors
		$extensions = @get_loaded_extensions();
		$needed_extensions = array(
			'zlib',
			'SPL',
			'iconv',
		);
		$infos['needed_extensions'] = $needed_extensions;
		$infos['missing_extensions'] = array();
		foreach($needed_extensions as $needed_extension)
		{
			if(!in_array($needed_extension, $extensions))
			{
				$infos['missing_extensions'][] = $needed_extension;
			}
		}

		$infos['pdo_ok'] = false;
		if(in_array('PDO', $extensions))
		{
			$infos['pdo_ok'] = true;
		}

		$infos['adapters'] = Piwik_Db::getAdapters();

		$infos['json'] = false;
		if(in_array('json', $extensions))
		{
			$infos['json'] = true;
		}

		$infos['xml'] = false;
		if(in_array('xml', $extensions))
		{
			$infos['xml'] = true;
		}

		// warnings
		$needed_functions = array(
			'set_time_limit',
			'mail',
		);
		$infos['needed_functions'] = $needed_functions;
		$infos['missing_functions'] = array();
		foreach($needed_functions as $needed_function)
		{
			if(!function_exists($needed_function))
			{
				$infos['missing_functions'][] = $needed_function;
			}
		}

		$infos['openurl'] = Piwik::getTransportMethod();

		$infos['gd_ok'] = false;
		if (in_array('gd', $extensions))
		{
			$gdInfo = gd_info();
			$infos['gd_version'] = $gdInfo['GD Version'];
			preg_match('/([0-9]{1})/', $gdInfo['GD Version'], $gdVersion);
			if($gdVersion[0] >= 2)
			{
				$infos['gd_ok'] = true;
			}
		}

		$infos['serverVersion'] = addslashes($_SERVER['SERVER_SOFTWARE']);
		$infos['serverOs'] = @php_uname();
		$infos['serverTime'] = date('H:i:s');

		$infos['registerGlobals_ok'] = ini_get('register_globals') == 0;
		$infos['memoryMinimum'] = $minimumMemoryLimit;

		$infos['memory_ok'] = true;
		// on windows the ini_get is not working?
		$infos['memoryCurrent'] = '?M';

		$raised = Piwik::raiseMemoryLimitIfNecessary();
		if(	$memoryValue = Piwik::getMemoryLimitValue() )
		{
			$infos['memoryCurrent'] = $memoryValue.'M';
			$infos['memory_ok'] = $memoryValue >= $minimumMemoryLimit;
		}

		$infos['isWindows'] = substr(PHP_OS, 0, 3) == 'WIN';

		$infos['protocol_ok'] = true;
		$infos['protocol'] = self::getProtocolInformation();
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:101,代码来源:Controller.php

示例4: checkDirectoriesWritableOrDie

 /**
  * Checks that the directories Piwik needs write access are actually writable
  * Displays a nice error page if permissions are missing on some directories
  *
  * @param array $directoriesToCheck Array of directory names to check
  */
 public static function checkDirectoriesWritableOrDie($directoriesToCheck = null)
 {
     $resultCheck = Piwik::checkDirectoriesWritable($directoriesToCheck);
     if (array_search(false, $resultCheck) === false) {
         return;
     }
     $directoryList = '';
     foreach ($resultCheck as $dir => $bool) {
         $realpath = Piwik_Common::realpath($dir);
         if (!empty($realpath) && $bool === false) {
             $directoryList .= self::getMakeWritableCommand($realpath);
         }
     }
     // Also give the chown since the chmod is only 755
     if (!Piwik_Common::isWindows()) {
         $realpath = Piwik_Common::realpath(PIWIK_INCLUDE_PATH . '/');
         $directoryList = "<code>chown -R www-data:www-data " . $realpath . "</code><br/>" . $directoryList;
     }
     // The error message mentions chmod 777 in case users can't chown
     $directoryMessage = "<p><b>Piwik couldn't write to some directories</b>.</p> \n\t\t\t\t\t\t\t<p>Try to Execute the following commands on your server:</p>" . "<blockquote>{$directoryList}</blockquote>" . "<p>If this doesn't work, you can try to create the directories with your FTP software, and set the CHMOD to 0777 (with your FTP software, right click on the directories, permissions).</p>" . "<p>After applying the modifications, you can <a href='index.php'>refresh the page</a>.</p>" . "<p>If you need more help, try <a href='?module=Proxy&action=redirect&url=http://piwik.org'>Piwik.org</a>.</p>";
     Piwik_ExitWithMessage($directoryMessage, false, true);
 }
开发者ID:neolf,项目名称:PIWIK4MOBILE,代码行数:28,代码来源:Piwik.php

示例5: checkDirectoriesWritableOrDie

 /**
  * Checks that the directories Piwik needs write access are actually writable
  * Displays a nice error page if permissions are missing on some directories
  *
  * @param array $directoriesToCheck Array of directory names to check
  */
 public static function checkDirectoriesWritableOrDie($directoriesToCheck = null)
 {
     $resultCheck = Piwik::checkDirectoriesWritable($directoriesToCheck);
     if (array_search(false, $resultCheck) === false) {
         return;
     }
     $directoryList = '';
     foreach ($resultCheck as $dir => $bool) {
         $realpath = Piwik_Common::realpath($dir);
         if (!empty($realpath) && $bool === false) {
             if (Piwik_Common::isWindows()) {
                 $directoryList .= "<code>cacls {$realpath} /t /g " . get_current_user() . ":f</code><br />";
             } else {
                 $directoryList .= "<code>chmod 0777 {$realpath}</code><br />";
             }
         }
     }
     $directoryMessage = "<p><b>Piwik couldn't write to some directories</b>.</p> <p>Try to Execute the following commands on your server:</p>" . "<blockquote>{$directoryList}</blockquote>" . "<p>If this doesn't work, you can try to create the directories with your FTP software, and set the CHMOD to 0777 (with your FTP software, right click on the directories, permissions).</p>" . "<p>After applying the modifications, you can <a href='index.php'>refresh the page</a>.</p>" . "<p>If you need more help, try <a href='?module=Proxy&action=redirect&url=http://piwik.org'>Piwik.org</a>.</p>";
     Piwik_ExitWithMessage($directoryMessage, false, true);
 }
开发者ID:Gninety,项目名称:Microweber,代码行数:26,代码来源:Piwik.php

示例6: getSystemInformation

 /**
  * Get system information
  */
 public static function getSystemInformation()
 {
     $minimumPhpVersion = Zend_Registry::get('config')->General->minimum_php_version;
     $minimumMemoryLimit = Zend_Registry::get('config')->General->minimum_memory_limit;
     $infos = array();
     $infos['directories'] = Piwik::checkDirectoriesWritable();
     $infos['phpVersion_minimum'] = $minimumPhpVersion;
     $infos['phpVersion'] = phpversion();
     $infos['phpVersion_ok'] = version_compare($minimumPhpVersion, $infos['phpVersion']) === -1;
     // critical errors
     $extensions = @get_loaded_extensions();
     $needed_extensions = array('zlib', 'SPL', 'iconv', 'Reflection');
     $infos['needed_extensions'] = $needed_extensions;
     $infos['missing_extensions'] = array();
     foreach ($needed_extensions as $needed_extension) {
         if (!in_array($needed_extension, $extensions)) {
             $infos['missing_extensions'][] = $needed_extension;
         }
     }
     $infos['pdo_ok'] = false;
     if (in_array('PDO', $extensions)) {
         $infos['pdo_ok'] = true;
     }
     $infos['adapters'] = Piwik_Db::getAdapters();
     $infos['json'] = false;
     if (in_array('json', $extensions)) {
         $infos['json'] = true;
     }
     $infos['xml'] = false;
     if (in_array('xml', $extensions)) {
         $infos['xml'] = true;
     }
     $needed_functions = array('debug_backtrace', 'create_function');
     $infos['needed_functions'] = $needed_functions;
     $infos['missing_functions'] = array();
     foreach ($needed_functions as $needed_function) {
         if (!self::functionExists($needed_function)) {
             $infos['missing_functions'][] = $needed_function;
         }
     }
     // warnings
     $desired_functions = array('set_time_limit', 'mail', 'parse_ini_file');
     $infos['desired_functions'] = $desired_functions;
     $infos['missing_desired_functions'] = array();
     foreach ($desired_functions as $desired_function) {
         if (!self::functionExists($desired_function)) {
             $infos['missing_desired_functions'][] = $desired_function;
         }
     }
     $infos['openurl'] = Piwik::getTransportMethod();
     $infos['gd_ok'] = false;
     if (in_array('gd', $extensions)) {
         $gdInfo = gd_info();
         $infos['gd_version'] = $gdInfo['GD Version'];
         preg_match('/([0-9]{1})/', $gdInfo['GD Version'], $gdVersion);
         if ($gdVersion[0] >= 2) {
             $infos['gd_ok'] = true;
         }
     }
     $infos['hasMbstring'] = false;
     $infos['multibyte_ok'] = true;
     if (function_exists('mb_internal_encoding')) {
         $infos['hasMbstring'] = true;
         if ((int) ini_get('mbstring.func_overload') != 0) {
             $infos['multibyte_ok'] = false;
         }
     }
     /**
      * @see http://php.net/ip2long
      */
     $infos['isIpv4'] = true;
     if (strpos($_SERVER['REMOTE_ADDR'], ':') !== false) {
         $infos['isIpv4'] = false;
     }
     $infos['serverVersion'] = addslashes($_SERVER['SERVER_SOFTWARE']);
     $infos['serverOs'] = @php_uname();
     $infos['serverTime'] = date('H:i:s');
     $infos['registerGlobals_ok'] = ini_get('register_globals') == 0;
     $infos['memoryMinimum'] = $minimumMemoryLimit;
     $infos['memory_ok'] = true;
     // on windows the ini_get is not working?
     $infos['memoryCurrent'] = '?M';
     $raised = Piwik::raiseMemoryLimitIfNecessary();
     if ($memoryValue = Piwik::getMemoryLimitValue()) {
         $infos['memoryCurrent'] = $memoryValue . 'M';
         $infos['memory_ok'] = $memoryValue >= $minimumMemoryLimit;
     }
     $infos['isWindows'] = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
     $infos['protocol_ok'] = true;
     $infos['protocol'] = self::getProtocolInformation();
     if (Piwik_Url::getCurrentScheme() == 'http' && $infos['protocol'] !== null) {
         $infos['protocol_ok'] = false;
     }
     $integrityInfo = Piwik::getFileIntegrityInformation();
     $infos['integrity'] = $integrityInfo[0];
     $infos['integrityErrorMessages'] = array();
     if (isset($integrityInfo[1])) {
//.........这里部分代码省略.........
开发者ID:Doluci,项目名称:tomatocart,代码行数:101,代码来源:Controller.php

示例7: checkDirectoriesWritableOrDie

    /**
     * Checks that the directories Piwik needs write access are actually writable
     * Displays a nice error page if permissions are missing on some directories
     * 
     * @return void
     */
    protected function checkDirectoriesWritableOrDie()
    {
        $resultCheck = Piwik::checkDirectoriesWritable();
        if (array_search(false, $resultCheck) !== false) {
            $directoryList = '';
            foreach ($resultCheck as $dir => $bool) {
                $dir = realpath($dir);
                if (!empty($dir) && $bool === false) {
                    $directoryList .= "<code>chmod 777 {$dir}</code><br>";
                }
            }
            $directoryList .= '';
            $directoryMessage = "<p><b>Piwik couldn't write to some directories</b>.</p> <p>Try to Execute the following commands on your Linux server:</P>";
            $directoryMessage .= $directoryList;
            $directoryMessage .= "<p>If this doesn't work, you can try to create the directories with your FTP software, and set the CHMOD to 777 (with your FTP software, right click on the directories, permissions).";
            $directoryMessage .= "<p>After applying the modifications, you can <a href='index.php'>refresh the page</a>.";
            $directoryMessage .= "<p>If you need more help, try <a href='http://piwik.org'>Piwik.org</a>.";
            $html = '
				<html>
				<head>
					<title>Piwik &rsaquo; Error</title>
					<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
				<style>
				
				html { background: #eee; }
				
				body {
					background: #fff;
					color: #000;
					font-family: Georgia, "Times New Roman", Times, serif;
					margin-left: 20%;
					margin-top: 25px;
					margin-right: 20%;
					padding: .2em 2em;
				}
				
				#h1 {
					color: #006;
					font-size: 45px;
					font-weight: lighter;
				}
				
				#subh1 {
					color: #879DBD;
					font-size: 25px;
					font-weight: lighter;
				}
				
				
				p, li, dt {
					line-height: 140%;
					padding-bottom: 2px;
				}
				
				ul, ol { padding: 5px 5px 5px 20px; }
				
				#logo { margin-bottom: 2em; }
				
				code { margin-left: 40px; }
				</style>
				</head>
				<body>
					<span id="h1">Piwik </span><span id="subh1"> # open source web analytics</span>
					<p>' . $directoryMessage . '</p>
				
				</body>
				</html>
				';
            print $html;
            exit;
        }
    }
开发者ID:Doluci,项目名称:tomatocart,代码行数:78,代码来源:FrontController.php

示例8: getSystemInformation

 protected function getSystemInformation()
 {
     $minimumPhpVersion = Zend_Registry::get('config')->General->minimum_php_version;
     $minimumMemoryLimit = Zend_Registry::get('config')->General->minimum_memory_limit;
     $infos = array();
     $infos['directories'] = Piwik::checkDirectoriesWritable();
     $infos['phpVersion_minimum'] = $minimumPhpVersion;
     $infos['phpVersion'] = phpversion();
     $infos['phpVersion_ok'] = version_compare($minimumPhpVersion, $infos['phpVersion']) === -1;
     // critical errors
     $extensions = @get_loaded_extensions();
     $needed_extensions = array('PDO', 'pdo_mysql', 'zlib', 'SPL');
     $infos['needed_extensions'] = $needed_extensions;
     $infos['missing_extensions'] = array();
     foreach ($needed_extensions as $needed_extension) {
         if (!in_array($needed_extension, $extensions)) {
             $infos['missing_extensions'][] = $needed_extension;
         }
     }
     // warnings
     $needed_functions = array('set_time_limit', 'mail');
     $infos['needed_functions'] = $needed_functions;
     $infos['missing_functions'] = array();
     foreach ($needed_functions as $needed_function) {
         if (!function_exists($needed_function)) {
             $infos['missing_functions'][] = $needed_function;
         }
     }
     $infos['gd_ok'] = false;
     if (in_array('gd', $extensions)) {
         $gdInfo = gd_info();
         $infos['gd_version'] = $gdInfo['GD Version'];
         preg_match('/([0-9]{1})/', $gdInfo['GD Version'], $gdVersion);
         if ($gdVersion[0] >= 2) {
             $infos['gd_ok'] = true;
         }
     }
     $infos['serverVersion'] = addslashes($_SERVER['SERVER_SOFTWARE']);
     $infos['serverOs'] = @php_uname();
     $infos['serverTime'] = date('H:i:s');
     $infos['registerGlobals_ok'] = ini_get('register_globals') == 0;
     $infos['memoryMinimum'] = $minimumMemoryLimit;
     $infos['memory_ok'] = true;
     // on windows the ini_get is not working?
     $infos['memoryCurrent'] = '?M';
     $raised = Piwik::raiseMemoryLimitIfNecessary();
     if ($memoryValue = Piwik::getMemoryLimitValue()) {
         $infos['memoryCurrent'] = $memoryValue . "M";
         $infos['memory_ok'] = $memoryValue >= $minimumMemoryLimit;
     }
     return $infos;
 }
开发者ID:BackupTheBerlios,项目名称:oos-svn,代码行数:52,代码来源:Controller.php


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