Index: trunk/extensions/Translate/tag/PageTranslationHooks.php |
— | — | @@ -303,23 +303,23 @@ |
304 | 304 | return true; |
305 | 305 | } |
306 | 306 | |
307 | | - // Here we disable editing of some existing or unknown pages |
308 | | - public static function translationsCheck( $title, $user, $action, &$result ) { |
309 | | - // Case 1: Unknown section translations |
| 307 | + /// Prevent editing of unknown pages in Translations namespace |
| 308 | + public static function preventUnknownTranslations( $title, $user, $action, &$result ) { |
310 | 309 | if ( $title->getNamespace() == NS_TRANSLATIONS && $action === 'edit' ) { |
311 | 310 | $group = self::titleToGroup( $title ); |
312 | 311 | if ( $group === null ) { |
313 | 312 | // No group means that the page is currently not |
314 | 313 | // registered to any page translation message groups |
315 | 314 | $result = array( 'tpt-unknown-page' ); |
316 | | - |
317 | 315 | return false; |
318 | 316 | } |
319 | | - |
320 | | - return true; |
321 | 317 | } |
322 | 318 | |
323 | | - // Case 2: Target pages |
| 319 | + return true; |
| 320 | + } |
| 321 | + |
| 322 | + /// Prevent editing of translation pages directly |
| 323 | + public static function preventDirectEditing( $title, $user, $action, &$result ) { |
324 | 324 | $page = TranslatablePage::isTranslationPage( $title ); |
325 | 325 | if ( $page !== false ) { |
326 | 326 | if ( self::$allowTargetEdit ) { |
Index: trunk/extensions/Translate/Translate.php |
— | — | @@ -523,7 +523,9 @@ |
524 | 524 | $wgHooks['ArticleSaveComplete'][] = 'PageTranslationHooks::addTranstag'; |
525 | 525 | |
526 | 526 | // Prevent editing of unknown pages in Translations namespace |
527 | | - $wgHooks['getUserPermissionsErrorsExpensive'][] = 'PageTranslationHooks::translationsCheck'; |
| 527 | + $wgHooks['getUserPermissionsErrorsExpensive'][] = 'PageTranslationHooks::preventUnknownTranslations'; |
| 528 | + // Prevent editing of translation pages directly |
| 529 | + $wgHooks['getUserPermissionsErrorsExpensive'][] = 'PageTranslationHooks::preventDirectEditing'; |
528 | 530 | |
529 | 531 | // Locking during page moves |
530 | 532 | $wgHooks['getUserPermissionsErrorsExpensive'][] = 'PageTranslationHooks::lockedPagesCheck'; |