[TASK] Replace DiffUtility with PHP library to save disk I/O 82/43382/10
authorMathias Schreiber <mathias.schreiber@wmdb.de>
Wed, 16 Sep 2015 19:42:16 +0000 (21:42 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Thu, 17 Sep 2015 05:37:23 +0000 (07:37 +0200)
In order to make diff displays work cross platform and save A LOT of
disk I/O we replace the questionable approach with a slick PHP library

Resolves: #69904
Releases: master
Change-Id: Ifd76f32d2102f895d61de085142195dc1dbbc2ed
Reviewed-on: http://review.typo3.org/43382
Reviewed-by: Benjamin Kott <info@bk2k.info>
Tested-by: Benjamin Kott <info@bk2k.info>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
12 files changed:
Build/Resources/Public/Less/Component/diff.less [new file with mode: 0644]
Build/Resources/Public/Less/TYPO3/_element_history.less [deleted file]
Build/Resources/Public/Less/_minimal.less
Build/Resources/Public/Less/backend.less
composer.json
composer.lock
typo3/sysext/backend/Classes/History/RecordHistory.php
typo3/sysext/core/Classes/Utility/DiffUtility.php
typo3/sysext/core/Configuration/DefaultConfiguration.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-69904-RemoveSettingDiff_pathFromDefaultConfiguration.rst [new file with mode: 0644]
typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php
typo3/sysext/t3skin/Resources/Public/Css/backend.css

diff --git a/Build/Resources/Public/Less/Component/diff.less b/Build/Resources/Public/Less/Component/diff.less
new file mode 100644 (file)
index 0000000..772178d
--- /dev/null
@@ -0,0 +1,75 @@
+//
+// Diff
+// ====
+// Used for comparision of records
+//
+//
+// Example Usage
+// -------------
+//
+// <div class="diff">
+//   <div class="div-item">
+//     <div class="diff-title">
+//       ...
+//     </div>
+//     <div class="diff-result">
+//       ...
+//     </div>
+//   </div>
+// </div>
+//
+
+
+//
+// Variables
+//
+@diff-bgcolor:         #fff;
+@diff-border:          #ccc;
+@diff-color-remove:    #c83c3c;
+@diff-color-add:       #79a548;
+@diff-padding:         10px;
+@diff-title-bgcolor:   #fafafa;
+
+
+//
+// Component
+//
+.diff {
+       background-color: @diff-bgcolor;
+       border: 1px solid @diff-border;
+}
+.diff-item {
+       display: table;
+       table-layout: fixed;
+       width: 100%;
+       + .diff-item {
+               border-top: 1px solid @diff-border;
+       }
+}
+.diff-item-title,
+.diff-item-result {
+       padding: @diff-padding;
+       display: table-cell;
+}
+.diff-item-title {
+       background-color: @diff-title-bgcolor;
+       width: 120px;
+       padding-right: 10px;
+       font-style: italic;
+}
+.diff-item-result {
+       font-family: @font-family-monospace;
+       white-space: pre;
+       word-break: break-all;
+    word-wrap: break-word;
+       del {
+               color: @diff-color-remove;
+               background-color: lighten(@diff-color-remove, 45%);
+               text-decoration: none;
+       }
+       ins {
+               color: @diff-color-add;
+               background-color: lighten(@diff-color-add, 45%);
+               text-decoration: none;
+       }
+}
diff --git a/Build/Resources/Public/Less/TYPO3/_element_history.less b/Build/Resources/Public/Less/TYPO3/_element_history.less
deleted file mode 100644 (file)
index f25d053..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-//
-// History / Undo
-//
-
-table#typo3-history,
-table#typo3-history-item {
-       tr.c-head td {
-               font-weight: bold;
-       }
-
-       tr {
-               td {
-                       vertical-align: top;
-
-               }
-       }
-
-       img {
-               margin: 1px;
-       }
-}
index 310e5ec..8e1564a 100644 (file)
@@ -73,6 +73,7 @@
 @import "Component/avatar.less";
 @import "Component/callout.less";
 @import "Component/icon.less";
+@import "Component/diff.less";
 
 //
 // Bootstrap Utility classes
index 6535c4d..dd32b7e 100644 (file)
@@ -36,7 +36,6 @@
 @import "TYPO3/_element_csh.less";
 @import "TYPO3/_element_csm.less";
 @import "TYPO3/_element_docheader.less";
-@import "TYPO3/_element_history.less";
 @import "TYPO3/_element_message.less";
 @import "TYPO3/_element_modal.less";
 @import "TYPO3/_element_pagetree.less";
