PATH:
var
/
www
/
clients
/
client1
/
web1
/
web
/
wp-content
/
plugins
/
wordpress-seo
/
src
/
helpers
<?php namespace Yoast\WP\SEO\Helpers; use Yoast\WP\Lib\Model; /** * A helper object for the cleanup of attachments. */ class Attachment_Cleanup_Helper { /** * Removes all indexables for attachments. * * @param bool $suppress_errors Whether to suppress db errors when running the cleanup query. * * @return void */ public function remove_attachment_indexables( $suppress_errors ) { global $wpdb; if ( $suppress_errors ) { // If migrations haven't been completed successfully the following may give false errors. So suppress them. $show_errors = $wpdb->show_errors; $wpdb->show_errors = false; } $indexable_table = Model::get_table_name( 'Indexable' ); $delete_query = "DELETE FROM $indexable_table WHERE object_type = 'post' AND object_sub_type = 'attachment'"; // phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared -- Reason: Is it prepared already. $wpdb->query( $delete_query ); // phpcs:enable if ( $suppress_errors ) { $wpdb->show_errors = $show_errors; } } /** * Cleans all attachment links in the links table from target indexable ids. * * @param bool $suppress_errors Whether to suppress db errors when running the cleanup query. * * @return void */ public function clean_attachment_links_from_target_indexable_ids( $suppress_errors ) { global $wpdb; if ( $suppress_errors ) { // If migrations haven't been completed successfully the following may give false errors. So suppress them. $show_errors = $wpdb->show_errors; $wpdb->show_errors = false; } $links_table = Model::get_table_name( 'SEO_Links' ); $query = "UPDATE $links_table SET target_indexable_id = NULL WHERE type = 'image-in'"; // phpcs:disable WordPress.DB.DirectDatabaseQuery.NoCaching -- Reason: No relevant caches. // phpcs:disable WordPress.DB.DirectDatabaseQuery.DirectQuery -- Reason: Most performant way. // phpcs:disable WordPress.DB.PreparedSQL.NotPrepared -- Reason: Is it prepared already. $wpdb->query( $query ); // phpcs:enable if ( $suppress_errors ) { $wpdb->show_errors = $show_errors; } } }
[+]
twitter
[-] url-helper.php
[edit]
[-] score-icon-helper.php
[edit]
[-] date-helper.php
[edit]
[-] robots-helper.php
[edit]
[-] wordpress-helper.php
[edit]
[-] home-url-helper.php
[edit]
[-] aioseo-helper.php
[edit]
[-] indexable-helper.php
[edit]
[-] site-helper.php
[edit]
[-] pagination-helper.php
[edit]
[-] product-helper.php
[edit]
[-] language-helper.php
[edit]
[-] string-helper.php
[edit]
[-] attachment-cleanup-helper.php
[edit]
[-] post-type-helper.php
[edit]
[-] require-file-helper.php
[edit]
[-] indexing-helper.php
[edit]
[-] import-cursor-helper.php
[edit]
[-] asset-helper.php
[edit]
[-] capability-helper.php
[edit]
[-] social-profiles-helper.php
[edit]
[-] post-helper.php
[edit]
[-] author-archive-helper.php
[edit]
[-] robots-txt-helper.php
[edit]
[-] indexable-to-postmeta-helper.php
[edit]
[-] import-helper.php
[edit]
[-] permalink-helper.php
[edit]
[-] meta-helper.php
[edit]
[-] wincher-helper.php
[edit]
[-] options-helper.php
[edit]
[+]
open-graph
[-] curl-helper.php
[edit]
[-] environment-helper.php
[edit]
[-] crawl-cleanup-helper.php
[edit]
[-] image-helper.php
[edit]
[-] taxonomy-helper.php
[edit]
[-] redirect-helper.php
[edit]
[+]
schema
[+]
..
[-] route-helper.php
[edit]
[-] wpdb-helper.php
[edit]
[-] blocks-helper.php
[edit]
[-] notification-helper.php
[edit]
[-] primary-term-helper.php
[edit]
[-] user-helper.php
[edit]
[-] first-time-configuration-notice-helper.php
[edit]
[-] current-page-helper.php
[edit]
[-] short-link-helper.php
[edit]
[-] sanitization-helper.php
[edit]
[-] woocommerce-helper.php
[edit]