Browse Source

MIRSPORTA-260 Отсутствующие картинки на 10баллов

"обход" ошибки с отсутствующим файлом изображения при попытке форсированного создания варианта
push-update
master
Alexander Demidov 11 years ago
parent
commit
de4a3a7924
  1. 3
      File.class.php
  2. 69
      push-update.sh

3
File.class.php

@ -86,7 +86,8 @@ abstract class File
* @var $this Image * @var $this Image
*/ */
if (!array_key_exists($size, $this->variants)) { if (!array_key_exists($size, $this->variants)) {
if ($force_create && $this->getIsNoEmpty()) {
$original_file_path = Config::get('PATH_WEB_ROOT') . '/' . $this->getWebName();
if ($force_create && $this->getIsNoEmpty() && file_exists($original_file_path)) {
Upload::imageVariant($this, $size); Upload::imageVariant($this, $size);
} else { } else {
$this->variants[$size] = new ImageVariant(); $this->variants[$size] = new ImageVariant();

69
push-update.sh

@ -1,6 +1,8 @@
#!/bin/bash #!/bin/bash
REMOTE_REPOSITORY='origin'
REMOTE_BRANCH='master'
PATH_LIB='/lib/Image' PATH_LIB='/lib/Image'
PROJECTS=( "/var/www/10ballov" "/var/www/predelanet" "/var/www/zelenoemore" "/var/www/d753_common" )
PROJECTS=( "/var/www/10ballov" "/var/www/predelanet" "/var/www/zelenoemore" "/var/www/d753_common" "/var/www/d753_predelanet" "/var/www/d753_10ballov" )
if [ ! -f "CHANGELOG.md" ] if [ ! -f "CHANGELOG.md" ]
then then
echo "CHANGELOG.md not exists\n" echo "CHANGELOG.md not exists\n"
@ -31,7 +33,7 @@ then
git commit -m "Update CHANGELOG.md" > /dev/null && git commit -m "Update CHANGELOG.md" > /dev/null &&
git tag -d "$VERSION" >/dev/null && git tag -d "$VERSION" >/dev/null &&
git tag "$VERSION" >/dev/null && git tag "$VERSION" >/dev/null &&
git push --tags >/dev/null 2>/dev/null
git push "${REMOTE_REPOSITORY}" --tags >/dev/null 2>/dev/null
} || { } || {
echo -e "Cannot push released tag into remote repository\n" echo -e "Cannot push released tag into remote repository\n"
exit 1 exit 1
@ -39,49 +41,50 @@ then
else else
VERSION=$VERSION_PREVIOUS VERSION=$VERSION_PREVIOUS
fi fi
git push >/dev/null || exit 1
git push "${REMOTE_REPOSITORY}" HEAD:"${REMOTE_BRANCH}" >/dev/null || exit 1
MESSAGE="\nUpdate ${PATH_LIB} on ${VERSION}\n"
MESSAGE="Update ${PATH_LIB} on ${VERSION}"
CURRENT_DIR=`pwd` CURRENT_DIR=`pwd`
for project in "${PROJECTS[@]}" for project in "${PROJECTS[@]}"
do do
echo -e "Update lib for ${project}...\n" echo -e "Update lib for ${project}...\n"
{ {
cd "${project}${PATH_LIB}" && cd "${project}${PATH_LIB}" &&
git fetch >/dev/null 2>/dev/null &&
git fetch "${REMOTE_REPOSITORY}" >/dev/null 2>/dev/null &&
git checkout "$VERSION" 2>/dev/null; git checkout "$VERSION" 2>/dev/null;
} || { } || {
echo -e "Failed to checkout lib on tag ${VERSION}\n" && echo -e "Failed to checkout lib on tag ${VERSION}\n" &&
exit 1; exit 1;
} }
cd "${project}"
LIB_DIR=`echo ${PATH_LIB#'/'}`
git diff-index --quiet HEAD "$LIB_DIR"
LIB_NEW_COMMITS=`echo $?`
if [ $LIB_NEW_COMMITS == 1 ]
then
{
git reset >/dev/null &&
git add "$LIB_DIR" >/dev/null &&
git commit -m "$MESSAGE" >/dev/null
} || {
echo -e "Failed to update lib for ${project}\n"
exit 1
}
if [ $project == "/var/www/d753_common" ]
then
{
git push origin master > /dev/null &&
cd /var/www/d753_predelanet/ && ./merge-from-master.sh > /dev/null
cd /var/www/d753_10ballov/ && ./merge-from-master.sh > /dev/null
} || {
echo -e "Failed to update dependency d753 branches... Please resolve that problem by hand\n"
exit 1
}
fi
else
echo -e "Already update\n"
fi
# cd "${project}"
# LIB_DIR=`echo ${PATH_LIB#'/'}`
# git diff-index --quiet HEAD "$LIB_DIR"
# LIB_NEW_COMMITS=`echo $?`
# if [ $LIB_NEW_COMMITS == 1 ]
# then
# {
# git reset >/dev/null &&
# git add "$LIB_DIR" >/dev/null &&
# git commit -m "$MESSAGE" >/dev/null
# } || {
# echo -e "Failed to update lib for ${project}\n"
# exit 1
# }
# if [ $project == "/var/www/d753_common" ]
# then
# {
# git push origin master > /dev/null &&
# cd /var/www/d753_predelanet/ && ./merge-from-master.sh > /dev/null
# cd /var/www/d753_10ballov/ && ./merge-from-master.sh > /dev/null
# } || {
# echo -e "Failed to update dependency d753 branches... Please resolve that problem by hand\n"
# exit 1
# }
# fi
# else
# echo -e "Already update\n"
# fi
done done
echo -e "All operations succeed\n" echo -e "All operations succeed\n"
Loading…
Cancel
Save