index cbd1c79..6e0e734 100644 (file)
@@ -41,7 +41,8 @@
                "doctrine/instantiator": "~1.0.4",
                "helhum/class-alias-loader": "^2.0.0",
                "typo3/cms-composer-installers": "^1.2.2",
-               "psr/http-message": "~1.0"
+               "psr/http-message": "~1.0",
+               "cogpowered/finediff": "*"
        },
        "require-dev": {
                "mikey179/vfsStream": "1.4.*@dev",
index d41e44d..b4aa5d8 100644 (file)
@@ -4,9 +4,60 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "hash": "77eccc9c2f6ef6123c30ddd10cc8039b",
+    "hash": "6b28192fe4297e8c315a5303234d4a0d",
     "packages": [
         {
+            "name": "cogpowered/finediff",
+            "version": "0.3.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/cogpowered/FineDiff.git",
+                "reference": "339ddc8c3afb656efed4f2f0a80e5c3d026f8ea8"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/cogpowered/FineDiff/zipball/339ddc8c3afb656efed4f2f0a80e5c3d026f8ea8",
+                "reference": "339ddc8c3afb656efed4f2f0a80e5c3d026f8ea8",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.0"
+            },
+            "require-dev": {
+                "mockery/mockery": "*",
+                "phpunit/phpunit": "*"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-0": {
+                    "cogpowered\\FineDiff": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Rob Crowe",
+                    "email": "rob@cogpowered.com"
+                },
+                {
+                    "name": "Raymond Hill"
+                }
+            ],
+            "description": "PHP implementation of a Fine granularity Diff engine",
+            "homepage": "https://github.com/cogpowered/FineDiff",
+            "keywords": [
+                "diff",
+                "finediff",
+                "opcode",
+                "string",
+                "text"
+            ],
+            "time": "2014-05-19 10:25:02"
+        },
+        {
             "name": "doctrine/instantiator",
             "version": "1.0.5",
             "source": {
         },
         {
             "name": "symfony/console",
-            "version": "v2.7.3",
+            "version": "v2.7.4",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/Console.git",
-                "reference": "d6cf02fe73634c96677e428f840704bfbcaec29e"
+                "reference": "9ff9032151186bd66ecee727d728f1319f52d1d8"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/Console/zipball/d6cf02fe73634c96677e428f840704bfbcaec29e",
-                "reference": "d6cf02fe73634c96677e428f840704bfbcaec29e",
+                "url": "https://api.github.com/repos/symfony/Console/zipball/9ff9032151186bd66ecee727d728f1319f52d1d8",
+                "reference": "9ff9032151186bd66ecee727d728f1319f52d1d8",
                 "shasum": ""
             },
             "require": {
             ],
             "description": "Symfony Console Component",
             "homepage": "https://symfony.com",
-            "time": "2015-07-28 15:18:12"
+            "time": "2015-09-03 11:40:38"
         },
         {
             "name": "symfony/finder",
-            "version": "v2.7.3",
+            "version": "v2.7.4",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/Finder.git",
-                "reference": "ae0f363277485094edc04c9f3cbe595b183b78e4"
+                "reference": "fff4b0c362640a0ab7355e2647b3d461608e9065"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/Finder/zipball/ae0f363277485094edc04c9f3cbe595b183b78e4",
-                "reference": "ae0f363277485094edc04c9f3cbe595b183b78e4",
+                "url": "https://api.github.com/repos/symfony/Finder/zipball/fff4b0c362640a0ab7355e2647b3d461608e9065",
+                "reference": "fff4b0c362640a0ab7355e2647b3d461608e9065",
                 "shasum": ""
             },
             "require": {
             ],
             "description": "Symfony Finder Component",
             "homepage": "https://symfony.com",
-            "time": "2015-07-09 16:07:40"
+            "time": "2015-08-26 17:56:37"
         },
         {
             "name": "typo3/cms-composer-installers",
     ],
     "packages-dev": [
         {
-            "name": "facebook/webdriver",
-            "version": "1.0.2",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/facebook/php-webdriver.git",
-                "reference": "fe1bbbc5dde804d08a8593f1d9d0d3b05f5c84f5"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/fe1bbbc5dde804d08a8593f1d9d0d3b05f5c84f5",
-                "reference": "fe1bbbc5dde804d08a8593f1d9d0d3b05f5c84f5",
-                "shasum": ""
-            },
-            "require": {
-                "php": ">=5.3.19"
-            },
-            "require-dev": {
-                "phpunit/phpunit": "4.6.*"
-            },
-            "suggest": {
-                "phpdocumentor/phpdocumentor": "2.*"
-            },
-            "type": "library",
-            "autoload": {
-                "psr-4": {
-                    "Facebook\\WebDriver\\": "lib/"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "Apache-2.0"
-            ],
-            "description": "A PHP client for WebDriver",
-            "homepage": "https://github.com/facebook/php-webdriver",
-            "keywords": [
-                "facebook",
-                "php",
-                "selenium",
-                "webdriver"
-            ],
-            "time": "2015-08-12 20:21:31"
-        },
-        {
-            "name": "guzzlehttp/guzzle",
-            "version": "6.1.0",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/guzzle/guzzle.git",
-                "reference": "66fd14b4d0b8f2389eaf37c5458608c7cb793a81"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/guzzle/guzzle/zipball/66fd14b4d0b8f2389eaf37c5458608c7cb793a81",
-                "reference": "66fd14b4d0b8f2389eaf37c5458608c7cb793a81",
-                "shasum": ""
-            },
-            "require": {
-                "guzzlehttp/promises": "~1.0",
-                "guzzlehttp/psr7": "~1.1",
-                "php": ">=5.5.0"
-            },
-            "require-dev": {
-                "ext-curl": "*",
-                "phpunit/phpunit": "~4.0",
-                "psr/log": "~1.0"
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "6.1-dev"
-                }
-            },
-            "autoload": {
-                "files": [
-                    "src/functions_include.php"
-                ],
-                "psr-4": {
-                    "GuzzleHttp\\": "src/"
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Michael Dowling",
-                    "email": "mtdowling@gmail.com",
-                    "homepage": "https://github.com/mtdowling"
-                }
-            ],
-            "description": "Guzzle is a PHP HTTP client library",
-            "homepage": "http://guzzlephp.org/",
-            "keywords": [
-                "client",
-                "curl",
-                "framework",
-                "http",
-                "http client",
-                "rest",
-                "web service"
-            ],
-            "time": "2015-09-08 17:36:26"
-        },
-        {
-            "name": "guzzlehttp/promises",
-            "version": "1.0.2",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/guzzle/promises.git",
-                "reference": "97fe7210def29451ec74923b27e552238defd75a"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/guzzle/promises/zipball/97fe7210def29451ec74923b27e552238defd75a",
-                "reference": "97fe7210def29451ec74923b27e552238defd75a",
-                "shasum": ""
-            },
-            "require": {
-                "php": ">=5.5.0"
-            },
-            "require-dev": {
-                "phpunit/phpunit": "~4.0"
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "1.0-dev"
-                }
-            },
-            "autoload": {
-                "psr-4": {
-                    "GuzzleHttp\\Promise\\": "src/"
-                },
-                "files": [
-                    "src/functions_include.php"
-                ]
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Michael Dowling",
-                    "email": "mtdowling@gmail.com",
-                    "homepage": "https://github.com/mtdowling"
-                }
-            ],
-            "description": "Guzzle promises library",
-            "keywords": [
-                "promise"
-            ],
-            "time": "2015-08-15 19:37:21"
-        },
-        {
-            "name": "guzzlehttp/psr7",
-            "version": "1.2.0",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/guzzle/psr7.git",
-                "reference": "4ef919b0cf3b1989523138b60163bbcb7ba1ff7e"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/guzzle/psr7/zipball/4ef919b0cf3b1989523138b60163bbcb7ba1ff7e",
-                "reference": "4ef919b0cf3b1989523138b60163bbcb7ba1ff7e",
-                "shasum": ""
-            },
-            "require": {
-                "php": ">=5.4.0",
-                "psr/http-message": "~1.0"
-            },
-            "provide": {
-                "psr/http-message-implementation": "1.0"
-            },
-            "require-dev": {
-                "phpunit/phpunit": "~4.0"
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "1.0-dev"
-                }
-            },
-            "autoload": {
-                "psr-4": {
-                    "GuzzleHttp\\Psr7\\": "src/"
-                },
-                "files": [
-                    "src/functions_include.php"
-                ]
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Michael Dowling",
-                    "email": "mtdowling@gmail.com",
-                    "homepage": "https://github.com/mtdowling"
-                }
-            ],
-            "description": "PSR-7 message implementation",
-            "keywords": [
-                "http",
-                "message",
-                "stream",
-                "uri"
-            ],
-            "time": "2015-08-15 19:32:36"
-        },
-        {
             "name": "mikey179/vfsStream",
             "version": "v1.4.0",
             "source": {
         },
         {
             "name": "phpunit/php-code-coverage",
-            "version": "2.2.2",
+            "version": "2.2.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
-                "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c"
+                "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2d7c03c0e4e080901b8f33b2897b0577be18a13c",
-                "reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c",
+                "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef1ca6835468857944d5c3b48fa503d5554cff2f",
+                "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f",
                 "shasum": ""
             },
             "require": {
                 "testing",
                 "xunit"
             ],
-            "time": "2015-08-04 03:42:39"
+            "time": "2015-09-14 06:51:16"
         },
         {
             "name": "phpunit/php-file-iterator",
         },
         {
             "name": "phpunit/php-token-stream",
-            "version": "1.4.6",
+            "version": "1.4.8",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/php-token-stream.git",
-                "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b"
+                "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3ab72c62e550370a6cd5dc873e1a04ab57562f5b",
-                "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b",
+                "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
+                "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da",
                 "shasum": ""
             },
             "require": {
             "keywords": [
                 "tokenizer"
             ],
-            "time": "2015-08-16 08:51:00"
+            "time": "2015-09-15 10:49:45"
         },
         {
             "name": "phpunit/phpunit",
-            "version": "4.8.6",
+            "version": "4.8.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
-                "reference": "2246830f4a1a551c67933e4171bf2126dc29d357"
+                "reference": "dab2ada9e9a503d2ec3c32fe0fb59dea9bdd9dfa"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2246830f4a1a551c67933e4171bf2126dc29d357",
-                "reference": "2246830f4a1a551c67933e4171bf2126dc29d357",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/dab2ada9e9a503d2ec3c32fe0fb59dea9bdd9dfa",
+                "reference": "dab2ada9e9a503d2ec3c32fe0fb59dea9bdd9dfa",
                 "shasum": ""
             },
             "require": {
                 "testing",
                 "xunit"
             ],
