WP Job Manager - Version 1.29.3

Version Description

  • Fix: When retrieving job listing results, cache only the post results and not all of WP_Query (@jom; props slavco)
Download this release

Release Info

Developer jakeom
Plugin Icon 128x128 WP Job Manager
Version 1.29.3
Comparing to
See all releases

Code changes from version 1.29.2 to 1.29.3

changelog.txt CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  = 1.29.2 =
2
  * Fix: PHP Notice when sanitizing multiple inputs (bug in 1.29.1 release). (@albionselimaj)
3
 
1
+ = 1.29.3 =
2
+ * Fix: When retrieving job listing results, cache only the post results and not all of `WP_Query` (@jom; props slavco)
3
+
4
  = 1.29.2 =
5
  * Fix: PHP Notice when sanitizing multiple inputs (bug in 1.29.1 release). (@albionselimaj)
6
 
languages/wp-job-manager.pot CHANGED
@@ -1,14 +1,14 @@
1
- # Copyright (C) 2017 Automattic
2
  # This file is distributed under the GPL2+.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WP Job Manager 1.29.2\n"
6
  "Report-Msgid-Bugs-To: https://github.com/Automattic/WP-Job-Manager/issues\n"
7
- "POT-Creation-Date: 2017-12-04 13:55:35+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
14
  "X-Generator: grunt-wp-i18n 0.5.4\n"
@@ -1194,7 +1194,7 @@ msgid "%s is invalid"
1194
  msgstr ""
1195
 
1196
  #: includes/forms/class-wp-job-manager-form-submit-job.php:315
1197
- #: wp-job-manager-functions.php:1036
1198
  msgid "\"%s\" (filetype %s) needs to be one of the following file types: %s"
1199
  msgstr ""
1200
 
@@ -1417,12 +1417,12 @@ msgid "Maximum file size: %s."
1417
  msgstr ""
1418
 
1419
  #: templates/form-fields/multiselect-field.php:20
1420
- #: wp-job-manager-functions.php:824
1421
  msgid "No results match"
1422
  msgstr ""
1423
 
1424
  #: templates/form-fields/multiselect-field.php:20
1425
- #: wp-job-manager-functions.php:825
1426
  msgid "Select Some Options"
1427
  msgstr ""
1428
 
@@ -1519,67 +1519,67 @@ msgstr ""
1519
  msgid "%s submitted successfully. Your listing will be visible once approved."
1520
  msgstr ""
1521
 
1522
- #: wp-job-manager-functions.php:395
1523
  msgid "Reset"
1524
  msgstr ""
1525
 
1526
- #: wp-job-manager-functions.php:399
1527
  msgid "RSS"
1528
  msgstr ""
1529
 
1530
- #: wp-job-manager-functions.php:494
1531
  msgid "Invalid email address."
1532
  msgstr ""
1533
 
1534
- #: wp-job-manager-functions.php:502
1535
  msgid "Your email address isn&#8217;t correct."
1536
  msgstr ""
1537
 
1538
- #: wp-job-manager-functions.php:506
1539
  msgid "This email is already registered, please choose another one."
1540
  msgstr ""
1541
 
1542
- #: wp-job-manager-functions.php:667
1543
  msgid "Full Time"
1544
  msgstr ""
1545
 
1546
- #: wp-job-manager-functions.php:668
1547
  msgid "Part Time"
1548
  msgstr ""
1549
 
1550
- #: wp-job-manager-functions.php:669
1551
  msgid "Contractor"
1552
  msgstr ""
1553
 
1554
- #: wp-job-manager-functions.php:670
1555
  msgid "Temporary"
1556
  msgstr ""
1557
 
1558
- #: wp-job-manager-functions.php:671
1559
  msgid "Intern"
1560
  msgstr ""
1561
 
1562
- #: wp-job-manager-functions.php:672
1563
  msgid "Volunteer"
1564
  msgstr ""
1565
 
1566
- #: wp-job-manager-functions.php:673
1567
  msgid "Per Diem"
1568
  msgstr ""
1569
 
1570
- #: wp-job-manager-functions.php:674
1571
  msgid "Other"
1572
  msgstr ""
1573
 
1574
- #: wp-job-manager-functions.php:741
1575
  msgid "Passwords must be at least 8 characters long."
1576
  msgstr ""
