mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-29 08:07:59 +01:00
Made the image re-importer more robust + fixed a typo.
This commit is contained in:
parent
dab9f08cf5
commit
af760aa13f
2 changed files with 14 additions and 15 deletions
|
@ -83,10 +83,7 @@ class Image extends Model
|
||||||
$hash = md5_file($file->getPathname());
|
$hash = md5_file($file->getPathname());
|
||||||
$image = Image::whereHash($hash)->whereUploadedBy($userId)->first();
|
$image = Image::whereHash($hash)->whereUploadedBy($userId)->first();
|
||||||
|
|
||||||
if (!$forceReupload && $image) {
|
if ($image) {
|
||||||
return $image;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($forceReupload) {
|
if ($forceReupload) {
|
||||||
// delete existing versions of the image
|
// delete existing versions of the image
|
||||||
$filenames = scandir($image->getDirectory());
|
$filenames = scandir($image->getDirectory());
|
||||||
|
@ -99,7 +96,9 @@ class Image extends Model
|
||||||
foreach($filenames as $filename) {
|
foreach($filenames as $filename) {
|
||||||
unlink($image->getDirectory().'/'.$filename);
|
unlink($image->getDirectory().'/'.$filename);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return $image;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$image = new Image();
|
$image = new Image();
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,7 +346,7 @@ ponyfm.config [
|
||||||
templateUrl: '/templates/home/index.html'
|
templateUrl: '/templates/home/index.html'
|
||||||
controller: 'home'
|
controller: 'home'
|
||||||
|
|
||||||
# Final catch-all for aritsts
|
# Final catch-all for artists
|
||||||
state.state 'content.artist',
|
state.state 'content.artist',
|
||||||
url: '^/{slug}'
|
url: '^/{slug}'
|
||||||
templateUrl: '/templates/artists/_show_layout.html'
|
templateUrl: '/templates/artists/_show_layout.html'
|
||||||
|
|
Loading…
Reference in a new issue