Index: trunk/phase3/includes/specials/SpecialComparePages.php |
— | — | @@ -100,29 +100,9 @@ |
101 | 101 | } |
102 | 102 | |
103 | 103 | public static function showDiff( $data ){ |
| 104 | + $rev1 = self::revOrTitle( $data['Revision1'], $data['Page1'] ); |
| 105 | + $rev2 = self::revOrTitle( $data['Revision2'], $data['Page2'] ); |
104 | 106 | |
105 | | - if( $data['Revision1'] ){ |
106 | | - $rev1 = $data['Revision1']; |
107 | | - } elseif( $data['Page1'] ) { |
108 | | - $title = Title::newFromText( $data['Page1'] ); |
109 | | - if( $title instanceof Title ){ |
110 | | - $rev1 = $title->getLatestRevID(); |
111 | | - } |
112 | | - } else { |
113 | | - $rev1 = null; |
114 | | - } |
115 | | - |
116 | | - if( $data['Revision2'] ){ |
117 | | - $rev2 = $data['Revision2']; |
118 | | - } elseif( $data['Page2'] ) { |
119 | | - $title = Title::newFromText( $data['Page2'] ); |
120 | | - if( $title instanceof Title ){ |
121 | | - $rev2 = $title->getLatestRevID(); |
122 | | - } |
123 | | - } else { |
124 | | - $rev2 = null; |
125 | | - } |
126 | | - |
127 | 107 | if( $rev1 && $rev2 ) { |
128 | 108 | $de = new DifferenceEngine( null, |
129 | 109 | $rev1, |
— | — | @@ -133,4 +113,16 @@ |
134 | 114 | $de->showDiffPage( true ); |
135 | 115 | } |
136 | 116 | } |
| 117 | + |
| 118 | + public static function revOrTitle( $revision, $title ) { |
| 119 | + if( $revision ){ |
| 120 | + return $revision; |
| 121 | + } elseif( $title ) { |
| 122 | + $title = Title::newFromText( $title ); |
| 123 | + if( $title instanceof Title ){ |
| 124 | + return $title->getLatestRevID(); |
| 125 | + } |
| 126 | + } |
| 127 | + return null; |
| 128 | + } |
137 | 129 | } |