Index: branches/wmf/1.19wmf1/thumb.php |
— | — | @@ -125,19 +125,22 @@ |
126 | 126 | // Dirty, horrible, evil hack. We need to create a repo with the right zone paths for this to work |
127 | 127 | $localRepo = RepoGroup::singleton()->getLocalRepo(); |
128 | 128 | |
| 129 | + global $wgLocalFileRepo; |
129 | 130 | $repo = new FSRepo( |
130 | | - array( 'directory' => $localRepo->getZonePath( 'temp' ), |
131 | | - 'url' => $localRepo->getZoneUrl( 'temp' ), |
132 | | - 'thumbDir'=> $localRepo->getZonePath( 'thumb' ) . '/temp', |
133 | | - 'thumbUrl' => $localRepo->getZoneUrl( 'thumb' ) . '/temp' |
| 131 | + array( 'directory' => $wgLocalFileRepo['directory'] . '/temp', |
| 132 | + 'url' => $wgLocalFileRepo['url'] . '/temp', |
| 133 | + 'thumbDir'=> $wgLocalFileRepo['thumbDir'] . '/temp', |
| 134 | + 'thumbUrl' => $wgLocalFileRepo['thumbUrl'] . '/temp', |
| 135 | + 'name' => 'UploadStashHackery', |
134 | 136 | ) |
135 | 137 | ); |
136 | 138 | |
137 | 139 | // $fileName can be like timestamp!name , strip the timestamp! part |
138 | 140 | $parts = explode( '!', $fileName, 2 ); |
139 | 141 | $strippedName = isset( $parts[1] ) ? $parts[1] : $fileName; |
140 | | - $path = $localRepo->getZonePath( 'temp' ) . '/' . RepoGroup::singleton()->getLocalRepo()->getHashPath( $strippedName ) . $fileName; |
141 | | - $img = new UnregisteredLocalFile( false, $repo, $path, false ); |
| 142 | + $path = $repo->getZonePath( 'public' ) . '/' . RepoGroup::singleton()->getLocalRepo()->getHashPath( $strippedName ) . $fileName; |
| 143 | + // Need to pass in $strippedName as a Title object so hash paths are computed correctly |
| 144 | + $img = new UnregisteredLocalFile( Title::makeTitle( NS_FILE, $strippedName ), $repo, $path, false ); |
142 | 145 | } else { |
143 | 146 | $img = wfLocalFile( $fileName ); |
144 | 147 | } |