Plugin Directory

Changeset 3067274


Ignore:
Timestamp:
04/09/2024 04:43:42 AM (2 years ago)
Author:
EdwardBock
Message:

release 1.2.2

Location:
cron-logger
Files:
4 added
2 deleted
19 edited
17 copied

Legend:

Unmodified
Added
Removed
  • cron-logger/tags/1.2.2/README.txt

    r2936889 r3067274  
    44Tags: tool, log, debug, cron, wp-cron
    55Requires at least: 5.3
    6 Tested up to: 6.2.2
    7 Stable tag: 1.2.1
     6Tested up to: 6.5.0
     7Stable tag: 1.2.2
     8Requires PHP: 8.0
    89License: GPLv3
    910License URI: http://www.gnu.org/licenses/gpl
     
    2829
    2930== Changelog ==
     31
     32= 1.2.2
     33 * Fix: PHP 8.2 warnings
    3034
    3135= 1.2.1
  • cron-logger/tags/1.2.2/classes/Components/Plugin.php

    r2587145 r3067274  
    11<?php
     2
    23namespace CronLogger\Components;
    34
     
    67
    78/**
    8  * @property string path
    9  * @property string url
    10  * @property string basename
    11  * @version 0.1.3
     9 * @version 0.1.4
    1210 */
    1311abstract class Plugin {
    1412
    15     /**
    16      * @var ReflectionClass
    17      */
    18     private $ref;
     13    private ReflectionClass $ref;
    1914
    20     private $tooLateForTextdomain;
     15    private bool $tooLateForTextdomain;
     16    public string $path;
     17    public string $url;
     18    public string $basename;
    2119
    2220    /**
     
    3634        register_deactivation_hook( $this->ref->getFileName(), array( $this, "onDeactivation" ) );
    3735
     36    }
     37
     38    public function getPath(string $inPluginPath): string {
     39        return trailingslashit($this->path) . ltrim($inPluginPath,"/");
     40    }
     41
     42    public function getUrl(string $inPluginUrl): string {
     43        return trailingslashit($this->url) . ltrim($inPluginUrl, "/");
    3844    }
    3945
  • cron-logger/tags/1.2.2/classes/Log.php

    r2936889 r3067274  
    33namespace CronLogger;
    44
    5 use wpdb;
     5use CronLogger\Components\Database;
    66
    7 /**
    8  * @property wpdb $wpdb
    9  * @property string $table
    10  */
    11 class Log {
     7class Log  extends Database {
    128
    13     private $plugin;
    149    private $log_id = null;
    15     private $errors = array();
     10    public $errors = array();
     11    public string $table;
    1612
    17     public function __construct( Plugin $plugin ) {
    18         $this->plugin = $plugin;
    19         global $wpdb;
    20         $this->wpdb = $wpdb;
     13    public function init() {
    2114        $this->table = $this->wpdb->prefix . Plugin::TABLE_LOGS;
    2215    }
    2316
    24     function start( $info = "" ) {
     17    function start( $info = "" ): void {
    2518        if ( $this->log_id != null ) {
    2619            error_log( "Only start logger once per session.", 4 );
     
    3124            $this->table,
    3225            array(
    33                 'executed' => $this->plugin->timer->getStart(),
     26                'executed' => Plugin::instance()->timer->getStart(),
    3427                'duration' => 0,
    3528                'info'     => "Running ⏳ $info",
     
    4437    }
    4538
    46     function update( $duration, $info = null ) {
     39    function update( $duration, $info = null ): int {
    4740
    4841        if ( $this->log_id == null ) {
     
    6962    }
    7063
    71     function addInfo( $message, $duration = null ) {
     64    function addInfo( $message, $duration = null ): void {
    7265        $result = $this->wpdb->insert(
    7366            $this->table,
     
    9285        } else {
    9386            $this->update(
    94                 $this->plugin->timer->getDuration()
     87                Plugin::instance()->timer->getDuration()
    9588            );
    9689        }
     
    9891    }
    9992
    100     function getList( $args = array() ) {
     93    function getList( $args = array() ): array {
    10194        $args = (object) array_merge(
    10295            array(
     
    118111    }
    119112
    120     function getSublist( $log_id, $count = 50, $page = 0 ) {
     113    function getSublist( $log_id, $count = 50, $page = 0 ): array {
    121114        $offset = $count * $page;
    122115
     
    126119    }
    127120
    128     function clean() {
     121    function clean(): void {
    129122        $table     = $this->table;
    130123        $days      = apply_filters( Plugin::FILTER_EXPIRE, 14 );
     
    139132    }
    140133
    141     function createTable() {
    142         require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     134    function createTables() {
     135        parent::createTables();
    143136        dbDelta( "CREATE TABLE IF NOT EXISTS " . $this->table . "
    144137        (
  • cron-logger/tags/1.2.2/classes/Page.php

    r2587145 r3067274  
    1010
    1111
    12 class Page {
     12use CronLogger\Components\Component;
     13
     14class Page extends Component {
    1315
    1416    const ARG_ITEMS = "cron-logs-items";
     
    1820    const ARG_DURATION_MIN = "cron-logs-dm";
    1921
    20     public function __construct( Plugin $plugin ) {
    21         $this->plugin = $plugin;
     22    public function onCreate() {
    2223        add_action( 'admin_menu', array( $this, 'menu_pages' ) );
    2324    }
     
    126127                            echo $time->format( "Y-m-d H:i:s" );
    127128                            ?></td>
    128                         <td style="border-top: 3px solid #333;"><?php echo getDurationString( $log->duration ); ?></td>
     129                        <td style="border-top: 3px solid #333;"><?php echo $this->getDurationString( $log->duration ); ?></td>
    129130                        <td style="border-top: 3px solid #333;"><?php echo $log->info; ?></td>
    130131                    </tr>
     
    135136                        <tr data-parent-id="<?php echo $log->id; ?>">
    136137                            <td></td>
    137                             <td><?php echo getDurationString( $sub->duration ); ?></td>
     138                            <td><?php echo $this->getDurationString( $sub->duration ); ?></td>
    138139                            <td><?php echo $sub->info; ?></td>
    139140                        </tr>
     
    147148        <script>
    148149            jQuery(function ($) {
    149                 var $logs = $('[data-log-id]');
     150                const $logs = $('[data-log-id]');
    150151                $logs.on('click', function () {
    151                     var id = $(this).attr('data-log-id');
     152                    const id = $(this).attr('data-log-id');
    152153                    console.log('clicked', id);
    153154                    $('[data-parent-id=' + id + ']').toggle();
    154155                });
    155                 var isVisible = true;
     156                let isVisible = true;
    156157                $('[name=toggle_logs]').on('click', function () {
    157158                    if (isVisible) {
     
    168169    }
    169170
     171    private function getDurationString($duration ): string {
     172        if ( $duration == null ) {
     173            return "";
     174        }
     175
     176        return $duration . "s";
     177    }
     178
    170179}
    171180
    172 function getDurationString( $duration ) {
    173     if ( $duration == null ) {
    174         return "";
    175     }
    176 
    177     return $duration . "s";
    178 }
  • cron-logger/tags/1.2.2/classes/Services.php

    r2587145 r3067274  
    77use CronLogger\Services\WPCron;
    88
    9 /**
    10  * @property WPCron wp_cron
    11  * @property SolrPlugin solr
    12  */
     9
    1310class Services {
    14     public function __construct( Plugin $plugin ) {
    1511
    16         $this->wp_cron = new WPCron( $plugin );
    17         $this->solr = new SolrPlugin( $plugin );
     12    public function __construct(Plugin $plugin ) {
     13
     14        new WPCron( $plugin );
     15        new SolrPlugin( $plugin );
    1816
    1917        add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
     
    2119    }
    2220
    23     function plugins_loaded() {
     21    function plugins_loaded(): void {
    2422        do_action( Plugin::ACTION_INIT, Plugin::instance() );
    2523    }
  • cron-logger/tags/1.2.2/classes/Services/SolrPlugin.php

    r2587145 r3067274  
    44
    55
    6 use CronLogger\Plugin;
     6use CronLogger\Components\Component;
    77
    8 class SolrPlugin {
    9     public function __construct( Plugin $plugin ) {
    10         $this->plugin = $plugin;
     8class SolrPlugin extends Component {
     9
     10    public function onCreate(): void {
    1111        add_action( "solr_cron_start", array( $this, "onStart" ) );
    1212        add_action( "solr_cron_finish", array( $this, "onFinish" ) );
    1313    }
    1414
    15     function onStart() {
     15    function onStart(): void {
    1616        $this->plugin->log->start( 'Solr cron.php' );
    1717        $this->plugin->log->addInfo( "Solr cron.php starts" );
    1818    }
    1919
    20     function onFinish() {
     20    function onFinish(): void {
    2121        $this->plugin->log->update( $this->plugin->timer->getDuration(), "Solr finished 🔎 🎉" );
    2222    }
  • cron-logger/tags/1.2.2/classes/Services/WPCron.php

    r2587145 r3067274  
    44
    55
     6use CronLogger\Components\Component;
    67use CronLogger\Plugin;
     8use WP_Post;
    79
    8 class WPCron {
     10class WPCron extends Component {
    911
    10     var $times = array();
     12    private array $times = array();
    1113
    12     public function __construct( Plugin $plugin ) {
    13 
    14         $this->log   = $plugin->log;
    15         $this->timer = $plugin->timer;
     14    public function onCreate(): void {
    1615
    1716        if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
     
    2524    }
    2625
    27     function start() {
     26    function start(): void {
    2827        do_action( Plugin::ACTION_WP_CRON_START );
    29         $this->log->start( "wp-cron.php" );
     28        $this->plugin->log->start( "wp-cron.php" );
    3029        $this->addCronActions();
    3130    }
    3231
    33     function shutdown() {
    34         $this->log->update( $this->timer->getDuration(), 'Done wp-cron.php 🎉 ' );
     32    function shutdown(): void {
     33        $this->plugin->log->update( $this->plugin->timer->getDuration(), 'Done wp-cron.php 🎉 ' );
    3534        do_action( Plugin::ACTION_WP_CRON_FINISH );
    36         $this->log->clean();
     35        $this->plugin->log->clean();
    3736    }
    3837
    39     function addCronActions() {
     38    function addCronActions(): void {
    4039        $crons      = _get_cron_array();
    4140        $registered = array();
     
    5352            $msg = sprintf( __( "Registered hooks: %s", Plugin::DOMAIN ), implode( ', ', $registered ) );
    5453        }
    55         $this->log->addInfo( $msg );
     54        $this->plugin->log->addInfo( $msg );
    5655    }
    5756
    58     function before_execute_cron_hook() {
     57    function before_execute_cron_hook(): void {
    5958        $this->times[ current_filter() ] = time();
    60         $this->log->addInfo( "Starts " . current_filter() );
     59        $this->plugin->log->addInfo( "Starts " . current_filter() );
    6160    }
    6261
    63     function after_execute_cron_hook() {
    64         $this->log->addInfo( "Finished " . current_filter(), time() - $this->times[ current_filter() ] );
     62    function after_execute_cron_hook(): void {
     63        $this->plugin->log->addInfo( "Finished " . current_filter(), time() - $this->times[ current_filter() ] );
    6564    }
    6665
     
    7069     * @param int $post_id
    7170     */
    72     public function publish_future_post_start( $post_id ) {
    73         $this->log->addInfo( "Check post -> $post_id" );
     71    public function publish_future_post_start( $post_id ): void {
     72        $this->plugin->log->addInfo( "Check post -> $post_id" );
    7473        add_action( 'transition_post_status', array( $this, 'transition_post_status' ), 10, 3 );
    7574    }
     
    8079     * @param $post
    8180     */
    82     public function publish_future_post_finish( $post ) {
     81    public function publish_future_post_finish( $post ): void {
    8382        remove_action( 'transition_post_status', array( $this, 'transition_post_status' ), 10 );
    8483    }
     
    8988     * @param string $new_status
    9089     * @param string $old_status
    91      * @param \WP_Post $post
     90     * @param WP_Post $post
    9291     */
    93     function transition_post_status( $new_status, $old_status, $post ) {
    94         $this->log->addInfo(
     92    function transition_post_status( $new_status, $old_status, $post ): void {
     93        $this->plugin->log->addInfo(
    9594            "Status changed from <b>$old_status</b> -> <b>$new_status</b> of '{$post->post_title}'"
    9695        );
  • cron-logger/tags/1.2.2/classes/Timer.php

    r2587145 r3067274  
    66class Timer {
    77
    8     private $start;
     8    private int $start;
    99
    1010    public function __construct() {
     
    1212    }
    1313
    14     function getStart() {
     14    function getStart(): int {
    1515        return $this->start;
    1616    }
    1717
    18     function getDuration() {
     18    function getDuration(): int {
    1919        return time() - $this->start;
    2020    }
  • cron-logger/tags/1.2.2/classes/Updates.php

    r2936889 r3067274  
    55use CronLogger\Components\Update;
    66
    7 /**
    8  * @property Plugin $plugin
    9  */
    107class Updates extends Update {
     8
     9    private Plugin $plugin;
    1110
    1211    public function __construct(Plugin $plugin) {
     
    3029
    3130    public function update_1(){
     31        global $wpdb;
    3232        $table = $this->plugin->log->table;
    33         $this->plugin->log->wpdb->query(
     33        $wpdb->query(
    3434            "ALTER TABLE $table ADD KEY (parent_id)"
    3535        );
  • cron-logger/tags/1.2.2/plugin.php

    r2936889 r3067274  
    33 * Plugin Name: Cron Logger
    44 * Description: Logs for wp-cron.php runs.
    5  * Version: 1.2.1
     5 * Version: 1.2.2
    66 * Requires at least: 5.3
    7  * Tested up to: 6.2.2
     7 * Tested up to: 6.5.0
    88 * Author: Palasthotel <[email protected]> (Edward Bock)
    99 * Author URI: https://palasthotel.de
    1010 * Domain Path: /languages
    1111 * Text Domain: cron-logger
    12  * @copyright Copyright (c) 2023, Palasthotel
     12 * Requires PHP: 8.0
     13 * @copyright Palasthotel
    1314 * @package Palasthotel\CronLogger
    1415 */
     
    1819require_once dirname( __FILE__ ) . "/vendor/autoload.php";
    1920
    20 
    21 /**
    22  * @property Timer timer
    23  * @property Log log
    24  * @property Services services
    25  * @property Page page
    26  * @property Updates $updates
    27  */
    2821class Plugin extends Components\Plugin {
    2922
     
    4437    const TABLE_LOGS = "cron_logs";
    4538    const OPTION_VERSION = "_cron_logger_version";
     39
     40    public Timer $timer;
     41    public Log $log;
     42
    4643    /**
    4744     * Plugin constructor
    4845     */
    49     function onCreate() {
     46    function onCreate(): void {
    5047
    5148        $this->loadTextdomain(
     
    5653        $this->timer    = new Timer();
    5754        $this->log      = new Log( $this );
    58         $this->updates  = new Updates( $this );
    59         $this->services = new Services( $this );
    60         $this->page     = new Page( $this );
     55        new Updates( $this );
     56        new Services( $this );
     57        new Page( $this );
    6158    }
    6259
     
    6461     * on activation
    6562     */
    66     function onSiteActivation() {
    67         $this->log->createTable();
     63    function onSiteActivation(): void {
     64        $this->log->createTables();
    6865    }
    6966}
  • cron-logger/tags/1.2.2/vendor/composer/ClassLoader.php

    r2936889 r3067274  
    4646    private static $includeFile;
    4747
    48     /** @var ?string */
     48    /** @var string|null */
    4949    private $vendorDir;
    5050
    5151    // PSR-4
    5252    /**
    53      * @var array[]
    54      * @psalm-var array<string, array<string, int>>
     53     * @var array<string, array<string, int>>
    5554     */
    5655    private $prefixLengthsPsr4 = array();
    5756    /**
    58      * @var array[]
    59      * @psalm-var array<string, array<int, string>>
     57     * @var array<string, list<string>>
    6058     */
    6159    private $prefixDirsPsr4 = array();
    6260    /**
    63      * @var array[]
    64      * @psalm-var array<string, string>
     61     * @var list<string>
    6562     */
    6663    private $fallbackDirsPsr4 = array();
     
    6865    // PSR-0
    6966    /**
    70      * @var array[]
    71      * @psalm-var array<string, array<string, string[]>>
     67     * List of PSR-0 prefixes
     68     *
     69     * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
     70     *
     71     * @var array<string, array<string, list<string>>>
    7272     */
    7373    private $prefixesPsr0 = array();
    7474    /**
    75      * @var array[]
    76      * @psalm-var array<string, string>
     75     * @var list<string>
    7776     */
    7877    private $fallbackDirsPsr0 = array();
     
    8281
    8382    /**
    84      * @var string[]
    85      * @psalm-var array<string, string>
     83     * @var array<string, string>
    8684     */
    8785    private $classMap = array();
     
    9189
    9290    /**
    93      * @var bool[]
    94      * @psalm-var array<string, bool>
     91     * @var array<string, bool>
    9592     */
    9693    private $missingClasses = array();
    9794
    98     /** @var ?string */
     95    /** @var string|null */
    9996    private $apcuPrefix;
    10097
    10198    /**
    102      * @var self[]
     99     * @var array<string, self>
    103100     */
    104101    private static $registeredLoaders = array();
    105102
    106103    /**
    107      * @param ?string $vendorDir
     104     * @param string|null $vendorDir
    108105     */
    109106    public function __construct($vendorDir = null)
     
    114111
    115112    /**
    116      * @return string[]
     113     * @return array<string, list<string>>
    117114     */
    118115    public function getPrefixes()
     
    126123
    127124    /**
    128      * @return array[]
    129      * @psalm-return array<string, array<int, string>>
     125     * @return array<string, list<string>>
    130126     */
    131127    public function getPrefixesPsr4()
     
    135131
    136132    /**
    137      * @return array[]
    138      * @psalm-return array<string, string>
     133     * @return list<string>
    139134     */
    140135    public function getFallbackDirs()
     
    144139
    145140    /**
    146      * @return array[]
    147      * @psalm-return array<string, string>
     141     * @return list<string>
    148142     */
    149143    public function getFallbackDirsPsr4()
     
    153147
    154148    /**
    155      * @return string[] Array of classname => path
    156      * @psalm-return array<string, string>
     149     * @return array<string, string> Array of classname => path
    157150     */
    158151    public function getClassMap()
     
    162155
    163156    /**
    164      * @param string[] $classMap Class to filename map
    165      * @psalm-param array<string, string> $classMap
     157     * @param array<string, string> $classMap Class to filename map
    166158     *
    167159     * @return void
     
    180172     * appending or prepending to the ones previously set for this prefix.
    181173     *
    182      * @param string          $prefix  The prefix
    183      * @param string[]|string $paths   The PSR-0 root directories
    184      * @param bool            $prepend Whether to prepend the directories
     174     * @param string              $prefix  The prefix
     175     * @param list<string>|string $paths   The PSR-0 root directories
     176     * @param bool                $prepend Whether to prepend the directories
    185177     *
    186178     * @return void
     
    188180    public function add($prefix, $paths, $prepend = false)
    189181    {
     182        $paths = (array) $paths;
    190183        if (!$prefix) {
    191184            if ($prepend) {
    192185                $this->fallbackDirsPsr0 = array_merge(
    193                     (array) $paths,
     186                    $paths,
    194187                    $this->fallbackDirsPsr0
    195188                );
     
    197190                $this->fallbackDirsPsr0 = array_merge(
    198191                    $this->fallbackDirsPsr0,
    199                     (array) $paths
     192                    $paths
    200193                );
    201194            }
     
    206199        $first = $prefix[0];
    207200        if (!isset($this->prefixesPsr0[$first][$prefix])) {
    208             $this->prefixesPsr0[$first][$prefix] = (array) $paths;
     201            $this->prefixesPsr0[$first][$prefix] = $paths;
    209202
    210203            return;
     
    212205        if ($prepend) {
    213206            $this->prefixesPsr0[$first][$prefix] = array_merge(
    214                 (array) $paths,
     207                $paths,
    215208                $this->prefixesPsr0[$first][$prefix]
    216209            );
     
    218211            $this->prefixesPsr0[$first][$prefix] = array_merge(
    219212                $this->prefixesPsr0[$first][$prefix],
    220                 (array) $paths
     213                $paths
    221214            );
    222215        }
     
    227220     * appending or prepending to the ones previously set for this namespace.
    228221     *
    229      * @param string          $prefix  The prefix/namespace, with trailing '\\'
    230      * @param string[]|string $paths   The PSR-4 base directories
    231      * @param bool            $prepend Whether to prepend the directories
     222     * @param string              $prefix  The prefix/namespace, with trailing '\\'
     223     * @param list<string>|string $paths   The PSR-4 base directories
     224     * @param bool                $prepend Whether to prepend the directories
    232225     *
    233226     * @throws \InvalidArgumentException
     
    237230    public function addPsr4($prefix, $paths, $prepend = false)
    238231    {
     232        $paths = (array) $paths;
    239233        if (!$prefix) {
    240234            // Register directories for the root namespace.
    241235            if ($prepend) {
    242236                $this->fallbackDirsPsr4 = array_merge(
    243                     (array) $paths,
     237                    $paths,
    244238                    $this->fallbackDirsPsr4
    245239                );
     
    247241                $this->fallbackDirsPsr4 = array_merge(
    248242                    $this->fallbackDirsPsr4,
    249                     (array) $paths
     243                    $paths
    250244                );
    251245            }
     
    257251            }
    258252            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
    259             $this->prefixDirsPsr4[$prefix] = (array) $paths;
     253            $this->prefixDirsPsr4[$prefix] = $paths;
    260254        } elseif ($prepend) {
    261255            // Prepend directories for an already registered namespace.
    262256            $this->prefixDirsPsr4[$prefix] = array_merge(
    263                 (array) $paths,
     257                $paths,
    264258                $this->prefixDirsPsr4[$prefix]
    265259            );
     
    268262            $this->prefixDirsPsr4[$prefix] = array_merge(
    269263                $this->prefixDirsPsr4[$prefix],
    270                 (array) $paths
     264                $paths
    271265            );
    272266        }
     
    277271     * replacing any others previously set for this prefix.
    278272     *
    279      * @param string          $prefix The prefix
    280      * @param string[]|string $paths  The PSR-0 base directories
     273     * @param string              $prefix The prefix
     274     * @param list<string>|string $paths  The PSR-0 base directories
    281275     *
    282276     * @return void
     
    295289     * replacing any others previously set for this namespace.
    296290     *
    297      * @param string          $prefix The prefix/namespace, with trailing '\\'
    298      * @param string[]|string $paths  The PSR-4 base directories
     291     * @param string              $prefix The prefix/namespace, with trailing '\\'
     292     * @param list<string>|string $paths  The PSR-4 base directories
    299293     *
    300294     * @throws \InvalidArgumentException
     
    430424    {
    431425        if ($file = $this->findFile($class)) {
    432             (self::$includeFile)($file);
     426            $includeFile = self::$includeFile;
     427            $includeFile($file);
    433428
    434429            return true;
     
    481476
    482477    /**
    483      * Returns the currently registered loaders indexed by their corresponding vendor directories.
    484      *
    485      * @return self[]
     478     * Returns the currently registered loaders keyed by their corresponding vendor directories.
     479     *
     480     * @return array<string, self>
    486481     */
    487482    public static function getRegisteredLoaders()
     
    561556    }
    562557
    563     private static function initializeIncludeClosure(): void
     558    /**
     559     * @return void
     560     */
     561    private static function initializeIncludeClosure()
    564562    {
    565563        if (self::$includeFile !== null) {
     
    575573         * @return void
    576574         */
    577         self::$includeFile = static function($file) {
     575        self::$includeFile = \Closure::bind(static function($file) {
    578576            include $file;
    579         };
     577        }, null, null);
    580578    }
    581579}
  • cron-logger/tags/1.2.2/vendor/composer/InstalledVersions.php

    r2936889 r3067274  
    9999        foreach (self::getInstalled() as $installed) {
    100100            if (isset($installed['versions'][$packageName])) {
    101                 return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
     101                return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
    102102            }
    103103        }
     
    120120    public static function satisfies(VersionParser $parser, $packageName, $constraint)
    121121    {
    122         $constraint = $parser->parseConstraints($constraint);
     122        $constraint = $parser->parseConstraints((string) $constraint);
    123123        $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
    124124
     
    329329                    $installed[] = self::$installedByVendor[$vendorDir];
    330330                } elseif (is_file($vendorDir.'/composer/installed.php')) {
    331                     $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
     331                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
     332                    $required = require $vendorDir.'/composer/installed.php';
     333                    $installed[] = self::$installedByVendor[$vendorDir] = $required;
    332334                    if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    333335                        self::$installed = $installed[count($installed) - 1];
     
    341343            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
    342344            if (substr(__DIR__, -8, 1) !== 'C') {
    343                 self::$installed = require __DIR__ . '/installed.php';
     345                /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
     346                $required = require __DIR__ . '/installed.php';
     347                self::$installed = $required;
    344348            } else {
    345349                self::$installed = array();
    346350            }
    347351        }
    348         $installed[] = self::$installed;
     352
     353        if (self::$installed !== array()) {
     354            $installed[] = self::$installed;
     355        }
    349356
    350357        return $installed;
  • cron-logger/tags/1.2.2/vendor/composer/installed.php

    r2936889 r3067274  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => '6ac0a6e4df6c4168adaed278efaa4cbc59a895bb',
     6        'reference' => 'fec4f5c6b21d3612292a1791bcf9061c8d56085a',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-master',
    1515            'version' => 'dev-master',
    16             'reference' => '6ac0a6e4df6c4168adaed278efaa4cbc59a895bb',
     16            'reference' => 'fec4f5c6b21d3612292a1791bcf9061c8d56085a',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
  • cron-logger/trunk/README.txt

    r2936889 r3067274  
    44Tags: tool, log, debug, cron, wp-cron
    55Requires at least: 5.3
    6 Tested up to: 6.2.2
    7 Stable tag: 1.2.1
     6Tested up to: 6.5.0
     7Stable tag: 1.2.2
     8Requires PHP: 8.0
    89License: GPLv3
    910License URI: http://www.gnu.org/licenses/gpl
     
    2829
    2930== Changelog ==
     31
     32= 1.2.2
     33 * Fix: PHP 8.2 warnings
    3034
    3135= 1.2.1
  • cron-logger/trunk/classes/Components/Plugin.php

    r2587145 r3067274  
    11<?php
     2
    23namespace CronLogger\Components;
    34
     
    67
    78/**
    8  * @property string path
    9  * @property string url
    10  * @property string basename
    11  * @version 0.1.3
     9 * @version 0.1.4
    1210 */
    1311abstract class Plugin {
    1412
    15     /**
    16      * @var ReflectionClass
    17      */
    18     private $ref;
     13    private ReflectionClass $ref;
    1914
    20     private $tooLateForTextdomain;
     15    private bool $tooLateForTextdomain;
     16    public string $path;
     17    public string $url;
     18    public string $basename;
    2119
    2220    /**
     
    3634        register_deactivation_hook( $this->ref->getFileName(), array( $this, "onDeactivation" ) );
    3735
     36    }
     37
     38    public function getPath(string $inPluginPath): string {
     39        return trailingslashit($this->path) . ltrim($inPluginPath,"/");
     40    }
     41
     42    public function getUrl(string $inPluginUrl): string {
     43        return trailingslashit($this->url) . ltrim($inPluginUrl, "/");
    3844    }
    3945
  • cron-logger/trunk/classes/Log.php

    r2936889 r3067274  
    33namespace CronLogger;
    44
    5 use wpdb;
     5use CronLogger\Components\Database;
    66
    7 /**
    8  * @property wpdb $wpdb
    9  * @property string $table
    10  */
    11 class Log {
     7class Log  extends Database {
    128
    13     private $plugin;
    149    private $log_id = null;
    15     private $errors = array();
     10    public $errors = array();
     11    public string $table;
    1612
    17     public function __construct( Plugin $plugin ) {
    18         $this->plugin = $plugin;
    19         global $wpdb;
    20         $this->wpdb = $wpdb;
     13    public function init() {
    2114        $this->table = $this->wpdb->prefix . Plugin::TABLE_LOGS;
    2215    }
    2316
    24     function start( $info = "" ) {
     17    function start( $info = "" ): void {
    2518        if ( $this->log_id != null ) {
    2619            error_log( "Only start logger once per session.", 4 );
     
    3124            $this->table,
    3225            array(
    33                 'executed' => $this->plugin->timer->getStart(),
     26                'executed' => Plugin::instance()->timer->getStart(),
    3427                'duration' => 0,
    3528                'info'     => "Running ⏳ $info",
     
    4437    }
    4538
    46     function update( $duration, $info = null ) {
     39    function update( $duration, $info = null ): int {
    4740
    4841        if ( $this->log_id == null ) {
     
    6962    }
    7063
    71     function addInfo( $message, $duration = null ) {
     64    function addInfo( $message, $duration = null ): void {
    7265        $result = $this->wpdb->insert(
    7366            $this->table,
     
    9285        } else {
    9386            $this->update(
    94                 $this->plugin->timer->getDuration()
     87                Plugin::instance()->timer->getDuration()
    9588            );
    9689        }
     
    9891    }
    9992
    100     function getList( $args = array() ) {
     93    function getList( $args = array() ): array {
    10194        $args = (object) array_merge(
    10295            array(
     
    118111    }
    119112
    120     function getSublist( $log_id, $count = 50, $page = 0 ) {
     113    function getSublist( $log_id, $count = 50, $page = 0 ): array {
    121114        $offset = $count * $page;
    122115
     
    126119    }
    127120
    128     function clean() {
     121    function clean(): void {
    129122        $table     = $this->table;
    130123        $days      = apply_filters( Plugin::FILTER_EXPIRE, 14 );
     
    139132    }
    140133
    141     function createTable() {
    142         require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
     134    function createTables() {
     135        parent::createTables();
    143136        dbDelta( "CREATE TABLE IF NOT EXISTS " . $this->table . "
    144137        (
  • cron-logger/trunk/classes/Page.php

    r2587145 r3067274  
    1010
    1111
    12 class Page {
     12use CronLogger\Components\Component;
     13
     14class Page extends Component {
    1315
    1416    const ARG_ITEMS = "cron-logs-items";
     
    1820    const ARG_DURATION_MIN = "cron-logs-dm";
    1921
    20     public function __construct( Plugin $plugin ) {
    21         $this->plugin = $plugin;
     22    public function onCreate() {
    2223        add_action( 'admin_menu', array( $this, 'menu_pages' ) );
    2324    }
     
    126127                            echo $time->format( "Y-m-d H:i:s" );
    127128                            ?></td>
    128                         <td style="border-top: 3px solid #333;"><?php echo getDurationString( $log->duration ); ?></td>
     129                        <td style="border-top: 3px solid #333;"><?php echo $this->getDurationString( $log->duration ); ?></td>
    129130                        <td style="border-top: 3px solid #333;"><?php echo $log->info; ?></td>
    130131                    </tr>
     
    135136                        <tr data-parent-id="<?php echo $log->id; ?>">
    136137                            <td></td>
    137                             <td><?php echo getDurationString( $sub->duration ); ?></td>
     138                            <td><?php echo $this->getDurationString( $sub->duration ); ?></td>
    138139                            <td><?php echo $sub->info; ?></td>
    139140                        </tr>
     
    147148        <script>
    148149            jQuery(function ($) {
    149                 var $logs = $('[data-log-id]');
     150                const $logs = $('[data-log-id]');
    150151                $logs.on('click', function () {
    151                     var id = $(this).attr('data-log-id');
     152                    const id = $(this).attr('data-log-id');
    152153                    console.log('clicked', id);
    153154                    $('[data-parent-id=' + id + ']').toggle();
    154155                });
    155                 var isVisible = true;
     156                let isVisible = true;
    156157                $('[name=toggle_logs]').on('click', function () {
    157158                    if (isVisible) {
     
    168169    }
    169170
     171    private function getDurationString($duration ): string {
     172        if ( $duration == null ) {
     173            return "";
     174        }
     175
     176        return $duration . "s";
     177    }
     178
    170179}
    171180
    172 function getDurationString( $duration ) {
    173     if ( $duration == null ) {
    174         return "";
    175     }
    176 
    177     return $duration . "s";
    178 }
  • cron-logger/trunk/classes/Services.php

    r2587145 r3067274  
    77use CronLogger\Services\WPCron;
    88
    9 /**
    10  * @property WPCron wp_cron
    11  * @property SolrPlugin solr
    12  */
     9
    1310class Services {
    14     public function __construct( Plugin $plugin ) {
    1511
    16         $this->wp_cron = new WPCron( $plugin );
    17         $this->solr = new SolrPlugin( $plugin );
     12    public function __construct(Plugin $plugin ) {
     13
     14        new WPCron( $plugin );
     15        new SolrPlugin( $plugin );
    1816
    1917        add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
     
    2119    }
    2220
    23     function plugins_loaded() {
     21    function plugins_loaded(): void {
    2422        do_action( Plugin::ACTION_INIT, Plugin::instance() );
    2523    }
  • cron-logger/trunk/classes/Services/SolrPlugin.php

    r2587145 r3067274  
    44
    55
    6 use CronLogger\Plugin;
     6use CronLogger\Components\Component;
    77
    8 class SolrPlugin {
    9     public function __construct( Plugin $plugin ) {
    10         $this->plugin = $plugin;
     8class SolrPlugin extends Component {
     9
     10    public function onCreate(): void {
    1111        add_action( "solr_cron_start", array( $this, "onStart" ) );
    1212        add_action( "solr_cron_finish", array( $this, "onFinish" ) );
    1313    }
    1414
    15     function onStart() {
     15    function onStart(): void {
    1616        $this->plugin->log->start( 'Solr cron.php' );
    1717        $this->plugin->log->addInfo( "Solr cron.php starts" );
    1818    }
    1919
    20     function onFinish() {
     20    function onFinish(): void {
    2121        $this->plugin->log->update( $this->plugin->timer->getDuration(), "Solr finished 🔎 🎉" );
    2222    }
  • cron-logger/trunk/classes/Services/WPCron.php

    r2587145 r3067274  
    44
    55
     6use CronLogger\Components\Component;
    67use CronLogger\Plugin;
     8use WP_Post;
    79
    8 class WPCron {
     10class WPCron extends Component {
    911
    10     var $times = array();
     12    private array $times = array();
    1113
    12     public function __construct( Plugin $plugin ) {
    13 
    14         $this->log   = $plugin->log;
    15         $this->timer = $plugin->timer;
     14    public function onCreate(): void {
    1615
    1716        if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
     
    2524    }
    2625
    27     function start() {
     26    function start(): void {
    2827        do_action( Plugin::ACTION_WP_CRON_START );
    29         $this->log->start( "wp-cron.php" );
     28        $this->plugin->log->start( "wp-cron.php" );
    3029        $this->addCronActions();
    3130    }
    3231
    33     function shutdown() {
    34         $this->log->update( $this->timer->getDuration(), 'Done wp-cron.php 🎉 ' );
     32    function shutdown(): void {
     33        $this->plugin->log->update( $this->plugin->timer->getDuration(), 'Done wp-cron.php 🎉 ' );
    3534        do_action( Plugin::ACTION_WP_CRON_FINISH );
    36         $this->log->clean();
     35        $this->plugin->log->clean();
    3736    }
    3837
    39     function addCronActions() {
     38    function addCronActions(): void {
    4039        $crons      = _get_cron_array();
    4140        $registered = array();
     
    5352            $msg = sprintf( __( "Registered hooks: %s", Plugin::DOMAIN ), implode( ', ', $registered ) );
    5453        }
    55         $this->log->addInfo( $msg );
     54        $this->plugin->log->addInfo( $msg );
    5655    }
    5756
    58     function before_execute_cron_hook() {
     57    function before_execute_cron_hook(): void {
    5958        $this->times[ current_filter() ] = time();
    60         $this->log->addInfo( "Starts " . current_filter() );
     59        $this->plugin->log->addInfo( "Starts " . current_filter() );
    6160    }
    6261
    63     function after_execute_cron_hook() {
    64         $this->log->addInfo( "Finished " . current_filter(), time() - $this->times[ current_filter() ] );
     62    function after_execute_cron_hook(): void {
     63        $this->plugin->log->addInfo( "Finished " . current_filter(), time() - $this->times[ current_filter() ] );
    6564    }
    6665
     
    7069     * @param int $post_id
    7170     */
    72     public function publish_future_post_start( $post_id ) {
    73         $this->log->addInfo( "Check post -> $post_id" );
     71    public function publish_future_post_start( $post_id ): void {
     72        $this->plugin->log->addInfo( "Check post -> $post_id" );
    7473        add_action( 'transition_post_status', array( $this, 'transition_post_status' ), 10, 3 );
    7574    }
     
    8079     * @param $post
    8180     */
    82     public function publish_future_post_finish( $post ) {
     81    public function publish_future_post_finish( $post ): void {
    8382        remove_action( 'transition_post_status', array( $this, 'transition_post_status' ), 10 );
    8483    }
     
    8988     * @param string $new_status
    9089     * @param string $old_status
    91      * @param \WP_Post $post
     90     * @param WP_Post $post
    9291     */
    93     function transition_post_status( $new_status, $old_status, $post ) {
    94         $this->log->addInfo(
     92    function transition_post_status( $new_status, $old_status, $post ): void {
     93        $this->plugin->log->addInfo(
    9594            "Status changed from <b>$old_status</b> -> <b>$new_status</b> of '{$post->post_title}'"
    9695        );
  • cron-logger/trunk/classes/Timer.php

    r2587145 r3067274  
    66class Timer {
    77
    8     private $start;
     8    private int $start;
    99
    1010    public function __construct() {
     
    1212    }
    1313
    14     function getStart() {
     14    function getStart(): int {
    1515        return $this->start;
    1616    }
    1717
    18     function getDuration() {
     18    function getDuration(): int {
    1919        return time() - $this->start;
    2020    }
  • cron-logger/trunk/classes/Updates.php

    r2936889 r3067274  
    55use CronLogger\Components\Update;
    66
    7 /**
    8  * @property Plugin $plugin
    9  */
    107class Updates extends Update {
     8
     9    private Plugin $plugin;
    1110
    1211    public function __construct(Plugin $plugin) {
     
    3029
    3130    public function update_1(){
     31        global $wpdb;
    3232        $table = $this->plugin->log->table;
    33         $this->plugin->log->wpdb->query(
     33        $wpdb->query(
    3434            "ALTER TABLE $table ADD KEY (parent_id)"
    3535        );
  • cron-logger/trunk/plugin.php

    r2936889 r3067274  
    33 * Plugin Name: Cron Logger
    44 * Description: Logs for wp-cron.php runs.
    5  * Version: 1.2.1
     5 * Version: 1.2.2
    66 * Requires at least: 5.3
    7  * Tested up to: 6.2.2
     7 * Tested up to: 6.5.0
    88 * Author: Palasthotel <[email protected]> (Edward Bock)
    99 * Author URI: https://palasthotel.de
    1010 * Domain Path: /languages
    1111 * Text Domain: cron-logger
    12  * @copyright Copyright (c) 2023, Palasthotel
     12 * Requires PHP: 8.0
     13 * @copyright Palasthotel
    1314 * @package Palasthotel\CronLogger
    1415 */
     
    1819require_once dirname( __FILE__ ) . "/vendor/autoload.php";
    1920
    20 
    21 /**
    22  * @property Timer timer
    23  * @property Log log
    24  * @property Services services
    25  * @property Page page
    26  * @property Updates $updates
    27  */
    2821class Plugin extends Components\Plugin {
    2922
     
    4437    const TABLE_LOGS = "cron_logs";
    4538    const OPTION_VERSION = "_cron_logger_version";
     39
     40    public Timer $timer;
     41    public Log $log;
     42
    4643    /**
    4744     * Plugin constructor
    4845     */
    49     function onCreate() {
     46    function onCreate(): void {
    5047
    5148        $this->loadTextdomain(
     
    5653        $this->timer    = new Timer();
    5754        $this->log      = new Log( $this );
    58         $this->updates  = new Updates( $this );
    59         $this->services = new Services( $this );
    60         $this->page     = new Page( $this );
     55        new Updates( $this );
     56        new Services( $this );
     57        new Page( $this );
    6158    }
    6259
     
    6461     * on activation
    6562     */
    66     function onSiteActivation() {
    67         $this->log->createTable();
     63    function onSiteActivation(): void {
     64        $this->log->createTables();
    6865    }
    6966}
  • cron-logger/trunk/vendor/composer/ClassLoader.php

    r2936889 r3067274  
    4646    private static $includeFile;
    4747
    48     /** @var ?string */
     48    /** @var string|null */
    4949    private $vendorDir;
    5050
    5151    // PSR-4
    5252    /**
    53      * @var array[]
    54      * @psalm-var array<string, array<string, int>>
     53     * @var array<string, array<string, int>>
    5554     */
    5655    private $prefixLengthsPsr4 = array();
    5756    /**
    58      * @var array[]
    59      * @psalm-var array<string, array<int, string>>
     57     * @var array<string, list<string>>
    6058     */
    6159    private $prefixDirsPsr4 = array();
    6260    /**
    63      * @var array[]
    64      * @psalm-var array<string, string>
     61     * @var list<string>
    6562     */
    6663    private $fallbackDirsPsr4 = array();
     
    6865    // PSR-0
    6966    /**
    70      * @var array[]
    71      * @psalm-var array<string, array<string, string[]>>
     67     * List of PSR-0 prefixes
     68     *
     69     * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2')))
     70     *
     71     * @var array<string, array<string, list<string>>>
    7272     */
    7373    private $prefixesPsr0 = array();
    7474    /**
    75      * @var array[]
    76      * @psalm-var array<string, string>
     75     * @var list<string>
    7776     */
    7877    private $fallbackDirsPsr0 = array();
     
    8281
    8382    /**
    84      * @var string[]
    85      * @psalm-var array<string, string>
     83     * @var array<string, string>
    8684     */
    8785    private $classMap = array();
     
    9189
    9290    /**
    93      * @var bool[]
    94      * @psalm-var array<string, bool>
     91     * @var array<string, bool>
    9592     */
    9693    private $missingClasses = array();
    9794
    98     /** @var ?string */
     95    /** @var string|null */
    9996    private $apcuPrefix;
    10097
    10198    /**
    102      * @var self[]
     99     * @var array<string, self>
    103100     */
    104101    private static $registeredLoaders = array();
    105102
    106103    /**
    107      * @param ?string $vendorDir
     104     * @param string|null $vendorDir
    108105     */
    109106    public function __construct($vendorDir = null)
     
    114111
    115112    /**
    116      * @return string[]
     113     * @return array<string, list<string>>
    117114     */
    118115    public function getPrefixes()
     
    126123
    127124    /**
    128      * @return array[]
    129      * @psalm-return array<string, array<int, string>>
     125     * @return array<string, list<string>>
    130126     */
    131127    public function getPrefixesPsr4()
     
    135131
    136132    /**
    137      * @return array[]
    138      * @psalm-return array<string, string>
     133     * @return list<string>
    139134     */
    140135    public function getFallbackDirs()
     
    144139
    145140    /**
    146      * @return array[]
    147      * @psalm-return array<string, string>
     141     * @return list<string>
    148142     */
    149143    public function getFallbackDirsPsr4()
     
    153147
    154148    /**
    155      * @return string[] Array of classname => path
    156      * @psalm-return array<string, string>
     149     * @return array<string, string> Array of classname => path
    157150     */
    158151    public function getClassMap()
     
    162155
    163156    /**
    164      * @param string[] $classMap Class to filename map
    165      * @psalm-param array<string, string> $classMap
     157     * @param array<string, string> $classMap Class to filename map
    166158     *
    167159     * @return void
     
    180172     * appending or prepending to the ones previously set for this prefix.
    181173     *
    182      * @param string          $prefix  The prefix
    183      * @param string[]|string $paths   The PSR-0 root directories
    184      * @param bool            $prepend Whether to prepend the directories
     174     * @param string              $prefix  The prefix
     175     * @param list<string>|string $paths   The PSR-0 root directories
     176     * @param bool                $prepend Whether to prepend the directories
    185177     *
    186178     * @return void
     
    188180    public function add($prefix, $paths, $prepend = false)
    189181    {
     182        $paths = (array) $paths;
    190183        if (!$prefix) {
    191184            if ($prepend) {
    192185                $this->fallbackDirsPsr0 = array_merge(
    193                     (array) $paths,
     186                    $paths,
    194187                    $this->fallbackDirsPsr0
    195188                );
     
    197190                $this->fallbackDirsPsr0 = array_merge(
    198191                    $this->fallbackDirsPsr0,
    199                     (array) $paths
     192                    $paths
    200193                );
    201194            }
     
    206199        $first = $prefix[0];
    207200        if (!isset($this->prefixesPsr0[$first][$prefix])) {
    208             $this->prefixesPsr0[$first][$prefix] = (array) $paths;
     201            $this->prefixesPsr0[$first][$prefix] = $paths;
    209202
    210203            return;
     
    212205        if ($prepend) {
    213206            $this->prefixesPsr0[$first][$prefix] = array_merge(
    214                 (array) $paths,
     207                $paths,
    215208                $this->prefixesPsr0[$first][$prefix]
    216209            );
     
    218211            $this->prefixesPsr0[$first][$prefix] = array_merge(
    219212                $this->prefixesPsr0[$first][$prefix],
    220                 (array) $paths
     213                $paths
    221214            );
    222215        }
     
    227220     * appending or prepending to the ones previously set for this namespace.
    228221     *
    229      * @param string          $prefix  The prefix/namespace, with trailing '\\'
    230      * @param string[]|string $paths   The PSR-4 base directories
    231      * @param bool            $prepend Whether to prepend the directories
     222     * @param string              $prefix  The prefix/namespace, with trailing '\\'
     223     * @param list<string>|string $paths   The PSR-4 base directories
     224     * @param bool                $prepend Whether to prepend the directories
    232225     *
    233226     * @throws \InvalidArgumentException
     
    237230    public function addPsr4($prefix, $paths, $prepend = false)
    238231    {
     232        $paths = (array) $paths;
    239233        if (!$prefix) {
    240234            // Register directories for the root namespace.
    241235            if ($prepend) {
    242236                $this->fallbackDirsPsr4 = array_merge(
    243                     (array) $paths,
     237                    $paths,
    244238                    $this->fallbackDirsPsr4
    245239                );
     
    247241                $this->fallbackDirsPsr4 = array_merge(
    248242                    $this->fallbackDirsPsr4,
    249                     (array) $paths
     243                    $paths
    250244                );
    251245            }
     
    257251            }
    258252            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
    259             $this->prefixDirsPsr4[$prefix] = (array) $paths;
     253            $this->prefixDirsPsr4[$prefix] = $paths;
    260254        } elseif ($prepend) {
    261255            // Prepend directories for an already registered namespace.
    262256            $this->prefixDirsPsr4[$prefix] = array_merge(
    263                 (array) $paths,
     257                $paths,
    264258                $this->prefixDirsPsr4[$prefix]
    265259            );
     
    268262            $this->prefixDirsPsr4[$prefix] = array_merge(
    269263                $this->prefixDirsPsr4[$prefix],
    270                 (array) $paths
     264                $paths
    271265            );
    272266        }
     
    277271     * replacing any others previously set for this prefix.
    278272     *
    279      * @param string          $prefix The prefix
    280      * @param string[]|string $paths  The PSR-0 base directories
     273     * @param string              $prefix The prefix
     274     * @param list<string>|string $paths  The PSR-0 base directories
    281275     *
    282276     * @return void
     
    295289     * replacing any others previously set for this namespace.
    296290     *
    297      * @param string          $prefix The prefix/namespace, with trailing '\\'
    298      * @param string[]|string $paths  The PSR-4 base directories
     291     * @param string              $prefix The prefix/namespace, with trailing '\\'
     292     * @param list<string>|string $paths  The PSR-4 base directories
    299293     *
    300294     * @throws \InvalidArgumentException
     
    430424    {
    431425        if ($file = $this->findFile($class)) {
    432             (self::$includeFile)($file);
     426            $includeFile = self::$includeFile;
     427            $includeFile($file);
    433428
    434429            return true;
     
    481476
    482477    /**
    483      * Returns the currently registered loaders indexed by their corresponding vendor directories.
    484      *
    485      * @return self[]
     478     * Returns the currently registered loaders keyed by their corresponding vendor directories.
     479     *
     480     * @return array<string, self>
    486481     */
    487482    public static function getRegisteredLoaders()
     
    561556    }
    562557
    563     private static function initializeIncludeClosure(): void
     558    /**
     559     * @return void
     560     */
     561    private static function initializeIncludeClosure()
    564562    {
    565563        if (self::$includeFile !== null) {
     
    575573         * @return void
    576574         */
    577         self::$includeFile = static function($file) {
     575        self::$includeFile = \Closure::bind(static function($file) {
    578576            include $file;
    579         };
     577        }, null, null);
    580578    }
    581579}
  • cron-logger/trunk/vendor/composer/InstalledVersions.php

    r2936889 r3067274  
    9999        foreach (self::getInstalled() as $installed) {
    100100            if (isset($installed['versions'][$packageName])) {
    101                 return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
     101                return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false;
    102102            }
    103103        }
     
    120120    public static function satisfies(VersionParser $parser, $packageName, $constraint)
    121121    {
    122         $constraint = $parser->parseConstraints($constraint);
     122        $constraint = $parser->parseConstraints((string) $constraint);
    123123        $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
    124124
     
    329329                    $installed[] = self::$installedByVendor[$vendorDir];
    330330                } elseif (is_file($vendorDir.'/composer/installed.php')) {
    331                     $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
     331                    /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
     332                    $required = require $vendorDir.'/composer/installed.php';
     333                    $installed[] = self::$installedByVendor[$vendorDir] = $required;
    332334                    if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
    333335                        self::$installed = $installed[count($installed) - 1];
     
    341343            // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
    342344            if (substr(__DIR__, -8, 1) !== 'C') {
    343                 self::$installed = require __DIR__ . '/installed.php';
     345                /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
     346                $required = require __DIR__ . '/installed.php';
     347                self::$installed = $required;
    344348            } else {
    345349                self::$installed = array();
    346350            }
    347351        }
    348         $installed[] = self::$installed;
     352
     353        if (self::$installed !== array()) {
     354            $installed[] = self::$installed;
     355        }
    349356
    350357        return $installed;
  • cron-logger/trunk/vendor/composer/installed.php

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