Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible Wrong Version Display and LOG disabling solution #122

Open
danidorado opened this issue Apr 24, 2023 · 2 comments
Open

Possible Wrong Version Display and LOG disabling solution #122

danidorado opened this issue Apr 24, 2023 · 2 comments

Comments

@danidorado
Copy link

danidorado commented Apr 24, 2023

Hi Guys, have you realised when you download the lastest version 2.0.2, the plugin.php file says version 2.0.0?

Is this just a typo on plugin.php file or are we downloading a wrong version?

In addition i'd like to ask if there's a way to disable the logs, it creates millions of rows at my set up and it has the databse constantly writting records, as i have several multisite installations with more than 200 sites.

Thanks in advance

@rmccue
Copy link
Member

rmccue commented Apr 24, 2023

Is this just a typo on plugin.php file or are we downloading a wrong version?

Looks like we haven't updated it:

* Version: 2.0.0

In addition i'd like to ask if there's a way to disable the logs, it creates millions of rows at my set up and it has the databse constantly writting records, as i have several multisite installations with more than 200 sites.

There's no option for it, but you could use the filter to change the logger implementation to a no-op log class:

https://github.com/humanmade/Cavalcade-Runner/blob/0dfb42d505e9cd870a11366c49ee680d327c961a/inc/class-runner.php#L366-L375

Alternatively, you can run a task to clean old logs.

@danidorado
Copy link
Author

danidorado commented Apr 24, 2023

so do you mean the code itself is updated to 2.0.2 but just the version reference is not updated on that particular line?

Just in case someone needs to implement the class to remove the log creation i've created this MU-plugin

/**

  • Plugin Name: Cavalcade Custom Logger
  • Description: Replaces the default logger with a no-op logger for all sites in a multisite installation.
  • Version: 1.0
  • Author: Dani Dorado
    */

class NoOpLogger {
public function __construct() {
// No-op constructor.
}

public function log( $message, $level = 'info', $context = array() ) {
	// No-op log method.
}

}

function my_custom_logger( $logger ) {
if ( is_multisite() ) {
// Si estamos en una instalación multisite, usa la clase NoOpLogger.
return new NoOpLogger();
}

// Si no, usa la implementación predeterminada del logger.
return $logger;

}

add_filter( 'Runner.check_workers.logger', 'my_custom_logger' );

@danidorado danidorado changed the title Wrong Version Possible Wrong Version Display and LOG disabling solution Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants