Index: trunk/extensions/StableVersion/language/en.php |
— | — | @@ -0,0 +1,32 @@ |
| 2 | +<? |
| 3 | +/** |
| 4 | + * English language file for the 'StableVErsion' extension |
| 5 | + */ |
| 6 | + |
| 7 | +// We will add messages to the global cache |
| 8 | +global $wgMessageCache; |
| 9 | + |
| 10 | +// Add messages |
| 11 | +$wgMessageCache->addMessages( |
| 12 | + array( |
| 13 | + 'stableversion_this_is_stable' => 'This is the stable version of this article. You can also look at the <a href="$1">latest draft version</a>.', |
| 14 | + 'stableversion_this_is_draft_no_stable' => 'You are looking at a draft version of this article; there is no stable version of this article yet.', |
| 15 | + 'stableversion_this_is_draft' => 'This is a draft version of this article. You can also look at the <a href="$1">stable version</a>.', |
| 16 | + 'stableversion_reset_stable_version' => 'Click <a href="$1">here</a> to remove this as stable version!', |
| 17 | + 'stableversion_set_stable_version' => 'Click <a href="$1">here</a> to set this as stable version!', |
| 18 | + 'stableversion_set_ok' => 'The stable version has been successfully set.', |
| 19 | + 'stableversion_reset_ok' => 'The stable version has been successfully removed. This article has no stable version right now.', |
| 20 | + 'stableversion_return' => 'Return to <a href="$1">$2</a>', |
| 21 | + |
| 22 | + 'stableversion_reset_log' => 'Stable version has been removed.', |
| 23 | + 'stableversion_logpage' => 'Stable version log', |
| 24 | + 'stableversion_logpagetext' => 'This is a log of changes to stable versions', |
| 25 | + 'stableversion_logentry' => '', |
| 26 | + 'stableversion_log' => 'Revision #$1 is now the stable version.', |
| 27 | + 'stableversion_before_no' => 'There was no stable revision before.', |
| 28 | + 'stableversion_before_yes' => 'The last stable revision was #$1.', |
| 29 | + 'stableversion_this_is_stable_and_current' => "This is both the stable and the latest version.", |
| 30 | + ) |
| 31 | +); |
| 32 | + |
| 33 | +?> |
\ No newline at end of file |
Property changes on: trunk/extensions/StableVersion/language/en.php |
___________________________________________________________________ |
Added: svn:keywords |
1 | 34 | + Author Date Id Revision |
Added: svn:eol-style |
2 | 35 | + native |
Index: trunk/extensions/StableVersion/StableVersion.php |
— | — | @@ -71,26 +71,14 @@ |
72 | 72 | global $wgMessageCache , $wgStableVersionAddCache ; |
73 | 73 | if ( $wgStableVersionAddCache ) return ; |
74 | 74 | $wgStableVersionAddCache = true ; |
75 | | - $wgMessageCache->addMessages( |
76 | | - array( |
77 | | - 'stableversion_this_is_stable' => 'This is the stable version of this article. You can also look at the <a href="$1">latest draft version</a>.', |
78 | | - 'stableversion_this_is_draft_no_stable' => 'You are looking at a draft version of this article; there is no stable version of this article yet.', |
79 | | - 'stableversion_this_is_draft' => 'This is a draft version of this article. You can also look at the <a href="$1">stable version</a>.', |
80 | | - 'stableversion_reset_stable_version' => 'Click <a href="$1">here</a> to remove this as stable version!', |
81 | | - 'stableversion_set_stable_version' => 'Click <a href="$1">here</a> to set this as stable version!', |
82 | | - 'stableversion_set_ok' => 'The stable version has been successfully set.', |
83 | | - 'stableversion_reset_ok' => 'The stable version has been successfully removed. This article has no stable version right now.', |
84 | | - 'stableversion_return' => 'Return to <a href="$1">$2</a>', |
85 | | - |
86 | | - 'stableversion_reset_log' => 'Stable version has been removed.', |
87 | | - 'stableversion_logpage' => 'Stable version log', |
88 | | - 'stableversion_logpagetext' => 'This is a log of changes to stable versions', |
89 | | - 'stableversion_logentry' => '', |
90 | | - 'stableversion_log' => 'Revision #$1 is now the stable version.', |
91 | | - 'stableversion_before_no' => 'There was no stable revision before.', |
92 | | - 'stableversion_before_yes' => 'The last stable revision was #$1.', |
93 | | - ) |
94 | | - ); |
| 75 | + |
| 76 | + // Default language is english |
| 77 | + require_once('language/en.php'); |
| 78 | + |
| 79 | + global $wgLanguageCode; |
| 80 | + $filename = 'language/' . addslashes($wgLanguageCode) . '.php' ; |
| 81 | + // inclusion might fail :p |
| 82 | + include( $filename ); |
95 | 83 | } |
96 | 84 | |
97 | 85 | /** |
— | — | @@ -120,10 +108,11 @@ |
121 | 109 | $res = $dbr->select( |
122 | 110 | /* FROM */ 'stableversions', |
123 | 111 | /* SELECT */ '*', |
124 | | - /* WHERE */ array( 'sv_page_id' => $title->getArticleID() , 'sv_page_rev' => $article->mRevision ) , |
| 112 | + /* WHERE */ array( 'sv_page_id' => $title->getArticleID() ) , |
| 113 | + $fname, |
125 | 114 | array ( "ORDER BY" => "sv_page_rev DESC" ) |
126 | 115 | ); |
127 | | - |
| 116 | + |
128 | 117 | $article->mIsStable = false ; |
129 | 118 | $article->mLastStable = 0 ; |
130 | 119 | while ( $o = $dbr->fetchObject( $res ) ) { |
— | — | @@ -164,8 +153,12 @@ |
165 | 154 | $st = "" ; # Subtitle |
166 | 155 | |
167 | 156 | if ( $article->mIsStable ) { # This is the stable version |
168 | | - $url = $wgTitle->getFullURL () ; |
169 | | - $st = wfMsg ( 'stableversion_this_is_stable' , $url ) ; |
| 157 | + if ( $article->mLatest == $article->mLastStable ) { |
| 158 | + $st .= wfMsg ( 'stableversion_this_is_stable_and_current' ) ; |
| 159 | + } else { |
| 160 | + $url = $wgTitle->getFullURL () ; |
| 161 | + $st .= wfMsg ( 'stableversion_this_is_stable' , $url ) ; |
| 162 | + } |
170 | 163 | } else if ( $article->mLastStable == "0" ) { # There is no spoon, er, stable version |
171 | 164 | $st = wfMsg ( 'stableversion_this_is_draft_no_stable' ) ; |
172 | 165 | } else { # This is not the stable version, recommend it |
— | — | @@ -212,7 +205,7 @@ |
213 | 206 | * main() |
214 | 207 | */ |
215 | 208 | function execute( $par = null ) { |
216 | | - global $wgOut , $wgRequest , $wgUser ; |
| 209 | + global $wgOut , $wgRequest , $wgUser , $wgArticle ; |
217 | 210 | |
218 | 211 | # Sanity checks |
219 | 212 | $mode = $wgRequest->getText('mode', "") ; |
— | — | @@ -237,11 +230,13 @@ |
238 | 231 | } |
239 | 232 | |
240 | 233 | # Get old stable version |
241 | | - $dbr =& wfGetDB( DB_SLAVE ); |
| 234 | +/* $dbr =& wfGetDB( DB_SLAVE ); |
242 | 235 | $fname = "SpecialStableVersion:execute" ; |
243 | 236 | $row = $dbr->selectRow( 'page', array( 'page_stable' ), |
244 | 237 | array( 'page_id' => $id ), $fname ); |
245 | 238 | $oldstable = $row->page_stable ; |
| 239 | +*/ |
| 240 | + $oldstable = isset ( $wgArticle->mLastStable ) ? $wgArticle->mLastStable : 0 ; |
246 | 241 | if ( $oldstable == 0 ) $before = wfMsg ( 'stableversion_before_no' ) ; |
247 | 242 | else $before = wfMsg ( 'stableversion_before_yes' , $oldstable ) ; |
248 | 243 | $act .= " " . $before ; |