From da7a93527de84f050262f58e1bfaea5aa449c116 Mon Sep 17 00:00:00 2001 From: Tuukka Norri Date: Sat, 9 Jun 2018 00:33:40 +0300 Subject: [PATCH 1/6] Fix image memory use (#2045) * Add a method for freeing the image file, free each derivative after it has been created * Save the scaled derivative on disk before freeing it, store its path --- system/src/Grav/Common/Page/Medium/ImageMedium.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Page/Medium/ImageMedium.php b/system/src/Grav/Common/Page/Medium/ImageMedium.php index 05bc4c486..8be914e12 100644 --- a/system/src/Grav/Common/Page/Medium/ImageMedium.php +++ b/system/src/Grav/Common/Page/Medium/ImageMedium.php @@ -301,6 +301,8 @@ class ImageMedium extends Medium $derivative->set('width', $width); $derivative->set('height', $height); + $derivative->saveImage(); + $derivative->resetImage(); $this->addAlternative($ratio, $derivative); } } @@ -559,6 +561,14 @@ class ImageMedium extends Medium return $this; } + /** + * Frees the cached image file. + */ + protected function resetImage() + { + $this->image = null; + } + /** * Save the image with cache. * @@ -587,7 +597,9 @@ class ImageMedium extends Medium $this->image->merge(ImageFile::open($overlay)); } - return $this->image->cacheFile($this->format, $this->quality); + $cachedPath = $this->image->cacheFile($this->format, $this->quality); + $this->set('filepath', $cachedPath); + return $cachedPath; } /** From bd7706a38e86b563b559f12211d0fb7497b942b2 Mon Sep 17 00:00:00 2001 From: Felipe Fonseca Date: Fri, 8 Jun 2018 18:36:11 -0300 Subject: [PATCH 2/6] pointing fastcgi_pass path to match php7.0-fpm (on debian stretch) (#2021) --- webserver-configs/nginx.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webserver-configs/nginx.conf b/webserver-configs/nginx.conf index 0696c8439..89dd1051e 100644 --- a/webserver-configs/nginx.conf +++ b/webserver-configs/nginx.conf @@ -30,7 +30,8 @@ server { ## Begin - PHP location ~ \.php$ { # Choose either a socket or TCP/IP address - fastcgi_pass unix:/var/run/php5-fpm.sock; + fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; + # fastcgi_pass unix:/var/run/php5-fpm.sock; #legacy # fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(.+\.php)(/.+)$; From 9053f9ab4499571d965f79ae2c47997b76fc5fc9 Mon Sep 17 00:00:00 2001 From: Lauri Nurmi Date: Sat, 9 Jun 2018 00:36:38 +0300 Subject: [PATCH 3/6] Use @example.com in default email addresses. (#2020) It could be a bad idea to use default email addresses that could really exist. Instead, use example.com, which RFC2606 defines as one of the domains reserved for examples. --- system/config/site.yaml | 2 +- user/config/site.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/system/config/site.yaml b/system/config/site.yaml index 1142a5dd2..bb2ee6e86 100644 --- a/system/config/site.yaml +++ b/system/config/site.yaml @@ -3,7 +3,7 @@ default_lang: en # Default language for site (potenti author: name: John Appleseed # Default author name - email: 'john@email.com' # Default author email + email: 'john@example.com' # Default author email taxonomies: [category,tag] # Arbitrary list of taxonomy types diff --git a/user/config/site.yaml b/user/config/site.yaml index c45818de4..4be78edc9 100644 --- a/user/config/site.yaml +++ b/user/config/site.yaml @@ -1,7 +1,7 @@ title: Grav author: name: Joe Bloggs - email: 'joe@test.com' + email: 'joe@example.com' metadata: description: 'Grav is an easy to use, yet powerful, open source flat-file CMS' From f883820c6afcaacae843dd2b89af6e0156e1e032 Mon Sep 17 00:00:00 2001 From: Jeremy Bouquain Date: Fri, 8 Jun 2018 23:37:06 +0200 Subject: [PATCH 4/6] Handle multibyte strings in truncateLetters (#2007) --- system/src/Grav/Common/Helpers/Truncator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Helpers/Truncator.php b/system/src/Grav/Common/Helpers/Truncator.php index b2a19dbc2..474aae1bc 100644 --- a/system/src/Grav/Common/Helpers/Truncator.php +++ b/system/src/Grav/Common/Helpers/Truncator.php @@ -113,7 +113,7 @@ class Truncator { if ($letters->key() >= $limit) { $currentText = $letters->currentTextPosition(); - $currentText[0]->nodeValue = substr($currentText[0]->nodeValue, 0, $currentText[1] + 1); + $currentText[0]->nodeValue = mb_substr($currentText[0]->nodeValue, 0, $currentText[1] + 1); self::removeProceedingNodes($currentText[0], $body); if (!empty($ellipsis)) { From ab58cca3f7d7a077a951ee0c4fa1602e075b0d17 Mon Sep 17 00:00:00 2001 From: Hydraner Date: Fri, 8 Jun 2018 23:37:44 +0200 Subject: [PATCH 5/6] Add getter methods for original and action to the Page object. (#2005) --- system/src/Grav/Common/Page/Page.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index a4027a514..e92e03bff 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -2955,4 +2955,26 @@ class Page return $route; } } + + /** + * Gets the Page Unmodified (original) version of the page. + * + * @return Page + * The original version of the page. + */ + public function getOriginal() + { + return $this->_original; + } + + /** + * Gets the action. + * + * @return string + * The Action string. + */ + public function getAction() + { + return $this->_action; + } } From 036fc2d2af385a8f3d19ddd4ad5f97754c29b334 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Alleaume Date: Sat, 9 Jun 2018 00:00:07 +0200 Subject: [PATCH 6/6] Modular template extension follows the master page extension (#2044) --- system/src/Grav/Common/Twig/Twig.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/system/src/Grav/Common/Twig/Twig.php b/system/src/Grav/Common/Twig/Twig.php index e1ba281f4..a47a2b7aa 100644 --- a/system/src/Grav/Common/Twig/Twig.php +++ b/system/src/Grav/Common/Twig/Twig.php @@ -238,7 +238,9 @@ class Twig // Process Modular Twig if ($item->modularTwig()) { $twig_vars['content'] = $content; - $template = $item->template() . TEMPLATE_EXT; + $extension = $this->grav['uri']->extension(); + $extension = $extension ? ".{$extension}.twig" : TEMPLATE_EXT; + $template = $item->template() . $extension; $output = $content = $local_twig->render($template, $twig_vars); }