Changeset 3398654
- Timestamp:
- 11/19/2025 08:43:02 AM (5 months ago)
- Location:
- modula-best-grid-gallery
- Files:
-
- 10 edited
- 1 copied
-
tags/2.13.2 (copied) (copied from modula-best-grid-gallery/trunk)
-
tags/2.13.2/Modula.php (modified) (1 diff)
-
tags/2.13.2/changelog.txt (modified) (1 diff)
-
tags/2.13.2/includes/ai/class-image-descriptor.php (modified) (1 diff)
-
tags/2.13.2/includes/ai/optimizer/class-optimizer.php (modified) (1 diff)
-
tags/2.13.2/readme.txt (modified) (2 diffs)
-
trunk/Modula.php (modified) (1 diff)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/includes/ai/class-image-descriptor.php (modified) (1 diff)
-
trunk/includes/ai/optimizer/class-optimizer.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
modula-best-grid-gallery/tags/2.13.2/Modula.php
r3395701 r3398654 5 5 * Description: Modula is the most powerful, user-friendly WordPress gallery plugin. Add galleries, masonry grids and more in a few clicks. 6 6 * Author: WPChill 7 * Version: 2.13. 17 * Version: 2.13.2 8 8 * Author URI: https://www.wpchill.com/ 9 9 * License: GPLv3 or later -
modula-best-grid-gallery/tags/2.13.2/changelog.txt
r3395701 r3398654 1 = 2.13.2 - 19.11.2025 = 2 Updated: Performance improvements. 3 1 4 = 2.13.1 - 14.11.2025 = 2 5 Added: Enhancements for zip import. -
modula-best-grid-gallery/tags/2.13.2/includes/ai/class-image-descriptor.php
r3248316 r3398654 21 21 } 22 22 23 /** 24 * Registers gallery actions only for galleries with scheduled Action Scheduler actions. 25 */ 23 26 private function _register_gallery_actions() { 24 $posts = get_posts( 25 array( 26 'post_type' => 'modula-gallery', 27 'posts_per_page' => -1, 28 ) 27 $post_ids = $this->_get_galleries_with_scheduled_actions(); 28 29 foreach ( $post_ids as $post_id ) { 30 Optimizer::get_instance( (string) $post_id ); 31 } 32 33 add_action( 'action_scheduler_before_execute', array( $this, '_lazy_register_optimizer_hooks' ), 10, 1 ); 34 } 35 36 /** 37 * Lazy-loads Optimizer hooks when an action is about to execute. 38 * 39 * @param int $action_id The action ID that's about to execute. 40 */ 41 public function _lazy_register_optimizer_hooks( $action_id ) { 42 if ( ! class_exists( 'ActionScheduler' ) || ! \ActionScheduler::is_initialized() ) { 43 return; 44 } 45 46 try { 47 $store = \ActionScheduler::store(); 48 $action = $store->fetch_action( $action_id ); 49 $hook = $action->get_hook(); 50 51 $hook_patterns = array( 52 'mai_process_image_batch_', 53 'mai_check_image_batch_', 54 'mai_check_optimizer_finished_', 55 ); 56 57 foreach ( $hook_patterns as $pattern ) { 58 if ( strpos( $hook, $pattern ) === 0 ) { 59 $post_id = str_replace( $pattern, '', $hook ); 60 if ( is_numeric( $post_id ) && $post_id > 0 ) { 61 Optimizer::get_instance( (string) $post_id ); 62 } 63 break; 64 } 65 } 66 } catch ( \Exception $e ) { 67 return; 68 } 69 } 70 71 /** 72 * Gets gallery post IDs that have scheduled Action Scheduler actions. 73 * Queries for all actions (not just pending/running) to catch all possible hooks. 74 * 75 * @return array Array of unique post IDs 76 */ 77 private function _get_galleries_with_scheduled_actions() { 78 if ( ! function_exists( 'as_get_scheduled_actions' ) ) { 79 return array(); 80 } 81 82 $post_ids = array(); 83 84 if ( ! class_exists( 'ActionScheduler' ) || ! \ActionScheduler::is_initialized() ) { 85 return array(); 86 } 87 88 $store = \ActionScheduler::store(); 89 90 $hook_patterns = array( 91 'mai_process_image_batch_', 92 'mai_check_image_batch_', 93 'mai_check_optimizer_finished_', 29 94 ); 30 95 31 foreach ( $posts as $post ) { 32 Optimizer::get_instance( (string) $post->ID ); 96 $actions = as_get_scheduled_actions( 97 array( 98 'status' => array( 99 \ActionScheduler_Store::STATUS_PENDING, 100 \ActionScheduler_Store::STATUS_RUNNING, 101 \ActionScheduler_Store::STATUS_FAILED, 102 ), 103 'per_page' => 1000, 104 ), 105 'ids' 106 ); 107 108 if ( empty( $actions ) ) { 109 return array(); 33 110 } 111 112 foreach ( $actions as $action_id ) { 113 try { 114 $action = $store->fetch_action( $action_id ); 115 $hook = $action->get_hook(); 116 117 foreach ( $hook_patterns as $pattern ) { 118 if ( strpos( $hook, $pattern ) === 0 ) { 119 $post_id = str_replace( $pattern, '', $hook ); 120 if ( is_numeric( $post_id ) && $post_id > 0 ) { 121 $post_ids[] = (int) $post_id; 122 } 123 break; 124 } 125 } 126 } catch ( \Exception $e ) { 127 continue; 128 } 129 } 130 131 return array_unique( $post_ids ); 34 132 } 35 133 } -
modula-best-grid-gallery/tags/2.13.2/includes/ai/optimizer/class-optimizer.php
r3248316 r3398654 74 74 $this->gallery_helper = Gallery_Helper::get_instance(); 75 75 76 add_action( 'init', array( $this, 'add_process_hooks' ) ); 76 77 $this->add_process_hooks(); 78 if ( ! did_action( 'init' ) ) { 79 add_action( 'init', array( $this, 'add_process_hooks' ) ); 80 } 77 81 } 78 82 -
modula-best-grid-gallery/tags/2.13.2/readme.txt
r3395701 r3398654 5 5 Tested up to: 6.8 6 6 Requires PHP: 5.6 7 Stable tag: 2.13. 17 Stable tag: 2.13.2 8 8 9 9 License: GNU General Public License v3.0 or later … … 323 323 324 324 == Changelog == 325 = 2.13.2 - 19.11.2025 = 326 Updated: Performance improvements. 327 325 328 = 2.13.1 - 14.11.2025 = 326 329 Added: Enhancements for zip import. -
modula-best-grid-gallery/trunk/Modula.php
r3395701 r3398654 5 5 * Description: Modula is the most powerful, user-friendly WordPress gallery plugin. Add galleries, masonry grids and more in a few clicks. 6 6 * Author: WPChill 7 * Version: 2.13. 17 * Version: 2.13.2 8 8 * Author URI: https://www.wpchill.com/ 9 9 * License: GPLv3 or later -
modula-best-grid-gallery/trunk/changelog.txt
r3395701 r3398654 1 = 2.13.2 - 19.11.2025 = 2 Updated: Performance improvements. 3 1 4 = 2.13.1 - 14.11.2025 = 2 5 Added: Enhancements for zip import. -
modula-best-grid-gallery/trunk/includes/ai/class-image-descriptor.php
r3248316 r3398654 21 21 } 22 22 23 /** 24 * Registers gallery actions only for galleries with scheduled Action Scheduler actions. 25 */ 23 26 private function _register_gallery_actions() { 24 $posts = get_posts( 25 array( 26 'post_type' => 'modula-gallery', 27 'posts_per_page' => -1, 28 ) 27 $post_ids = $this->_get_galleries_with_scheduled_actions(); 28 29 foreach ( $post_ids as $post_id ) { 30 Optimizer::get_instance( (string) $post_id ); 31 } 32 33 add_action( 'action_scheduler_before_execute', array( $this, '_lazy_register_optimizer_hooks' ), 10, 1 ); 34 } 35 36 /** 37 * Lazy-loads Optimizer hooks when an action is about to execute. 38 * 39 * @param int $action_id The action ID that's about to execute. 40 */ 41 public function _lazy_register_optimizer_hooks( $action_id ) { 42 if ( ! class_exists( 'ActionScheduler' ) || ! \ActionScheduler::is_initialized() ) { 43 return; 44 } 45 46 try { 47 $store = \ActionScheduler::store(); 48 $action = $store->fetch_action( $action_id ); 49 $hook = $action->get_hook(); 50 51 $hook_patterns = array( 52 'mai_process_image_batch_', 53 'mai_check_image_batch_', 54 'mai_check_optimizer_finished_', 55 ); 56 57 foreach ( $hook_patterns as $pattern ) { 58 if ( strpos( $hook, $pattern ) === 0 ) { 59 $post_id = str_replace( $pattern, '', $hook ); 60 if ( is_numeric( $post_id ) && $post_id > 0 ) { 61 Optimizer::get_instance( (string) $post_id ); 62 } 63 break; 64 } 65 } 66 } catch ( \Exception $e ) { 67 return; 68 } 69 } 70 71 /** 72 * Gets gallery post IDs that have scheduled Action Scheduler actions. 73 * Queries for all actions (not just pending/running) to catch all possible hooks. 74 * 75 * @return array Array of unique post IDs 76 */ 77 private function _get_galleries_with_scheduled_actions() { 78 if ( ! function_exists( 'as_get_scheduled_actions' ) ) { 79 return array(); 80 } 81 82 $post_ids = array(); 83 84 if ( ! class_exists( 'ActionScheduler' ) || ! \ActionScheduler::is_initialized() ) { 85 return array(); 86 } 87 88 $store = \ActionScheduler::store(); 89 90 $hook_patterns = array( 91 'mai_process_image_batch_', 92 'mai_check_image_batch_', 93 'mai_check_optimizer_finished_', 29 94 ); 30 95 31 foreach ( $posts as $post ) { 32 Optimizer::get_instance( (string) $post->ID ); 96 $actions = as_get_scheduled_actions( 97 array( 98 'status' => array( 99 \ActionScheduler_Store::STATUS_PENDING, 100 \ActionScheduler_Store::STATUS_RUNNING, 101 \ActionScheduler_Store::STATUS_FAILED, 102 ), 103 'per_page' => 1000, 104 ), 105 'ids' 106 ); 107 108 if ( empty( $actions ) ) { 109 return array(); 33 110 } 111 112 foreach ( $actions as $action_id ) { 113 try { 114 $action = $store->fetch_action( $action_id ); 115 $hook = $action->get_hook(); 116 117 foreach ( $hook_patterns as $pattern ) { 118 if ( strpos( $hook, $pattern ) === 0 ) { 119 $post_id = str_replace( $pattern, '', $hook ); 120 if ( is_numeric( $post_id ) && $post_id > 0 ) { 121 $post_ids[] = (int) $post_id; 122 } 123 break; 124 } 125 } 126 } catch ( \Exception $e ) { 127 continue; 128 } 129 } 130 131 return array_unique( $post_ids ); 34 132 } 35 133 } -
modula-best-grid-gallery/trunk/includes/ai/optimizer/class-optimizer.php
r3248316 r3398654 74 74 $this->gallery_helper = Gallery_Helper::get_instance(); 75 75 76 add_action( 'init', array( $this, 'add_process_hooks' ) ); 76 77 $this->add_process_hooks(); 78 if ( ! did_action( 'init' ) ) { 79 add_action( 'init', array( $this, 'add_process_hooks' ) ); 80 } 77 81 } 78 82 -
modula-best-grid-gallery/trunk/readme.txt
r3395701 r3398654 5 5 Tested up to: 6.8 6 6 Requires PHP: 5.6 7 Stable tag: 2.13. 17 Stable tag: 2.13.2 8 8 9 9 License: GNU General Public License v3.0 or later … … 323 323 324 324 == Changelog == 325 = 2.13.2 - 19.11.2025 = 326 Updated: Performance improvements. 327 325 328 = 2.13.1 - 14.11.2025 = 326 329 Added: Enhancements for zip import.
Note: See TracChangeset
for help on using the changeset viewer.