PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/FrmUsage.php +33 -14 6.33 → trunk View file →
@@ -602,24 +602,43 @@
602 602 *
603 603 * @return array
604 604 */
605 605 private function actions() {
606 - $args = array(
607 - 'post_type' => FrmFormActionsController::$action_post_type,
608 - 'numberposts' => 100,
609 - );
606 + $actions = array();
607 + $offset = 0;
608 + $limit = 100;
609 + $limit_plus_one = $limit + 1;
610 610
611 - $actions = array();
612 - $saved_actions = FrmDb::check_cache( json_encode( $args ), 'frm_actions', $args, 'get_posts' );
611 + do {
612 + $args = array(
613 + 'post_type' => FrmFormActionsController::$action_post_type,
614 + 'numberposts' => $limit_plus_one,
615 + 'offset' => $offset,
616 + );
617 + $saved_actions = get_posts( $args );
618 + $has_more = count( $saved_actions ) === $limit_plus_one;
613 619
614 - foreach ( $saved_actions as $action ) {
615 - $actions[] = array(
616 - 'form_id' => $action->menu_order,
617 - 'type' => $action->post_excerpt,
618 - 'status' => $action->post_status,
619 - 'settings' => FrmAppHelper::maybe_json_decode( $action->post_content ),
620 - );
621 - }
620 + if ( $has_more ) {
621 + // Pop off the last item as it is only queried to determine if there are more results.
622 + array_pop( $saved_actions );
623 + }
624 +
625 + foreach ( $saved_actions as $action ) {
626 + $actions[] = array(
627 + 'form_id' => $action->menu_order,
628 + 'type' => $action->post_excerpt,
629 + 'status' => $action->post_status,
630 + 'settings' => FrmAppHelper::maybe_json_decode( $action->post_content ),
631 + );
632 + unset( $action );
633 + }
634 +
635 + $offset += $limit;
636 +
637 + unset( $saved_actions );
638 +
639 + gc_collect_cycles();
640 + } while ( $has_more );
622 641
623 642 return $actions;
624 643 }
625 644