1577
 
1578
- #: wp-job-manager-functions.php:823
1579
  msgid "Choose a category&hellip;"
1580
  msgstr ""
1581
 
1582
- #: wp-job-manager-functions.php:1038
1583
  msgid "Uploaded files need to be one of the following file types: %s"
1584
  msgstr ""
1585
 
@@ -1701,33 +1701,33 @@ msgid "jobs"
1701
  msgstr ""
1702
 
1703
  #: includes/class-wp-job-manager-post-types.php:261
1704
- #: wp-job-manager-functions.php:290
1705
  msgctxt "post status"
1706
  msgid "Expired"
1707
  msgstr ""
1708
 
1709
  #: includes/class-wp-job-manager-post-types.php:270
1710
- #: wp-job-manager-functions.php:291
1711
  msgctxt "post status"
1712
  msgid "Preview"
1713
  msgstr ""
1714
 
1715
- #: wp-job-manager-functions.php:289
1716
  msgctxt "post status"
1717
  msgid "Draft"
1718
  msgstr ""
1719
 
1720
- #: wp-job-manager-functions.php:292
1721
  msgctxt "post status"
1722
  msgid "Pending approval"
1723
  msgstr ""
1724
 
1725
- #: wp-job-manager-functions.php:293
1726
  msgctxt "post status"
1727
  msgid "Pending payment"
1728
  msgstr ""
1729
 
1730
- #: wp-job-manager-functions.php:294
1731
  msgctxt "post status"
1732
  msgid "Active"
1733
- msgstr ""
1
+ # Copyright (C) 2018 Automattic
2
  # This file is distributed under the GPL2+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WP Job Manager 1.29.3\n"
6
  "Report-Msgid-Bugs-To: https://github.com/Automattic/WP-Job-Manager/issues\n"
7
+ "POT-Creation-Date: 2018-01-29 21:58:28+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
14
  "X-Generator: grunt-wp-i18n 0.5.4\n"
1194
  msgstr ""
1195
 
1196
  #: includes/forms/class-wp-job-manager-form-submit-job.php:315
1197
+ #: wp-job-manager-functions.php:1061
1198
  msgid "\"%s\" (filetype %s) needs to be one of the following file types: %s"
1199
  msgstr ""
1200
 
1417
  msgstr ""
1418
 
1419
  #: templates/form-fields/multiselect-field.php:20
1420
+ #: wp-job-manager-functions.php:849
1421
  msgid "No results match"
1422
  msgstr ""
1423
 
1424
  #: templates/form-fields/multiselect-field.php:20
1425
+ #: wp-job-manager-functions.php:850
1426
  msgid "Select Some Options"
1427
  msgstr ""
1428
 
1519
  msgid "%s submitted successfully. Your listing will be visible once approved."
1520
  msgstr ""
1521
 
1522
+ #: wp-job-manager-functions.php:420
1523
  msgid "Reset"
1524
  msgstr ""
1525
 
1526
+ #: wp-job-manager-functions.php:424
1527
  msgid "RSS"
1528
  msgstr ""
1529
 
1530
+ #: wp-job-manager-functions.php:519
1531
  msgid "Invalid email address."
1532
  msgstr ""
1533
 
1534
+ #: wp-job-manager-functions.php:527
1535
  msgid "Your email address isn&#8217;t correct."
1536
  msgstr ""
1537
 
1538
+ #: wp-job-manager-functions.php:531
1539
  msgid "This email is already registered, please choose another one."
1540
  msgstr ""
1541
 
1542
+ #: wp-job-manager-functions.php:692
1543
  msgid "Full Time"
1544
  msgstr ""
1545
 
1546
+ #: wp-job-manager-functions.php:693
1547
  msgid "Part Time"
1548
  msgstr ""
1549
 
1550
+ #: wp-job-manager-functions.php:694
1551
  msgid "Contractor"
1552
  msgstr ""
1553
 
1554
+ #: wp-job-manager-functions.php:695
1555
  msgid "Temporary"
1556
  msgstr ""
1557
 
1558
+ #: wp-job-manager-functions.php:696
1559
  msgid "Intern"
1560
  msgstr ""
1561
 
1562
+ #: wp-job-manager-functions.php:697
1563
  msgid "Volunteer"
1564
  msgstr ""
1565
 
