Index: trunk/extensions/Translate/MessageCollection.php |
— | — | @@ -186,9 +186,14 @@ |
187 | 187 | } elseif( $filter === 'changed' ) { |
188 | 188 | $keys = $this->filterChanged( $keys, $condition ); |
189 | 189 | } else { // Filter based on tags |
190 | | - if ( !isset($this->tags[$filter]) ) throw new MWException( "No tagged messages for filter $filter" ); |
191 | | - $taggedKeys = array_flip( $this->tags[$filter] ); |
192 | | - $keys = $this->filterOnCondition( $keys, $taggedKeys, $condition ); |
| 190 | + if ( !isset($this->tags[$filter]) ) { |
| 191 | + if ( $filter !== 'optional' && $filter !== 'ignored' ) { |
| 192 | + throw new MWException( "No tagged messages for custom filter $filter" ); |
| 193 | + } |
| 194 | + } else { |
| 195 | + $taggedKeys = array_flip( $this->tags[$filter] ); |
| 196 | + $keys = $this->filterOnCondition( $keys, $taggedKeys, $condition ); |
| 197 | + } |
193 | 198 | } |
194 | 199 | $this->keys = $keys; |
195 | 200 | } |
Index: trunk/extensions/Translate/FFS.php |
— | — | @@ -42,8 +42,10 @@ |
43 | 43 | |
44 | 44 | public function read( $code ) { |
45 | 45 | $filename = $this->group->getSourceFilePath( $code ); |
46 | | - if ( $filename === null ) return array(); |
| 46 | + if ( $filename === null ) return false; |
47 | 47 | |
| 48 | + if ( !file_exists($filename) ) return false; |
| 49 | + |
48 | 50 | $input = file_get_contents( $filename ); |
49 | 51 | if ( $input === false ) throw new MWException( "Unable to read file $filename" ); |
50 | 52 | |
Index: trunk/extensions/Translate/Groups.php |
— | — | @@ -167,7 +167,7 @@ |
168 | 168 | $ffs = $this->getFFS(); |
169 | 169 | if ( !$ffs ) throw new MWException( 'No FFS defined' ); |
170 | 170 | $data = $ffs->read( 'en' ); |
171 | | - return (bool) count($data['MESSAGES']); |
| 171 | + return $data && count($data['MESSAGES']); |
172 | 172 | } |
173 | 173 | |
174 | 174 | public function load( $code ) { |
— | — | @@ -179,7 +179,8 @@ |
180 | 180 | $ffs = $this->getFFS(); |
181 | 181 | if ( !$ffs ) throw new MWException( 'No FFS defined' ); |
182 | 182 | $data = $ffs->read( $code ); |
183 | | - return $data['MESSAGES']; |
| 183 | + |
| 184 | + return $data ? $data['MESSAGES'] : array(); |
184 | 185 | } |
185 | 186 | } |
186 | 187 | |