This commit is contained in:
Javier Casares 2026-08-18 10:48:13 +00:00
commit 5589c54b9b
13 changed files with 138 additions and 58 deletions

View file

@ -79,8 +79,8 @@ class Robotstxt_Manager_Core_Client {
* @return self
*/
public static function from_options(): self {
$store_url_raw = get_option( 'robotstxt_manager_store_url', '' );
$api_key_raw = get_option( 'robotstxt_manager_api_key', '' );
$store_url_raw = get_site_option( 'robotstxt_manager_store_url', '' );
$api_key_raw = get_site_option( 'robotstxt_manager_api_key', '' );
$store_url = is_string( $store_url_raw ) ? $store_url_raw : '';
$api_key = is_string( $api_key_raw )
@ -197,7 +197,7 @@ class Robotstxt_Manager_Core_Client {
}
$cache_key = 'robotstxt_manager_catalog';
$cached = get_transient( $cache_key );
$cached = get_site_transient( $cache_key );
if ( is_array( $cached ) ) {
$typed = array();
@ -248,7 +248,7 @@ class Robotstxt_Manager_Core_Client {
}
$ttl = $this->get_catalog_ttl();
set_transient( $cache_key, $catalog, $ttl );
set_site_transient( $cache_key, $catalog, $ttl );
return $catalog;
}
@ -260,7 +260,7 @@ class Robotstxt_Manager_Core_Client {
* @return void
*/
public function clear_catalog_cache(): void {
delete_transient( 'robotstxt_manager_catalog' );
delete_site_transient( 'robotstxt_manager_catalog' );
}
/**
@ -269,7 +269,7 @@ class Robotstxt_Manager_Core_Client {
* @return int
*/
private function get_catalog_ttl(): int {
$raw = get_option( 'robotstxt_manager_cache_ttl_minutes', 60 );
$raw = get_site_option( 'robotstxt_manager_cache_ttl_minutes', 60 );
$min = is_numeric( $raw ) ? (int) $raw : 60;
if ( $min < 1 ) {
@ -316,7 +316,7 @@ class Robotstxt_Manager_Core_Client {
}
$cache_key = 'robotstxt_manager_subscriptions';
$cached = get_transient( $cache_key );
$cached = get_site_transient( $cache_key );
if ( is_array( $cached ) ) {
$typed = array();
@ -363,7 +363,7 @@ class Robotstxt_Manager_Core_Client {
);
}
set_transient( $cache_key, $rows, HOUR_IN_SECONDS );
set_site_transient( $cache_key, $rows, HOUR_IN_SECONDS );
return $rows;
}
@ -413,6 +413,6 @@ class Robotstxt_Manager_Core_Client {
* @return void
*/
public function clear_subscriptions_cache(): void {
delete_transient( 'robotstxt_manager_subscriptions' );
delete_site_transient( 'robotstxt_manager_subscriptions' );
}
}