Index: trunk/extensions/SemanticForms/specials/SF_UploadWindow2.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | /** |
16 | 16 | * @ingroup SFSpecialPages |
17 | 17 | */ |
18 | | -class SFUploadWindow2 extends UnlistedSpecialPage { |
| 18 | +class SFUploadWindow2Proto extends UnlistedSpecialPage { |
19 | 19 | /** |
20 | 20 | * Constructor : initialise object |
21 | 21 | * Get data POSTed through the form and assign them to the object |
— | — | @@ -105,23 +105,6 @@ |
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
109 | | - * This page can be shown if uploading is enabled. |
110 | | - * Handle permission checking elsewhere in order to be able to show |
111 | | - * custom error messages. |
112 | | - * |
113 | | - * @param User $user |
114 | | - * @return bool |
115 | | - */ |
116 | | - // @TODO The "User" class was added to the function header |
117 | | - // for SpecialPage::userCanExecute in MW 1.19 (r86407) - somehow |
118 | | - // both the old and new signatures need to be supported. For now, |
119 | | - // though, support only the old signature, since that's used by |
120 | | - // the vast majority of users. |
121 | | - public function userCanExecute( $user ) { |
122 | | - return UploadBase::isEnabled() && parent::userCanExecute( $user ); |
123 | | - } |
124 | | - |
125 | | - /** |
126 | 109 | * Special page entry point |
127 | 110 | */ |
128 | 111 | public function execute( $par ) { |
— | — | @@ -1101,3 +1084,51 @@ |
1102 | 1085 | } |
1103 | 1086 | |
1104 | 1087 | } |
| 1088 | + |
| 1089 | +global $wgVersion; |
| 1090 | +// @TODO The "User" class was added to the function header |
| 1091 | +// for SpecialPage::userCanExecute in MW 1.19 (r86407) - somehow |
| 1092 | +// both the old and new signatures need to be supported. When support |
| 1093 | +// is dropped for MW below 1.19 this should be reintegrated into one |
| 1094 | +// class. |
| 1095 | +if ( version_compare( $wgVersion, '1.18alpha', '<' )) { |
| 1096 | + |
| 1097 | + /** |
| 1098 | + * Class variant for MW up to 1.17 |
| 1099 | + */ |
| 1100 | + class SFUploadWindow2 extends SFUploadWindow2Proto { |
| 1101 | + /** |
| 1102 | + * This page can be shown if uploading is enabled. |
| 1103 | + * Handle permission checking elsewhere in order to be able to show |
| 1104 | + * custom error messages. |
| 1105 | + * |
| 1106 | + * @param User $user |
| 1107 | + * @return bool |
| 1108 | + */ |
| 1109 | + public function userCanExecute( $user ) { |
| 1110 | + return UploadBase::isEnabled() && parent::userCanExecute( $user ); |
| 1111 | + } |
| 1112 | + |
| 1113 | + |
| 1114 | + } |
| 1115 | + |
| 1116 | +} else { |
| 1117 | + |
| 1118 | + /** |
| 1119 | + * Class variant for MW 1.18+ |
| 1120 | + */ |
| 1121 | + class SFUploadWindow2 extends SFUploadWindow2Proto { |
| 1122 | + /** |
| 1123 | + * This page can be shown if uploading is enabled. |
| 1124 | + * Handle permission checking elsewhere in order to be able to show |
| 1125 | + * custom error messages. |
| 1126 | + * |
| 1127 | + * @param User $user |
| 1128 | + * @return bool |
| 1129 | + */ |
| 1130 | + public function userCanExecute( User $user ) { |
| 1131 | + return UploadBase::isEnabled() && parent::userCanExecute( $user ); |
| 1132 | + } |
| 1133 | + } |
| 1134 | + |
| 1135 | +} |
\ No newline at end of file |