| @@ -139,9 +139,10 @@ | ||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $destination = WPO_WebP_Utils::get_destination_path($source); |
| 142 | 142 | if (file_exists($destination)) { |
| 143 | - $this->backfill_webp_conversion_meta($post->ID); | |
| 143 | + // A way of backfilling already webp converted images | |
| 144 | + update_post_meta($post->ID, WPO_Webp_Convert_Image_Task::WEBP_CONVERSION_META_KEY, true); | |
| 144 | 145 | continue; |
| 145 | 146 | } |
| 146 | 147 | |
| 147 | 148 | $filtered_post_ids[] = array( |
| @@ -156,19 +157,8 @@ | ||
| 156 | 157 | return $filtered_post_ids; |
| 157 | 158 | } |
| 158 | 159 | |
| 159 | 160 | /** |
| 160 | - * Backfill the webp conversion meta for attachments that already have | |
| 161 | - * a WebP file present at the destination path. | |
| 162 | - * | |
| 163 | - * @param int $post_id The attachment post ID. | |
| 164 | - * @return void | |
| 165 | - */ | |
| 166 | - private function backfill_webp_conversion_meta($post_id): void { | |
| 167 | - update_post_meta($post_id, '_wpo-webp-conversion-complete', true); | |
| 168 | - } | |
| 169 | - | |
| 170 | - /** | |
| 171 | 161 | * Meta query array for getting compressed images not yet converted to WebP |
| 172 | 162 | * |
| 173 | 163 | * @return array<int|string, array<int|string, array<string, string>|string>|string> |
| 174 | 164 | */ |
| @@ -182,14 +172,14 @@ | ||
| 182 | 172 | ), |
| 183 | 173 | array( |
| 184 | 174 | 'relation' => 'OR', |
| 185 | 175 | array( |
| 186 | - 'key' => '_wpo-webp-conversion-complete', | |
| 176 | + 'key' => WPO_Webp_Convert_Image_Task::WEBP_CONVERSION_META_KEY, | |
| 187 | 177 | 'compare' => 'NOT EXISTS', |
| 188 | 178 | 'value' => '', |
| 189 | 179 | ), |
| 190 | 180 | array( |
| 191 | - 'key' => '_wpo-webp-conversion-complete', | |
| 181 | + 'key' => WPO_Webp_Convert_Image_Task::WEBP_CONVERSION_META_KEY, | |
| 192 | 182 | 'compare' => '!=', |
| 193 | 183 | 'value' => '1', |
| 194 | 184 | ) |
| 195 | 185 | ) |