| Server IP : 121.121.20.254 / Your IP : 216.73.216.202 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/KnowledgeBase/wp-content/plugins/aioseo-link-assistant/app/Traits/ |
Upload File : |
<?php
namespace AIOSEO\Plugin\Addon\LinkAssistant\Traits;
use AIOSEO\Plugin\Addon\LinkAssistant\Models;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Contains helper methods for the Debug panel.
*
* @since 1.0.0
*/
trait Debug {
/**
* Executes a given administrative task.
*
* @since 1.0.8
*
* @param string $action The action name.
* @return bool Whether an action was found and executed.
*/
public function doTask( $action ) {
$actionFound = true;
switch ( $action ) {
case 'link-assistant-clear-data':
$this->resetData();
break;
case 'link-assistant-clear-links':
$this->resetLinks();
break;
case 'link-assistant-clear-suggestions':
$this->resetSuggestions();
break;
case 'link-assistant-undismiss-suggestions':
$this->undismissSuggestions();
break;
default:
$actionFound = false;
break;
}
return $actionFound;
}
/**
* Resets all Link Assistant data, except for the settings.
*
* @since 1.0.0
*
* @return void
*/
private function resetData() {
$this->resetLinks();
$this->resetSuggestions();
}
/**
* Resets all link data and forces the site to be rescanned.
*
* @since 1.0.8
*
* @return void
*/
private function resetLinks() {
aioseo()->core->db->update( 'aioseo_posts' )
->set( [ 'link_scan_date' => null ] )
->run();
aioseo()->core->db->truncate( 'aioseo_links ' )->run();
}
/**
* Resets all suggestion data and forces the site to be rescanned.
*
* @since 1.0.8
*
* @return void
*/
private function resetSuggestions() {
aioseo()->core->db->update( 'aioseo_posts' )
->set( [ 'link_suggestions_scan_date' => null ] )
->run();
aioseo()->core->db->truncate( 'aioseo_links_suggestions' )->run();
}
/**
* Undismisses all suggestions.
*
* @since 1.0.0
*
* @return void
*/
private function undismissSuggestions() {
aioseo()->core->db->update( 'aioseo_links_suggestions' )
->set( [ 'dismissed' => 0 ] )
->run();
}
}