-            "time": "2015-08-24 04:09:38"
+            "time": "2015-09-14 06:57:22"
         },
         {
             "name": "phpunit/phpunit-mock-objects",
             "time": "2015-06-21 13:59:46"
         },
         {
-            "name": "symfony/browser-kit",
-            "version": "v2.7.4",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/symfony/BrowserKit.git",
-                "reference": "277a2457776d4cc25706fbdd9d1e4ab2dac884e4"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/277a2457776d4cc25706fbdd9d1e4ab2dac884e4",
-                "reference": "277a2457776d4cc25706fbdd9d1e4ab2dac884e4",
-                "shasum": ""
-            },
-            "require": {
-                "php": ">=5.3.9",
-                "symfony/dom-crawler": "~2.0,>=2.0.5"
-            },
-            "require-dev": {
-                "symfony/css-selector": "~2.0,>=2.0.5",
-                "symfony/phpunit-bridge": "~2.7",
-                "symfony/process": "~2.0,>=2.0.5"
-            },
-            "suggest": {
-                "symfony/process": ""
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "2.7-dev"
-                }
-            },
-            "autoload": {
-                "psr-4": {
-                    "Symfony\\Component\\BrowserKit\\": ""
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Fabien Potencier",
-                    "email": "fabien@symfony.com"
-                },
-                {
-                    "name": "Symfony Community",
-                    "homepage": "https://symfony.com/contributors"
-                }
-            ],
-            "description": "Symfony BrowserKit Component",
-            "homepage": "https://symfony.com",
-            "time": "2015-09-06 08:36:38"
-        },
-        {
-            "name": "symfony/css-selector",
-            "version": "v2.7.4",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/symfony/CssSelector.git",
-                "reference": "ffb5f3b8a75f8d1b9801e74dc6789a0751a670ad"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/symfony/CssSelector/zipball/ffb5f3b8a75f8d1b9801e74dc6789a0751a670ad",
-                "reference": "ffb5f3b8a75f8d1b9801e74dc6789a0751a670ad",
-                "shasum": ""
-            },
-            "require": {
-                "php": ">=5.3.9"
-            },
-            "require-dev": {
-                "symfony/phpunit-bridge": "~2.7"
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "2.7-dev"
-                }
-            },
-            "autoload": {
-                "psr-4": {
-                    "Symfony\\Component\\CssSelector\\": ""
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Jean-Fran├žois Simon",
-                    "email": "jeanfrancois.simon@sensiolabs.com"
-                },
-                {
-                    "name": "Fabien Potencier",
-                    "email": "fabien@symfony.com"
-                },
-                {
-                    "name": "Symfony Community",
-                    "homepage": "https://symfony.com/contributors"
-                }
-            ],
-            "description": "Symfony CssSelector Component",
-            "homepage": "https://symfony.com",
-            "time": "2015-08-24 07:13:45"
-        },
-        {
-            "name": "symfony/dom-crawler",
-            "version": "v2.7.4",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/symfony/DomCrawler.git",
-                "reference": "2a161e4ee2b2f33d4153be58df4f6f2a5506936e"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/2a161e4ee2b2f33d4153be58df4f6f2a5506936e",
-                "reference": "2a161e4ee2b2f33d4153be58df4f6f2a5506936e",
-                "shasum": ""
-            },
-            "require": {
-                "php": ">=5.3.9"
-            },
-            "require-dev": {
-                "symfony/css-selector": "~2.3",
-                "symfony/phpunit-bridge": "~2.7"
-            },
-            "suggest": {
-                "symfony/css-selector": ""
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "2.7-dev"
-                }
-            },
-            "autoload": {
-                "psr-4": {
-                    "Symfony\\Component\\DomCrawler\\": ""
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Fabien Potencier",
-                    "email": "fabien@symfony.com"
-                },
-                {
-                    "name": "Symfony Community",
-                    "homepage": "https://symfony.com/contributors"
-                }
-            ],
-            "description": "Symfony DomCrawler Component",
-            "homepage": "https://symfony.com",
-            "time": "2015-08-26 10:48:03"
-        },
-        {
-            "name": "symfony/event-dispatcher",
-            "version": "v2.7.4",
-            "source": {
-                "type": "git",
-                "url": "https://github.com/symfony/EventDispatcher.git",
-                "reference": "b58c916f1db03a611b72dd702564f30ad8fe83fa"
-            },
-            "dist": {
-                "type": "zip",
-                "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/b58c916f1db03a611b72dd702564f30ad8fe83fa",
-                "reference": "b58c916f1db03a611b72dd702564f30ad8fe83fa",
-                "shasum": ""
-            },
-            "require": {
-                "php": ">=5.3.9"
-            },
-            "require-dev": {
-                "psr/log": "~1.0",
-                "symfony/config": "~2.0,>=2.0.5",
-                "symfony/dependency-injection": "~2.6",
-                "symfony/expression-language": "~2.6",
-                "symfony/phpunit-bridge": "~2.7",
-                "symfony/stopwatch": "~2.3"
-            },
-            "suggest": {
-                "symfony/dependency-injection": "",
-                "symfony/http-kernel": ""
-            },
-            "type": "library",
-            "extra": {
-                "branch-alias": {
-                    "dev-master": "2.7-dev"
-                }
-            },
-            "autoload": {
-                "psr-4": {
-                    "Symfony\\Component\\EventDispatcher\\": ""
-                }
-            },
-            "notification-url": "https://packagist.org/downloads/",
-            "license": [
-                "MIT"
-            ],
-            "authors": [
-                {
-                    "name": "Fabien Potencier",
-                    "email": "fabien@symfony.com"
-                },
-                {
-                    "name": "Symfony Community",
-                    "homepage": "https://symfony.com/contributors"
-                }
-            ],
-            "description": "Symfony EventDispatcher Component",
-            "homepage": "https://symfony.com",
-            "time": "2015-08-24 07:13:45"
-        },
-        {
             "name": "symfony/yaml",
-            "version": "v2.7.3",
+            "version": "v2.7.4",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/Yaml.git",
-                "reference": "71340e996171474a53f3d29111d046be4ad8a0ff"
+                "reference": "2dc7b06c065df96cc686c66da2705e5e18aef661"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/Yaml/zipball/71340e996171474a53f3d29111d046be4ad8a0ff",
-                "reference": "71340e996171474a53f3d29111d046be4ad8a0ff",
+                "url": "https://api.github.com/repos/symfony/Yaml/zipball/2dc7b06c065df96cc686c66da2705e5e18aef661",
+                "reference": "2dc7b06c065df96cc686c66da2705e5e18aef661",
                 "shasum": ""
             },
             "require": {
             ],
             "description": "Symfony Yaml Component",
             "homepage": "https://symfony.com",
