Project

General

Profile

Actions

Feature #20854

closed

unsing class.t3lib_diff.php on Windows - using DIFF in Workspaces on Windows Machines

Added by Robert Wunsch over 15 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2009-08-09
Due date:
% Done:

0%

Estimated time:
PHP Version:
4.3
Tags:
Complexity:
Sprint Focus:

Description

It was not possible to use the DIFF feature on Windows servers.

The site http://www.domain.com/typo3/sysext/version/cm1/index.php just returned black text, even if Content Elements of Live-Workspace and Draft-Workspace were different.

The diff.exe was executed, but the result was just in one element in the returned array.
In linux the command exec("diff.exe",array) returned an array with one element for each 'newline'.

Now I used the " WshShell.Exec" command, which at least returns 'newlines', this is then 'exploded' to an array for Windows.

The "diff.exe" - Path in the install tool needs to look like this:
[BE][diff_path] = C:\TYPO3_4.2.3\diff\diff.exe

Patch file is attached.

(issue imported from #M11674)


Files

class.t3lib_diff.php.patch (477 Bytes) class.t3lib_diff.php.patch Administrator Admin, 2009-08-09 06:05
Actions #1

Updated by Jonas Felix over 13 years ago

  • Target version deleted (0)

The current version with "exec()" works for me if you enclosure the path to files and command with a "":

Instead of:

$cmd = $GLOBALS['TYPO3_CONF_VARS']['BE']['diff_path'] . ' ' . $this->diffOptions . ' ' . $file1 . ' " . $file2 . '';

do this:

$cmd = '"' . $GLOBALS['TYPO3_CONF_VARS']['BE']['diff_path'] . '" ' . $this->diffOptions . ' "' . $file1 . '" "' . $file2 . '"';

Then I installed UnxUtils with diff.exe...

complete code:


/**
 * This class has functions which generates a difference output of a content string
 *
 * @author    Kasper Skårhøj <kasperYYYY@typo3.com>
 * @package TYPO3
 * @subpackage t3lib
 */
class t3lib_diff {
...
    /**
     * Produce a diff (using the "diff" application) between two strings
     * The function will write the two input strings to temporary files, then execute the diff program, delete the temp files and return the result.
     *
     * @param    string        String 1
     * @param    string        String 2
     * @return    array        The result from the exec() function call.
     * @access private
     */
    function getDiff($str1, $str2) {
            // Create file 1 and write string
        $file1 = t3lib_div::tempnam('diff1_');
        t3lib_div::writeFile($file1, $str1);
            // Create file 2 and write string
        $file2 = t3lib_div::tempnam('diff2_');
        t3lib_div::writeFile($file2, $str2);
            // Perform diff.
        $cmd = '"' . $GLOBALS['TYPO3_CONF_VARS']['BE']['diff_path'] . '" ' . $this->diffOptions . ' "' . $file1 . '" "' . $file2 . '"';
        $res = array();
        t3lib_utility_Command::exec($cmd, $res);

        unlink($file1);
        unlink($file2);

        return $res;
    }
Actions #2

Updated by Alexander Opitz over 11 years ago

  • Status changed from New to Needs Feedback
  • TYPO3 Version set to 4.2

The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?

Actions #3

Updated by Alexander Opitz about 11 years ago

  • Status changed from Needs Feedback to Closed

No feedback for over 90 days.

Actions

Also available in: Atom PDF