Skip to content
This repository has been archived by the owner on Aug 11, 2019. It is now read-only.

Commit

Permalink
Merge branch 'master' into prod
Browse files Browse the repository at this point in the history
  • Loading branch information
lbesson committed Nov 9, 2016
2 parents 451673f + 8796976 commit 70f3ffd
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
2 changes: 2 additions & 0 deletions apps/frontend/config/app.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,7 @@ all:
2: country
range:
alpes_s:
820370: 54 # Calanques
14463: 54 # Provence
14464: 52 # Préalpes Dignoises
14465: 50 # Pelat - Préalpes de Castellane
Expand Down Expand Up @@ -1696,6 +1697,7 @@ all:
1: culmen
2: pass
4: cliff
12: cascade
6: valley
3: lake
7: glacier
Expand Down
13 changes: 13 additions & 0 deletions apps/frontend/lib/Images.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,19 @@ public static function hasSVG($file, $path)
return file_exists($path . DIRECTORY_SEPARATOR . $file_name . '.svg');
}

/**
* Duplicate bug: different image docs may have the same file..
*/
public static function isDuplicateFile($file)
{
return Doctrine_Query::create()
->select('COUNT(i.id) num')
->from('Image i')
->where('i.filename = ?', $file)
->execute()
->getFirst()->num > 1;
}

/**
* Remove given image and its resized versions.
*/
Expand Down
12 changes: 10 additions & 2 deletions apps/frontend/modules/images/actions/actions.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -829,8 +829,16 @@ protected function deleteLinkedFile($id)
$filenames = Image::getLinkedFiles($id);
foreach ($filenames as $filename)
{
$path = sfConfig::get('sf_upload_dir') . DIRECTORY_SEPARATOR . 'images';
Images::removeAll($filename, $path);
// check that image file is used only by this document (image duplicates bug)
if (!Images::isDuplicateFile($filename))
{
$path = sfConfig::get('sf_upload_dir') . DIRECTORY_SEPARATOR . 'images';
Images::removeAll($filename, $path);
}
else
{
c2cTools::log("images::deleteLinkedFile skip duplicate image");
}
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion web/static/js/carto/script/c2corg/config/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ c2corg.styleMap = function (layertype, config) {
if (typeof attr.summit_type != "undefined") {
if (attr.summit_type == 2) attr.icon = "picto/pass.png";
if (attr.summit_type == 3) attr.icon = "picto/lake.png";
if (attr.summit_type == 4) attr.icon = "picto/crag.png";
if (attr.summit_type == 4 || attr.summit_type == 12) attr.icon = "picto/crag.png";
// FIXME: other types?
}
} else if (attr.module == "parkings" || attr.module == "public_transportations") {
Expand Down

0 comments on commit 70f3ffd

Please sign in to comment.