original_string: public static function checkIfFileSystemIsNFS()
      {
          $sessionsPath = Session::getSessionsDirectory();
  
          // this command will display details for the filesystem that holds the $sessionsPath
          // path, but only if its type is NFS. if not NFS, df will return one or less lines
          // and the return code 1. if NFS, it will return 0 and at least 2 lines of text.
          $command = "df -T -t nfs \"$sessionsPath\" 2>&1";
  
          if (function_exists('exec')) {
              // use exec
  
              $output = $returnCode = null;
              @exec($command, $output, $returnCode);
  
              // check if filesystem is NFS
              if ($returnCode == 0
                  && count($output) > 1
              ) {
                  return true;
              }
          } elseif (function_exists('shell_exec')) {
              // use shell_exec
  
              $output = @shell_exec($command);
              if ($output) {
                  $commandFailed = (false !== strpos($output, "no file systems processed"));
                  $output = explode("\n", trim($output));
                  if (!$commandFailed
                      && count($output) > 1) {
                      // check if filesystem is NFS
                      return true;
                  }
              }
          }
  
          return false; // not NFS, or we can't run a program to find out
      }
code: public static function checkIfFileSystemIsNFS()
      {
          $sessionsPath = Session::getSessionsDirectory();
  
          // this command will display details for the filesystem that holds the $sessionsPath
          // path, but only if its type is NFS. if not NFS, df will return one or less lines
          // and the return code 1. if NFS, it will return 0 and at least 2 lines of text.
          $command = "df -T -t nfs \"$sessionsPath\" 2>&1";
  
          if (function_exists('exec')) {
              // use exec
  
              $output = $returnCode = null;
              @exec($command, $output, $returnCode);
  
              // check if filesystem is NFS
              if ($returnCode == 0
                  && count($output) > 1
              ) {
                  return true;
              }
          } elseif (function_exists('shell_exec')) {
              // use shell_exec
  
              $output = @shell_exec($command);
              if ($output) {
                  $commandFailed = (false !== strpos($output, "no file systems processed"));
                  $output = explode("\n", trim($output));
                  if (!$commandFailed
                      && count($output) > 1) {
                      // check if filesystem is NFS
                      return true;
                  }
              }
          }
  
          return false; // not NFS, or we can't run a program to find out
      }
code_tokens: public static function checkIfFileSystemIsNFS ( ) { $ sessionsPath = Session :: getSessionsDirectory ( ) ; // this command will display details for the filesystem that holds the $sessionsPath // path, but only if its type is NFS. if not NFS, df will return one or less lines // and the return code 1. if NFS, it will return 0 and at least 2 lines of text. $ command = "df -T -t nfs \"$sessionsPath\" 2>&1" ; if ( function_exists ( 'exec' ) ) { // use exec $ output = $ returnCode = null ; @ exec ( $ command , $ output , $ returnCode ) ; // check if filesystem is NFS if ( $ returnCode == 0 && count ( $ output ) > 1 ) { return true ; } } elseif ( function_exists ( 'shell_exec' ) ) { // use shell_exec $ output = @ shell_exec ( $ command ) ; if ( $ output ) { $ commandFailed = ( false !== strpos ( $ output , "no file systems processed" ) ) ; $ output = explode ( "\n" , trim ( $ output ) ) ; if ( ! $ commandFailed && count ( $ output ) > 1 ) { // check if filesystem is NFS return true ; } } } return false ; // not NFS, or we can't run a program to find out }
docstring: Checks if the filesystem Piwik stores sessions in is NFS or not. This
  check is done in order to avoid using file based sessions on NFS system,
  since on such a filesystem file locking can make file based sessions
  incredibly slow.
  
  Note: In order to figure this out, we try to run the 'df' program. If
  the 'exec' or 'shell_exec' functions are not available, we can't do
  the check.
  
  @return bool True if on an NFS filesystem, false if otherwise or if we
  can't use shell_exec or exec.
docstring_tokens: Checks if the filesystem Piwik stores sessions in is NFS or not . This check is done in order to avoid using file based sessions on NFS system since on such a filesystem file locking can make file based sessions incredibly slow .