1566
+ #: wp-job-manager-functions.php:698
1567
  msgid "Per Diem"
1568
  msgstr ""
1569
 
1570
+ #: wp-job-manager-functions.php:699
1571
  msgid "Other"
1572
  msgstr ""
1573
 
1574
+ #: wp-job-manager-functions.php:766
1575
  msgid "Passwords must be at least 8 characters long."
1576
  msgstr ""
1577
 
1578
+ #: wp-job-manager-functions.php:848
1579
  msgid "Choose a category&hellip;"
1580
  msgstr ""
1581
 
1582
+ #: wp-job-manager-functions.php:1063
1583
  msgid "Uploaded files need to be one of the following file types: %s"
1584
  msgstr ""
1585
 
1701
  msgstr ""
1702
 
1703
  #: includes/class-wp-job-manager-post-types.php:261
1704
+ #: wp-job-manager-functions.php:315
1705
  msgctxt "post status"
1706
  msgid "Expired"
1707
  msgstr ""
1708
 
1709
  #: includes/class-wp-job-manager-post-types.php:270
1710
+ #: wp-job-manager-functions.php:316
1711
  msgctxt "post status"
1712
  msgid "Preview"
1713
  msgstr ""
1714
 
1715
+ #: wp-job-manager-functions.php:314
1716
  msgctxt "post status"
1717
  msgid "Draft"
1718
  msgstr ""
1719
 
1720
+ #: wp-job-manager-functions.php:317
1721
  msgctxt "post status"
1722
  msgid "Pending approval"
1723
  msgstr ""
1724
 
1725
+ #: wp-job-manager-functions.php:318
1726
  msgctxt "post status"
1727
  msgid "Pending payment"
1728
  msgstr ""
1729
 
1730
+ #: wp-job-manager-functions.php:319
1731
  msgctxt "post status"
1732
  msgid "Active"
1733
+ msgstr ""
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: mikejolley, automattic, adamkheckler, annezazu, cena, chaselivings
3
  Tags: job manager, job listing, job board, job management, job lists, job list, job, jobs, company, hiring, employment, employer, employees, candidate, freelance, internship, job listings, positions, board, application, hiring, listing, manager, recruiting, recruitment, talent
4
  Requires at least: 4.3.1
5
  Tested up to: 4.9
