PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / trunk
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF vtrunk
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
← All changes | inc/3rd-party/nextgen-gallery/classes/Optimization/Data/NGG.php +21 -7 1.10 → trunk View file →
@@ -1,8 +1,8 @@
1 1 <?php
2 2 namespace Imagify\ThirdParty\NGG\Optimization\Data;
3 3
4 -defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
4 +use Imagify\Traits\MediaRowTrait;
5 5
6 6 /**
7 7 * Optimization data class for the custom folders.
8 8 * This class constructor accepts:
@@ -16,9 +16,9 @@
16 16 * @see Imagify\ThirdParty\NGG\Media\NGG
17 17 * @author Grégory Viguier
18 18 */
19 19 class NGG extends \Imagify\Optimization\Data\AbstractData {
20 - use \Imagify\Traits\MediaRowTrait;
20 + use MediaRowTrait;
21 21
22 22 /**
23 23 * The attachment SQL DB class.
24 24 *
@@ -156,12 +156,23 @@
156 156 if ( ! $data['success'] ) {
157 157 /**
158 158 * Error.
159 159 */
160 - $old_data['data']['sizes'][ $size ] = [
160 + $size_data = [
161 161 'success' => false,
162 162 'error' => $data['error'],
163 163 ];
164 +
165 + if ( ! empty( $data['permanent_error'] ) ) {
166 + /**
167 + * `permanent_error` is written as the FIRST key on purpose: the bulk query matches the
168 + * serialized data with a LIKE on the `<size>";a:3:{s:15:"permanent_error";b:1;` prefix,
169 + * which only stays deterministic if the key order does.
170 + */
171 + $size_data = array_merge( [ 'permanent_error' => true ], $size_data );
172 + }
173 +
174 + $old_data['data']['sizes'][ $size ] = $size_data;
164 175 } else {
165 176 /**
166 177 * Success.
167 178 */
@@ -252,12 +263,15 @@
252 263 $db_instance = $this->get_row_db_instance();
253 264 $primary_key = $db_instance->get_primary_key();
254 265 $column_defaults = $db_instance->get_column_defaults();
255 266
256 - return array_diff_key( $column_defaults, [
257 - 'data_id' => 0,
258 - $primary_key => 0,
259 - ] );
267 + return array_diff_key(
268 + $column_defaults,
269 + [
270 + 'data_id' => 0,
271 + $primary_key => 0,
272 + ]
273 + );
260 274 }
261 275
262 276 /**
263 277 * Update the row.