Index: trunk/phase3/includes/filerepo/LocalFile.php |
— | — | @@ -261,8 +261,7 @@ |
262 | 262 | return; |
263 | 263 | } |
264 | 264 | if ( is_null($this->media_type) || |
265 | | - $this->mime == 'image/svg' || |
266 | | - $this->sha1 == '' |
| 265 | + $this->mime == 'image/svg' |
267 | 266 | ) { |
268 | 267 | $this->upgradeRow(); |
269 | 268 | $this->upgraded = true; |
— | — | @@ -972,6 +971,19 @@ |
973 | 972 | |
974 | 973 | function getSha1() { |
975 | 974 | $this->load(); |
| 975 | + // Initialise now if necessary |
| 976 | + if ( $this->sha1 == '' && $this->fileExists ) { |
| 977 | + $this->sha1 = File::sha1Base36( $this->getPath() ); |
| 978 | + if ( strval( $this->sha1 ) != '' ) { |
| 979 | + $dbw = $this->repo->getMasterDB(); |
| 980 | + $dbw->update( 'image', |
| 981 | + array( 'img_sha1' => $this->sha1 ), |
| 982 | + array( 'img_name' => $this->getName() ), |
| 983 | + __METHOD__ ); |
| 984 | + $this->saveToCache(); |
| 985 | + } |
| 986 | + } |
| 987 | + |
976 | 988 | return $this->sha1; |
977 | 989 | } |
978 | 990 | |