jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/348522 )
Change subject: Re-write the fix for T151294 which caused all graph links to be
the same.
......................................................................
Re-write the fix for T151294 which caused all graph links to be the same.
Bug: T163103
Change-Id: I4465483442339829398fc02bdc543a66b29b73f0
---
M GraphViz.php
M GraphViz_body.php
M RELEASE-NOTES.md
M composer.json
A phpcs.xml
5 files changed, 30 insertions(+), 9 deletions(-)
Approvals:
Welterkj: Verified; Looks good to me, approved
jenkins-bot: Verified
Samwilson: Looks good to me, but someone else must approve
diff --git a/GraphViz.php b/GraphViz.php
index 7299154..7752351 100644
--- a/GraphViz.php
+++ b/GraphViz.php
@@ -33,7 +33,7 @@
if ( !defined( 'MEDIAWIKI' ) ) die();
-define( 'GraphViz_VERSION', '2.0.0' );
+define( 'GraphViz_VERSION', '2.0.1' );
/**
* The GraphViz settings class.
diff --git a/GraphViz_body.php b/GraphViz_body.php
index 6307289..c13c06a 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -980,11 +980,16 @@
// has already encoded them and we want to pass
them to ImageMap::render
// unencoded.
$hrefPattern = '~href="([^"]+)"~';
- preg_match( $hrefPattern, $map, $matches );
- if ( isset( $matches[1] ) ) {
- $decodedHref =
Sanitizer::decodeCharReferences( $matches[1] );
- $map = preg_replace( $hrefPattern,
"href=\"$decodedHref\"", $map );
- }
+ $map = preg_replace_callback(
+ $hrefPattern,
+ function ( $matches ) {
+ if ( $matches[1] !== '' ) {
+ $decoded =
Sanitizer::decodeCharReferences( $matches[1] );
+ return 'href="' .
$decoded . '"';
+ }
+ return $matches[0];
+ },
+ $map );
// reorder map lines to the pattern shape name,
coordinates, URL
$map = preg_replace(
'~.+shape="([^"]+).+href="([^"]+).+coords="([^"]+).+~',
@@ -995,6 +1000,8 @@
// eliminate blank lines (platform independent)
$map =
preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", '', $map);
+ wfDebug( __METHOD__ . ": map($map)\n" ); //KJW
+
// write the normalized map contents back to the file
if ( file_put_contents( $mapPath, $map ) === false ) {
wfDebug( __METHOD__ . ": file_put_contents(
$mapPath, map ) failed.\n" );
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index cc0221a..f6c5b4e 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -1,5 +1,8 @@
These are the release notes for the [MediaWiki][mediawiki] [GraphViz
extension][gv_ext].
+## GraphViz 2.0.0 ## (2017-4-18)
+* Fix for [bug T163103](https://phabricator.wikimedia.org/T163103).
+
## GraphViz 2.0.0 ## (2017-3-23)
* Redesign to eliminate creation of file pages for uploaded graph images.
* Fix for [bug T100795](https://phabricator.wikimedia.org/T100795).
diff --git a/composer.json b/composer.json
index 2229e6f..9a4d238 100644
--- a/composer.json
+++ b/composer.json
@@ -29,11 +29,14 @@
]
},
"require-dev": {
- "jakub-onderka/php-parallel-lint": "0.9.2"
+ "jakub-onderka/php-parallel-lint": "0.9.2",
+ "mediawiki/mediawiki-codesniffer": "0.7.2"
},
"scripts": {
"test": [
- "parallel-lint . --exclude vendor"
- ]
+ "parallel-lint . --exclude vendor",
+ "phpcs -p -s"
+ ],
+ "fix": "phpcbf"
}
}
diff --git a/phpcs.xml b/phpcs.xml
new file mode 100644
index 0000000..d81a292
--- /dev/null
+++ b/phpcs.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<ruleset>
+ <rule ref="vendor/mediawiki/mediawiki-codesniffer/MediaWiki"/>
+ <file>.</file>
+ <arg name="extensions" value="php,php5,inc"/>
+ <arg name="encoding" value="utf8"/>
+ <exclude-pattern>vendor</exclude-pattern>
+</ruleset>
--
To view, visit https://gerrit.wikimedia.org/r/348522
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4465483442339829398fc02bdc543a66b29b73f0
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj <[email protected]>
Gerrit-Reviewer: Samwilson <[email protected]>
Gerrit-Reviewer: Welterkj <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits