Plugin Directory

Changeset 3181810


Ignore:
Timestamp:
11/04/2024 09:49:32 PM (17 months ago)
Author:
EdwardBock
Message:

cleanup

Location:
cron-logger/trunk
Files:
3 added
7 edited

Legend:

Unmodified
Added
Removed
  • cron-logger/trunk/README.txt

    r3067274 r3181810  
    44Tags: tool, log, debug, cron, wp-cron
    55Requires at least: 5.3
    6 Tested up to: 6.5.0
    7 Stable tag: 1.2.2
    8 Requires PHP: 8.0
     6Tested up to: 6.6.2
     7Stable tag: 1.3.0
     8Requires PHP: 8.1
    99License: GPLv3
    1010License URI: http://www.gnu.org/licenses/gpl
     
    2929
    3030== Changelog ==
     31
     32= 1.3.0
     33* Feature: Database cleanup cron and cleanup button
     34* Feature: Automatically purge logs after 30 day. Can be modified via filter.
    3135
    3236= 1.2.2
  • cron-logger/trunk/classes/Components/Component.php

    r3067274 r3181810  
    33
    44namespace CronLogger\Components;
     5abstract class Component {
    56
    6 /**
    7  * Class Component
    8  *
    9  * @package Palasthotel\WordPress
    10  * @version 0.1.3
    11  */
    12 abstract class Component {
    13     protected Plugin $plugin;
    147
    15     /**
    16      * _Component constructor.
    17      */
    18     public function __construct(Plugin $plugin) {
    19         $this->plugin = $plugin;
     8    public function __construct(
     9        public \CronLogger\Plugin $plugin
     10    ) {
    2011        $this->onCreate();
    21     }
    22 
    23     public function getPlugin(): Plugin {
    24         return $this->plugin;
    2512    }
    2613
     
    2815     * overwrite this method in component implementations
    2916     */
    30     public function onCreate(){
     17    public function onCreate(): void {
    3118        // init your hooks and stuff
    3219    }
  • cron-logger/trunk/classes/Log.php

    r3067274 r3181810  
    1111    public string $table;
    1212
    13     public function init() {
     13    public function init(): void {
    1414        $this->table = $this->wpdb->prefix . Plugin::TABLE_LOGS;
    1515    }
     
    121121    function clean(): void {
    122122        $table     = $this->table;
    123         $days      = apply_filters( Plugin::FILTER_EXPIRE, 14 );
     123        $days      = apply_filters( Plugin::FILTER_EXPIRE, 30 );
    124124        $parentIds = "SELECT id FROM (" .
    125125                     "SELECT id FROM " . $this->table . " WHERE " .
  • cron-logger/trunk/classes/Page.php

    r3067274 r3181810  
    2020    const ARG_DURATION_MIN = "cron-logs-dm";
    2121
    22     public function onCreate() {
     22    public function onCreate(): void {
    2323        add_action( 'admin_menu', array( $this, 'menu_pages' ) );
    2424    }
    2525
    26     public function menu_pages() {
     26    public function menu_pages(): void {
    2727        add_submenu_page(
    2828            'tools.php',
     
    9999            </form>
    100100
    101             <?php submit_button( __( 'Toggle open/close log details', Plugin::DOMAIN ), 'small', "toggle_logs" ); ?>
     101            <div style="display: flex; gap: 25px;">
     102                <?php submit_button( __( 'Toggle open/close log details', Plugin::DOMAIN ), 'small', "toggle_logs" ); ?>
     103                <p class="submit"><button class="button button-small button-link-delete" id="cron-logger-cleanup">Cleanup</button></p>
     104            </div>
    102105
    103106            <table class="widefat striped">
     
    164167                });
    165168            });
     169            const cleanupButton = document.getElementById("cron-logger-cleanup");
     170            cleanupButton.addEventListener("click", function(e){
     171                e.preventDefault();
     172                cleanupButton.removeEventListener("click", this);
     173                cleanupButton.innerHTML = "<span class='spinner is-active'></span>";
     174                fetch("/wp-admin/admin-ajax.php?action=cron_logger_cleanup")
     175                    .then(() => {
     176                        window.location.reload();
     177                    });
     178            })
    166179        </script>
    167180        <?php
  • cron-logger/trunk/plugin.php

    r3067274 r3181810  
    33 * Plugin Name: Cron Logger
    44 * Description: Logs for wp-cron.php runs.
    5  * Version: 1.2.2
     5 * Version: 1.3.0
    66 * Requires at least: 5.3
    7  * Tested up to: 6.5.0
     7 * Tested up to: 6.6.2
    88 * Author: Palasthotel <rezeption@palasthotel.de> (Edward Bock)
    99 * Author URI: https://palasthotel.de
    1010 * Domain Path: /languages
    1111 * Text Domain: cron-logger
    12  * Requires PHP: 8.0
     12 * Requires PHP: 8.1
    1313 * @copyright Palasthotel
    1414 * @package Palasthotel\CronLogger
     
    3838    const OPTION_VERSION = "_cron_logger_version";
    3939
     40    const SCHEDULE = "cron_logger";
     41
    4042    public Timer $timer;
    4143    public Log $log;
     
    5254
    5355        $this->timer    = new Timer();
    54         $this->log      = new Log( $this );
     56        $this->log      = new Log();
    5557        new Updates( $this );
    5658        new Services( $this );
    5759        new Page( $this );
     60        new Schedule($this);
     61        new Ajax($this);
    5862    }
    5963
  • cron-logger/trunk/vendor/composer/autoload_real.php

    r2936889 r3181810  
    2323        }
    2424
     25        require __DIR__ . '/platform_check.php';
     26
    2527        spl_autoload_register(array('ComposerAutoloaderInit23ee4c2407e30847b3ca4c7f48c696a9', 'loadClassLoader'), true, true);
    2628        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
  • cron-logger/trunk/vendor/composer/installed.php

    r3067274 r3181810  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => 'fec4f5c6b21d3612292a1791bcf9061c8d56085a',
     6        'reference' => 'd2eac360b2fd360dbef067cd52f256f0d3b97d45',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => 'fec4f5c6b21d3612292a1791bcf9061c8d56085a',
     16            'reference' => 'd2eac360b2fd360dbef067cd52f256f0d3b97d45',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.