v1.8.1
This commit is contained in:
parent
7b7fff5246
commit
b6a55a7f04
27 changed files with 2221 additions and 45 deletions
5
includes/External/AbstractProvider.php
vendored
5
includes/External/AbstractProvider.php
vendored
|
|
@ -11,6 +11,8 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
exit;
|
||||
}
|
||||
|
||||
use MediaRightsAudit\Admin\Settings;
|
||||
|
||||
/**
|
||||
* Provides rate-limited scanning via a transient-based per-minute counter.
|
||||
*
|
||||
|
|
@ -41,8 +43,7 @@ abstract class AbstractProvider {
|
|||
* @return positive-int
|
||||
*/
|
||||
public function rate_limit(): int {
|
||||
$raw = get_option( 'robotstxt_mediaaudit_settings', array() );
|
||||
$opts = is_array( $raw ) ? $raw : array();
|
||||
$opts = Settings::get_effective_settings();
|
||||
$val = $opts['rate_limit_per_minute'] ?? null;
|
||||
return is_numeric( $val ) ? max( 1, (int) $val ) : 10;
|
||||
}
|
||||
|
|
|
|||
8
includes/External/ExternalScanner.php
vendored
8
includes/External/ExternalScanner.php
vendored
|
|
@ -11,6 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
exit;
|
||||
}
|
||||
|
||||
use MediaRightsAudit\Admin\Settings;
|
||||
use MediaRightsAudit\Core\Queue\Scheduler;
|
||||
|
||||
/**
|
||||
|
|
@ -142,8 +143,7 @@ class ExternalScanner {
|
|||
* @return void
|
||||
*/
|
||||
public static function process_scheduled_batch(): void {
|
||||
$raw = get_option( 'robotstxt_mediaaudit_settings', array() );
|
||||
$opts = is_array( $raw ) ? $raw : array();
|
||||
$opts = Settings::get_effective_settings();
|
||||
$bs_val = $opts['external_batch_size'] ?? null;
|
||||
$batch_size = is_numeric( $bs_val ) ? max( 1, (int) $bs_val ) : 10;
|
||||
|
||||
|
|
@ -151,6 +151,10 @@ class ExternalScanner {
|
|||
|
||||
delete_transient( 'mra_alert_count' );
|
||||
|
||||
if ( is_multisite() && 'central' === get_site_option( 'robotstxt_mediaaudit_network_mode', 'per_site' ) ) {
|
||||
\MediaRightsAudit\Core\NetworkDatabase::sync_site( get_current_blog_id() );
|
||||
}
|
||||
|
||||
if ( self::get_pending_count() > 0 ) {
|
||||
Scheduler::schedule_single( self::AS_HOOK );
|
||||
}
|
||||
|
|
|
|||
6
includes/External/GoogleVisionProvider.php
vendored
6
includes/External/GoogleVisionProvider.php
vendored
|
|
@ -126,9 +126,9 @@ class GoogleVisionProvider extends AbstractProvider {
|
|||
* @return string Empty string if not configured.
|
||||
*/
|
||||
private function get_api_key(): string {
|
||||
$raw = get_option( Settings::OPTION_NAME, array() );
|
||||
$opts = is_array( $raw ) ? $raw : array();
|
||||
$val = $opts['google_vision_api_key'] ?? null;
|
||||
$opts = Settings::get_effective_settings();
|
||||
|
||||
$val = $opts['google_vision_api_key'] ?? null;
|
||||
return is_string( $val ) ? trim( $val ) : '';
|
||||
}
|
||||
|
||||
|
|
|
|||
4
includes/External/PicDefenseProvider.php
vendored
4
includes/External/PicDefenseProvider.php
vendored
|
|
@ -112,8 +112,8 @@ class PicDefenseProvider extends AbstractProvider {
|
|||
* @return array{string, string} [user_id, api_key] — empty strings if not configured.
|
||||
*/
|
||||
private function get_credentials(): array {
|
||||
$raw = get_option( Settings::OPTION_NAME, array() );
|
||||
$opts = is_array( $raw ) ? $raw : array();
|
||||
$opts = Settings::get_effective_settings();
|
||||
|
||||
$uid_val = $opts['picdefense_user_id'] ?? null;
|
||||
$key_val = $opts['picdefense_api_key'] ?? null;
|
||||
$user_id = is_string( $uid_val ) ? trim( $uid_val ) : '';
|
||||
|
|
|
|||
6
includes/External/TinEyeProvider.php
vendored
6
includes/External/TinEyeProvider.php
vendored
|
|
@ -104,9 +104,9 @@ class TinEyeProvider extends AbstractProvider {
|
|||
* @return string Empty string if not configured.
|
||||
*/
|
||||
private function get_api_key(): string {
|
||||
$raw = get_option( Settings::OPTION_NAME, array() );
|
||||
$opts = is_array( $raw ) ? $raw : array();
|
||||
$val = $opts['tineye_api_key'] ?? null;
|
||||
$opts = Settings::get_effective_settings();
|
||||
|
||||
$val = $opts['tineye_api_key'] ?? null;
|
||||
return is_string( $val ) ? trim( $val ) : '';
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue