[MediaWiki-commits] [Gerrit] mediawiki...GraphViz[master]: Improve some parameter docs

2018-01-19 Thread Welterkj (Code Review)
Welterkj has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/402651 )

Change subject: Improve some parameter docs
..


Improve some parameter docs

Change-Id: I3ff96ec363776a12be0cc5247b3de74d172c6bd9
---
M .phpcs.xml
M includes/GraphViz.php
M includes/UploadFromLocalFile.php
M includes/UploadLocalFile.php
4 files changed, 98 insertions(+), 54 deletions(-)

Approvals:
  Welterkj: Verified; Looks good to me, approved
  Samwilson: Looks good to me, but someone else must approve



diff --git a/.phpcs.xml b/.phpcs.xml
index f9408cd..6cbe822 100644
--- a/.phpcs.xml
+++ b/.phpcs.xml
@@ -6,8 +6,6 @@



-   
-   

.

diff --git a/includes/GraphViz.php b/includes/GraphViz.php
index c1f5d91..bcfc101 100644
--- a/includes/GraphViz.php
+++ b/includes/GraphViz.php
@@ -185,7 +185,8 @@
/**
 * Check if a given image type is probably allowed to be uploaded
 * (does not consult any file extension blacklists).
-* @param[in] string $imageType is the type of image (e.g. png) to 
check.
+* @param string $imageType is the type of image (e.g. png) to check.
+* @return bool
 * @author Keith Welter
 */
