[MediaWiki-commits] [Gerrit] Fix Fatal error in recent changes - change (mediawiki...Flow)

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

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

Change subject: Fix Fatal error in recent changes
..

Fix Fatal error in recent changes

When displaying grouped header edits the formatter code was attempting
to clone a non-existant topic link. Patch updates to fall back to a
'workflow' link if the topic is not available.  Further falls back
to throwing an exception instead of fataling.

Bug: T92536
Change-Id: Ie3230d48bea5d7f18754f3fa725726409fd3e92b
---
M includes/Formatter/RecentChanges.php
1 file changed, 13 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/03/196303/1

diff --git a/includes/Formatter/RecentChanges.php 
b/includes/Formatter/RecentChanges.php
index 4cb94d2..b5817cf 100644
--- a/includes/Formatter/RecentChanges.php
+++ b/includes/Formatter/RecentChanges.php
@@ -176,13 +176,20 @@
throw new FlowException( 'Could not format data for row 
' . $row-revision-getRevisionId()-getAlphadecimal() );
}
 
-   // add highlight details to anchor
-   /** @var Anchor $anchor */
-   $anchor = clone $data['links']['topic'];
-   $anchor-query['fromnotif'] = '1';
-   $anchor-fragment = '#flow-post-' . $oldId-getAlphadecimal();
+   if ( isset( $data['links']['topic'] ) ) {
+   // add highlight details to anchor
+   /** @var Anchor $anchor */
+   $anchor = clone $data['links']['topic'];
+   $anchor-query['fromnotif'] = '1';
+   $anchor-fragment = '#flow-post-' . 
$oldId-getAlphadecimal();
+   } elseif ( isset( $data['links']['workflow'] ) ) {
+   $anchor = $data['links']['workflow'];
+   } else {
+   // this will be caught and logged by the RC hook, it 
will not fatal the page.
+   throw new FlowException( No anchor available for 
revision $oldId );
+   }
 
-   $changes = count($block);
+   $changes = count( $block );
// link text: n changes
$text = $ctx-msg( 'nchanges' )-numParams( $changes 
)-escaped();
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie3230d48bea5d7f18754f3fa725726409fd3e92b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson ebernhard...@wikimedia.org

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


[MediaWiki-commits] [Gerrit] Fix Fatal error in recent changes - change (mediawiki...Flow)

2015-03-12 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Fix Fatal error in recent changes
..


Fix Fatal error in recent changes

When displaying grouped header edits the formatter code was attempting
to clone a non-existant topic link. Patch updates to fall back to a
'workflow' link if the topic is not available.  Further falls back
to throwing an exception instead of fataling.

Bug: T92536
Change-Id: Ie3230d48bea5d7f18754f3fa725726409fd3e92b
---
M includes/Formatter/RecentChanges.php
1 file changed, 13 insertions(+), 6 deletions(-)

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



diff --git a/includes/Formatter/RecentChanges.php 
b/includes/Formatter/RecentChanges.php
index 4cb94d2..b5817cf 100644
--- a/includes/Formatter/RecentChanges.php
+++ b/includes/Formatter/RecentChanges.php
@@ -176,13 +176,20 @@
throw new FlowException( 'Could not format data for row 
' . $row-revision-getRevisionId()-getAlphadecimal() );
}
 
-   // add highlight details to anchor
-   /** @var Anchor $anchor */
-   $anchor = clone $data['links']['topic'];
-   $anchor-query['fromnotif'] = '1';
-   $anchor-fragment = '#flow-post-' . $oldId-getAlphadecimal();
+   if ( isset( $data['links']['topic'] ) ) {
+   // add highlight details to anchor
+   /** @var Anchor $anchor */
+   $anchor = clone $data['links']['topic'];
+   $anchor-query['fromnotif'] = '1';
+   $anchor-fragment = '#flow-post-' . 
$oldId-getAlphadecimal();
+   } elseif ( isset( $data['links']['workflow'] ) ) {
+   $anchor = $data['links']['workflow'];
+   } else {
+   // this will be caught and logged by the RC hook, it 
will not fatal the page.
+   throw new FlowException( No anchor available for 
revision $oldId );
+   }
 
-   $changes = count($block);
+   $changes = count( $block );
// link text: n changes
$text = $ctx-msg( 'nchanges' )-numParams( $changes 
)-escaped();
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie3230d48bea5d7f18754f3fa725726409fd3e92b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson ebernhard...@wikimedia.org
Gerrit-Reviewer: Mattflaschen mflasc...@wikimedia.org
Gerrit-Reviewer: SG shah...@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] Fix Fatal error in recent changes - change (mediawiki...Flow)

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

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

Change subject: Fix Fatal error in recent changes
..

Fix Fatal error in recent changes

When displaying grouped header edits the formatter code was attempting
to clone a non-existant topic link. Patch updates to fall back to a
'workflow' link if the topic is not available.  Further falls back
to throwing an exception instead of fataling.

Bug: T92536
Change-Id: Ie3230d48bea5d7f18754f3fa725726409fd3e92b
(cherry picked from commit e3b1e83bcdd78863158c3dde7c8d86bd2fb13aaf)
---
M includes/Formatter/RecentChanges.php
1 file changed, 13 insertions(+), 6 deletions(-)


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

diff --git a/includes/Formatter/RecentChanges.php 
b/includes/Formatter/RecentChanges.php
index 4cb94d2..b5817cf 100644
--- a/includes/Formatter/RecentChanges.php
+++ b/includes/Formatter/RecentChanges.php
@@ -176,13 +176,20 @@
throw new FlowException( 'Could not format data for row 
' . $row-revision-getRevisionId()-getAlphadecimal() );
}
 
-   // add highlight details to anchor
-   /** @var Anchor $anchor */
-   $anchor = clone $data['links']['topic'];
-   $anchor-query['fromnotif'] = '1';
-   $anchor-fragment = '#flow-post-' . $oldId-getAlphadecimal();
+   if ( isset( $data['links']['topic'] ) ) {
+   // add highlight details to anchor
+   /** @var Anchor $anchor */
+   $anchor = clone $data['links']['topic'];
+   $anchor-query['fromnotif'] = '1';
+   $anchor-fragment = '#flow-post-' . 
$oldId-getAlphadecimal();
+   } elseif ( isset( $data['links']['workflow'] ) ) {
+   $anchor = $data['links']['workflow'];
+   } else {
+   // this will be caught and logged by the RC hook, it 
will not fatal the page.
+   throw new FlowException( No anchor available for 
revision $oldId );
+   }
 
-   $changes = count($block);
+   $changes = count( $block );
// link text: n changes
$text = $ctx-msg( 'nchanges' )-numParams( $changes 
)-escaped();
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie3230d48bea5d7f18754f3fa725726409fd3e92b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: wmf/1.25wmf21
Gerrit-Owner: EBernhardson ebernhard...@wikimedia.org

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


[MediaWiki-commits] [Gerrit] Fix Fatal error in recent changes - change (mediawiki...Flow)

2015-03-12 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Fix Fatal error in recent changes
..


Fix Fatal error in recent changes

When displaying grouped header edits the formatter code was attempting
to clone a non-existant topic link. Patch updates to fall back to a
'workflow' link if the topic is not available.  Further falls back
to throwing an exception instead of fataling.

Bug: T92536
Change-Id: Ie3230d48bea5d7f18754f3fa725726409fd3e92b
(cherry picked from commit e3b1e83bcdd78863158c3dde7c8d86bd2fb13aaf)
---
M includes/Formatter/RecentChanges.php
1 file changed, 13 insertions(+), 6 deletions(-)

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



diff --git a/includes/Formatter/RecentChanges.php 
b/includes/Formatter/RecentChanges.php
index 4cb94d2..b5817cf 100644
--- a/includes/Formatter/RecentChanges.php
+++ b/includes/Formatter/RecentChanges.php
@@ -176,13 +176,20 @@
throw new FlowException( 'Could not format data for row 
' . $row-revision-getRevisionId()-getAlphadecimal() );
}
 
-   // add highlight details to anchor
-   /** @var Anchor $anchor */
-   $anchor = clone $data['links']['topic'];
-   $anchor-query['fromnotif'] = '1';
-   $anchor-fragment = '#flow-post-' . $oldId-getAlphadecimal();
+   if ( isset( $data['links']['topic'] ) ) {
+   // add highlight details to anchor
+   /** @var Anchor $anchor */
+   $anchor = clone $data['links']['topic'];
+   $anchor-query['fromnotif'] = '1';
+   $anchor-fragment = '#flow-post-' . 
$oldId-getAlphadecimal();
+   } elseif ( isset( $data['links']['workflow'] ) ) {
+   $anchor = $data['links']['workflow'];
+   } else {
+   // this will be caught and logged by the RC hook, it 
will not fatal the page.
+   throw new FlowException( No anchor available for 
revision $oldId );
+   }
 
-   $changes = count($block);
+   $changes = count( $block );
// link text: n changes
$text = $ctx-msg( 'nchanges' )-numParams( $changes 
)-escaped();
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie3230d48bea5d7f18754f3fa725726409fd3e92b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: wmf/1.25wmf21
Gerrit-Owner: EBernhardson ebernhard...@wikimedia.org
Gerrit-Reviewer: EBernhardson ebernhard...@wikimedia.org
Gerrit-Reviewer: jenkins-bot 

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