-            "time": "2015-07-28 14:07:07"
+            "time": "2015-08-24 07:13:45"
         }
     ],
     "aliases": [],
index d2af90a..f31d4a3 100644 (file)
@@ -528,7 +528,7 @@ class RecordHistory {
                                History (list):
                        -->
 
-                       <table class="table table-striped table-hover" id="typo3-history">
+                       <table class="table table-striped table-hover table-vertical-top" id="typo3-history">
                                ' . implode('', $lines) . '
                        </table>';
                if ($this->lastSyslogId) {
@@ -612,19 +612,18 @@ class RecordHistory {
                                                BackendUtility::getProcessedValue($table, $fN, $entry['newRecord'][$fN], 0, TRUE)
                                        );
                                        $lines[] = '
-                                               <tr class="bgColor4">
-                                               ' . ($rollbackUid ? '<td style="width:33px">' . $this->createRollbackLink(($table . ':' . $rollbackUid . ':' . $fN), $languageService->getLL('revertField', TRUE), 2) . '</td>' : '') . '
-                                                       <td style="width:90px"><em>' . $languageService->sl(BackendUtility::getItemLabel($table, $fN), TRUE) . '</em></td>
-                                                       <td style="width:300px">' . nl2br($diffres) . '</td>
-                                               </tr>';
+                                               <div class="diff-item">
+                                                       <div class="diff-item-title">
+                                                               ' . ($rollbackUid ? $this->createRollbackLink(($table . ':' . $rollbackUid . ':' . $fN), $languageService->getLL('revertField', TRUE), 2) : '') . '
+                                                               ' . $languageService->sl(BackendUtility::getItemLabel($table, $fN), TRUE) . '
+                                                       </div>
+                                                       <div class="diff-item-result">' . str_replace('\n', PHP_EOL, str_replace('\r\n', '\n', $diffres)) . '</div>
+                                               </div>';
                                }
                        }
                }
                if ($lines) {
-                       $content = '<table border="0" cellpadding="2" cellspacing="2" id="typo3-history-item">
-                                       ' . implode('', $lines) . '
-                               </table>';
-                       return $content;
+                       return '<div class="diff">' . implode('', $lines) . '</div>';
                }
                // error fallback
                return NULL;
index b243dbb..06ba824 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Core\Utility;
  *
  * The TYPO3 project - inspiring people to share!
  */
+use cogpowered\FineDiff\Diff;
 
 /**
  * This class has functions which generates a difference output of a content string
@@ -24,175 +25,21 @@ class DiffUtility {
         *
         * @var bool
         */
-       public $stripTags = 0;
-
-       /**
-        * Diff options. eg "--unified=3"
-        *
-        * @var string
-        */
-       public $diffOptions = '';
-
-       /**
-        * This indicates the number of times the function addClearBuffer has been called - and used to detect the very first call...
-        *
-        * @var int
-        */
-       public $clearBufferIdx = 0;
-
-       /**
-        * @var int
-        */
-       public $differenceLgd = 0;
+       public $stripTags = TRUE;
 
        /**
         * This will produce a color-marked-up diff output in HTML from the input strings.
         *
         * @param string $str1 String 1
         * @param string $str2 String 2
-        * @param string $wrapTag Setting the wrapping tag name
         * @return string Formatted output.
         */
-       public function makeDiffDisplay($str1, $str2, $wrapTag = 'span') {
+       public function makeDiffDisplay($str1, $str2) {
                if ($this->stripTags) {
                        $str1 = strip_tags($str1);
                        $str2 = strip_tags($str2);
-               } else {
-                       $str1 = $this->tagSpace($str1);
-                       $str2 = $this->tagSpace($str2);
-               }
-               $str1Lines = $this->explodeStringIntoWords($str1);
-               $str2Lines = $this->explodeStringIntoWords($str2);
-               $diffRes = $this->getDiff(implode(LF, $str1Lines) . LF, implode(LF, $str2Lines) . LF);
-               if (is_array($diffRes)) {
-                       $c = 0;
-                       $diffResArray = array();
-                       $differenceStr = '';
-                       foreach ($diffRes as $lValue) {
-                               if ((int)$lValue) {
-                                       $c = (int)$lValue;
-                                       $diffResArray[$c]['changeInfo'] = $lValue;
-                               }
-                               if ($lValue[0] === '<') {
-                                       $differenceStr .= ($diffResArray[$c]['old'][] = substr($lValue, 2));
-                               }
-                               if ($lValue[0] === '>') {
-                                       $differenceStr .= ($diffResArray[$c]['new'][] = substr($lValue, 2));
-                               }
-                       }
-                       $this->differenceLgd = strlen($differenceStr);
-                       $outString = '';
-                       $clearBuffer = '';
-                       $str1LinesCount = count($str1Lines);
-                       for ($a = -1; $a < $str1LinesCount; $a++) {
-                               if (is_array($diffResArray[$a + 1])) {
-                                       // a=Add, c=change, d=delete: If a, then the content is Added after the entry and we must insert the line content as well.
-                                       if (strstr($diffResArray[$a + 1]['changeInfo'], 'a')) {
-                                               $clearBuffer .= htmlspecialchars($str1Lines[$a]) . ' ';
-                                       }
-                                       $outString .= $this->addClearBuffer($clearBuffer);
-                                       $clearBuffer = '';
-                                       if (is_array($diffResArray[$a + 1]['old'])) {
-                                               $outString .= '<' . $wrapTag . ' class="text-danger">' . htmlspecialchars(implode(' ', $diffResArray[($a + 1)]['old'])) . '</' . $wrapTag . '> ';
-                                       }
-                                       if (is_array($diffResArray[$a + 1]['new'])) {
-                                               $outString .= '<' . $wrapTag . ' class="text-success">' . htmlspecialchars(implode(' ', $diffResArray[($a + 1)]['new'])) . '</' . $wrapTag . '> ';
-                                       }
-                                       $chInfParts = explode(',', $diffResArray[$a + 1]['changeInfo']);
-                                       if ((string)$chInfParts[0] === (string)($a + 1)) {
-                                               $newLine = (int)$chInfParts[1] - 1;
-                                               if ($newLine > $a) {
-                                                       $a = $newLine;
-                                               }
-                                       }
-                               } else {
-                                       $clearBuffer .= htmlspecialchars($str1Lines[$a]) . ' ';
-                               }
-                       }
-                       $outString .= $this->addClearBuffer($clearBuffer, 1);
-                       $outString = str_replace('  ', LF, $outString);
-                       if (!$this->stripTags) {
-                               $outString = $this->tagSpace($outString, 1);
-                       }
-                       return $outString;
-               }
-       }
-
-       /**
-        * 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 $str1 String 1
-        * @param string $str2 String 2
-        * @return array The result from the exec() function call.
-        * @access private
-        */
-       public function getDiff($str1, $str2) {
-               // Create file 1 and write string
-               $file1 = GeneralUtility::tempnam('diff1_');
-               GeneralUtility::writeFile($file1, $str1);
-               // Create file 2 and write string
-               $file2 = GeneralUtility::tempnam('diff2_');
-               GeneralUtility::writeFile($file2, $str2);
-               // Perform diff.
-               $cmd = $GLOBALS['TYPO3_CONF_VARS']['BE']['diff_path'] . ' ' . $this->diffOptions . ' ' . $file1 . ' ' . $file2;
-               $res = array();
-               CommandUtility::exec($cmd, $res);
-               unlink($file1);
-               unlink($file2);
-               return $res;
-       }
-
-       /**
-        * Will bring down the length of strings to < 150 chars if they were longer than 200 chars. This done by preserving the 70 first and last chars and concatenate those strings with "..." and a number indicating the string length
-        *
-        * @param string $clearBuffer The input string.
-        * @param bool $last If set, it indicates that the string should just end with ... (thus no "complete" ending)
-        * @return string Processed string.
-        * @access private
-        */
-       public function addClearBuffer($clearBuffer, $last = 0) {
-               if (strlen($clearBuffer) > 200) {
-                       $clearBuffer = ($this->clearBufferIdx ? GeneralUtility::fixed_lgd_cs($clearBuffer, 70) : '') . '[' . strlen($clearBuffer) . ']' . (!$last ? GeneralUtility::fixed_lgd_cs($clearBuffer, -70) : '');
                }
-               $this->clearBufferIdx++;
-               return $clearBuffer;
+               $diff = new Diff();
+               return $diff->render($str1, $str2);
        }
-
-       /**
-        * Explodes the input string into words.
-        * This is done by splitting first by lines, then by space char. Each word will be in stored as a value in an array. Lines will be indicated by two subsequent empty values.
-        *
-        * @param string $str The string input
-        * @return array Array with words.
-        * @access private
-        */
-       public function explodeStringIntoWords($str) {
-               $strArr = GeneralUtility::trimExplode(LF, $str);
-               $outArray = array();
-               foreach ($strArr as $lineOfWords) {
-                       $allWords = GeneralUtility::trimExplode(' ', $lineOfWords, TRUE);
-                       $outArray[] = $allWords;
-                       $outArray[] = array('');
-                       $outArray[] = array('');
-               }
-               return call_user_func_array('array_merge', $outArray);
-       }
-
-       /**
-        * Adds a space character before and after HTML tags (more precisely any found < or >)
-        *
-        * @param string $str String to process
-        * @param bool $rev If set, the < > searched for will be &lt; and &gt;
-        * @return string Processed string
-        * @access private
-        */
-       public function tagSpace($str, $rev = 0) {
-               if ($rev) {
-                       return str_replace(' &lt;', '&lt;', str_replace('&gt; ', '&gt;', $str));
-               } else {
-                       return str_replace('<', ' <', str_replace('>', '> ', $str));
-               }
-       }
-
 }
index 427e724..fb8507b 100644 (file)
@@ -508,7 +508,6 @@ return array(
                        'debug' => FALSE
                ),
                'unzip_path' => '',                                                             // Path to "unzip". Only specify the path here, do not include the program name, it is expected to be called "unzip".
-               'diff_path' => 'diff',                                                  // Path to "diff" including the program name. Example: /somepath/specialdiff<br />For Windows this program can be downloaded here: <a href="http://unxutils.sourceforge.net/" target="_blank">unxutils.sourceforge.net</a>
                'fileadminDir' => 'fileadmin/',                                 // Path to the fileadmin dir. This is relative to PATH_site, DefaultStorage will be created with that configuration, do not access manually but ResourceFactory::getDefaultStorage()
                'RTE_imageStorageDir' => 'uploads/',                    // Default storage directory for Rich Text Editor files
                'lockRootPath' => '',                                                   // This path is used to evaluate if paths outside of PATH_site should be allowed. Ending slash required!
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-69904-RemoveSettingDiff_pathFromDefaultConfiguration.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-69904-RemoveSettingDiff_pathFromDefaultConfiguration.rst
new file mode 100644 (file)
index 0000000..4b7df53
--- /dev/null
@@ -0,0 +1,27 @@
+=====================================================================
+Breaking: #69904 - Remove Setting diff_path from DefaultConfiguration
+=====================================================================
+
+Description
+===========
+
+Creating a diff view of text has been replaced with a PHP library instead of using ``diff`` on the command line.
+Thus we no longer need to be able to configure the path.
+
+
+Impact
+======
+
+The setting ``[BE][diff_path]`` will no longer have any effect.
+
+
+Affected Installations
+======================
+
+Any Installation that had to define a path different than ``diff``
+
+
+Migration
+=========
+
+Delete the line from LocalConfiguration.php
\ No newline at end of file
index c55f30a..3650c2d 100644 (file)
@@ -94,6 +94,8 @@ class SilentConfigurationUpgradeService {
                'SYS/caching/cacheConfigurations/cache_classes',
                // #68178
                'SYS/form_enctype',
+               // #69904
+               'BE/diff_path',
        );
 
        /**
index 6a71c81..8a6a7fc 100644 (file)
@@ -7877,6 +7877,45 @@ button.close {
 .icon-status-dialog-warning {
   color: #e8a33d;
 }
+.diff {
+  background-color: #ffffff;
+  border: 1px solid #cccccc;
+}
+.diff-item {
+  display: table;
+  table-layout: fixed;
+  width: 100%;
+}
+.diff-item + .diff-item {
+  border-top: 1px solid #cccccc;
+}
+.diff-item-title,
+.diff-item-result {
+  padding: 10px;
+  display: table-cell;
+}
+.diff-item-title {
+  background-color: #fafafa;
+  width: 120px;
+  padding-right: 10px;
+  font-style: italic;
+}
+.diff-item-result {
+  font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
+  white-space: pre;
+  word-break: break-all;
+  word-wrap: break-word;
+}
+.diff-item-result del {
+  color: #c83c3c;
+  background-color: #faefef;
+  text-decoration: none;
+}
+.diff-item-result ins {
+  color: #79a548;
+  background-color: #eaf2e1;
+  text-decoration: none;
+}
 .clearfix:before,
 .clearfix:after,
 .dl-horizontal dd:before,
@@ -9559,18 +9598,6 @@ div#contentMenu1 {
 #typo3-pagetree-topPanelItems #typo3-pagetree-topPanel .x-panel-body a:hover {
   color: #000;
 }
-table#typo3-history tr.c-head td,
-table#typo3-history-item tr.c-head td {
-  font-weight: bold;
-}
-table#typo3-history tr td,
-table#typo3-history-item tr td {
-  vertical-align: top;
-}
-table#typo3-history img,
-table#typo3-history-item img {
-  margin: 1px;
-}
 ul.typo3-messages {
   padding: 0;
 }