public static function imageTypeAllowed( $imageType ) {
@@ -201,6 +202,7 @@
/**
 * Set parser hook functions for supported graph types.
 * @author Keith Welter
+* @param Parser &$parser
 * @return true
 */
public static function onParserInit( Parser &$parser ) {
@@ -213,6 +215,10 @@
/**
 * When an article is deleted, delete all the associated graph files.
 * @author Keith Welter
+* @param Article &$article
+* @param User &$user
+* @param string $reason
+* @param int $id
 */
public static function onArticleDeleteComplete( &$article, User &$user, 
$reason, $id ) {
self::deleteArticleUploadedFiles( $article, self::getImageDir() 
);
@@ -223,6 +229,8 @@
/**
 * For a given title, get the corresponding graph file base name.
 * @author Keith Welter
+* @param Title $title
+* @return string
 */
public static function getGraphFileBaseNameFromTitle( $title ) {
$baseName = $title->getFulltext();
@@ -233,6 +241,8 @@
/**
 * Delete all the graph files associated with the given article and 
path.
 * @author Keith Welter
+* @param Article $article
+* @param string $path
 */
public static function deleteArticleFiles( $article, $path ) {
$title = $article->getTitle();
@@ -244,6 +254,8 @@
 
/**
 * Detect if the given title has associated graph files at the given 
path.
+* @param Title $title
+* @param string $path
 * @return True if the title has associated graph files.  Otherwise 
false.
 * @author Keith Welter
 */
@@ -262,6 +274,8 @@
/**
 * Delete all uploaded files associated with the given article and path.
 * @author Keith Welter
+* @param Article $article
+* @param string $path
 */
public static function deleteArticleUploadedFiles( $article, $path ) {
wfDebug( __METHOD__ . ": entering\n" );
@@ -280,6 +294,8 @@
/**
 * Delete all the graph files associated with the graph name and path.
 * @author Keith Welter
+* @param string $graphName
+* @param string $path
 */
public static function deleteGraphFiles( $graphName, $path ) {
$globPattern = $path . $graphName . "*.*";
@@ -293,6 +309,10 @@
 * the parser cache reflects the canceled edit rather than the saved 
graph so we must
 * reject it.
 * @author Keith Welter
+* @param ParserOutput $parserOutput
+* @param WikiPage $wikiPage
+* @param ParserOptions $parserOptions
+* @return bool
 */
public static function onRejectParserCacheValue( $parserOutput, 
$wikiPage, $parserOptions ) {
$title = $wikiPage->getTitle();
@@ -313,6 +333,16 @@
 * (graph images for which the source wiki text has been deleted).
 * Graph images for extant wiki source will be regenerated when parsed.
 * @author Keith Welter
+* @param \WikiPage $wikiPage
+* @param User $user
+* @param Content $content
+* @param string $summary
+* @param bool $isMinor
+* @param bool $isWatch
+* @param string|int $section
+* @param int $flags
+* @param Status $status
+* @return true
 */
public static function onPageContentSave(
\WikiPage $wikiPage, $user, $content,
@@ -329,7 +359,7 @@
}
 
 

[MediaWiki-commits] [Gerrit] mediawiki...GraphViz[master]: Re-write the fix for T151294 which caused all graph links to...

2017-04-17 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review. ( 
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
2 files changed, 13 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/22/348522/1

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..d07178a 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" );

-- 
To view, visit https://gerrit.wikimedia.org/r/348522
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4465483442339829398fc02bdc543a66b29b73f0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki...GraphViz[master]: Redesign to eliminate creation of file pages for graph images.

2017-03-23 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/344483 )

Change subject: Redesign to eliminate creation of file pages for graph images.
..

Redesign to eliminate creation of file pages for graph images.

Bug: T100795
Change-Id: I3aa5957899aad85a9a443a07aed369c60aeb7a49
---
M GraphViz.php
M GraphViz_body.php
M RELEASE-NOTES.md
M UploadLocalFile.php
4 files changed, 347 insertions(+), 683 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/83/344483/1

diff --git a/GraphViz.php b/GraphViz.php
index 1739841..7299154 100644
--- a/GraphViz.php
+++ b/GraphViz.php
@@ -33,7 +33,7 @@
 
 if ( !defined( 'MEDIAWIKI' ) ) die();
 
-define( 'GraphViz_VERSION', '1.6.1' );
+define( 'GraphViz_VERSION', '2.0.0' );
 
 /**
  * The GraphViz settings class.
@@ -106,12 +106,10 @@
$GLOBALS['wgAutoloadClasses']['UploadLocalFile'] = $dir . 
"UploadLocalFile.php";
$GLOBALS['wgAutoloadClasses']['UploadFromLocalFile'] = $dir . 
"UploadLocalFile.php";
$GLOBALS['wgHooks']['ParserFirstCallInit'][] = 'GraphViz::onParserInit';
-   $GLOBALS['wgHooks']['OutputPageParserOutput'][] = 
'GraphViz::onOutputPageParserOutput';
$GLOBALS['wgHooks']['ArticleDeleteComplete'][] = 
'GraphViz::onArticleDeleteComplete';
$GLOBALS['wgHooks']['UnitTestsList'][] = 'GraphViz::onUnitTestsList';
$GLOBALS['wgHooks']['PageContentSave'][] = 
'GraphViz::onPageContentSave';
-   $GLOBALS['wgHooks']['PageContentSaveComplete'][] = 
'GraphViz::onPageContentSaveComplete';
-   $GLOBALS['wgHooks']['EditPageGetPreviewContent'][] = 
'GraphViz::onEditPageGetPreviewContent';
+   $GLOBALS['wgHooks']['RejectParserCacheValue'][] = 
'GraphViz::onRejectParserCacheValue';
$GLOBALS['wgExtensionCredits']['parserhook'][] = array(
'name' => 'Graphviz',
'path' => __FILE__,
diff --git a/GraphViz_body.php b/GraphViz_body.php
index 43d6d45..3e233f1 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -99,14 +99,6 @@
const IMAGE_SUBDIR = "images/";
 
/**
-* The basename to use for dummy graph image files.
-* @see GraphViz::createDummyImageFilePage
-*
-* @var string IMAGE_DUMMY
-*/
-   const IMAGE_DUMMY = "File_graph_GraphVizExtensionDummy_dot";
-
-   /**
 * Used as an array key in GraphViz::$graphTypes and other arrays.
 * It must be a unique value in GraphViz::$graphTypes.
 *
@@ -121,13 +113,6 @@
 * @var integer MSCGEN
 */
const MSCGEN = 1;
-
-   /**
-* The name of the root category containing pages created by this 
extension.
-*
-* @var integer ROOT_CATEGORY
-*/
-   const ROOT_CATEGORY = "GraphViz";
 
/**
 * A list of dot attributes that are forbidden.
@@ -179,63 +164,6 @@
);
 
/**
-* A two dimensional array of graph related state.
-* The array keys of the first dimension are the list of article titles 
being saved.
-* The array keys of the second dimension are the list of active graph 
files for a given title being saved.
-* @var array $titlesBeingSaved
-*/
-   private static $titlesBeingSaved = array();
-
-   /**
-* A variable for temporarily holding a copy of GLOBALS['wgHooks'].
-* @var $disabledHooks
-*/
-   private static $disabledHooks = null;
-
-   /**
-* Disable all hook functions (GLOBALS['wgHooks']).
-* @author Keith Welter
-* @return true upon success, false upon failure.
-*/
-   protected static function disableHooks() {
-   if ( isset( $GLOBALS['wgHooks'] ) ) {
-   if ( isset( self::$disabledHooks ) ) {
-   wfDebug( __METHOD__ . ": hooks already 
disabled\n" );
-   } else {
-   self::$disabledHooks = $GLOBALS['wgHooks'];
-   $GLOBALS['wgHooks'] = null;
-   wfDebug( __METHOD__ . ": hooks disabled\n" );
-   return true;
-   }
-   } else {
-   wfDebug( __METHOD__ . ": hooks not set\n" );
-   }
-   return false;
-   }
-
-   /**
-* Re-enable all hook functions (GLOBALS['wgHooks']).
-* Must be called after GraphViz::disableHooks.
-* @author Keith Welter
-* @return true upon success, false upon failure.
-*/
-   protected static function enableHooks() {
-   if ( isset( self::$disabledHooks ) ) {
-   if ( isset( $GLOBALS['wgHooks'] ) ) {
-   wfDebug( __METHOD__ . ": hooks are already set 
- aborting\n" );
-   } else {
-  

[MediaWiki-commits] [Gerrit] Provide missing license label to show on "Special:Version" - change (mediawiki...GraphViz)

2016-04-14 Thread Welterkj (Code Review)
Welterkj has submitted this change and it was merged.

Change subject: Provide missing license label to show on "Special:Version"
..


Provide missing license label to show on "Special:Version"

Bug: T123943
Change-Id: Ib40c91a912ec4c585d212e2c7d3286807ff9bcfc
---
M GraphViz.php
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Welterkj: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/GraphViz.php b/GraphViz.php
index 9468fcf..b559a95 100644
--- a/GraphViz.php
+++ b/GraphViz.php
@@ -134,6 +134,7 @@
'[mailto://welt...@gmail.com Keith Welter]'
),
'url' => 'https://www.mediawiki.org/wiki/Extension:GraphViz',
-   'descriptionmsg' => 'graphviz-desc'
+   'descriptionmsg' => 'graphviz-desc',
+   'license-name' => 'GPL-2.0+'
);
 } );

-- 
To view, visit https://gerrit.wikimedia.org/r/283397
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib40c91a912ec4c585d212e2c7d3286807ff9bcfc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Kghbln 
Gerrit-Reviewer: Legoktm 
Gerrit-Reviewer: Welterkj 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Update release notes for version 1.6.1. - change (mediawiki...GraphViz)

2015-06-16 Thread Welterkj (Code Review)
Welterkj has submitted this change and it was merged.

Change subject: Update release notes for version 1.6.1.
..


Update release notes for version 1.6.1.

Change-Id: Ib62c1ab19e4a0e9afe9e5eaa8d9ac23e1e6ee715
---
M GraphViz.php
M RELEASE-NOTES.md
2 files changed, 5 insertions(+), 2 deletions(-)

Approvals:
  Welterkj: Verified; Looks good to me, approved



diff --git a/GraphViz.php b/GraphViz.php
index 0b9ca20..9468fcf 100644
--- a/GraphViz.php
+++ b/GraphViz.php
@@ -33,7 +33,7 @@
 
 if ( !defined( 'MEDIAWIKI' ) ) die();
 
-define( 'GraphViz_VERSION', '1.6.0' );
+define( 'GraphViz_VERSION', '1.6.1' );
 
 /**
  * The GraphViz settings class.
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index e094615..c971727 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -1,7 +1,10 @@
 These are the release notes for the [MediaWiki][mediawiki] [GraphViz 
extension][gv_ext].
 
-## GraphViz 1.6.1 ## (not released yet)
+## GraphViz 1.6.1 ## (2015-6-16)
 * Fix for [bug T89325](https://phabricator.wikimedia.org/T89325).
+* Fix for [bug T97596](https://phabricator.wikimedia.org/T97596).
+* Fix for [bug T97603](https://phabricator.wikimedia.org/T97603).
+* Fix for [bug T98500](https://phabricator.wikimedia.org/T98500).
 
 ## GraphViz 1.6.0 ## (2015-3-26)
 * Make the category pages created by this extension optional, non-empty and do 
not tag “dummy” images as belonging to a category.

-- 
To view, visit https://gerrit.wikimedia.org/r/218675
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib62c1ab19e4a0e9afe9e5eaa8d9ac23e1e6ee715
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Update release notes for version 1.6.1. - change (mediawiki...GraphViz)

2015-06-16 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/218675

Change subject: Update release notes for version 1.6.1.
..

Update release notes for version 1.6.1.

Change-Id: Ib62c1ab19e4a0e9afe9e5eaa8d9ac23e1e6ee715
---
M GraphViz.php
M RELEASE-NOTES.md
2 files changed, 5 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/75/218675/1

diff --git a/GraphViz.php b/GraphViz.php
index 0b9ca20..9468fcf 100644
--- a/GraphViz.php
+++ b/GraphViz.php
@@ -33,7 +33,7 @@
 
 if ( !defined( 'MEDIAWIKI' ) ) die();
 
-define( 'GraphViz_VERSION', '1.6.0' );
+define( 'GraphViz_VERSION', '1.6.1' );
 
 /**
  * The GraphViz settings class.
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index e094615..c971727 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -1,7 +1,10 @@
 These are the release notes for the [MediaWiki][mediawiki] [GraphViz 
extension][gv_ext].
 
-## GraphViz 1.6.1 ## (not released yet)
+## GraphViz 1.6.1 ## (2015-6-16)
 * Fix for [bug T89325](https://phabricator.wikimedia.org/T89325).
+* Fix for [bug T97596](https://phabricator.wikimedia.org/T97596).
+* Fix for [bug T97603](https://phabricator.wikimedia.org/T97603).
+* Fix for [bug T98500](https://phabricator.wikimedia.org/T98500).
 
 ## GraphViz 1.6.0 ## (2015-3-26)
 * Make the category pages created by this extension optional, non-empty and do 
not tag “dummy” images as belonging to a category.

-- 
To view, visit https://gerrit.wikimedia.org/r/218675
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib62c1ab19e4a0e9afe9e5eaa8d9ac23e1e6ee715
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Display DOT syntax warnings when they occur. - change (mediawiki...GraphViz)

2015-05-07 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/209534

Change subject: Display DOT syntax warnings when they occur.
..

Display DOT syntax warnings when they occur.

Bug: T98500
Change-Id: I6dbaf54d96f5692a7013cb5726bd70473d7ccf1e
---
M GraphViz_body.php
1 file changed, 2 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/34/209534/1

diff --git a/GraphViz_body.php b/GraphViz_body.php
index 5e5fb9a..2adb1c7 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -1098,7 +1098,6 @@
// execute the image creation command
if ( !self::executeCommand( 
$graphParms-getImageCommand( $isPreview ), $errorText ) )
{
-   wfDebug( __METHOD__ . : $errorText\n );
self::deleteFiles( $graphParms, $isPreview, 
false );
 
// remove path info from the errorText
@@ -1124,7 +1123,6 @@
// execute the map creation command
if ( !self::executeCommand( $graphParms-getMapCommand( 
$isPreview ), $errorText ) )
{
-   wfDebug( __METHOD__ . : $errorText\n );
self::deleteFiles( $graphParms, $isPreview, 
false );
 
// remove path info from the errorText (file 
base names are allowed to pass)
@@ -1461,7 +1459,8 @@
}
$output = wfShellExec( $command, $ret );
 
-   if ( $ret != 0 ) {
+   if ( $ret != 0 || $output ) {
+   wfDebug( __METHOD__ . : command: $command ret: $ret 
output: $output\n );
return false;
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/209534
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6dbaf54d96f5692a7013cb5726bd70473d7ccf1e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Display DOT syntax warnings when they occur. - change (mediawiki...GraphViz)

2015-05-07 Thread Welterkj (Code Review)
Welterkj has submitted this change and it was merged.

Change subject: Display DOT syntax warnings when they occur.
..


Display DOT syntax warnings when they occur.

Bug: T98500
Change-Id: I6dbaf54d96f5692a7013cb5726bd70473d7ccf1e
---
M GraphViz_body.php
1 file changed, 2 insertions(+), 3 deletions(-)

Approvals:
  Welterkj: Verified; Looks good to me, approved



diff --git a/GraphViz_body.php b/GraphViz_body.php
index 5e5fb9a..2adb1c7 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -1098,7 +1098,6 @@
// execute the image creation command
if ( !self::executeCommand( 
$graphParms-getImageCommand( $isPreview ), $errorText ) )
{
-   wfDebug( __METHOD__ . : $errorText\n );
self::deleteFiles( $graphParms, $isPreview, 
false );
 
// remove path info from the errorText
@@ -1124,7 +1123,6 @@
// execute the map creation command
if ( !self::executeCommand( $graphParms-getMapCommand( 
$isPreview ), $errorText ) )
{
-   wfDebug( __METHOD__ . : $errorText\n );
self::deleteFiles( $graphParms, $isPreview, 
false );
 
// remove path info from the errorText (file 
base names are allowed to pass)
@@ -1461,7 +1459,8 @@
}
$output = wfShellExec( $command, $ret );
 
-   if ( $ret != 0 ) {
+   if ( $ret != 0 || $output ) {
+   wfDebug( __METHOD__ . : command: $command ret: $ret 
output: $output\n );
return false;
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/209534
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6dbaf54d96f5692a7013cb5726bd70473d7ccf1e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Stop leaking dummy files. - change (mediawiki...GraphViz)

2015-05-07 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/209530

Change subject: Stop leaking dummy files.
..

Stop leaking dummy files.

Fix deleteArticleFiles() so that it properly deletes dummy files.
Also, only touch image files that are not the target of a copy
(more details in the code comments).

Bug: T97603
Change-Id: I834f7fac77d9b271ac0add8be55d51579e83a162
---
M GraphViz_body.php
1 file changed, 30 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/30/209530/1

diff --git a/GraphViz_body.php b/GraphViz_body.php
index 1f64296..5e5fb9a 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -455,9 +455,9 @@
 */
public static function uploadImagesForTitle( $title, $user ) {
// find any stored images for the page
-   $titleText = $title-getFulltext();
+   $graphName = self::getGraphFileBaseNameFromTitle( $title );
$imageDir = self::getImageDir();
-   $globPattern = $imageDir . self::makeFriendlyGraphName( 
$titleText ) . *.*;
+   $globPattern = $imageDir . $graphName . *.*;
$imageFilePaths = glob( $globPattern );
$uploaded = 0;
 
@@ -465,7 +465,7 @@
if ( !empty( $imageFilePaths ) ) {
$errorText = ;
 
-   $uploaded = self::uploadImages( $titleText, 
$imageFilePaths, $user, $errorText );
+   $uploaded = self::uploadImages( $title-getFulltext(), 
$imageFilePaths, $user, $errorText );
 
if ( $errorText !=  ) {
$errorHTML = self::multilineErrorHTML( 
$errorText );
@@ -595,12 +595,28 @@
}
 
/**
+* For a given title, get the corresponding graph file base name.
+* @author Keith Welter
+*/
+   public static function getGraphFileBaseNameFromTitle( $title ) {
+   if ( $title-inNamespace( NS_FILE ) ) {
+   $baseName = $title-getText();
+   // remove the dummy file extension
+   $baseName = substr( $baseName, 0, strrpos( $baseName, 
'.' ) );
+   } else {
+   $baseName = $title-getFulltext();
+   }
+   $baseName = self::makeFriendlyGraphName( $baseName );
+   return $baseName;
+   }
+
+   /**
 * Delete all the graph files associated with the given article and 
path.
 * @author Keith Welter
 */
public static function deleteArticleFiles( $article, $path ) {
-   $globPattern = $article-getTitle()-getFulltext();
-   $globPattern = self::makeFriendlyGraphName( $globPattern );
+   $title = $article-getTitle();
+   $globPattern = self::getGraphFileBaseNameFromTitle( $title );
$globPattern = $path . $globPattern . *.*;
wfDebug( __METHOD__ . : deleting: $globPattern\n );
array_map( 'unlink', glob( $globPattern ) );
@@ -1118,7 +1134,7 @@
}
 
// normalize the map file contents
-   if ( !self::normalizeMapFileContents( 
$graphParms-getMapPath( $isPreview ), $graphParms-getRenderer(), 
+   if ( !self::normalizeMapFileContents( 
$graphParms-getMapPath( $isPreview ), $graphParms-getRenderer(),
$titleText, $errorText ) ) {
wfDebug( __METHOD__ . : $errorText\n );
self::deleteFiles( $graphParms, $isPreview, 
false );
@@ -1212,7 +1228,14 @@
// The image file is touched here to trigger
// additional processing later in 
GraphViz::uploadImages.
// Specifically, see the path containing the 
call to doEditContent.
-   touch( $imageFilePath );
+   // If a dummy file page was used, we do not 
touch the image file
+   // because it was the target of a copy and the 
source still exists
+   // to trigger the additional processing.  We 
want the additional
+   // processing done on the source, not the 
target of the copy.  If
+   // we did touch the target, it would be a 
leaked file.
+   if ( !$usedDummy ) {
+   touch( $imageFilePath );
+   }
}
 
if ( !self::enableHooks() ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/209530
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange

[MediaWiki-commits] [Gerrit] Stop leaking dummy files. - change (mediawiki...GraphViz)

2015-05-07 Thread Welterkj (Code Review)
Welterkj has submitted this change and it was merged.

Change subject: Stop leaking dummy files.
..


Stop leaking dummy files.

Fix deleteArticleFiles() so that it properly deletes dummy files.
Also, only touch image files that are not the target of a copy
(more details in the code comments).

Bug: T97603
Change-Id: I834f7fac77d9b271ac0add8be55d51579e83a162
---
M GraphViz_body.php
1 file changed, 30 insertions(+), 7 deletions(-)

Approvals:
  Welterkj: Verified; Looks good to me, approved



diff --git a/GraphViz_body.php b/GraphViz_body.php
index 1f64296..5e5fb9a 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -455,9 +455,9 @@
 */
public static function uploadImagesForTitle( $title, $user ) {
// find any stored images for the page
-   $titleText = $title-getFulltext();
+   $graphName = self::getGraphFileBaseNameFromTitle( $title );
$imageDir = self::getImageDir();
-   $globPattern = $imageDir . self::makeFriendlyGraphName( 
$titleText ) . *.*;
+   $globPattern = $imageDir . $graphName . *.*;
$imageFilePaths = glob( $globPattern );
$uploaded = 0;
 
@@ -465,7 +465,7 @@
if ( !empty( $imageFilePaths ) ) {
$errorText = ;
 
-   $uploaded = self::uploadImages( $titleText, 
$imageFilePaths, $user, $errorText );
+   $uploaded = self::uploadImages( $title-getFulltext(), 
$imageFilePaths, $user, $errorText );
 
if ( $errorText !=  ) {
$errorHTML = self::multilineErrorHTML( 
$errorText );
@@ -595,12 +595,28 @@
}
 
/**
+* For a given title, get the corresponding graph file base name.
+* @author Keith Welter
+*/
+   public static function getGraphFileBaseNameFromTitle( $title ) {
+   if ( $title-inNamespace( NS_FILE ) ) {
+   $baseName = $title-getText();
+   // remove the dummy file extension
+   $baseName = substr( $baseName, 0, strrpos( $baseName, 
'.' ) );
+   } else {
+   $baseName = $title-getFulltext();
+   }
+   $baseName = self::makeFriendlyGraphName( $baseName );
+   return $baseName;
+   }
+
+   /**
 * Delete all the graph files associated with the given article and 
path.
 * @author Keith Welter
 */
public static function deleteArticleFiles( $article, $path ) {
-   $globPattern = $article-getTitle()-getFulltext();
-   $globPattern = self::makeFriendlyGraphName( $globPattern );
+   $title = $article-getTitle();
+   $globPattern = self::getGraphFileBaseNameFromTitle( $title );
$globPattern = $path . $globPattern . *.*;
wfDebug( __METHOD__ . : deleting: $globPattern\n );
array_map( 'unlink', glob( $globPattern ) );
@@ -1118,7 +1134,7 @@
}
 
// normalize the map file contents
-   if ( !self::normalizeMapFileContents( 
$graphParms-getMapPath( $isPreview ), $graphParms-getRenderer(), 
+   if ( !self::normalizeMapFileContents( 
$graphParms-getMapPath( $isPreview ), $graphParms-getRenderer(),
$titleText, $errorText ) ) {
wfDebug( __METHOD__ . : $errorText\n );
self::deleteFiles( $graphParms, $isPreview, 
false );
@@ -1212,7 +1228,14 @@
// The image file is touched here to trigger
// additional processing later in 
GraphViz::uploadImages.
// Specifically, see the path containing the 
call to doEditContent.
-   touch( $imageFilePath );
+   // If a dummy file page was used, we do not 
touch the image file
+   // because it was the target of a copy and the 
source still exists
+   // to trigger the additional processing.  We 
want the additional
+   // processing done on the source, not the 
target of the copy.  If
+   // we did touch the target, it would be a 
leaked file.
+   if ( !$usedDummy ) {
+   touch( $imageFilePath );
+   }
}
 
if ( !self::enableHooks() ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/209530
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I834f7fac77d9b271ac0add8be55d51579e83a162
Gerrit-PatchSet: 1

[MediaWiki-commits] [Gerrit] Eliminate PHP fread() length 0 warning - change (mediawiki...GraphViz)

2015-04-29 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/207541

Change subject: Eliminate PHP fread() length 0 warning
..

Eliminate PHP fread() length 0 warning

The full text of the warning is:
PHP Warning: fread(): Length parameter must be
greater than 0 in /w/includes/MimeMagic.php on line 595

The copy from $imageFilePath to $dummyFilePath failed due to a
file that already existed at the destination $dummyFilePath
(despite PHP documentation saying copy will overwrite the
target if it exists).

This fix avoids the problem by not touching (creating) the
target file prior to the copy on the particular path that
had the problem.

Bug: T89325
Change-Id: I70ae9d8b8f0cad28fd741d8260efc50b7a2b4e10
---
M GraphViz_body.php
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/41/207541/1

diff --git a/GraphViz_body.php b/GraphViz_body.php
index ba61ec1..19b6e8e 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -1202,7 +1202,14 @@
} else {
wfDebug( __METHOD__ . : uploaded 
$imageFilePath\n );
$uploaded = true;
-   touch( $imageFilePath );
+   if ( !$isDummy  !$usedDummy ) {
+   // File page content cannot be 
created/modified here so we leave
+   // a record to do it later using the 
touch below.
+   // For non-dummies, the image file is 
touched here to trigger
+   // additional processing later in 
GraphViz::uploadImages.
+   // Specifically, see the path 
containing the call to doEditContent.
+   touch( $imageFilePath );
+   }
}
 
if ( !self::enableHooks() ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/207541
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I70ae9d8b8f0cad28fd741d8260efc50b7a2b4e10
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Eliminate PHP fread() length 0 warning - change (mediawiki...GraphViz)

2015-04-29 Thread Welterkj (Code Review)
Welterkj has submitted this change and it was merged.

Change subject: Eliminate PHP fread() length 0 warning
..


Eliminate PHP fread() length 0 warning

The full text of the warning is:
PHP Warning: fread(): Length parameter must be
greater than 0 in /w/includes/MimeMagic.php on line 595

The copy from $imageFilePath to $dummyFilePath failed due to a
file that already existed at the destination $dummyFilePath
(despite PHP documentation saying copy will overwrite the
target if it exists).

The fix is to unlink the target if it exists before doing the copy.

Bug: T89325

Change-Id: I70ae9d8b8f0cad28fd741d8260efc50b7a2b4e10
---
M GraphRenderParms.php
M GraphViz_body.php
2 files changed, 7 insertions(+), 1 deletion(-)

Approvals:
  Welterkj: Verified; Looks good to me, approved



diff --git a/GraphRenderParms.php b/GraphRenderParms.php
index f6d21ce..c931dfa 100644
--- a/GraphRenderParms.php
+++ b/GraphRenderParms.php
@@ -189,7 +189,7 @@
self::unlinkIfFileExists( $this-getMapPath( $userSpecific ) );
}
 
-   protected static function unlinkIfFileExists( $path ) {
+   public static function unlinkIfFileExists( $path ) {
// prevent directory traversal
if ( strpos( $path, ../ ) !== false ) {
throw new MWException( directory traversal detected in 
$path );
diff --git a/GraphViz_body.php b/GraphViz_body.php
index ba61ec1..f4baba6 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -1148,6 +1148,7 @@
return wfMessage( 
'graphviz-reload' )-escaped();
} else {
// the dummy file page 
exists and has not been copied over yet... use it now!
+   
GraphRenderParms::unlinkIfFileExists( $dummyFilePath );
wfDebug( __METHOD__ . 
: copying $imageFilePath to $dummyFilePath\n );
copy( $imageFilePath, 
$dummyFilePath );
$imageFilePath = 
$dummyFilePath;
@@ -1202,6 +1203,11 @@
} else {
wfDebug( __METHOD__ . : uploaded 
$imageFilePath\n );
$uploaded = true;
+   // File page content cannot be created/modified 
here so we leave
+   // a record to do it later using the touch 
below.
+   // The image file is touched here to trigger
+   // additional processing later in 
GraphViz::uploadImages.
+   // Specifically, see the path containing the 
call to doEditContent.
touch( $imageFilePath );
}
 

-- 
To view, visit https://gerrit.wikimedia.org/r/207541
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I70ae9d8b8f0cad28fd741d8260efc50b7a2b4e10
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Do not init dummy file pages for file pages. - change (mediawiki...GraphViz)

2015-04-29 Thread Welterkj (Code Review)
Welterkj has submitted this change and it was merged.

Change subject: Do not init dummy file pages for file pages.
..


Do not init dummy file pages for file pages.

Bug: T97596
Change-Id: I83d1971c2950e916073bce7afdf7e7bfe29a612d
---
M GraphViz_body.php
1 file changed, 11 insertions(+), 7 deletions(-)

Approvals:
  Welterkj: Verified; Looks good to me, approved



diff --git a/GraphViz_body.php b/GraphViz_body.php
index f4baba6..1f64296 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -621,17 +621,21 @@
 * @author Keith Welter
 */
public static function onPageContentSave( $wikiPage, $user, $content, 
$summary, $isMinor, $isWatch, $section, $flags, $status ) {
-   $titleText = $wikiPage-getTitle()-getFulltext();
-   return self::onTitleSave( $titleText );
+   $title = $wikiPage-getTitle();
+   return self::onTitleSave( $title );
}
 
/**
 * Function to record when a page with the given title is being saved.
-* Also, ensure initDummyFilePages() is called before parsing the page.
+* Also, ensure initDummyFilePages() is called before parsing the page
+* (except for file pages).
 * @author Keith Welter
 */
-   public static function onTitleSave( $titleText ) {
-   self::initDummyFilePages();
+   public static function onTitleSave( $title ) {
+   $titleText = $title-getFulltext();
+   if ( !$title-inNamespace( NS_FILE ) ) {
+   self::initDummyFilePages();
+   }
self::$titlesBeingSaved[$titleText] = '';
wfDebug( __METHOD__ . : saving: $titleText\n );
return true;
@@ -642,8 +646,8 @@
 * @author Keith Welter
 */
public static function onArticleSave( $article, $user, $text, 
$summary, $minor, $watchthis, $sectionanchor, $flags, $status ) {
-   $titleText = $article-getTitle()-getFulltext();
-   return self::onTitleSave( $titleText );
+   $title = $article-getTitle();
+   return self::onTitleSave( $title );
}
 
/**

-- 
To view, visit https://gerrit.wikimedia.org/r/207654
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I83d1971c2950e916073bce7afdf7e7bfe29a612d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Do not init dummy file pages for file pages. - change (mediawiki...GraphViz)

2015-04-29 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/207654

Change subject: Do not init dummy file pages for file pages.
..

Do not init dummy file pages for file pages.

Bug: T97596
Change-Id: I83d1971c2950e916073bce7afdf7e7bfe29a612d
---
M GraphViz_body.php
1 file changed, 11 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/54/207654/1

diff --git a/GraphViz_body.php b/GraphViz_body.php
index f4baba6..1f64296 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -621,17 +621,21 @@
 * @author Keith Welter
 */
public static function onPageContentSave( $wikiPage, $user, $content, 
$summary, $isMinor, $isWatch, $section, $flags, $status ) {
-   $titleText = $wikiPage-getTitle()-getFulltext();
-   return self::onTitleSave( $titleText );
+   $title = $wikiPage-getTitle();
+   return self::onTitleSave( $title );
}
 
/**
 * Function to record when a page with the given title is being saved.
-* Also, ensure initDummyFilePages() is called before parsing the page.
+* Also, ensure initDummyFilePages() is called before parsing the page
+* (except for file pages).
 * @author Keith Welter
 */
-   public static function onTitleSave( $titleText ) {
-   self::initDummyFilePages();
+   public static function onTitleSave( $title ) {
+   $titleText = $title-getFulltext();
+   if ( !$title-inNamespace( NS_FILE ) ) {
+   self::initDummyFilePages();
+   }
self::$titlesBeingSaved[$titleText] = '';
wfDebug( __METHOD__ . : saving: $titleText\n );
return true;
@@ -642,8 +646,8 @@
 * @author Keith Welter
 */
public static function onArticleSave( $article, $user, $text, 
$summary, $minor, $watchthis, $sectionanchor, $flags, $status ) {
-   $titleText = $article-getTitle()-getFulltext();
-   return self::onTitleSave( $titleText );
+   $title = $article-getTitle();
+   return self::onTitleSave( $title );
}
 
/**

-- 
To view, visit https://gerrit.wikimedia.org/r/207654
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I83d1971c2950e916073bce7afdf7e7bfe29a612d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Handle null revision in titleHasMultipleRevisions(). Bug: T8... - change (mediawiki...GraphViz)

2015-04-11 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/203535

Change subject: Handle null revision in titleHasMultipleRevisions(). Bug: T89325
..

Handle null revision in titleHasMultipleRevisions().
Bug: T89325

Change-Id: Ic7d0f51ebf9506b6f03965d8cccf9bbbd26c74ea
---
M GraphViz_body.php
M RELEASE-NOTES.md
2 files changed, 9 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/35/203535/1

diff --git a/GraphViz_body.php b/GraphViz_body.php
index a84aac8..ba61ec1 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -391,7 +391,11 @@
 * @return true if the given title has multiple revisions, otherwise 
false.
 */
public static function titleHasMultipleRevisions( $title ) {
-   return $title-getLatestRevID() != 
$title-getFirstRevision()-getId();
+   $firstRev = $title-getFirstRevision();
+   if ( $firstRev ) {
+   return $title-getLatestRevID() != $firstRev-getId();
+   }
+   return false;
}
 
/**
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 13ac586..e094615 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -1,6 +1,9 @@
 These are the release notes for the [MediaWiki][mediawiki] [GraphViz 
extension][gv_ext].
 
-## GraphViz 1.6.0 ## (2015-3-26 )
+## GraphViz 1.6.1 ## (not released yet)
+* Fix for [bug T89325](https://phabricator.wikimedia.org/T89325).
+
+## GraphViz 1.6.0 ## (2015-3-26)
 * Make the category pages created by this extension optional, non-empty and do 
not tag “dummy” images as belonging to a category.
 * Allow DOT tooltips without URLs.
 

-- 
To view, visit https://gerrit.wikimedia.org/r/203535
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic7d0f51ebf9506b6f03965d8cccf9bbbd26c74ea
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Update release notes for version 1.6.0. - change (mediawiki...GraphViz)

2015-03-26 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/199978

Change subject: Update release notes for version 1.6.0.
..

Update release notes for version 1.6.0.

Change-Id: I42248b4122965c4cdabf569a9eb2ebab67d7518b
---
M RELEASE-NOTES.md
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/78/199978/1

diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index d92ef60..13ac586 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -1,6 +1,6 @@
 These are the release notes for the [MediaWiki][mediawiki] [GraphViz 
extension][gv_ext].
 
-## GraphViz 1.6.0 ## (not released yet )
+## GraphViz 1.6.0 ## (2015-3-26 )
 * Make the category pages created by this extension optional, non-empty and do 
not tag “dummy” images as belonging to a category.
 * Allow DOT tooltips without URLs.
 

-- 
To view, visit https://gerrit.wikimedia.org/r/199978
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I42248b4122965c4cdabf569a9eb2ebab67d7518b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Update release notes for version 1.6.0. - change (mediawiki...GraphViz)

2015-03-26 Thread Welterkj (Code Review)
Welterkj has submitted this change and it was merged.

Change subject: Update release notes for version 1.6.0.
..


Update release notes for version 1.6.0.

Change-Id: I42248b4122965c4cdabf569a9eb2ebab67d7518b
---
M RELEASE-NOTES.md
1 file changed, 1 insertion(+), 1 deletion(-)

Approvals:
  Welterkj: Verified; Looks good to me, approved



diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index d92ef60..13ac586 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -1,6 +1,6 @@
 These are the release notes for the [MediaWiki][mediawiki] [GraphViz 
extension][gv_ext].
 
-## GraphViz 1.6.0 ## (not released yet )
+## GraphViz 1.6.0 ## (2015-3-26 )
 * Make the category pages created by this extension optional, non-empty and do 
not tag “dummy” images as belonging to a category.
 * Allow DOT tooltips without URLs.
 

-- 
To view, visit https://gerrit.wikimedia.org/r/199978
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I42248b4122965c4cdabf569a9eb2ebab67d7518b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] For tooltips without links, supply a link to the graph page. - change (mediawiki...GraphViz)

2015-03-04 Thread Welterkj (Code Review)
Welterkj has submitted this change and it was merged.

Change subject: For tooltips without links, supply a link to the graph page.
..


For tooltips without links, supply a link to the graph page.

Change-Id: Idc0bc289a3fb505cfd68baaa70e5645b081b1179
---
M GraphViz_body.php
1 file changed, 7 insertions(+), 5 deletions(-)

Approvals:
  Welterkj: Verified; Looks good to me, approved



diff --git a/GraphViz_body.php b/GraphViz_body.php
index 0f9b1f1..a84aac8 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -1110,7 +1110,8 @@
}
 
// normalize the map file contents
-   if ( !self::normalizeMapFileContents( 
$graphParms-getMapPath( $isPreview ), $graphParms-getRenderer(), $errorText ) 
) {
+   if ( !self::normalizeMapFileContents( 
$graphParms-getMapPath( $isPreview ), $graphParms-getRenderer(), 
+   $titleText, $errorText ) ) {
wfDebug( __METHOD__ . : $errorText\n );
self::deleteFiles( $graphParms, $isPreview, 
false );
return self::errorHTML( $errorText );
@@ -1445,13 +1446,14 @@
 *
 * @param[in] string $mapPath is the map file (including path).
 * @param[in] string $renderer is the name of the renderer used to 
produce the map.
+* @param[in] string $pageTitle is the page title to supply for DOT 
tooltips that do not have URLs.
 * @param[out] string $errorText is populated with an error message in 
the event of an error.
 *
 * @return boolean true upon success, false upon failure.
 *
 * @author Keith Welter
 */
-   protected static function normalizeMapFileContents( $mapPath, 
$renderer, $errorText ) {
+   protected static function normalizeMapFileContents( $mapPath, 
$renderer, $pageTitle, $errorText ) {
// read the map file contents
$map = file_get_contents( $mapPath );
if ( !empty( $map ) ) {
@@ -1497,12 +1499,12 @@
$map  = str_replace( '/map', '', $map );
 
// DOT and HTML allow tooltips without URLs but 
ImageMap does not.
-   // We want to allow tooltips without URLs 
(hrefs) so add a dummy URL if it is missing.
-   // ImageMap accepts the URL http://; so use 
that as the dummy href.
+   // We want to allow tooltips without URLs 
(hrefs) so supply the page title if it is missing.
 
// detect missing hrefs and add them as needed
+   $missingHrefReplacement = 'id=$1 href=[[' . 
$pageTitle . ']] title=$2';
$map = preg_replace( 
'~id=([^]+)[\s\t]+title=([^]+)~',
-   'id=$1 href=http://; title=$2',
+   $missingHrefReplacement,
$map );
 
// add enclosing square brackets to URLs that 
don't have them and add the title

-- 
To view, visit https://gerrit.wikimedia.org/r/194344
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idc0bc289a3fb505cfd68baaa70e5645b081b1179
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] For tooltips without links, supply a link to the graph page. - change (mediawiki...GraphViz)

2015-03-04 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/194344

Change subject: For tooltips without links, supply a link to the graph page.
..

For tooltips without links, supply a link to the graph page.

Change-Id: Idc0bc289a3fb505cfd68baaa70e5645b081b1179
---
M GraphViz_body.php
1 file changed, 7 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/44/194344/1

diff --git a/GraphViz_body.php b/GraphViz_body.php
index 0f9b1f1..a84aac8 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -1110,7 +1110,8 @@
}
 
// normalize the map file contents
-   if ( !self::normalizeMapFileContents( 
$graphParms-getMapPath( $isPreview ), $graphParms-getRenderer(), $errorText ) 
) {
+   if ( !self::normalizeMapFileContents( 
$graphParms-getMapPath( $isPreview ), $graphParms-getRenderer(), 
+   $titleText, $errorText ) ) {
wfDebug( __METHOD__ . : $errorText\n );
self::deleteFiles( $graphParms, $isPreview, 
false );
return self::errorHTML( $errorText );
@@ -1445,13 +1446,14 @@
 *
 * @param[in] string $mapPath is the map file (including path).
 * @param[in] string $renderer is the name of the renderer used to 
produce the map.
+* @param[in] string $pageTitle is the page title to supply for DOT 
tooltips that do not have URLs.
 * @param[out] string $errorText is populated with an error message in 
the event of an error.
 *
 * @return boolean true upon success, false upon failure.
 *
 * @author Keith Welter
 */
-   protected static function normalizeMapFileContents( $mapPath, 
$renderer, $errorText ) {
+   protected static function normalizeMapFileContents( $mapPath, 
$renderer, $pageTitle, $errorText ) {
// read the map file contents
$map = file_get_contents( $mapPath );
if ( !empty( $map ) ) {
@@ -1497,12 +1499,12 @@
$map  = str_replace( '/map', '', $map );
 
// DOT and HTML allow tooltips without URLs but 
ImageMap does not.
-   // We want to allow tooltips without URLs 
(hrefs) so add a dummy URL if it is missing.
-   // ImageMap accepts the URL http://; so use 
that as the dummy href.
+   // We want to allow tooltips without URLs 
(hrefs) so supply the page title if it is missing.
 
// detect missing hrefs and add them as needed
+   $missingHrefReplacement = 'id=$1 href=[[' . 
$pageTitle . ']] title=$2';
$map = preg_replace( 
'~id=([^]+)[\s\t]+title=([^]+)~',
-   'id=$1 href=http://; title=$2',
+   $missingHrefReplacement,
$map );
 
// add enclosing square brackets to URLs that 
don't have them and add the title

-- 
To view, visit https://gerrit.wikimedia.org/r/194344
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idc0bc289a3fb505cfd68baaa70e5645b081b1179
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Allow tooltips without links. - change (mediawiki...GraphViz)

2015-02-05 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/16

Change subject: Allow tooltips without links.
..

Allow tooltips without links.

DOT and HTML allow tooltips without URLs but ImageMap does not.
Detect the case of a DOT tooltip without a URL and supply a dummy
URL instead.

Change-Id: Iae1bc04719b61c4d2baa1424e20b7bc4e9bf6683
---
M GraphViz_body.php
M RELEASE-NOTES.md
2 files changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/86/16/1

diff --git a/GraphViz_body.php b/GraphViz_body.php
index cf091b4..0f9b1f1 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -1496,6 +1496,15 @@
// remove map ending tag from map file 
contents
$map  = str_replace( '/map', '', $map );
 
+   // DOT and HTML allow tooltips without URLs but 
ImageMap does not.
+   // We want to allow tooltips without URLs 
(hrefs) so add a dummy URL if it is missing.
+   // ImageMap accepts the URL http://; so use 
that as the dummy href.
+
+   // detect missing hrefs and add them as needed
+   $map = preg_replace( 
'~id=([^]+)[\s\t]+title=([^]+)~',
+   'id=$1 href=http://; title=$2',
+   $map );
+
// add enclosing square brackets to URLs that 
don't have them and add the title
$map = preg_replace( 
'~href=([^[][^]+).+title=([^]+)~',
'href=[$1 $2]',
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 83cb2b5..d92ef60 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -2,6 +2,7 @@
 
 ## GraphViz 1.6.0 ## (not released yet )
 * Make the category pages created by this extension optional, non-empty and do 
not tag “dummy” images as belonging to a category.
+* Allow DOT tooltips without URLs.
 
 ## GraphViz 1.5.1 ## (2015-1-24)
 * Fix for [bug T75073](https://phabricator.wikimedia.org/T75073).

-- 
To view, visit https://gerrit.wikimedia.org/r/16
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae1bc04719b61c4d2baa1424e20b7bc4e9bf6683
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Allow tooltips without links. - change (mediawiki...GraphViz)

2015-02-05 Thread Welterkj (Code Review)
Welterkj has submitted this change and it was merged.

Change subject: Allow tooltips without links.
..


Allow tooltips without links.

DOT and HTML allow tooltips without URLs but ImageMap does not.
Detect the case of a DOT tooltip without a URL and supply a dummy
URL instead.

Change-Id: Iae1bc04719b61c4d2baa1424e20b7bc4e9bf6683
---
M GraphViz_body.php
M RELEASE-NOTES.md
2 files changed, 10 insertions(+), 0 deletions(-)

Approvals:
  Welterkj: Verified; Looks good to me, approved



diff --git a/GraphViz_body.php b/GraphViz_body.php
index cf091b4..0f9b1f1 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -1496,6 +1496,15 @@
// remove map ending tag from map file 
contents
$map  = str_replace( '/map', '', $map );
 
+   // DOT and HTML allow tooltips without URLs but 
ImageMap does not.
+   // We want to allow tooltips without URLs 
(hrefs) so add a dummy URL if it is missing.
+   // ImageMap accepts the URL http://; so use 
that as the dummy href.
+
+   // detect missing hrefs and add them as needed
+   $map = preg_replace( 
'~id=([^]+)[\s\t]+title=([^]+)~',
+   'id=$1 href=http://; title=$2',
+   $map );
+
// add enclosing square brackets to URLs that 
don't have them and add the title
$map = preg_replace( 
'~href=([^[][^]+).+title=([^]+)~',
'href=[$1 $2]',
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 83cb2b5..d92ef60 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -2,6 +2,7 @@
 
 ## GraphViz 1.6.0 ## (not released yet )
 * Make the category pages created by this extension optional, non-empty and do 
not tag “dummy” images as belonging to a category.
+* Allow DOT tooltips without URLs.
 
 ## GraphViz 1.5.1 ## (2015-1-24)
 * Fix for [bug T75073](https://phabricator.wikimedia.org/T75073).

-- 
To view, visit https://gerrit.wikimedia.org/r/16
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iae1bc04719b61c4d2baa1424e20b7bc4e9bf6683
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Make category pages less obtrusive. - change (mediawiki...GraphViz)

2015-02-04 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/188686

Change subject: Make category pages less obtrusive.
..

Make category pages less obtrusive.

Make the category pages created by this extension optional,
non-empty and do not tag “dummy” images as belonging to a category.

Change-Id: I9ba117c7844cd1d43150e6fbfabc837f0596faa6
---
M GraphViz.php
M GraphViz_body.php
M RELEASE-NOTES.md
3 files changed, 47 insertions(+), 35 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/86/188686/1

diff --git a/GraphViz.php b/GraphViz.php
index 3ac07c2..0b9ca20 100644
--- a/GraphViz.php
+++ b/GraphViz.php
@@ -33,7 +33,7 @@
 
 if ( !defined( 'MEDIAWIKI' ) ) die();
 
-define( 'GraphViz_VERSION', '1.5.1' );
+define( 'GraphViz_VERSION', '1.6.0' );
 
 /**
  * The GraphViz settings class.
@@ -67,23 +67,36 @@
 * @var string $defaultImageType
 */
public $defaultImageType;
+
+   /**
+* Whether or not to automatically create category pages for images 
created by this extension.
+* yes|no (case insensitive). The default is no.
+*
+* @var string $createCategoryPages
+*/
+   public $createCategoryPages;
+
+   /**
+* Constructor for setting configuration variable defaults.
+*/
+   public function __construct() {
+   // Set execution path
+   if ( stristr( PHP_OS, 'WIN' )  !stristr( PHP_OS, 'Darwin' ) ) 
{
+   $this-execPath = 'C:/Program Files/Graphviz/bin/';
+   } else {
+   $this-execPath = '/usr/bin/';
+   }
+
+   $this-mscgenPath = '';
+   $this-defaultImageType = 'png';
+   $this-createCategoryPages = 'no';
+   }
 };
 
 $GLOBALS['wgGraphVizSettings'] = new GraphVizSettings();
 
 //self executing anonymous function to prevent global scope assumptions
 call_user_func( function() {
-
-   // Set execution path
-   if ( stristr( PHP_OS, 'WIN' )  !stristr( PHP_OS, 'Darwin' ) ) {
-   $GLOBALS['wgGraphVizSettings']-execPath = 'C:/Program 
Files/Graphviz/bin/';
-   } else {
-   $GLOBALS['wgGraphVizSettings']-execPath = '/usr/bin/';
-   }
-
-   $GLOBALS['wgGraphVizSettings']-mscgenPath = '';
-   $GLOBALS['wgGraphVizSettings']-defaultImageType = 'png';
-
$dir = __DIR__ . '/';
 
$GLOBALS['wgMessagesDirs']['GraphViz'] = $dir . 'i18n';
diff --git a/GraphViz_body.php b/GraphViz_body.php
index f871270..cf091b4 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -130,20 +130,6 @@
const ROOT_CATEGORY = GraphViz;
 
/**
-* Subcategories of pages created by this extension.
-* @var array $subCategories
-*/
-   private static $subCategories = array(
-   'mscgen',
-   'dot',
-   'neato',
-   'fdp',
-   'sfdp',
-   'circo',
-   'twopi'
-   );
-
-   /**
 * A list of dot attributes that are forbidden.
 * @see http://www.graphviz.org/content/attrs#dimagepath
 * @see http://www.graphviz.org/content/attrs#dshapefile
@@ -335,15 +321,18 @@
}
 
/**
-* Create a category page for GraphViz::ROOT_CATEGORY and subcategory 
pages for GraphViz::$subCategories.
+* Optionally create a category page for GraphViz::ROOT_CATEGORY and 
the given subcategory.
+* @param[in] string $subCategory is the same as the graph renderer.
 * @author Keith Welter
 */
-   public static function createCategoryPages() {
-   $rootCategoryName = self::ROOT_CATEGORY;
-   $rootCategoryDesc = wfMessage( 'graphviz-category-desc', 
[[:Category:$rootCategoryName]] )-text();
-   self::createCategoryPage( $rootCategoryName, $rootCategoryDesc, 
 );
+   public static function optionallyCreateCategoryPage( $subCategory ) {
+   global $wgGraphVizSettings;
 
-   foreach( self::$subCategories as $subCategory ) {
+   if ( strcasecmp( $wgGraphVizSettings-createCategoryPages, 
'yes' ) == 0 ) {
+   $rootCategoryName = self::ROOT_CATEGORY;
+   $rootCategoryDesc = wfMessage( 
'graphviz-category-desc', [[:Category:$rootCategoryName]] )-text();
+   self::createCategoryPage( $rootCategoryName, 
$rootCategoryDesc,  );
+
$subCategoryName = $rootCategoryName . ' ' . 
$subCategory;
$subCategoryDesc = wfMessage( 
'graphviz-subcategory-desc', [[:Category:$subCategoryName]], $subCategory 
)-text();
$subCategoryDesc .= [[Category:$rootCategoryName]];
@@ -411,8 +400,6 @@
 * @return true
 */
public static function onParserInit( Parser $parser 

[MediaWiki-commits] [Gerrit] Make category pages less obtrusive. - change (mediawiki...GraphViz)

2015-02-04 Thread Welterkj (Code Review)
Welterkj has submitted this change and it was merged.

Change subject: Make category pages less obtrusive.
..


Make category pages less obtrusive.

Make the category pages created by this extension optional,
non-empty and do not tag “dummy” images as belonging to a category.

Change-Id: I9ba117c7844cd1d43150e6fbfabc837f0596faa6
---
M GraphViz.php
M GraphViz_body.php
M RELEASE-NOTES.md
3 files changed, 47 insertions(+), 35 deletions(-)

Approvals:
  Welterkj: Verified; Looks good to me, approved



diff --git a/GraphViz.php b/GraphViz.php
index 3ac07c2..0b9ca20 100644
--- a/GraphViz.php
+++ b/GraphViz.php
@@ -33,7 +33,7 @@
 
 if ( !defined( 'MEDIAWIKI' ) ) die();
 
-define( 'GraphViz_VERSION', '1.5.1' );
+define( 'GraphViz_VERSION', '1.6.0' );
 
 /**
  * The GraphViz settings class.
@@ -67,23 +67,36 @@
 * @var string $defaultImageType
 */
public $defaultImageType;
+
+   /**
+* Whether or not to automatically create category pages for images 
created by this extension.
+* yes|no (case insensitive). The default is no.
+*
+* @var string $createCategoryPages
+*/
+   public $createCategoryPages;
+
+   /**
+* Constructor for setting configuration variable defaults.
+*/
+   public function __construct() {
+   // Set execution path
+   if ( stristr( PHP_OS, 'WIN' )  !stristr( PHP_OS, 'Darwin' ) ) 
{
+   $this-execPath = 'C:/Program Files/Graphviz/bin/';
+   } else {
+   $this-execPath = '/usr/bin/';
+   }
+
+   $this-mscgenPath = '';
+   $this-defaultImageType = 'png';
+   $this-createCategoryPages = 'no';
+   }
 };
 
 $GLOBALS['wgGraphVizSettings'] = new GraphVizSettings();
 
 //self executing anonymous function to prevent global scope assumptions
 call_user_func( function() {
-
-   // Set execution path
-   if ( stristr( PHP_OS, 'WIN' )  !stristr( PHP_OS, 'Darwin' ) ) {
-   $GLOBALS['wgGraphVizSettings']-execPath = 'C:/Program 
Files/Graphviz/bin/';
-   } else {
-   $GLOBALS['wgGraphVizSettings']-execPath = '/usr/bin/';
-   }
-
-   $GLOBALS['wgGraphVizSettings']-mscgenPath = '';
-   $GLOBALS['wgGraphVizSettings']-defaultImageType = 'png';
-
$dir = __DIR__ . '/';
 
$GLOBALS['wgMessagesDirs']['GraphViz'] = $dir . 'i18n';
diff --git a/GraphViz_body.php b/GraphViz_body.php
index f871270..cf091b4 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -130,20 +130,6 @@
const ROOT_CATEGORY = GraphViz;
 
/**
-* Subcategories of pages created by this extension.
-* @var array $subCategories
-*/
-   private static $subCategories = array(
-   'mscgen',
-   'dot',
-   'neato',
-   'fdp',
-   'sfdp',
-   'circo',
-   'twopi'
-   );
-
-   /**
 * A list of dot attributes that are forbidden.
 * @see http://www.graphviz.org/content/attrs#dimagepath
 * @see http://www.graphviz.org/content/attrs#dshapefile
@@ -335,15 +321,18 @@
}
 
/**
-* Create a category page for GraphViz::ROOT_CATEGORY and subcategory 
pages for GraphViz::$subCategories.
+* Optionally create a category page for GraphViz::ROOT_CATEGORY and 
the given subcategory.
+* @param[in] string $subCategory is the same as the graph renderer.
 * @author Keith Welter
 */
-   public static function createCategoryPages() {
-   $rootCategoryName = self::ROOT_CATEGORY;
-   $rootCategoryDesc = wfMessage( 'graphviz-category-desc', 
[[:Category:$rootCategoryName]] )-text();
-   self::createCategoryPage( $rootCategoryName, $rootCategoryDesc, 
 );
+   public static function optionallyCreateCategoryPage( $subCategory ) {
+   global $wgGraphVizSettings;
 
-   foreach( self::$subCategories as $subCategory ) {
+   if ( strcasecmp( $wgGraphVizSettings-createCategoryPages, 
'yes' ) == 0 ) {
+   $rootCategoryName = self::ROOT_CATEGORY;
+   $rootCategoryDesc = wfMessage( 
'graphviz-category-desc', [[:Category:$rootCategoryName]] )-text();
+   self::createCategoryPage( $rootCategoryName, 
$rootCategoryDesc,  );
+
$subCategoryName = $rootCategoryName . ' ' . 
$subCategory;
$subCategoryDesc = wfMessage( 
'graphviz-subcategory-desc', [[:Category:$subCategoryName]], $subCategory 
)-text();
$subCategoryDesc .= [[Category:$rootCategoryName]];
@@ -411,8 +400,6 @@
 * @return true
 */
public static function onParserInit( Parser $parser ) {
-   self::createCategoryPages();
-

[MediaWiki-commits] [Gerrit] Add UploadFromLocalFile to wgAutoloadClasses. - change (mediawiki...GraphViz)

2015-01-29 Thread Welterkj (Code Review)
Welterkj has submitted this change and it was merged.

Change subject: Add UploadFromLocalFile to wgAutoloadClasses.
..


Add UploadFromLocalFile to wgAutoloadClasses.

Change-Id: Ibaf51161250e5808f7fbd96932bc178eca90
---
M GraphViz.php
1 file changed, 1 insertion(+), 0 deletions(-)

Approvals:
  Welterkj: Verified; Looks good to me, approved



diff --git a/GraphViz.php b/GraphViz.php
index 25ea832..3ac07c2 100644
--- a/GraphViz.php
+++ b/GraphViz.php
@@ -91,6 +91,7 @@
$GLOBALS['wgAutoloadClasses']['GraphViz'] = $dir . GraphViz_body.php;
$GLOBALS['wgAutoloadClasses']['GraphRenderParms'] = $dir . 
GraphRenderParms.php;
$GLOBALS['wgAutoloadClasses']['UploadLocalFile'] = $dir . 
UploadLocalFile.php;
+   $GLOBALS['wgAutoloadClasses']['UploadFromLocalFile'] = $dir . 
UploadLocalFile.php;
$GLOBALS['wgHooks']['ParserFirstCallInit'][] = 'GraphViz::onParserInit';
$GLOBALS['wgHooks']['OutputPageParserOutput'][] = 
'GraphViz::onOutputPageParserOutput';
$GLOBALS['wgHooks']['ArticleDeleteComplete'][] = 
'GraphViz::onArticleDeleteComplete';

-- 
To view, visit https://gerrit.wikimedia.org/r/185339
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ibaf51161250e5808f7fbd96932bc178eca90
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Update release notes for version 1.5.1. - change (mediawiki...GraphViz)

2015-01-24 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/186613

Change subject: Update release notes for version 1.5.1.
..

Update release notes for version 1.5.1.

Change-Id: Ib396c484272eb428bd7d9edd622b03d5c1f5e9f9
---
M RELEASE-NOTES.md
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/13/186613/1

diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 339ee34..b316580 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -1,7 +1,7 @@
 These are the release notes for the [MediaWiki][mediawiki] [GraphViz 
extension][gv_ext].
 
-## GraphViz 1.5.x ## (not released yet)
-* Fix for [bug 73073](https://bugzilla.wikimedia.org/show_bug.cgi?id=72325).
+## GraphViz 1.5.1 ## (2015-1-24)
+* Fix for [bug T75073](https://phabricator.wikimedia.org/T75073).
 
 ## GraphViz 1.5.0 ## (2014-10-28)
 * Add tag arguments preparse=dynamic and preparse=static.

-- 
To view, visit https://gerrit.wikimedia.org/r/186613
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib396c484272eb428bd7d9edd622b03d5c1f5e9f9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Update release notes for version 1.5.1. - change (mediawiki...GraphViz)

2015-01-24 Thread Welterkj (Code Review)
Welterkj has submitted this change and it was merged.

Change subject: Update release notes for version 1.5.1.
..


Update release notes for version 1.5.1.

Change-Id: Ib396c484272eb428bd7d9edd622b03d5c1f5e9f9
---
M RELEASE-NOTES.md
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Welterkj: Verified; Looks good to me, approved



diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 339ee34..b316580 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -1,7 +1,7 @@
 These are the release notes for the [MediaWiki][mediawiki] [GraphViz 
extension][gv_ext].
 
-## GraphViz 1.5.x ## (not released yet)
-* Fix for [bug 73073](https://bugzilla.wikimedia.org/show_bug.cgi?id=72325).
+## GraphViz 1.5.1 ## (2015-1-24)
+* Fix for [bug T75073](https://phabricator.wikimedia.org/T75073).
 
 ## GraphViz 1.5.0 ## (2014-10-28)
 * Add tag arguments preparse=dynamic and preparse=static.

-- 
To view, visit https://gerrit.wikimedia.org/r/186613
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ib396c484272eb428bd7d9edd622b03d5c1f5e9f9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Unstub wgParser before call to initDummyFilePages(). Bug: T7... - change (mediawiki...GraphViz)

2015-01-15 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/185208

Change subject: Unstub wgParser before call to initDummyFilePages(). Bug: T75073
..

Unstub wgParser before call to initDummyFilePages().
Bug: T75073

Change-Id: Ibd3c1518b11ef42612540aa932b9224a8ad8d908
---
M GraphViz_body.php
1 file changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/08/185208/1

diff --git a/GraphViz_body.php b/GraphViz_body.php
index f8cb150..3d73e87 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -628,6 +628,10 @@
 * @author Keith Welter
 */
public static function onPageContentSave( $wikiPage, $user, $content, 
$summary, $isMinor, $isWatch, $section, $flags, $status ) {
+   global $wgParser;
+   StubObject::unstub( $wgParser );
+   self::initDummyFilePages( $wgParser );
+
$titleText = $wikiPage-getTitle()-getFulltext();
return self::onTitleSave( $titleText );
}
@@ -637,9 +641,6 @@
 * @author Keith Welter
 */
public static function onTitleSave( $titleText ) {
-   global $wgParser;
-   self::initDummyFilePages( $wgParser );
-
self::$titlesBeingSaved[$titleText] = '';
wfDebug( __METHOD__ . : saving: $titleText\n );
return true;
@@ -650,6 +651,10 @@
 * @author Keith Welter
 */
public static function onArticleSave( $article, $user, $text, 
$summary, $minor, $watchthis, $sectionanchor, $flags, $status ) {
+   global $wgParser;
+   $wgParser-_unstub();
+   self::initDummyFilePages( $wgParser );
+
$titleText = $article-getTitle()-getFulltext();
return self::onTitleSave( $titleText );
}

-- 
To view, visit https://gerrit.wikimedia.org/r/185208
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd3c1518b11ef42612540aa932b9224a8ad8d908
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Unstub wgParser in initDummyFilePages(). - change (mediawiki...GraphViz)

2015-01-15 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/185324

Change subject: Unstub wgParser in initDummyFilePages().
..

Unstub wgParser in initDummyFilePages().

Bug: T75073
Change-Id: I3d850cccf97fccbd582495a2e0bda6b1158bfda2
---
M GraphViz_body.php
1 file changed, 13 insertions(+), 15 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/24/185324/1

diff --git a/GraphViz_body.php b/GraphViz_body.php
index f8cb150..d6be0f4 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -275,7 +275,13 @@
 * @param[in] Parser $parser
 * @author Keith Welter
 */
-   public static function initDummyFilePages( Parser $parser ) {
+   public static function initDummyFilePages() {
+   global $wgParser;
+
+   if ( $wgParser instanceof StubObject ) {
+   $wgParser-_unstub();
+   }
+
foreach ( GraphRenderParms::$supportedDotImageTypes as 
$imageType ) {
if ( !self::imageTypeAllowed( $imageType ) ) {
wfDebug( __METHOD__ . : skipping $imageType\n 
);
@@ -287,12 +293,12 @@
 
if ( !$imageTitle-exists() ) {
wfDebug( __METHOD__ . : file page for 
$imageFileName does not exist\n );
-   self::createDummyImageFilePage( $parser, 
$imageType );
+   self::createDummyImageFilePage( $wgParser, 
$imageType );
} else if ( self::titleHasMultipleRevisions( 
$imageTitle ) ) {
wfDebug( __METHOD__ . : file page for 
$imageFileName has multiple revisions\n );
self::deleteFilePage( $imageTitle );
 
-   self::createDummyImageFilePage( $parser, 
$imageType );
+   self::createDummyImageFilePage( $wgParser, 
$imageType );
}
}
}
@@ -402,7 +408,6 @@
 
/**
 * Set parser hook functions for supported graph types.
-* Also, ensure initDummyFilePages() is be called before parsing the 
edit page.
 * @author Keith Welter
 * @return true
 */
@@ -421,10 +426,7 @@
 * @author Keith Welter
 */
public static function onEditPageGetPreviewContent( $editPage, 
$content ) {
-   global $wgParser;
-   StubObject::unstub( $wgParser );
-   wfDebug( __METHOD__ . : calling self::initDummyFilePages\n );
-   self::initDummyFilePages( $wgParser );
+   self::initDummyFilePages();
}
 
/**
@@ -433,10 +435,7 @@
 * @author Keith Welter
 */
public static function onEditPageGetPreviewText( $editPage, $toParse ) 
{
-   global $wgParser;
-   $wgParser-_unstub();
-   wfDebug( __METHOD__ . : calling self::initDummyFilePages\n );
-   self::initDummyFilePages( $wgParser );
+   self::initDummyFilePages();
return true;
}
 
@@ -634,12 +633,11 @@
 
/**
 * Function to record when a page with the given title is being saved.
+* Also, ensure initDummyFilePages() is called before parsing the page.
 * @author Keith Welter
 */
public static function onTitleSave( $titleText ) {
-   global $wgParser;
-   self::initDummyFilePages( $wgParser );
-
+   self::initDummyFilePages();
self::$titlesBeingSaved[$titleText] = '';
wfDebug( __METHOD__ . : saving: $titleText\n );
return true;

-- 
To view, visit https://gerrit.wikimedia.org/r/185324
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d850cccf97fccbd582495a2e0bda6b1158bfda2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add UploadFromLocalFile to wgAutoloadClasses. - change (mediawiki...GraphViz)

2015-01-15 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/185339

Change subject: Add UploadFromLocalFile to wgAutoloadClasses.
..

Add UploadFromLocalFile to wgAutoloadClasses.

Change-Id: Ibaf51161250e5808f7fbd96932bc178eca90
---
M GraphViz.php
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/39/185339/1

diff --git a/GraphViz.php b/GraphViz.php
index 25ea832..3ac07c2 100644
--- a/GraphViz.php
+++ b/GraphViz.php
@@ -91,6 +91,7 @@
$GLOBALS['wgAutoloadClasses']['GraphViz'] = $dir . GraphViz_body.php;
$GLOBALS['wgAutoloadClasses']['GraphRenderParms'] = $dir . 
GraphRenderParms.php;
$GLOBALS['wgAutoloadClasses']['UploadLocalFile'] = $dir . 
UploadLocalFile.php;
+   $GLOBALS['wgAutoloadClasses']['UploadFromLocalFile'] = $dir . 
UploadLocalFile.php;
$GLOBALS['wgHooks']['ParserFirstCallInit'][] = 'GraphViz::onParserInit';
$GLOBALS['wgHooks']['OutputPageParserOutput'][] = 
'GraphViz::onOutputPageParserOutput';
$GLOBALS['wgHooks']['ArticleDeleteComplete'][] = 
'GraphViz::onArticleDeleteComplete';

-- 
To view, visit https://gerrit.wikimedia.org/r/185339
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibaf51161250e5808f7fbd96932bc178eca90
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Unstub wgParser in initDummyFilePages(). - change (mediawiki...GraphViz)

2015-01-15 Thread Welterkj (Code Review)
Welterkj has submitted this change and it was merged.

Change subject: Unstub wgParser in initDummyFilePages().
..


Unstub wgParser in initDummyFilePages().

Bug: T75073
Change-Id: I3d850cccf97fccbd582495a2e0bda6b1158bfda2
---
M GraphViz_body.php
1 file changed, 13 insertions(+), 16 deletions(-)

Approvals:
  Welterkj: Verified; Looks good to me, approved



diff --git a/GraphViz_body.php b/GraphViz_body.php
index f8cb150..f871270 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -272,10 +272,15 @@
/**
 * Create dummy file pages for each image type supported by this 
extension.
 * @see GraphViz::createDummyImageFilePage
-* @param[in] Parser $parser
 * @author Keith Welter
 */
-   public static function initDummyFilePages( Parser $parser ) {
+   public static function initDummyFilePages() {
+   global $wgParser;
+
+   if ( $wgParser instanceof StubObject ) {
+   $wgParser-_unstub();
+   }
+
foreach ( GraphRenderParms::$supportedDotImageTypes as 
$imageType ) {
if ( !self::imageTypeAllowed( $imageType ) ) {
wfDebug( __METHOD__ . : skipping $imageType\n 
);
@@ -287,12 +292,12 @@
 
if ( !$imageTitle-exists() ) {
wfDebug( __METHOD__ . : file page for 
$imageFileName does not exist\n );
-   self::createDummyImageFilePage( $parser, 
$imageType );
+   self::createDummyImageFilePage( $wgParser, 
$imageType );
} else if ( self::titleHasMultipleRevisions( 
$imageTitle ) ) {
wfDebug( __METHOD__ . : file page for 
$imageFileName has multiple revisions\n );
self::deleteFilePage( $imageTitle );
 
-   self::createDummyImageFilePage( $parser, 
$imageType );
+   self::createDummyImageFilePage( $wgParser, 
$imageType );
}
}
}
@@ -402,7 +407,6 @@
 
/**
 * Set parser hook functions for supported graph types.
-* Also, ensure initDummyFilePages() is be called before parsing the 
edit page.
 * @author Keith Welter
 * @return true
 */
@@ -421,10 +425,7 @@
 * @author Keith Welter
 */
public static function onEditPageGetPreviewContent( $editPage, 
$content ) {
-   global $wgParser;
-   StubObject::unstub( $wgParser );
-   wfDebug( __METHOD__ . : calling self::initDummyFilePages\n );
-   self::initDummyFilePages( $wgParser );
+   self::initDummyFilePages();
}
 
/**
@@ -433,10 +434,7 @@
 * @author Keith Welter
 */
public static function onEditPageGetPreviewText( $editPage, $toParse ) 
{
-   global $wgParser;
-   $wgParser-_unstub();
-   wfDebug( __METHOD__ . : calling self::initDummyFilePages\n );
-   self::initDummyFilePages( $wgParser );
+   self::initDummyFilePages();
return true;
}
 
@@ -634,12 +632,11 @@
 
/**
 * Function to record when a page with the given title is being saved.
+* Also, ensure initDummyFilePages() is called before parsing the page.
 * @author Keith Welter
 */
public static function onTitleSave( $titleText ) {
-   global $wgParser;
-   self::initDummyFilePages( $wgParser );
-
+   self::initDummyFilePages();
self::$titlesBeingSaved[$titleText] = '';
wfDebug( __METHOD__ . : saving: $titleText\n );
return true;

-- 
To view, visit https://gerrit.wikimedia.org/r/185324
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3d850cccf97fccbd582495a2e0bda6b1158bfda2
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Prevent recursive call to Parser::parse (see bug T75073). Bu... - change (mediawiki...GraphViz)

2015-01-14 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/185026

Change subject: Prevent recursive call to Parser::parse (see bug T75073). Bug: 
T75073
..

Prevent recursive call to Parser::parse (see bug T75073).
Bug: T75073

Change-Id: I0d0e7eafa749201104bd8f0f22fb600158f558b7
---
M GraphViz_body.php
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/26/185026/1

diff --git a/GraphViz_body.php b/GraphViz_body.php
index 2972957..f8cb150 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -409,8 +409,6 @@
public static function onParserInit( Parser $parser ) {
self::createCategoryPages();
 
-   self::initDummyFilePages( $parser );
-
foreach ( self::$graphTypes as $graphType ) {
$parser-setHook( self::$tags[$graphType] , array( 
__CLASS__, self::$parserHookFunctions[$graphType] ) );
}
@@ -639,6 +637,9 @@
 * @author Keith Welter
 */
public static function onTitleSave( $titleText ) {
+   global $wgParser;
+   self::initDummyFilePages( $wgParser );
+
self::$titlesBeingSaved[$titleText] = '';
wfDebug( __METHOD__ . : saving: $titleText\n );
return true;

-- 
To view, visit https://gerrit.wikimedia.org/r/185026
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0d0e7eafa749201104bd8f0f22fb600158f558b7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Prevent recursive call to Parser::parse (see bug T75073). Bu... - change (mediawiki...GraphViz)

2015-01-14 Thread Welterkj (Code Review)
Welterkj has submitted this change and it was merged.

Change subject: Prevent recursive call to Parser::parse (see bug T75073). Bug: 
T75073
..


Prevent recursive call to Parser::parse (see bug T75073).
Bug: T75073

Change-Id: I0d0e7eafa749201104bd8f0f22fb600158f558b7
---
M GraphViz_body.php
1 file changed, 3 insertions(+), 2 deletions(-)

Approvals:
  Welterkj: Verified; Looks good to me, approved



diff --git a/GraphViz_body.php b/GraphViz_body.php
index 2972957..f8cb150 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -409,8 +409,6 @@
public static function onParserInit( Parser $parser ) {
self::createCategoryPages();
 
-   self::initDummyFilePages( $parser );
-
foreach ( self::$graphTypes as $graphType ) {
$parser-setHook( self::$tags[$graphType] , array( 
__CLASS__, self::$parserHookFunctions[$graphType] ) );
}
@@ -639,6 +637,9 @@
 * @author Keith Welter
 */
public static function onTitleSave( $titleText ) {
+   global $wgParser;
+   self::initDummyFilePages( $wgParser );
+
self::$titlesBeingSaved[$titleText] = '';
wfDebug( __METHOD__ . : saving: $titleText\n );
return true;

-- 
To view, visit https://gerrit.wikimedia.org/r/185026
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I0d0e7eafa749201104bd8f0f22fb600158f558b7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: Welterkj welterkj+...@gmail.com
Gerrit-Reviewer: jenkins-bot 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Prevent recursive call to Parser::parse (see bug 73073). - change (mediawiki...GraphViz)

2014-12-15 Thread Welterkj (Code Review)
Welterkj has submitted this change and it was merged.

Change subject: Prevent recursive call to Parser::parse (see bug 73073).
..


Prevent recursive call to Parser::parse (see bug 73073).

Bug: 73073
Change-Id: I376df7cb7e7782bd846f572e7a0c42e48f6e71cd
---
M GraphViz.php
M GraphViz_body.php
M RELEASE-NOTES.md
3 files changed, 62 insertions(+), 1 deletion(-)

Approvals:
  Welterkj: Verified; Looks good to me, approved
  Temptuousinsolence: Looks good to me, but someone else must approve
  jenkins-bot: Checked



diff --git a/GraphViz.php b/GraphViz.php
index 4192f75..25ea832 100644
--- a/GraphViz.php
+++ b/GraphViz.php
@@ -33,7 +33,7 @@
 
 if ( !defined( 'MEDIAWIKI' ) ) die();
 
-define( 'GraphViz_VERSION', '1.5.0' );
+define( 'GraphViz_VERSION', '1.5.1' );
 
 /**
  * The GraphViz settings class.
diff --git a/GraphViz_body.php b/GraphViz_body.php
index c051374..2972957 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -201,6 +201,55 @@
private static $titlesBeingSaved = array();
 
/**
+* A variable for temporarily holding a copy of GLOBALS['wgHooks'].
+* @var $disabledHooks
+*/
+   private static $disabledHooks = null;
+
+   /**
+* Disable all hook functions (GLOBALS['wgHooks']).
+* @author Keith Welter
+* @return true upon success, false upon failure.
+*/
+   protected static function disableHooks() {
+   if ( isset( $GLOBALS['wgHooks'] ) ) {
+   if ( isset( self::$disabledHooks ) ) {
+   wfDebug( __METHOD__ . : hooks already 
disabled\n );
+   } else {
+   self::$disabledHooks = $GLOBALS['wgHooks'];
+   $GLOBALS['wgHooks'] = null;
+   wfDebug( __METHOD__ . : hooks disabled\n );
+   return true;
+   }
+   } else {
+   wfDebug( __METHOD__ . : hooks not set\n );
+   }
+   return false;
+   }
+
+   /**
+* Re-enable all hook functions (GLOBALS['wgHooks']).
+* Must be called after GraphViz::disableHooks.
+* @author Keith Welter
+* @return true upon success, false upon failure.
+*/
+   protected static function enableHooks() {
+   if ( isset( self::$disabledHooks ) ) {
+   if ( isset( $GLOBALS['wgHooks'] ) ) {
+   wfDebug( __METHOD__ . : hooks are already set 
- aborting\n );
+   } else {
+   $GLOBALS['wgHooks'] = self::$disabledHooks;
+   self::$disabledHooks = null;
+   wfDebug( __METHOD__ . : hooks enabled\n );
+   return true;
+   }
+   } else {
+   wfDebug( __METHOD__ . : hooks not disabled\n );
+   }
+   return false;
+   }
+
+   /**
 * @return string regular expression for matching an image attribute in 
the DOT language.
 *
 * @see http://www.graphviz.org/content/attrs#dimage
@@ -1131,6 +1180,11 @@
$watch = false;
$removeTempFile = true;
 
+   // prevent recusive call to Parser::parse (see bug 
73073).
+   if ( !self::disableHooks() ) {
+   return wfMessage( 'graphviz-reload' 
)-escaped();
+   }
+
// Upload the graph image.
// We can only do this here when a file page already 
exists for the given image.
// Otherwise, file page creation triggers parsing of 
the page text and comment
@@ -1151,6 +1205,10 @@
$uploaded = true;
touch( $imageFilePath );
}
+
+   if ( !self::enableHooks() ) {
+   throw new MWException( failed to re-enable 
hooks );
+   }
}
 
// If rendering a dummy graph image just return without 
producing HTML.
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 91cb0b3..339ee34 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -1,6 +1,9 @@
 These are the release notes for the [MediaWiki][mediawiki] [GraphViz 
extension][gv_ext].
 
 ## GraphViz 1.5.x ## (not released yet)
+* Fix for [bug 73073](https://bugzilla.wikimedia.org/show_bug.cgi?id=72325).
+
+## GraphViz 1.5.0 ## (2014-10-28)
 * Add tag arguments preparse=dynamic and preparse=static.
 * Add categories for pages created by this extension.
 

-- 
To view, visit https://gerrit.wikimedia.org/r/174487
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings


[MediaWiki-commits] [Gerrit] Release version 1.5.0. - change (mediawiki...GraphViz)

2014-10-28 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/169574

Change subject: Release version 1.5.0.
..

Release version 1.5.0.

Change-Id: I9c145b77646c2fde8bbe68fb5ccf6274db5070c5
---
M GraphViz.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/74/169574/1

diff --git a/GraphViz.php b/GraphViz.php
index d32fc01..4192f75 100644
--- a/GraphViz.php
+++ b/GraphViz.php
@@ -33,7 +33,7 @@
 
 if ( !defined( 'MEDIAWIKI' ) ) die();
 
-define( 'GraphViz_VERSION', '1.4.1' );
+define( 'GraphViz_VERSION', '1.5.0' );
 
 /**
  * The GraphViz settings class.

-- 
To view, visit https://gerrit.wikimedia.org/r/169574
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9c145b77646c2fde8bbe68fb5ccf6274db5070c5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add category pages and tags. - change (mediawiki...GraphViz)

2014-10-27 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/169316

Change subject: Add category pages and tags.
..

Add category pages and tags.

This change adds a category for all pages generated by the
GraphViz extension.  There is one root category for GraphViz
and a subcategory for each renderer (dot, neato, fdp, sfdp,
circo, twopi and mscgen).  This makes it easy to find graph
images created by the extension.

Change-Id: I942f703614165d7cadcf501b1312139e265bf5f0
---
M GraphRenderParms.php
M GraphViz_body.php
M RELEASE-NOTES.md
M i18n/en.json
M i18n/qqq.json
5 files changed, 131 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/16/169316/1

diff --git a/GraphRenderParms.php b/GraphRenderParms.php
index a0d4c8f..f6d21ce 100644
--- a/GraphRenderParms.php
+++ b/GraphRenderParms.php
@@ -159,12 +159,16 @@
return $this-getGraphName( $userSpecific ) . '.src';
}
 
+   public function getImageBaseName( $userSpecific ) {
+   return $this-getGraphName( $userSpecific ) . '_' . 
$this-getRenderer();
+   }
+
public function getImageFileName( $userSpecific ) {
-   return $this-getGraphName( $userSpecific ) . '.' . 
$this-imageType;
+   return $this-getImageBaseName( $userSpecific ) . '.' . 
$this-imageType;
}
 
public function getMapFileName( $userSpecific ) {
-   return $this-getGraphName( $userSpecific ) . '.map';
+   return $this-getImageBaseName( $userSpecific ) . '.map';
}
 
public function getSourcePath( $userSpecific ) {
diff --git a/GraphViz_body.php b/GraphViz_body.php
index 95634c4..c051374 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -104,7 +104,7 @@
 *
 * @var string IMAGE_DUMMY
 */
-   const IMAGE_DUMMY = File_graph_GraphVizExtensionDummy;
+   const IMAGE_DUMMY = File_graph_GraphVizExtensionDummy_dot;
 
/**
 * Used as an array key in GraphViz::$graphTypes and other arrays.
@@ -121,6 +121,27 @@
 * @var integer MSCGEN
 */
const MSCGEN = 1;
+
+   /**
+* The name of the root category containing pages created by this 
extension.
+*
+* @var integer ROOT_CATEGORY
+*/
+   const ROOT_CATEGORY = GraphViz;
+
+   /**
+* Subcategories of pages created by this extension.
+* @var array $subCategories
+*/
+   private static $subCategories = array(
+   'mscgen',
+   'dot',
+   'neato',
+   'fdp',
+   'sfdp',
+   'circo',
+   'twopi'
+   );
 
/**
 * A list of dot attributes that are forbidden.
@@ -260,6 +281,50 @@
}
 
/**
+* Create a category page for GraphViz::ROOT_CATEGORY and subcategory 
pages for GraphViz::$subCategories.
+* @author Keith Welter
+*/
+   public static function createCategoryPages() {
+   $rootCategoryName = self::ROOT_CATEGORY;
+   $rootCategoryDesc = wfMessage( 'graphviz-category-desc', 
[[:Category:$rootCategoryName]] )-text();
+   self::createCategoryPage( $rootCategoryName, $rootCategoryDesc, 
 );
+
+   foreach( self::$subCategories as $subCategory ) {
+   $subCategoryName = $rootCategoryName . ' ' . 
$subCategory;
+   $subCategoryDesc = wfMessage( 
'graphviz-subcategory-desc', [[:Category:$subCategoryName]], $subCategory 
)-text();
+   $subCategoryDesc .= [[Category:$rootCategoryName]];
+   self::createCategoryPage( $subCategoryName, 
$subCategoryDesc,  );
+   }
+   }
+
+   public static function getCategoryTags( $renderer ) {
+   $rootCategoryName = self::ROOT_CATEGORY;
+   return 
[[Category:$rootCategoryName]][[Category:$rootCategoryName $renderer]];
+   }
+
+   /**
+* Create a category page with the given name if it does not already 
exist.
+* @param[in] string $name is the name to use for the new category page.
+* @param[in] string $pageText is the page text to supply.
+* @param[in] string $comment is the comment to supply for the edit.
+* @author Keith Welter
+*/
+   public static function createCategoryPage( $name, $pageText, $comment ) 
{
+   $title = Title::newFromText( Category: . $name );
+
+   if ( !$title-exists() ) {
+   $wikiPage = new WikiPage( $title );
+   $flags = EDIT_NEW;
+   $status = self::doEditContent( $wikiPage, $title, 
$pageText, $comment, $flags, null );
+   if ( $status-isOK() ) {
+   wfDebug( __METHOD__ . : created 

[MediaWiki-commits] [Gerrit] Add tag argument “preparse”. - change (mediawiki...GraphViz)

2014-10-23 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/168410

Change subject: Add tag argument “preparse”.
..

Add tag argument “preparse”.

This change adds support for wiki variable and template
replacement in the wikitext before it is passed to the dot
or mscgen renderer.

The new tag argument “preparse” indicates that the wikitext
should be preparsed using Parser::recursiveTagParse.
The key/value pair preparse=”dynamic” means that the
preparse should occur every time the page is displayed.
The key/value pair preparse=”static” means that the
preparsing should occur only when an edit is saved or previewed.

Change-Id: I0cb1457ce9d04467e69d6992aed9655ad7d37606
---
M GraphViz_body.php
M RELEASE-NOTES.md
M i18n/en.json
M i18n/qqq.json
4 files changed, 49 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/10/168410/1

diff --git a/GraphViz_body.php b/GraphViz_body.php
index 391126f..a9e9658 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -271,8 +271,9 @@
public static function createDummyImageFilePage( Parser $parser, 
$imageType ) {
$input = graph GraphVizExtensionDummy { GraphViz };
$args['format'] = $imageType;
+   $frame = false;
$isDummy = true;
-   self::render( $input, $args, $parser, $isDummy );
+   self::render( $input, $args, $parser, $frame, $isDummy );
}
 
/**
@@ -606,10 +607,10 @@
 * @see http://www.mcternan.me.uk/mscgen/
 * @author Matthew Pearson
 */
-   public static function mscgenParserHook( $input, $args, $parser )
+   public static function mscgenParserHook( $input, $args, $parser, $frame 
)
{
$args['renderer'] = self::$graphLanguages[self::MSCGEN];
-   return self::render( $input, $args, $parser );
+   return self::render( $input, $args, $parser, $frame );
}
 
/**
@@ -619,7 +620,7 @@
 * @see http://www.graphviz.org/content/dot-language
 * @author Thomas Hummel
 */
-   public static function graphvizParserHook( $input, $args, $parser )
+   public static function graphvizParserHook( $input, $args, $parser, 
$frame )
{
if ( isset( $args['renderer'] ) ) {
switch( $args['renderer'] ) {
@@ -637,7 +638,7 @@
$args['renderer'] = 
self::$graphLanguages[self::GRAPHVIZ];
}
 
-   return self::render( $input, $args, $parser );
+   return self::render( $input, $args, $parser, $frame );
}
 
/**
@@ -756,7 +757,7 @@
 *
 * @author Keith Welter et al.
 */
-   protected static function render( $input, $args, $parser, $isDummy = 
false )
+   protected static function render( $input, $args, $parser, $frame, 
$isDummy = false )
{
global
$wgUser,
@@ -833,14 +834,6 @@
// instantiate an object to hold the graph rendering parameters
$graphParms = new GraphRenderParms( $renderer, $graphName, 
$userName, $imageType, $sourceAndMapDir, $imageDir );
 
-   $errorText = ;
-   // if the input is in the dot language, sanitize it
-   if ( $graphParms-getRenderer() != 
self::$graphLanguages[self::MSCGEN] ) {
-   if ( !self::sanitizeDotInput( $input, $errorText ) ) {
-   return self::errorHTML( $errorText );
-   }
-   }
-
// initialize context variables
$saving = false;
$isPreview = false;
@@ -857,7 +850,41 @@
self::deleteFiles( $graphParms, true, true );
}
}
-   wfDebug( __METHOD__ . : isPreview: $isPreview saving: 
$saving\n );
+   wfDebug( __METHOD__ . : isPreview: $isPreview saving: $saving 
isDummy: $isDummy\n );
+
+   // determine whether or not to call recursiveTagParse
+   $doRecursiveTagParse = false;
+   $preParseType = none;
+
+   if ( !$isDummy ) {
+   if ( isset( $args['preparse'] ) ) {
+   $preParseType = $args['preparse'];
+   if ( $preParseType == dynamic ) {
+   $doRecursiveTagParse = true;
+   $parser-disableCache();
+   } else if ( $preParseType == static ) {
+   if ( $saving || $isPreview ) {
+   $doRecursiveTagParse = true;
+   }
+   } else {
+

[MediaWiki-commits] [Gerrit] Avoid reload message. - change (mediawiki...GraphViz)

2014-10-21 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/168026

Change subject: Avoid reload message.
..

Avoid reload message.

Users have complained about needing to reload pages containing
graphs after editing the graphs (associated message: “Graph image
source changed. Reload page to display updated graph image”).
This behavior is a result of:
- graph images are created by a parser hook function which...
- uses the ImageMap extension to render graph images as HTML
which...
- requires that graph images have been uploaded prior to
rendering which...
- causes an *exception if the upload is done from within a parser
hook function so...
- the upload is done as a separate step after parsing is complete
which...
- requires the page reload to see the graph image rendered by
ImageMap

*The exception (“invalid marker” from the StripState class)
is due to a recursive call to Parser::parse.

After further investigation I found that a file upload can occur
within the context of a parser hook function but not page
creation (the latter is what causes the exception described
above).  I found that by creating a dummy file page before
entering the parsing code I could upload the “real” graph images
associated with parsed wiki text on top of the dummy and thus
avoid the exception.

I am using this pre-initialized dummy file page technique to
avoid the reload message.  The one case when the message still
appears is when creating more than one new graph and then doing
an edit preview (rather than saving immediately).  In this case,
the first new graph is rendered immediately but the subsequent
new graphs result in the reload message.

Change-Id: Ie77e9a04b6353f74081550281bb252ae1f00a298

Bug: 72325

Change-Id: I11c6c7b41d63aa199b80735d700a73f6af5c697e
---
M GraphViz.php
M GraphViz_body.php
M RELEASE-NOTES.md
3 files changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/26/168026/1

diff --git a/GraphViz.php b/GraphViz.php
index 0e88286..ba1afa3 100644
--- a/GraphViz.php
+++ b/GraphViz.php
@@ -69,7 +69,7 @@
public $defaultImageType;
 };
 
-$wgGraphVizSettings = new GraphVizSettings();
+$GLOBALS['wgGraphVizSettings'] = new GraphVizSettings();
 
 //self executing anonymous function to prevent global scope assumptions
 call_user_func( function() {
diff --git a/GraphViz_body.php b/GraphViz_body.php
index 391126f..49bc36b 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -1358,6 +1358,7 @@
 * -# shape name
 * -# coordinates
 * -# link (see http://en.wikipedia.org/wiki/Help:Link)
+* @param[in] string $desc is the desc parameter applicable to the 
ImageMap syntax
 *
 * @return string suitable for input to ImageMap::render.
 *
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index ca34766..7271d3d 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 1.4.1 ## (2014-10-21)
+* Fix for [bug 72325](https://bugzilla.wikimedia.org/show_bug.cgi?id=72325).
+
 ## GraphViz 1.4.0 ## (2014-10-19)
 * Add unit test hook, first unit test.
 * Avoid reload message (Graph image source changed. Reload page to display 
updated graph image.)

-- 
To view, visit https://gerrit.wikimedia.org/r/168026
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I11c6c7b41d63aa199b80735d700a73f6af5c697e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Update version to 1.4.1. - change (mediawiki...GraphViz)

2014-10-21 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/168036

Change subject: Update version to 1.4.1.
..

Update version to 1.4.1.

Change-Id: I7a46cb48f78b3f068325f4d99b56da5e2cf9da3f
---
M GraphViz.php
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/36/168036/1

diff --git a/GraphViz.php b/GraphViz.php
index ba1afa3..d32fc01 100644
--- a/GraphViz.php
+++ b/GraphViz.php
@@ -33,7 +33,7 @@
 
 if ( !defined( 'MEDIAWIKI' ) ) die();
 
-define( 'GraphViz_VERSION', '1.4.0' );
+define( 'GraphViz_VERSION', '1.4.1' );
 
 /**
  * The GraphViz settings class.

-- 
To view, visit https://gerrit.wikimedia.org/r/168036
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7a46cb48f78b3f068325f4d99b56da5e2cf9da3f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Avoid reload message. - change (mediawiki...GraphViz)

2014-10-19 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/167451

Change subject: Avoid reload message.
..

Avoid reload message.

Users have complained about needing to reload pages containing
graphs after editing the graphs (associated message: “Graph image
source changed. Reload page to display updated graph image”).
This behavior is a result of:
- graph images are created by a parser hook function which...
- uses the ImageMap extension to render graph images as HTML
which...
- requires that graph images have been uploaded prior to
rendering which...
- causes an *exception if the upload is done from within a parser
hook function so...
- the upload is done as a separate step after parsing is complete
which...
- requires the page reload to see the graph image rendered by
ImageMap

*The exception (“invalid marker” from the StripState class)
is due to a recursive call to Parser::parse.

After further investigation I found that a file upload can occur
within the context of a parser hook function but not page
creation (the latter is what causes the exception described
above).  I found that by creating a dummy file page before
entering the parsing code I could upload the “real” graph images
associated with parsed wiki text on top of the dummy and thus
avoid the exception.

I am using this pre-initialized dummy file page technique to
avoid the reload message.  The one case when the message still
appears is when creating more than one new graph and then doing
an edit preview (rather than saving immediately).  In this case,
the first new graph is rendered immediately but the subsequent
new graphs result in the reload message.

Change-Id: Ie77e9a04b6353f74081550281bb252ae1f00a298
---
A COPYING
M GraphRenderParms.php
M GraphViz.php
M GraphViz_body.php
M RELEASE-NOTES.md
M UploadLocalFile.php
6 files changed, 653 insertions(+), 60 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/51/167451/1

diff --git a/COPYING b/COPYING
new file mode 100644
index 000..d159169
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,339 @@
+GNU GENERAL PUBLIC LICENSE
+   Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for 

[MediaWiki-commits] [Gerrit] This change modifies the GraphViz extension to make graph im... - change (mediawiki...GraphViz)

2014-10-01 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/164159

Change subject: This change modifies the GraphViz extension to make graph image 
upload optional instead of automatic/required.
..

This change modifies the GraphViz extension to make graph image
upload optional instead of automatic/required.

Users have complained about needing to reload pages containing
graphs after editing the graphs (associated message: “Graph
image source changed. Reload page to display updated graph
image”).  This behavior is because:
- graph images are created by a parser hook function which...
- uses the ImageMap extension to render graph images as HTML
which...
- requires that graph images have been uploaded prior to
rendering which...
- causes an exception if the upload is done from within a
parser hook function so...
- the upload is done as a separate step after parsing is
complete which...
- requires the page reload to see the graph image rendered
by ImageMap

I’ve considered a few alternative remedies and have selected the
last one below:
- modify the MW core to allow uploads from within parser
functions (not backwards compatible)
- trickery such as custom upload (too complicated,
bad engineering)
- refactor extensions/ImageMap/ImageMap_body.php to allow
specialization by subclasses (requires co-operation/collaboration
with the ImageMap extension maintainer-- no luck with this in the
past)
- modify a copy of ImageMap_body.php to work on non-uploaded local
files and make uploading optional (I dislike the code duplication
but this seems to be the best alternative)

Change-Id: I2b171c8414d4df10a8e1cb0bab1f6974bc5f6463
---
A COPYING
A GraphVizImageMap.php
2 files changed, 732 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/59/164159/1

diff --git a/COPYING b/COPYING
new file mode 100644
index 000..d159169
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,339 @@
+GNU GENERAL PUBLIC LICENSE
+   Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+

[MediaWiki-commits] [Gerrit] Add unit test hook and first unit test. - change (mediawiki...GraphViz)

2014-07-11 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/145689

Change subject: Add unit test hook and first unit test.
..

Add unit test hook and first unit test.

Change-Id: I4b8c505ffdf8f9e6f905b323f096e163743ad342
---
M GraphViz.php
M GraphViz_body.php
A tests/phpunit/GraphVizTest.php
3 files changed, 52 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/89/145689/1

diff --git a/GraphViz.php b/GraphViz.php
index 752a315..1f0d6e5 100644
--- a/GraphViz.php
+++ b/GraphViz.php
@@ -96,6 +96,7 @@
$GLOBALS['wgHooks']['PageContentSaveComplete'][] = 
'GraphViz::onPageContentSaveComplete';
$GLOBALS['wgHooks']['OutputPageParserOutput'][] = 
'GraphViz::onOutputPageParserOutput';
$GLOBALS['wgHooks']['ArticleDeleteComplete'][] = 
'GraphViz::onArticleDeleteComplete';
+   $GLOBALS['wgHooks']['UnitTestsList'][] = 'GraphViz::onUnitTestsList';
 
$GLOBALS['wgExtensionCredits']['parserhook'][] = array(
'name' = 'Graphviz',
diff --git a/GraphViz_body.php b/GraphViz_body.php
index f431738..59c062b 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -182,6 +182,16 @@
}
 
/**
+* Unit test hook.
+* @author Keith Welter
+* @return true
+*/
+   public static function onUnitTestsList( $files ) {
+   $files = array_merge( $files, glob( __DIR__ . 
'/tests/phpunit/*Test.php' ) );
+   return true;
+   }
+
+   /**
 * Set parser hook functions for supported graph types.
 * @author Keith Welter
 * @return true
diff --git a/tests/phpunit/GraphVizTest.php b/tests/phpunit/GraphVizTest.php
new file mode 100644
index 000..aea9b10
--- /dev/null
+++ b/tests/phpunit/GraphVizTest.php
@@ -0,0 +1,41 @@
+?php
+
+/**
+ *  @group GraphViz
+ */
+class GraphVizTest extends MediaWikiTestCase {
+   protected function setUp() {
+   parent::setUp();
+   //...GraphVizTest set-up
+   }
+ 
+   protected function tearDown() {
+   //GraphVizTest tear-down...
+   parent::tearDown();
+   }
+
+   protected static function getGraphVizMethod( $name ) {
+   $class = new ReflectionClass('GraphViz');
+   $method = $class-getMethod( $name );
+   $method-setAccessible( true );
+   return $method;
+   }
+ 
+   public function testForbiddenDotAttributes() {
+   $sanitizeDotInput = self::getGraphVizMethod( 'sanitizeDotInput' 
);
+   $graphviz = new GraphViz();
+
+   $errorText = ;
+   $input = 'digraph graphName { node [imagepath=../]; }';
+   $result = $sanitizeDotInput-invokeArgs( $graphviz, array( 
$input, $errorText) );
+   $this-assertFalse( $result, imagepath should be rejected );
+
+   $input = 'digraph graphName { node [fontpath=../]; }';
+   $result = $sanitizeDotInput-invokeArgs( $graphviz, array( 
$input, $errorText) );
+   $this-assertFalse( $result, fontpath should be rejected );
+
+   $input = 'digraph graphName { node [shapefile=../]; }';
+   $result = $sanitizeDotInput-invokeArgs( $graphviz, array( 
$input, $errorText) );
+   $this-assertFalse( $result, shapefile should be rejected );
+   }
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/145689
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4b8c505ffdf8f9e6f905b323f096e163743ad342
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Backward compatibility fix for MW version 1.21. - change (mediawiki...GraphViz)

2014-07-07 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/144467

Change subject: Backward compatibility fix for MW version 1.21.
..

Backward compatibility fix for MW version 1.21.

The problem is that the GraphViz extension 1.0+ uses two hooks and
one function that were introduced in MW 1.21 (PageContentSave,
PageContentSaveComplete and WikiPage::doEdit respectively).

The fix is for the extension to use the older hooks and function
for MW versions 1.21 (ArticleSave, ArticleSaveComplete and
WikiPage::doEditContent respectively).

Change-Id: Ie353c40ff784e49cb7740059c2e653443dfa0cce
---
M GraphViz.php
M GraphViz_body.php
M README.md
M RELEASE-NOTES.md
M UploadLocalFile.php
5 files changed, 68 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/67/144467/1

diff --git a/GraphViz.php b/GraphViz.php
index 752a315..3343cf9 100644
--- a/GraphViz.php
+++ b/GraphViz.php
@@ -92,11 +92,20 @@
$GLOBALS['wgAutoloadClasses']['GraphRenderParms'] = $dir . 
GraphRenderParms.php;
$GLOBALS['wgAutoloadClasses']['UploadLocalFile'] = $dir . 
UploadLocalFile.php;
$GLOBALS['wgHooks']['ParserFirstCallInit'][] = 'GraphViz::onParserInit';
-   $GLOBALS['wgHooks']['PageContentSave'][] = 
'GraphViz::onPageContentSave';
-   $GLOBALS['wgHooks']['PageContentSaveComplete'][] = 
'GraphViz::onPageContentSaveComplete';
$GLOBALS['wgHooks']['OutputPageParserOutput'][] = 
'GraphViz::onOutputPageParserOutput';
$GLOBALS['wgHooks']['ArticleDeleteComplete'][] = 
'GraphViz::onArticleDeleteComplete';
 
+   $oldVersion = version_compare( $GLOBALS['wgVersion'], '1.21', '' );
+   if ( $oldVersion ) {
+   # Do stuff for MediaWiki 1.20 and older
+   $GLOBALS['wgHooks']['ArticleSave'][] = 
'GraphViz::onArticleSave';
+   $GLOBALS['wgHooks']['ArticleSaveComplete'][] = 
'GraphViz::onArticleSaveComplete';
+   } else {
+   # Do stuff for MediaWiki 1.21 and newer
+   $GLOBALS['wgHooks']['PageContentSave'][] = 
'GraphViz::onPageContentSave';
+   $GLOBALS['wgHooks']['PageContentSaveComplete'][] = 
'GraphViz::onPageContentSaveComplete';
+   }
+
$GLOBALS['wgExtensionCredits']['parserhook'][] = array(
'name' = 'Graphviz',
'path' = __FILE__,
diff --git a/GraphViz_body.php b/GraphViz_body.php
index f431738..a5af37b 100644
--- a/GraphViz_body.php
+++ b/GraphViz_body.php
@@ -312,14 +312,31 @@
}
 
/**
-* Hook function to record when a page is being saved.
+* Hook function front-end to GraphViz::onTitleSave.
 * @author Keith Welter
 */
public static function onPageContentSave( $wikiPage, $user, $content, 
$summary, $isMinor, $isWatch, $section, $flags, $status ) {
$titleText = $wikiPage-getTitle()-getFulltext();
+   return self::onTitleSave( $titleText );
+   }
+
+   /**
+* Function to record when a page with the given title is being saved.
+* @author Keith Welter
+*/
+   public static function onTitleSave( $titleText ) {
self::$titlesBeingSaved[$titleText] = '';
wfDebug( __METHOD__ . : saving: $titleText\n );
return true;
+   }
+
+   /**
+* Backwards-compatible ( MW 1.21) hook function front-end to 
GraphViz::onTitleSave.
+* @author Keith Welter
+*/
+   public static function onArticleSave( $article, $user, $text, 
$summary, $minor, $watchthis, $sectionanchor, $flags, $status ) {
+   $titleText = $article-getTitle()-getFulltext();
+   return self::onTitleSave( $titleText );
}
 
/**
@@ -331,14 +348,23 @@
}
 
/**
-* Hook function to clean-up when a page is done being saved.  Firstly, 
this function invokes
-* deleteInactiveFiles() to delete inactive graph files associated with 
a page when
-* it is done being saved.  Lastly, this function removes the record 
that the page is being
-* saved as well as the list of active files for the page.
+* Hook function front-end to GraphViz::onTitleSaveComplete.
 * @author Keith Welter
 */
public static function onPageContentSaveComplete( $wikiPage, $user, 
$content, $summary, $isMinor, $isWatch, $section, $flags, $revision, $status, 
$baseRevId ) {
$titleText = $wikiPage-getTitle()-getFulltext();
+   return self::onTitleSaveComplete( $titleText );
+   }
+
+   /**
+* Function to clean-up when a page with the given title is done being 
saved.  
+* Firstly, this function invokes deleteInactiveFiles() to delete 
inactive 
+* graph files associated with a page when it is done being saved.  
Lastly, 
+* this function removes 

[MediaWiki-commits] [Gerrit] Add README.md and RELEASE-NOTES.md. - change (mediawiki...GraphViz)

2014-06-27 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/142704

Change subject: Add README.md and RELEASE-NOTES.md.
..

Add README.md and RELEASE-NOTES.md.

Change-Id: I335534ffc2034d2407a91e14b1fcbb0beb054fc4
---
A README.md
A RELEASE-NOTES.md
2 files changed, 93 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/04/142704/1

diff --git a/README.md b/README.md
new file mode 100644
index 000..7442671
--- /dev/null
+++ b/README.md
@@ -0,0 +1,46 @@
+# GraphViz
+[![Latest Stable 
Version](https://poser.pugx.org/mediawiki/graph-viz/version.png)](https://packagist.org/packages/mediawiki/graph-viz)
+[![Packagist download 
count](https://poser.pugx.org/mediawiki/graph-viz/d/total.png)](https://packagist.org/packages/mediawiki/graph-viz)
+
+The [MediaWiki][mediawiki] [GraphViz extension][gv_ext] lets users collaborate 
to create and display graphs and message sequence charts as in-line images on 
wiki pages using tools from the open-source [Graphviz][graphviz] and 
[Mscgen][mscgen] projects.  For more information, consult the [release 
notes](RELEASE-NOTES.md).
+
+## Requirements
+
+- PHP 5.3 or later
+- MediaWiki 1.19 or later
+
+## Installation
+
+The recommended way to install this extension is by using 
[Composer][composer]. Just add the following to the MediaWiki `composer.json` 
file and run the ``php composer.phar install/update`` command.
+
+```json
+{
+   require: {
+   mediawiki/graph-viz: ~1.1.*
+   }
+}
+```
+
+## Contribution and support
+
+Development is coordinated by Keith Welter and Jeroen De Dauw.
+
+If you have remarks, questions, or suggestions, please add a topic to the 
[GraphViz extension talk page][talk].
+
+If you want to contribute work to the project, start by reading the [MediaWiki 
hacker tutorial][hacker]. A list of people who have made contributions in the 
past can be found [here][contributors].
+
+To report a bug, go 
[here](https://bugzilla.wikimedia.org/enter_bug.cgi?product=MediaWiki%20extensionsformat=guided).
+
+## License
+
+Generally published under [GNU General Public License 2.0 or later][license] 
together with third-party plugins and their license.
+
+[mediawiki]: https://www.mediawiki.org/wiki/MediaWiki
+[gv_ext]: https://www.mediawiki.org/wiki/Extension:GraphViz
+[graphviz]: https://github.com/ellson/graphviz
+[mscgen]: http://www.mcternan.me.uk/mscgen/
+[composer]: https://getcomposer.org/
+[talk]: https://www.mediawiki.org/wiki/Extension_talk:GraphViz
+[hacker]: 
https://www.mediawiki.org/wiki/How_to_become_a_MediaWiki_hacker/Extension_Writing_Tutorial
+[contributors]: 
https://github.com/mediawiki-extensions-GraphViz/graphs/contributors
+[license]: https://www.gnu.org/copyleft/gpl.html
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
new file mode 100644
index 000..2323563
--- /dev/null
+++ b/RELEASE-NOTES.md
@@ -0,0 +1,47 @@
+These are the release notes for the [MediaWiki][mediawiki] [GraphViz 
extension][gv_ext].
+
+
+## GraphViz 1.2.0 ## (2014-06-25)
+
+### Compatibility changes
+* Added suggestion for [Composer][composer] [mediawiki/image-map 
package](https://packagist.org/packages/mediawiki/image-map).
+
+## GraphViz 1.1.0 ## (2014-06-13)
+
+### Compatibility changes
+* Installation is now done via the [Composer][composer] dependency manager 
using the [mediawiki/graph-viz 
package](https://packagist.org/packages/mediawiki/graph-viz).
+
+## GraphViz 1.0.0 ## (2014-05-28)
+
+### Dependency changes
+* added dependency on [MediaWiki][mediawiki] [ImageMap 
extension][image_map_ext].
+
+### Compatibility changes
+* global function renderGraphviz() replaced by GraphViz::graphvizParserHook
+* global function renderMscGen() replaced by GraphViz::mscgenParserHook
+* new link syntax is given 
[here](https://www.mediawiki.org/wiki/Extension:GraphViz#Links)
+
+### New features
+* rendered graph and message sequence chart images are uploaded to the wiki
+* graphs and message sequence charts are only re-rendered when the source 
changes
+* embedded links work properly when the rendered image is resized (powered by 
[[Extension:ImageMap]])
+* embedded links support tooltips (powered by [[Extension:ImageMap]])
+* support for the DOT [image 
attribute](http://www.graphviz.org/content/attrs#dimage image)
+* deterministic file clean-up (active files are retained, inactive files are 
deleted)
+* support for multiple message sequence charts per page (uniquifier)
+* security fixes
+* extensive internal documentation (doxygen format)
+
+## GraphViz 0.9.0 (and prior) ## (2011-03-14)
+* In 2011 Jeroen De Dauw uploaded the latest code into [MediaWiki 
SVN](http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/GraphViz/ 
MediaWiki SVN).
+* In 2010 Thomas Hummel merged versions, along with his own fixes, to try to 
create a working solution for several OSes in one file.
+* In 2008 Matthew 

[MediaWiki-commits] [Gerrit] Suggest the image-map package in the GraphViz composer.json. - change (mediawiki...GraphViz)

2014-06-25 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/141989

Change subject: Suggest the image-map package in the GraphViz composer.json.
..

Suggest the image-map package in the GraphViz composer.json.

The GraphViz extension depends on the ImageMap extension being
installed.  Since the ImageMap extension is bundled with MediaWiki,
the image-map package is merely a suggestion.

Also, since the image-map package only exists @dev stability,
the graph-viz package cannot unilaterally require/install it without
a change to minimum-stability in the main MediaWiki composer.json.

While the image-map composer package may be convenient for some,
it will cause the latest development version of the extension to
be installed with each composer update command.  For stability,
the MediaWiki admin may prefer to keep the snapshot of the ImageMap
extension that was bundled with the installed MediaWiki version.

Change-Id: I980892434bfaf345f05a37cb6badca439c55a2ca
---
M composer.json
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/89/141989/1

diff --git a/composer.json b/composer.json
index 152b53c..a6afbb3 100644
--- a/composer.json
+++ b/composer.json
@@ -15,6 +15,9 @@
php: =5.3.0,
composer/installers: 1.*,=1.0.1
},
+   suggest: {
+   mediawiki/image-map: The ImageMap extension is required and 
is bundled with MediaWiki.  See 
https://www.mediawiki.org/wiki/Extension:ImageMap;
+   },
autoload: {
files : [
GraphViz.php

-- 
To view, visit https://gerrit.wikimedia.org/r/141989
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I980892434bfaf345f05a37cb6badca439c55a2ca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add composer support. - change (mediawiki...ImageMap)

2014-06-24 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/141830

Change subject: Add composer support.
..

Add composer support.

Change-Id: I5d41737028a7337021c48a3c70efeba821d6d0c2
---
M ImageMap.php
A composer.json
2 files changed, 40 insertions(+), 13 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ImageMap 
refs/changes/30/141830/1

diff --git a/ImageMap.php b/ImageMap.php
index 0e5ea97..081eeaa 100644
--- a/ImageMap.php
+++ b/ImageMap.php
@@ -16,21 +16,24 @@
die( 'This file is a MediaWiki extension, it is not a valid entry point' );
 }
 
-$dir = __DIR__ . '/';
-$wgMessagesDirs['ImageMap'] = __DIR__ . '/i18n';
-$wgExtensionMessagesFiles['ImageMap'] = $dir . 'ImageMap.i18n.php';
-$wgAutoloadClasses['ImageMap'] = $dir . 'ImageMap_body.php';
-$wgHooks['ParserFirstCallInit'][] = 'wfSetupImageMap';
+//self executing anonymous function to prevent global scope assumptions
+call_user_func( function() {
+   $dir = __DIR__ . '/';
+   $GLOBALS['wgMessagesDirs']['ImageMap'] = __DIR__ . '/i18n';
+   $GLOBALS['wgExtensionMessagesFiles']['ImageMap'] = $dir . 
'ImageMap.i18n.php';
+   $GLOBALS['wgAutoloadClasses']['ImageMap'] = $dir . 'ImageMap_body.php';
+   $GLOBALS['wgHooks']['ParserFirstCallInit'][] = 'wfSetupImageMap';
 
-$wgExtensionCredits['parserhook']['ImageMap'] = array(
-   'path'   = __FILE__,
-   'name'   = 'ImageMap',
-   'author' = 'Tim Starling',
-   'url'= 'https://www.mediawiki.org/wiki/Extension:ImageMap',
-   'descriptionmsg' = 'imagemap_desc',
-);
+   $GLOBALS['wgExtensionCredits']['parserhook']['ImageMap'] = array(
+   'path'   = __FILE__,
+   'name'   = 'ImageMap',
+   'author' = 'Tim Starling',
+   'url'= 
'https://www.mediawiki.org/wiki/Extension:ImageMap',
+   'descriptionmsg' = 'imagemap_desc',
+   );
 
-$wgParserTestFiles[] = $dir . 'imageMapParserTests.txt';
+   $GLOBALS['wgParserTestFiles'][] = $dir . 'imageMapParserTests.txt';
+} );
 
 /**
  * @param $parser Parser
diff --git a/composer.json b/composer.json
new file mode 100644
index 000..ec220ba
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,24 @@
+{
+   name: mediawiki/image-map,
+   type: mediawiki-extension,
+   description: Allows clickable HTML image maps,
+   keywords: [
+   Wiki,
+   MediaWiki,
+   ImageMap
+   ],
+   homepage: https://www.mediawiki.org/wiki/Extension:ImageMap;,
+   license : Any OSI approved license,
+   require: {
+   php: =5.3.0,
+   composer/installers: 1.*,=1.0.1
+   },
+   autoload: {
+   files : [
+   ImageMap.php
+   ],
+   classmap: [
+   ImageMap_body.php
+   ]
+   }
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/141830
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5d41737028a7337021c48a3c70efeba821d6d0c2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ImageMap
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Fix GraphViz package name (from mediawiki/graphviz to mediaw... - change (mediawiki...GraphViz)

2014-06-24 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/141888

Change subject: Fix GraphViz package name (from mediawiki/graphviz to 
mediawiki/graph-viz).
..

Fix GraphViz package name (from mediawiki/graphviz to mediawiki/graph-viz).

Change-Id: Ifc8c2ad1ed45e0adf93fdf99dacbc9ff33adada6
---
M composer.json
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/88/141888/1

diff --git a/composer.json b/composer.json
index 3b287f4..152b53c 100644
--- a/composer.json
+++ b/composer.json
@@ -1,5 +1,5 @@
 {
-   name: mediawiki/graphviz,
+   name: mediawiki/graph-viz,
type: mediawiki-extension,
description: Online DOT graph renderer and message sequence chart 
renderer,
keywords: [

-- 
To view, visit https://gerrit.wikimedia.org/r/141888
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifc8c2ad1ed45e0adf93fdf99dacbc9ff33adada6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Add composer support and increment the minor version of this... - change (mediawiki...GraphViz)

2014-06-12 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/139298

Change subject: Add composer support and increment the minor version of this 
extension (1.0 - 1.1.0).
..

Add composer support and increment the minor version of this
extension (1.0 - 1.1.0).

Change-Id: I71a3d64f71ada66217b627981d45f0b678ce55f2
---
M GraphViz.php
A composer.json
2 files changed, 52 insertions(+), 37 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/98/139298/1

diff --git a/GraphViz.php b/GraphViz.php
index aa134b8..752a315 100644
--- a/GraphViz.php
+++ b/GraphViz.php
@@ -1,6 +1,4 @@
 ?php
-if ( !defined( 'MEDIAWIKI' ) ) die();
-
 /**
  * Extension to allow Graphviz to work inside MediaWiki.
  * See mediawiki.org/wiki/Extension:GraphViz for more information
@@ -33,7 +31,9 @@
  * @ingroup Extensions
  */
 
-define( 'GraphViz_VERSION', '1.0' );
+if ( !defined( 'MEDIAWIKI' ) ) die();
+
+define( 'GraphViz_VERSION', '1.1.0' );
 
 /**
  * The GraphViz settings class.
@@ -67,43 +67,47 @@
 * @var string $defaultImageType
 */
public $defaultImageType;
-} ;
-
+};
 
 $wgGraphVizSettings = new GraphVizSettings();
 
-// Set execution path
-if ( stristr( PHP_OS, 'WIN' )  !stristr( PHP_OS, 'Darwin' ) ) {
-   $wgGraphVizSettings-execPath = 'C:/Program Files/Graphviz/bin/';
-} else {
-   $wgGraphVizSettings-execPath = '/usr/bin/';
-}
+//self executing anonymous function to prevent global scope assumptions
+call_user_func( function() {
 
-$wgGraphVizSettings-mscgenPath = '';
-$wgGraphVizSettings-defaultImageType = 'png';
+   // Set execution path
+   if ( stristr( PHP_OS, 'WIN' )  !stristr( PHP_OS, 'Darwin' ) ) {
+   $GLOBALS['wgGraphVizSettings']-execPath = 'C:/Program 
Files/Graphviz/bin/';
+   } else {
+   $GLOBALS['wgGraphVizSettings']-execPath = '/usr/bin/';
+   }
 
-$dir = __DIR__ . '/';
-$wgMessagesDirs['GraphViz'] = $dir . 'i18n';
-$wgExtensionMessagesFiles['GraphViz'] = $dir . 'GraphViz.i18n.php';
-$wgAutoloadClasses['GraphViz'] = $dir . GraphViz_body.php;
-$wgAutoloadClasses['GraphRenderParms'] = $dir . GraphRenderParms.php;
-$wgAutoloadClasses['UploadLocalFile'] = $dir . UploadLocalFile.php;
-$wgHooks['ParserFirstCallInit'][] = 'GraphViz::onParserInit';
-$wgHooks['PageContentSave'][] = 'GraphViz::onPageContentSave';
-$wgHooks['PageContentSaveComplete'][] = 'GraphViz::onPageContentSaveComplete';
-$wgHooks['OutputPageParserOutput'][] = 'GraphViz::onOutputPageParserOutput';
-$wgHooks['ArticleDeleteComplete'][] = 'GraphViz::onArticleDeleteComplete';
+   $GLOBALS['wgGraphVizSettings']-mscgenPath = '';
+   $GLOBALS['wgGraphVizSettings']-defaultImageType = 'png';
 
-$wgExtensionCredits['parserhook'][] = array(
-   'name' = 'Graphviz',
-   'path' = __FILE__,
-   'version' = GraphViz_VERSION,
-   'author' = array(
-   '[http://wickle.com CoffMan]',
-   '[mailto://arno.ven...@gmail.com MasterOfDesaster]',
-   '[http://hummel-universe.net Thomas Hummel]',
-   '[mailto://welt...@gmail.com Keith Welter]'
-   ),
-   'url' = 'https://www.mediawiki.org/wiki/Extension:GraphViz',
-   'descriptionmsg' = 'graphviz-desc'
-   );
+   $dir = __DIR__ . '/';
+
+   $GLOBALS['wgMessagesDirs']['GraphViz'] = $dir . 'i18n';
+   $GLOBALS['wgExtensionMessagesFiles']['GraphViz'] = $dir . 
'GraphViz.i18n.php';
+   $GLOBALS['wgAutoloadClasses']['GraphViz'] = $dir . GraphViz_body.php;
+   $GLOBALS['wgAutoloadClasses']['GraphRenderParms'] = $dir . 
GraphRenderParms.php;
+   $GLOBALS['wgAutoloadClasses']['UploadLocalFile'] = $dir . 
UploadLocalFile.php;
+   $GLOBALS['wgHooks']['ParserFirstCallInit'][] = 'GraphViz::onParserInit';
+   $GLOBALS['wgHooks']['PageContentSave'][] = 
'GraphViz::onPageContentSave';
+   $GLOBALS['wgHooks']['PageContentSaveComplete'][] = 
'GraphViz::onPageContentSaveComplete';
+   $GLOBALS['wgHooks']['OutputPageParserOutput'][] = 
'GraphViz::onOutputPageParserOutput';
+   $GLOBALS['wgHooks']['ArticleDeleteComplete'][] = 
'GraphViz::onArticleDeleteComplete';
+
+   $GLOBALS['wgExtensionCredits']['parserhook'][] = array(
+   'name' = 'Graphviz',
+   'path' = __FILE__,
+   'version' = GraphViz_VERSION,
+   'author' = array(
+   '[http://wickle.com CoffMan]',
+   '[mailto://arno.ven...@gmail.com MasterOfDesaster]',
+   '[http://hummel-universe.net Thomas Hummel]',
+   '[mailto://welt...@gmail.com Keith Welter]'
+   ),
+   'url' = 'https://www.mediawiki.org/wiki/Extension:GraphViz',
+   'descriptionmsg' = 'graphviz-desc'
+   );
+} );
diff --git a/composer.json b/composer.json
new file mode 100644
index 

[MediaWiki-commits] [Gerrit] add missing message to qqq.json - change (mediawiki...GraphViz)

2014-05-28 Thread Welterkj (Code Review)
Welterkj has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/135990

Change subject: add missing message to qqq.json
..

add missing message to qqq.json

Change-Id: Ia4e9fb692504005f65ce75ac4ba763d6b94bb3f8
---
M i18n/qqq.json
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GraphViz 
refs/changes/90/135990/1

diff --git a/i18n/qqq.json b/i18n/qqq.json
index 09801dd..e43ff6b 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -8,6 +8,7 @@
 graphviz-desc: 
{{desc|name=GraphViz|url=http://www.mediawiki.org/wiki/Extension:Graphviz}};,
 graphviz-reload: Used as an informational message to inform the user to 
reload the wiki page.,
 graphviz-no-input: Used as error message,
+graphviz-no-imagemap-class: Used as error message,
 graphviz-dot-invalid-image: Used as error message.  Parameters:\n* $1 - 
attribute name,
 graphviz-dot-attr-forbidden: Used as an error message.  Parameters:\n* 
$1 - attribute name,
 graphviz-read-src-failed: Used as error message.,

-- 
To view, visit https://gerrit.wikimedia.org/r/135990
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia4e9fb692504005f65ce75ac4ba763d6b94bb3f8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GraphViz
Gerrit-Branch: master
Gerrit-Owner: Welterkj welterkj+ger...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits