GRAYBYTE WORDPRESS FILE MANAGER1056

Server IP : 198.54.121.189 / Your IP : 216.73.216.112
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /home/giriqfky/nioscentre.in/wp-content/plugins/woocommerce/src/Internal/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/giriqfky/nioscentre.in/wp-content/plugins/woocommerce/src/Internal//AssignDefaultCategory.php
<?php
/**
 * AssignDefaultCategory class file.
 */

namespace Automattic\WooCommerce\Internal;

defined( 'ABSPATH' ) || exit;

/**
 * Class to assign default category to products.
 */
class AssignDefaultCategory {
	/**
	 * Class initialization, to be executed when the class is resolved by the container.
	 *
	 * @internal
	 */
	final public function init() {
		add_action( 'wc_schedule_update_product_default_cat', array( $this, 'maybe_assign_default_product_cat' ) );
	}

	/**
	 * When a product category is deleted, we need to check
	 * if the product has no categories assigned. Then assign
	 * it a default category. We delay this with a scheduled
	 * action job to not block the response.
	 *
	 * @return void
	 */
	public function schedule_action() {
		WC()->queue()->schedule_single(
			time(),
			'wc_schedule_update_product_default_cat',
			array(),
			'wc_update_product_default_cat'
		);
	}

	/**
	 * Assigns default product category for products
	 * that have no categories.
	 *
	 * @return void
	 */
	public function maybe_assign_default_product_cat() {
		global $wpdb;

		$default_category = get_option( 'default_product_cat', 0 );

		if ( $default_category ) {
			$affected_rows = $wpdb->query(
				$wpdb->prepare(
					"INSERT INTO {$wpdb->term_relationships} (object_id, term_taxonomy_id)
					SELECT DISTINCT posts.ID, %s FROM {$wpdb->posts} posts
					LEFT JOIN
						(
							SELECT object_id FROM {$wpdb->term_relationships} term_relationships
							LEFT JOIN {$wpdb->term_taxonomy} term_taxonomy ON term_relationships.term_taxonomy_id = term_taxonomy.term_taxonomy_id
							WHERE term_taxonomy.taxonomy = 'product_cat'
						) AS tax_query
					ON posts.ID = tax_query.object_id
					WHERE posts.post_type = 'product'
					AND tax_query.object_id IS NULL",
					$default_category
				)
			);
			if ( $affected_rows > 0 ) {
				wp_cache_flush();
				delete_transient( 'wc_term_counts' );
				wp_update_term_count_now( array( $default_category ), 'product_cat' );
			}
		}
	}
}

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
AddressProvider
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
Admin
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
BatchProcessing
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
ComingSoon
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
CostOfGoodsSold
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
DataStores
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
DependencyManagement
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
Email
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
EmailEditor
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
Features
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
Font
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
Integrations
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
Logging
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
Orders
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
ProductAttributesLookup
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
ProductDownloads
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
ProductFilters
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
ProductImage
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
ReceiptRendering
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
Settings
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
Traits
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
TransientFiles
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
Utilities
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
WCCom
--
June 24 2025 08:34:22
giriqfky / giriqfky
0755
AssignDefaultCategory.php
1.954 KB
August 27 2024 23:04:44
giriqfky / giriqfky
0644
Brands.php
1.484 KB
May 12 2025 21:07:28
giriqfky / giriqfky
0644
DownloadPermissionsAdjuster.php
6.521 KB
April 19 2023 03:03:20
giriqfky / giriqfky
0644
McStats.php
2.099 KB
September 23 2024 20:44:04
giriqfky / giriqfky
0644
OrderCouponDataMigrator.php
8.328 KB
December 18 2024 22:19:16
giriqfky / giriqfky
0644
RegisterHooksInterface.php
0.492 KB
November 28 2024 03:41:18
giriqfky / giriqfky
0644
RestApiControllerBase.php
8.315 KB
December 18 2024 22:19:16
giriqfky / giriqfky
0644
RestApiParameterUtil.php
5.717 KB
May 28 2024 14:28:20
giriqfky / giriqfky
0644
RestockRefundedItemsAdjuster.php
2.079 KB
June 22 2021 15:24:06
giriqfky / giriqfky
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF