classes/phing/Diagnostics.php
private static function doReportTempDir(PrintStream $out)
    {
        $tempdir = PhingFile::getTempDir();
        if ($tempdir == null) {
            $out->println("Warning: php.tmpdir is undefined");
            return;
        }
        $out->println("Temp dir is " . $tempdir);
        $tempDirectory = new PhingFile($tempdir);

        if (!$tempDirectory->exists()) {
            $out->println("Warning, php.tmpdir directory does not exist: " . $tempdir);
            return;
        }

        $now = time();
        $tempFile = PhingFile::createTempFile('diag', 'txt', $tempDirectory);
        $fileWriter = new FileWriter($tempFile);
        $fileWriter->write('some test text');
        $fileWriter->close();

        $filetime = $tempFile->lastModified();

        $tempFile->delete();

        $out->println("Temp dir is writeable");
        $drift = $filetime - $now;
        $out->println("Temp dir alignment with system clock is " . $drift . " s");
        if (abs($drift) > 10) {
            $out->println("Warning: big clock drift -maybe a network filesystem");
        }
    }
private static function doReportTempDir(PrintStream $out)
    {
        $tempdir = PhingFile::getTempDir();
        if ($tempdir == null) {
            $out->println("Warning: php.tmpdir is undefined");
            return;
        }
        $out->println("Temp dir is " . $tempdir);
        $tempDirectory = new PhingFile($tempdir);

        if (!$tempDirectory->exists()) {
            $out->println("Warning, php.tmpdir directory does not exist: " . $tempdir);
            return;
        }

        $now = time();
        $tempFile = PhingFile::createTempFile('diag', 'txt', $tempDirectory);
        $fileWriter = new FileWriter($tempFile);
        $fileWriter->write('some test text');
        $fileWriter->close();

        $filetime = $tempFile->lastModified();

        $tempFile->delete();

        $out->println("Temp dir is writeable");
        $drift = $filetime - $now;
        $out->println("Temp dir alignment with system clock is " . $drift . " s");
        if (abs($drift) > 10) {
            $out->println("Warning: big clock drift -maybe a network filesystem");
        }
    }
private static function doReportTempDir ( PrintStream $ out ) { $ tempdir = PhingFile :: getTempDir ( ) ; if ( $ tempdir == null ) { $ out -> println ( "Warning: php.tmpdir is undefined" ) ; return ; } $ out -> println ( "Temp dir is " . $ tempdir ) ; $ tempDirectory = new PhingFile ( $ tempdir ) ; if ( ! $ tempDirectory -> exists ( ) ) { $ out -> println ( "Warning, php.tmpdir directory does not exist: " . $ tempdir ) ; return ; } $ now = time ( ) ; $ tempFile = PhingFile :: createTempFile ( 'diag' , 'txt' , $ tempDirectory ) ; $ fileWriter = new FileWriter ( $ tempFile ) ; $ fileWriter -> write ( 'some test text' ) ; $ fileWriter -> close ( ) ; $ filetime = $ tempFile -> lastModified ( ) ; $ tempFile -> delete ( ) ; $ out -> println ( "Temp dir is writeable" ) ; $ drift = $ filetime - $ now ; $ out -> println ( "Temp dir alignment with system clock is " . $ drift . " s" ) ; if ( abs ( $ drift ) > 10 ) { $ out -> println ( "Warning: big clock drift -maybe a network filesystem" ) ; } }
try and create a temp file in our temp dir; this
checks that it has space and access.
We also do some clock reporting.

@param PrintStream $out
try and create a temp file in our temp dir ; this checks that it has space and access . We also do some clock reporting .