6
- Stable tag: 1.29.2
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -141,6 +141,9 @@ You can view (and contribute) translations via the [translate.wordpress.org](htt
141
 
142
  == Changelog ==
143
 
 
 
 
144
  = 1.29.2 =
145
  * Fix: PHP Notice when sanitizing multiple inputs (bug in 1.29.1 release). (@albionselimaj)
146
 
3
  Tags: job manager, job listing, job board, job management, job lists, job list, job, jobs, company, hiring, employment, employer, employees, candidate, freelance, internship, job listings, positions, board, application, hiring, listing, manager, recruiting, recruitment, talent
4
  Requires at least: 4.3.1
5
  Tested up to: 4.9
6
+ Stable tag: 1.29.3
7
  License: GPLv3
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
141
 
142
  == Changelog ==
143
 
144
+ = 1.29.3 =
145
+ * Fix: When retrieving job listing results, cache only the post results and not all of `WP_Query` (@jom; props slavco)
146
+
147
  = 1.29.2 =
148
  * Fix: PHP Notice when sanitizing multiple inputs (bug in 1.29.1 release). (@albionselimaj)
149
 
wp-job-manager-functions.php CHANGED
@@ -148,22 +148,47 @@ function get_job_listings( $args = array() ) {
148
  // Filter args
149
  $query_args = apply_filters( 'get_job_listings_query_args', $query_args, $args );
150
 
151
- // Generate hash
152
- $to_hash = json_encode( $query_args );
153
- $query_args_hash = 'jm_' . md5( $to_hash ) . WP_Job_Manager_Cache_Helper::get_transient_version( 'get_job_listings' );
154
 
155
  do_action( 'before_get_job_listings', $query_args, $args );
156
 
157
  // Cache results
158
  if ( apply_filters( 'get_job_listings_cache_results', true ) ) {
159
- $cached_query = true;
160
- if ( false === ( $result = get_transient( $query_args_hash ) ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  $result = new WP_Query( $query_args );
162
- $cached_query = false;
163
- set_transient( $query_args_hash, $result, DAY_IN_SECONDS );
 
 
 
 
 
164
  }
165
 
166
- if ( $cached_query ) {
167
  // random order is cached so shuffle them
168
  if ( 'rand_featured' === $args['orderby'] ) {
169
  usort( $result->posts, '_wpjm_shuffle_featured_post_results_helper' );
148
  // Filter args
149
  $query_args = apply_filters( 'get_job_listings_query_args', $query_args, $args );
150
 
 
 
 
151
 
152
  do_action( 'before_get_job_listings', $query_args, $args );
153
 
154
  // Cache results
155
  if ( apply_filters( 'get_job_listings_cache_results', true ) ) {
156
+ $to_hash = json_encode( $query_args );
157
+ $query_args_hash = 'jm_' . md5( $to_hash . JOB_MANAGER_VERSION ) . WP_Job_Manager_Cache_Helper::get_transient_version( 'get_job_listings' );
158
+ $result = false;
159
+ $cached_query_results = false;
160
+ $cached_query_posts = get_transient( $query_args_hash );
161
+ if ( is_string( $cached_query_posts ) ) {
162
+ $cached_query_posts = json_decode( $cached_query_posts, false );
163
+ if ( $cached_query_posts
164
+ && is_object( $cached_query_posts )
165
+ && isset( $cached_query_posts->max_num_pages )
166
+ && isset( $cached_query_posts->found_posts )
167
+ && isset( $cached_query_posts->posts )
168
+ && is_array( $cached_query_posts->posts )
169
+ ) {
170
+ $posts = array_map( 'get_post', $cached_query_posts->posts );
171
+ $result = new WP_Query();
172
+ $result->parse_query( $query_args );
173
+ $result->posts = $posts;
174
+ $result->found_posts = intval( $cached_query_posts->found_posts );
175
+ $result->max_num_pages = intval( $cached_query_posts->max_num_pages );
176
+ $result->post_count = count( $posts );
177
+ }
178
+ }
179
+
180
+ if ( false === $result ) {
181
  $result = new WP_Query( $query_args );
182
+ $cached_query_results = false;
183
+
184
+ $cacheable_result = array();
185
+ $cacheable_result['posts'] = array_values( $result->posts );
186
+ $cacheable_result['found_posts'] = $result->found_posts;
187
+ $cacheable_result['max_num_pages'] = $result->max_num_pages;
188
+ set_transient( $query_args_hash, json_encode( $cacheable_result ), DAY_IN_SECONDS );
189
  }
190
 
191
+ if ( $cached_query_results ) {
192
  // random order is cached so shuffle them
193
  if ( 'rand_featured' === $args['orderby'] ) {
194
  usort( $result->posts, '_wpjm_shuffle_featured_post_results_helper' );
wp-job-manager.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: WP Job Manager
4
  * Plugin URI: https://wpjobmanager.com/
5
  * Description: Manage job listings from the WordPress admin panel, and allow users to post jobs directly to your site.
6
- * Version: 1.29.2
7
  * Author: Automattic
8
  * Author URI: https://wpjobmanager.com/
9
  * Requires at least: 4.1
@@ -58,7 +58,7 @@ class WP_Job_Manager {
58
  */
59
  public function __construct() {
60
  // Define constants
61
- define( 'JOB_MANAGER_VERSION', '1.29.2' );
62
  define( 'JOB_MANAGER_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
63
  define( 'JOB_MANAGER_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
64
 
3
  * Plugin Name: WP Job Manager
4
  * Plugin URI: https://wpjobmanager.com/
5
  * Description: Manage job listings from the WordPress admin panel, and allow users to post jobs directly to your site.
6
+ * Version: 1.29.3
7
  * Author: Automattic
8
  * Author URI: https://wpjobmanager.com/
9
  * Requires at least: 4.1
58
  */
59
  public function __construct() {
60
  // Define constants
61
+ define( 'JOB_MANAGER_VERSION', '1.29.3' );
62
  define( 'JOB_MANAGER_PLUGIN_DIR', untrailingslashit( plugin_dir_path( __FILE__ ) ) );
63
  define( 'JOB_MANAGER_PLUGIN_URL', untrailingslashit( plugins_url( basename( plugin_dir_path( __FILE__ ) ), basename( __FILE__ ) ) ) );
64