Merged in release/release-1.09 (pull request #10)

Release/release 1.09

* Install missing plugins 
* rs set to 1

* rebase pantheon for aws

* rebase pantheon for aws

* prod config change

* prod config change

* fix campaing issue

* revert


Approved-by: Jay Sharma
This commit is contained in:
Rachit Bhargava
2023-12-27 20:55:58 +00:00
committed by Jay Sharma
parent 779393381f
commit 22f10a9edd
2154 changed files with 22313 additions and 209875 deletions

View File

@@ -46,6 +46,13 @@ class Indexable_Home_Page_Builder {
*/
protected $post_helper;
/**
* The WPDB instance.
*
* @var wpdb
*/
protected $wpdb;
/**
* Indexable_Home_Page_Builder constructor.
*
@@ -53,17 +60,20 @@ class Indexable_Home_Page_Builder {
* @param Url_Helper $url_helper The url helper.
* @param Indexable_Builder_Versions $versions Knows the latest version of each Indexable type.
* @param Post_Helper $post_helper The post helper.
* @param wpdb $wpdb The WPDB instance.
*/
public function __construct(
Options_Helper $options,
Url_Helper $url_helper,
Indexable_Builder_Versions $versions,
Post_Helper $post_helper
Post_Helper $post_helper,
wpdb $wpdb
) {
$this->options = $options;
$this->url_helper = $url_helper;
$this->version = $versions->get_latest_version_for_type( 'home-page' );
$this->post_helper = $post_helper;
$this->wpdb = $wpdb;
}
/**
@@ -117,33 +127,17 @@ class Indexable_Home_Page_Builder {
* @return object An object with last_modified and published_at timestamps.
*/
protected function get_object_timestamps() {
global $wpdb;
$post_statuses = $this->post_helper->get_public_post_statuses();
$replacements = [];
$replacements[] = 'post_modified_gmt';
$replacements[] = 'post_date_gmt';
$replacements[] = $wpdb->posts;
$replacements[] = 'post_status';
$replacements = \array_merge( $replacements, $post_statuses );
$replacements[] = 'post_password';
$replacements[] = 'post_type';
$sql = "
SELECT MAX(p.post_modified_gmt) AS last_modified, MIN(p.post_date_gmt) AS published_at
FROM {$this->wpdb->posts} AS p
WHERE p.post_status IN (" . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ")
AND p.post_password = ''
AND p.post_type = 'post'
";
//phpcs:disable WordPress.DB.PreparedSQLPlaceholders -- %i placeholder is still not recognized.
//phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way.
//phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches.
return $wpdb->get_row(
$wpdb->prepare(
'
SELECT MAX(p.%i) AS last_modified, MIN(p.%i) AS published_at
FROM %i AS p
WHERE p.%i IN (' . \implode( ', ', \array_fill( 0, \count( $post_statuses ), '%s' ) ) . ")
AND p.%i = ''
AND p.%i = 'post'
",
$replacements
)
);
//phpcs:enable
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- We are using wpdb prepare.
return $this->wpdb->get_row( $this->wpdb->prepare( $sql, $post_statuses ) );
}
}