Changeset 3372770
- Timestamp:
- 10/04/2025 09:20:51 AM (6 months ago)
- Location:
- muchat-ai
- Files:
-
- 6 edited
- 1 copied
-
tags/2.0.46 (copied) (copied from muchat-ai/trunk)
-
tags/2.0.46/includes/Models/Product.php (modified) (2 diffs)
-
tags/2.0.46/muchat-ai.php (modified) (2 diffs)
-
tags/2.0.46/readme.txt (modified) (2 diffs)
-
trunk/includes/Models/Product.php (modified) (2 diffs)
-
trunk/muchat-ai.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
muchat-ai/tags/2.0.46/includes/Models/Product.php
r3357955 r3372770 62 62 // Add date filters if provided 63 63 if (!empty($params['modified_after'])) { 64 $modified_after_timestamp = strtotime($params['modified_after']); 65 if ($modified_after_timestamp) { 64 try { 65 // Parse the date as UTC to ensure consistency 66 $date = new \DateTime($params['modified_after'], new \DateTimeZone('UTC')); 66 67 $args['date_query'][] = [ 67 68 'column' => 'post_modified_gmt', 68 'after' => gmdate('Y-m-d H:i:s', $modified_after_timestamp),69 'after' => $date->format('Y-m-d H:i:s'), 69 70 'inclusive' => false 70 71 ]; 72 } catch (\Exception $e) { 73 // If date parsing fails, try with strtotime as fallback 74 $modified_after_timestamp = strtotime($params['modified_after']); 75 if ($modified_after_timestamp) { 76 $args['date_query'][] = [ 77 'column' => 'post_modified_gmt', 78 'after' => gmdate('Y-m-d H:i:s', $modified_after_timestamp), 79 'inclusive' => false 80 ]; 81 } 71 82 } 72 83 } … … 142 153 'post_status' => 'publish', 143 154 'posts_per_page' => -1, 144 'fields' => 'ids', 145 'orderby' => 'ID', 146 'order' => 'ASC' 155 'orderby' => ['modified' => 'ASC', 'ID' => 'ASC'], 147 156 ]; 148 157 149 158 if ($modified_after) { 150 $modified_after_timestamp = strtotime($modified_after); 151 if ($modified_after_timestamp) { 159 try { 160 // Parse the date as UTC to ensure consistency 161 $date = new \DateTime($modified_after, new \DateTimeZone('UTC')); 152 162 $args['date_query'] = [ 153 163 [ 154 164 'column' => 'post_modified_gmt', 155 'after' => gmdate('Y-m-d H:i:s', $modified_after_timestamp),165 'after' => $date->format('Y-m-d H:i:s'), 156 166 'inclusive' => false 157 167 ] 158 168 ]; 159 } 160 } 169 } catch (\Exception $e) { 170 // If date parsing fails, try with strtotime as fallback 171 $modified_after_timestamp = strtotime($modified_after); 172 if ($modified_after_timestamp) { 173 $args['date_query'] = [ 174 [ 175 'column' => 'post_modified_gmt', 176 'after' => gmdate('Y-m-d H:i:s', $modified_after_timestamp), 177 'inclusive' => false 178 ] 179 ]; 180 } 181 } 182 } 183 184 // Filter to select only ID and post_modified_gmt for performance 185 $fields_filter = function ($fields) { 186 global $wpdb; 187 return "{$wpdb->posts}.ID, {$wpdb->posts}.post_modified_gmt"; 188 }; 189 add_filter('posts_fields', $fields_filter); 161 190 162 191 $query = new \WP_Query($args); 192 193 // Clean up the filter 194 remove_filter('posts_fields', $fields_filter); 195 196 $products = array_map(function ($post) { 197 return [ 198 'id' => $post->ID, 199 'date_modified' => $post->post_modified_gmt 200 ]; 201 }, $query->posts); 163 202 164 203 return [ 165 204 'total_count' => (int) $query->found_posts, 166 'i ds' => $query->posts205 'items' => $products 167 206 ]; 168 207 } -
muchat-ai/tags/2.0.46/muchat-ai.php
r3357955 r3372770 5 5 * Plugin URI: https://mu.chat 6 6 * Description: Muchat, a powerful tool for customer support using artificial intelligence 7 * Version: 2.0.4 57 * Version: 2.0.46 8 8 * Author: Muchat 9 9 * Text Domain: muchat-ai … … 27 27 28 28 // Define plugin constants with unique prefix 29 define('MUCHAT_AI_CHATBOT_PLUGIN_VERSION', '2.0.4 5');29 define('MUCHAT_AI_CHATBOT_PLUGIN_VERSION', '2.0.46'); 30 30 // define('MUCHAT_AI_CHATBOT_CACHE_DURATION', HOUR_IN_SECONDS); 31 31 define('MUCHAT_AI_CHATBOT_PLUGIN_FILE', __FILE__); -
muchat-ai/tags/2.0.46/readme.txt
r3357955 r3372770 4 4 Requires at least: 5.0 5 5 Tested up to: 6.8 6 Stable tag: 2.0.4 56 Stable tag: 2.0.46 7 7 Requires PHP: 7.3 8 8 License: GPLv2 or later … … 75 75 76 76 == Changelog == 77 78 = 2.0.46 = 79 * Feature: Return `date_modified` along with `id` in the `product-ids` endpoint. 80 * Fix: Corrected sorting for the `product-ids` endpoint to use `date_modified` and then `id`. 81 * Tweak: Optimized the performance of the `product-ids` endpoint for a large number of products. 77 82 78 83 = 2.0.45 = -
muchat-ai/trunk/includes/Models/Product.php
r3357955 r3372770 62 62 // Add date filters if provided 63 63 if (!empty($params['modified_after'])) { 64 $modified_after_timestamp = strtotime($params['modified_after']); 65 if ($modified_after_timestamp) { 64 try { 65 // Parse the date as UTC to ensure consistency 66 $date = new \DateTime($params['modified_after'], new \DateTimeZone('UTC')); 66 67 $args['date_query'][] = [ 67 68 'column' => 'post_modified_gmt', 68 'after' => gmdate('Y-m-d H:i:s', $modified_after_timestamp),69 'after' => $date->format('Y-m-d H:i:s'), 69 70 'inclusive' => false 70 71 ]; 72 } catch (\Exception $e) { 73 // If date parsing fails, try with strtotime as fallback 74 $modified_after_timestamp = strtotime($params['modified_after']); 75 if ($modified_after_timestamp) { 76 $args['date_query'][] = [ 77 'column' => 'post_modified_gmt', 78 'after' => gmdate('Y-m-d H:i:s', $modified_after_timestamp), 79 'inclusive' => false 80 ]; 81 } 71 82 } 72 83 } … … 142 153 'post_status' => 'publish', 143 154 'posts_per_page' => -1, 144 'fields' => 'ids', 145 'orderby' => 'ID', 146 'order' => 'ASC' 155 'orderby' => ['modified' => 'ASC', 'ID' => 'ASC'], 147 156 ]; 148 157 149 158 if ($modified_after) { 150 $modified_after_timestamp = strtotime($modified_after); 151 if ($modified_after_timestamp) { 159 try { 160 // Parse the date as UTC to ensure consistency 161 $date = new \DateTime($modified_after, new \DateTimeZone('UTC')); 152 162 $args['date_query'] = [ 153 163 [ 154 164 'column' => 'post_modified_gmt', 155 'after' => gmdate('Y-m-d H:i:s', $modified_after_timestamp),165 'after' => $date->format('Y-m-d H:i:s'), 156 166 'inclusive' => false 157 167 ] 158 168 ]; 159 } 160 } 169 } catch (\Exception $e) { 170 // If date parsing fails, try with strtotime as fallback 171 $modified_after_timestamp = strtotime($modified_after); 172 if ($modified_after_timestamp) { 173 $args['date_query'] = [ 174 [ 175 'column' => 'post_modified_gmt', 176 'after' => gmdate('Y-m-d H:i:s', $modified_after_timestamp), 177 'inclusive' => false 178 ] 179 ]; 180 } 181 } 182 } 183 184 // Filter to select only ID and post_modified_gmt for performance 185 $fields_filter = function ($fields) { 186 global $wpdb; 187 return "{$wpdb->posts}.ID, {$wpdb->posts}.post_modified_gmt"; 188 }; 189 add_filter('posts_fields', $fields_filter); 161 190 162 191 $query = new \WP_Query($args); 192 193 // Clean up the filter 194 remove_filter('posts_fields', $fields_filter); 195 196 $products = array_map(function ($post) { 197 return [ 198 'id' => $post->ID, 199 'date_modified' => $post->post_modified_gmt 200 ]; 201 }, $query->posts); 163 202 164 203 return [ 165 204 'total_count' => (int) $query->found_posts, 166 'i ds' => $query->posts205 'items' => $products 167 206 ]; 168 207 } -
muchat-ai/trunk/muchat-ai.php
r3357955 r3372770 5 5 * Plugin URI: https://mu.chat 6 6 * Description: Muchat, a powerful tool for customer support using artificial intelligence 7 * Version: 2.0.4 57 * Version: 2.0.46 8 8 * Author: Muchat 9 9 * Text Domain: muchat-ai … … 27 27 28 28 // Define plugin constants with unique prefix 29 define('MUCHAT_AI_CHATBOT_PLUGIN_VERSION', '2.0.4 5');29 define('MUCHAT_AI_CHATBOT_PLUGIN_VERSION', '2.0.46'); 30 30 // define('MUCHAT_AI_CHATBOT_CACHE_DURATION', HOUR_IN_SECONDS); 31 31 define('MUCHAT_AI_CHATBOT_PLUGIN_FILE', __FILE__); -
muchat-ai/trunk/readme.txt
r3357955 r3372770 4 4 Requires at least: 5.0 5 5 Tested up to: 6.8 6 Stable tag: 2.0.4 56 Stable tag: 2.0.46 7 7 Requires PHP: 7.3 8 8 License: GPLv2 or later … … 75 75 76 76 == Changelog == 77 78 = 2.0.46 = 79 * Feature: Return `date_modified` along with `id` in the `product-ids` endpoint. 80 * Fix: Corrected sorting for the `product-ids` endpoint to use `date_modified` and then `id`. 81 * Tweak: Optimized the performance of the `product-ids` endpoint for a large number of products. 77 82 78 83 = 2.0.45 =
Note: See TracChangeset
for help on using the changeset viewer.