Changeset 3067274
- Timestamp:
- 04/09/2024 04:43:42 AM (2 years ago)
- Location:
- cron-logger
- Files:
-
- 4 added
- 2 deleted
- 19 edited
- 17 copied
-
tags/1.2.2 (copied) (copied from cron-logger/trunk)
-
tags/1.2.2/README.txt (copied) (copied from cron-logger/trunk/README.txt) (2 diffs)
-
tags/1.2.2/classes (copied) (copied from cron-logger/trunk/classes)
-
tags/1.2.2/classes/Components/Component.php (added)
-
tags/1.2.2/classes/Components/Database.php (added)
-
tags/1.2.2/classes/Components/Plugin.php (modified) (3 diffs)
-
tags/1.2.2/classes/Components/Update.php (copied) (copied from cron-logger/trunk/classes/Components/Update.php)
-
tags/1.2.2/classes/Log.php (copied) (copied from cron-logger/trunk/classes/Log.php) (9 diffs)
-
tags/1.2.2/classes/Page.php (modified) (6 diffs)
-
tags/1.2.2/classes/Services.php (modified) (2 diffs)
-
tags/1.2.2/classes/Services/SolrPlugin.php (modified) (1 diff)
-
tags/1.2.2/classes/Services/WPCron.php (modified) (6 diffs)
-
tags/1.2.2/classes/Timer.php (modified) (2 diffs)
-
tags/1.2.2/classes/Updates.php (copied) (copied from cron-logger/trunk/classes/Updates.php) (2 diffs)
-
tags/1.2.2/inc (deleted)
-
tags/1.2.2/plugin.php (copied) (copied from cron-logger/trunk/plugin.php) (5 diffs)
-
tags/1.2.2/readme.md (deleted)
-
tags/1.2.2/uninstall.php (copied) (copied from cron-logger/trunk/uninstall.php)
-
tags/1.2.2/vendor (copied) (copied from cron-logger/trunk/vendor)
-
tags/1.2.2/vendor/autoload.php (copied) (copied from cron-logger/trunk/vendor/autoload.php)
-
tags/1.2.2/vendor/composer/ClassLoader.php (copied) (copied from cron-logger/trunk/vendor/composer/ClassLoader.php) (27 diffs)
-
tags/1.2.2/vendor/composer/InstalledVersions.php (copied) (copied from cron-logger/trunk/vendor/composer/InstalledVersions.php) (4 diffs)
-
tags/1.2.2/vendor/composer/autoload_classmap.php (copied) (copied from cron-logger/trunk/vendor/composer/autoload_classmap.php)
-
tags/1.2.2/vendor/composer/autoload_namespaces.php (copied) (copied from cron-logger/trunk/vendor/composer/autoload_namespaces.php)
-
tags/1.2.2/vendor/composer/autoload_psr4.php (copied) (copied from cron-logger/trunk/vendor/composer/autoload_psr4.php)
-
tags/1.2.2/vendor/composer/autoload_real.php (copied) (copied from cron-logger/trunk/vendor/composer/autoload_real.php)
-
tags/1.2.2/vendor/composer/installed.php (copied) (copied from cron-logger/trunk/vendor/composer/installed.php) (2 diffs)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/classes/Components/Component.php (added)
-
trunk/classes/Components/Database.php (added)
-
trunk/classes/Components/Plugin.php (modified) (3 diffs)
-
trunk/classes/Log.php (modified) (9 diffs)
-
trunk/classes/Page.php (modified) (6 diffs)
-
trunk/classes/Services.php (modified) (2 diffs)
-
trunk/classes/Services/SolrPlugin.php (modified) (1 diff)
-
trunk/classes/Services/WPCron.php (modified) (6 diffs)
-
trunk/classes/Timer.php (modified) (2 diffs)
-
trunk/classes/Updates.php (modified) (2 diffs)
-
trunk/plugin.php (modified) (5 diffs)
-
trunk/vendor/composer/ClassLoader.php (modified) (27 diffs)
-
trunk/vendor/composer/InstalledVersions.php (modified) (4 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cron-logger/tags/1.2.2/README.txt
r2936889 r3067274 4 4 Tags: tool, log, debug, cron, wp-cron 5 5 Requires at least: 5.3 6 Tested up to: 6.2.2 7 Stable tag: 1.2.1 6 Tested up to: 6.5.0 7 Stable tag: 1.2.2 8 Requires PHP: 8.0 8 9 License: GPLv3 9 10 License URI: http://www.gnu.org/licenses/gpl … … 28 29 29 30 == Changelog == 31 32 = 1.2.2 33 * Fix: PHP 8.2 warnings 30 34 31 35 = 1.2.1 -
cron-logger/tags/1.2.2/classes/Components/Plugin.php
r2587145 r3067274 1 1 <?php 2 2 3 namespace CronLogger\Components; 3 4 … … 6 7 7 8 /** 8 * @property string path 9 * @property string url 10 * @property string basename 11 * @version 0.1.3 9 * @version 0.1.4 12 10 */ 13 11 abstract class Plugin { 14 12 15 /** 16 * @var ReflectionClass 17 */ 18 private $ref; 13 private ReflectionClass $ref; 19 14 20 private $tooLateForTextdomain; 15 private bool $tooLateForTextdomain; 16 public string $path; 17 public string $url; 18 public string $basename; 21 19 22 20 /** … … 36 34 register_deactivation_hook( $this->ref->getFileName(), array( $this, "onDeactivation" ) ); 37 35 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, "/"); 38 44 } 39 45 -
cron-logger/tags/1.2.2/classes/Log.php
r2936889 r3067274 3 3 namespace CronLogger; 4 4 5 use wpdb;5 use CronLogger\Components\Database; 6 6 7 /** 8 * @property wpdb $wpdb 9 * @property string $table 10 */ 11 class Log { 7 class Log extends Database { 12 8 13 private $plugin;14 9 private $log_id = null; 15 private $errors = array(); 10 public $errors = array(); 11 public string $table; 16 12 17 public function __construct( Plugin $plugin ) { 18 $this->plugin = $plugin; 19 global $wpdb; 20 $this->wpdb = $wpdb; 13 public function init() { 21 14 $this->table = $this->wpdb->prefix . Plugin::TABLE_LOGS; 22 15 } 23 16 24 function start( $info = "" ) {17 function start( $info = "" ): void { 25 18 if ( $this->log_id != null ) { 26 19 error_log( "Only start logger once per session.", 4 ); … … 31 24 $this->table, 32 25 array( 33 'executed' => $this->plugin->timer->getStart(),26 'executed' => Plugin::instance()->timer->getStart(), 34 27 'duration' => 0, 35 28 'info' => "Running ⏳ $info", … … 44 37 } 45 38 46 function update( $duration, $info = null ) {39 function update( $duration, $info = null ): int { 47 40 48 41 if ( $this->log_id == null ) { … … 69 62 } 70 63 71 function addInfo( $message, $duration = null ) {64 function addInfo( $message, $duration = null ): void { 72 65 $result = $this->wpdb->insert( 73 66 $this->table, … … 92 85 } else { 93 86 $this->update( 94 $this->plugin->timer->getDuration()87 Plugin::instance()->timer->getDuration() 95 88 ); 96 89 } … … 98 91 } 99 92 100 function getList( $args = array() ) {93 function getList( $args = array() ): array { 101 94 $args = (object) array_merge( 102 95 array( … … 118 111 } 119 112 120 function getSublist( $log_id, $count = 50, $page = 0 ) {113 function getSublist( $log_id, $count = 50, $page = 0 ): array { 121 114 $offset = $count * $page; 122 115 … … 126 119 } 127 120 128 function clean() {121 function clean(): void { 129 122 $table = $this->table; 130 123 $days = apply_filters( Plugin::FILTER_EXPIRE, 14 ); … … 139 132 } 140 133 141 function createTable () {142 require_once( ABSPATH . 'wp-admin/includes/upgrade.php');134 function createTables() { 135 parent::createTables(); 143 136 dbDelta( "CREATE TABLE IF NOT EXISTS " . $this->table . " 144 137 ( -
cron-logger/tags/1.2.2/classes/Page.php
r2587145 r3067274 10 10 11 11 12 class Page { 12 use CronLogger\Components\Component; 13 14 class Page extends Component { 13 15 14 16 const ARG_ITEMS = "cron-logs-items"; … … 18 20 const ARG_DURATION_MIN = "cron-logs-dm"; 19 21 20 public function __construct( Plugin $plugin ) { 21 $this->plugin = $plugin; 22 public function onCreate() { 22 23 add_action( 'admin_menu', array( $this, 'menu_pages' ) ); 23 24 } … … 126 127 echo $time->format( "Y-m-d H:i:s" ); 127 128 ?></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> 129 130 <td style="border-top: 3px solid #333;"><?php echo $log->info; ?></td> 130 131 </tr> … … 135 136 <tr data-parent-id="<?php echo $log->id; ?>"> 136 137 <td></td> 137 <td><?php echo getDurationString( $sub->duration ); ?></td>138 <td><?php echo $this->getDurationString( $sub->duration ); ?></td> 138 139 <td><?php echo $sub->info; ?></td> 139 140 </tr> … … 147 148 <script> 148 149 jQuery(function ($) { 149 var$logs = $('[data-log-id]');150 const $logs = $('[data-log-id]'); 150 151 $logs.on('click', function () { 151 varid = $(this).attr('data-log-id');152 const id = $(this).attr('data-log-id'); 152 153 console.log('clicked', id); 153 154 $('[data-parent-id=' + id + ']').toggle(); 154 155 }); 155 varisVisible = true;156 let isVisible = true; 156 157 $('[name=toggle_logs]').on('click', function () { 157 158 if (isVisible) { … … 168 169 } 169 170 171 private function getDurationString($duration ): string { 172 if ( $duration == null ) { 173 return ""; 174 } 175 176 return $duration . "s"; 177 } 178 170 179 } 171 180 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 7 7 use CronLogger\Services\WPCron; 8 8 9 /** 10 * @property WPCron wp_cron 11 * @property SolrPlugin solr 12 */ 9 13 10 class Services { 14 public function __construct( Plugin $plugin ) {15 11 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 ); 18 16 19 17 add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) ); … … 21 19 } 22 20 23 function plugins_loaded() {21 function plugins_loaded(): void { 24 22 do_action( Plugin::ACTION_INIT, Plugin::instance() ); 25 23 } -
cron-logger/tags/1.2.2/classes/Services/SolrPlugin.php
r2587145 r3067274 4 4 5 5 6 use CronLogger\ Plugin;6 use CronLogger\Components\Component; 7 7 8 class SolrPlugin {9 public function __construct( Plugin $plugin ) { 10 $this->plugin = $plugin;8 class SolrPlugin extends Component { 9 10 public function onCreate(): void { 11 11 add_action( "solr_cron_start", array( $this, "onStart" ) ); 12 12 add_action( "solr_cron_finish", array( $this, "onFinish" ) ); 13 13 } 14 14 15 function onStart() {15 function onStart(): void { 16 16 $this->plugin->log->start( 'Solr cron.php' ); 17 17 $this->plugin->log->addInfo( "Solr cron.php starts" ); 18 18 } 19 19 20 function onFinish() {20 function onFinish(): void { 21 21 $this->plugin->log->update( $this->plugin->timer->getDuration(), "Solr finished 🔎 🎉" ); 22 22 } -
cron-logger/tags/1.2.2/classes/Services/WPCron.php
r2587145 r3067274 4 4 5 5 6 use CronLogger\Components\Component; 6 7 use CronLogger\Plugin; 8 use WP_Post; 7 9 8 class WPCron {10 class WPCron extends Component { 9 11 10 var$times = array();12 private array $times = array(); 11 13 12 public function __construct( Plugin $plugin ) { 13 14 $this->log = $plugin->log; 15 $this->timer = $plugin->timer; 14 public function onCreate(): void { 16 15 17 16 if ( defined( 'DOING_CRON' ) && DOING_CRON ) { … … 25 24 } 26 25 27 function start() {26 function start(): void { 28 27 do_action( Plugin::ACTION_WP_CRON_START ); 29 $this-> log->start( "wp-cron.php" );28 $this->plugin->log->start( "wp-cron.php" ); 30 29 $this->addCronActions(); 31 30 } 32 31 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 🎉 ' ); 35 34 do_action( Plugin::ACTION_WP_CRON_FINISH ); 36 $this-> log->clean();35 $this->plugin->log->clean(); 37 36 } 38 37 39 function addCronActions() {38 function addCronActions(): void { 40 39 $crons = _get_cron_array(); 41 40 $registered = array(); … … 53 52 $msg = sprintf( __( "Registered hooks: %s", Plugin::DOMAIN ), implode( ', ', $registered ) ); 54 53 } 55 $this-> log->addInfo( $msg );54 $this->plugin->log->addInfo( $msg ); 56 55 } 57 56 58 function before_execute_cron_hook() {57 function before_execute_cron_hook(): void { 59 58 $this->times[ current_filter() ] = time(); 60 $this-> log->addInfo( "Starts " . current_filter() );59 $this->plugin->log->addInfo( "Starts " . current_filter() ); 61 60 } 62 61 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() ] ); 65 64 } 66 65 … … 70 69 * @param int $post_id 71 70 */ 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" ); 74 73 add_action( 'transition_post_status', array( $this, 'transition_post_status' ), 10, 3 ); 75 74 } … … 80 79 * @param $post 81 80 */ 82 public function publish_future_post_finish( $post ) {81 public function publish_future_post_finish( $post ): void { 83 82 remove_action( 'transition_post_status', array( $this, 'transition_post_status' ), 10 ); 84 83 } … … 89 88 * @param string $new_status 90 89 * @param string $old_status 91 * @param \WP_Post $post90 * @param WP_Post $post 92 91 */ 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( 95 94 "Status changed from <b>$old_status</b> -> <b>$new_status</b> of '{$post->post_title}'" 96 95 ); -
cron-logger/tags/1.2.2/classes/Timer.php
r2587145 r3067274 6 6 class Timer { 7 7 8 private $start;8 private int $start; 9 9 10 10 public function __construct() { … … 12 12 } 13 13 14 function getStart() {14 function getStart(): int { 15 15 return $this->start; 16 16 } 17 17 18 function getDuration() {18 function getDuration(): int { 19 19 return time() - $this->start; 20 20 } -
cron-logger/tags/1.2.2/classes/Updates.php
r2936889 r3067274 5 5 use CronLogger\Components\Update; 6 6 7 /**8 * @property Plugin $plugin9 */10 7 class Updates extends Update { 8 9 private Plugin $plugin; 11 10 12 11 public function __construct(Plugin $plugin) { … … 30 29 31 30 public function update_1(){ 31 global $wpdb; 32 32 $table = $this->plugin->log->table; 33 $ this->plugin->log->wpdb->query(33 $wpdb->query( 34 34 "ALTER TABLE $table ADD KEY (parent_id)" 35 35 ); -
cron-logger/tags/1.2.2/plugin.php
r2936889 r3067274 3 3 * Plugin Name: Cron Logger 4 4 * Description: Logs for wp-cron.php runs. 5 * Version: 1.2. 15 * Version: 1.2.2 6 6 * Requires at least: 5.3 7 * Tested up to: 6. 2.27 * Tested up to: 6.5.0 8 8 * Author: Palasthotel <[email protected]> (Edward Bock) 9 9 * Author URI: https://palasthotel.de 10 10 * Domain Path: /languages 11 11 * Text Domain: cron-logger 12 * @copyright Copyright (c) 2023, Palasthotel 12 * Requires PHP: 8.0 13 * @copyright Palasthotel 13 14 * @package Palasthotel\CronLogger 14 15 */ … … 18 19 require_once dirname( __FILE__ ) . "/vendor/autoload.php"; 19 20 20 21 /**22 * @property Timer timer23 * @property Log log24 * @property Services services25 * @property Page page26 * @property Updates $updates27 */28 21 class Plugin extends Components\Plugin { 29 22 … … 44 37 const TABLE_LOGS = "cron_logs"; 45 38 const OPTION_VERSION = "_cron_logger_version"; 39 40 public Timer $timer; 41 public Log $log; 42 46 43 /** 47 44 * Plugin constructor 48 45 */ 49 function onCreate() {46 function onCreate(): void { 50 47 51 48 $this->loadTextdomain( … … 56 53 $this->timer = new Timer(); 57 54 $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 ); 61 58 } 62 59 … … 64 61 * on activation 65 62 */ 66 function onSiteActivation() {67 $this->log->createTable ();63 function onSiteActivation(): void { 64 $this->log->createTables(); 68 65 } 69 66 } -
cron-logger/tags/1.2.2/vendor/composer/ClassLoader.php
r2936889 r3067274 46 46 private static $includeFile; 47 47 48 /** @var ?string*/48 /** @var string|null */ 49 49 private $vendorDir; 50 50 51 51 // PSR-4 52 52 /** 53 * @var array[] 54 * @psalm-var array<string, array<string, int>> 53 * @var array<string, array<string, int>> 55 54 */ 56 55 private $prefixLengthsPsr4 = array(); 57 56 /** 58 * @var array[] 59 * @psalm-var array<string, array<int, string>> 57 * @var array<string, list<string>> 60 58 */ 61 59 private $prefixDirsPsr4 = array(); 62 60 /** 63 * @var array[] 64 * @psalm-var array<string, string> 61 * @var list<string> 65 62 */ 66 63 private $fallbackDirsPsr4 = array(); … … 68 65 // PSR-0 69 66 /** 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>>> 72 72 */ 73 73 private $prefixesPsr0 = array(); 74 74 /** 75 * @var array[] 76 * @psalm-var array<string, string> 75 * @var list<string> 77 76 */ 78 77 private $fallbackDirsPsr0 = array(); … … 82 81 83 82 /** 84 * @var string[] 85 * @psalm-var array<string, string> 83 * @var array<string, string> 86 84 */ 87 85 private $classMap = array(); … … 91 89 92 90 /** 93 * @var bool[] 94 * @psalm-var array<string, bool> 91 * @var array<string, bool> 95 92 */ 96 93 private $missingClasses = array(); 97 94 98 /** @var ?string*/95 /** @var string|null */ 99 96 private $apcuPrefix; 100 97 101 98 /** 102 * @var self[]99 * @var array<string, self> 103 100 */ 104 101 private static $registeredLoaders = array(); 105 102 106 103 /** 107 * @param ?string$vendorDir104 * @param string|null $vendorDir 108 105 */ 109 106 public function __construct($vendorDir = null) … … 114 111 115 112 /** 116 * @return string[]113 * @return array<string, list<string>> 117 114 */ 118 115 public function getPrefixes() … … 126 123 127 124 /** 128 * @return array[] 129 * @psalm-return array<string, array<int, string>> 125 * @return array<string, list<string>> 130 126 */ 131 127 public function getPrefixesPsr4() … … 135 131 136 132 /** 137 * @return array[] 138 * @psalm-return array<string, string> 133 * @return list<string> 139 134 */ 140 135 public function getFallbackDirs() … … 144 139 145 140 /** 146 * @return array[] 147 * @psalm-return array<string, string> 141 * @return list<string> 148 142 */ 149 143 public function getFallbackDirsPsr4() … … 153 147 154 148 /** 155 * @return string[] Array of classname => path 156 * @psalm-return array<string, string> 149 * @return array<string, string> Array of classname => path 157 150 */ 158 151 public function getClassMap() … … 162 155 163 156 /** 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 166 158 * 167 159 * @return void … … 180 172 * appending or prepending to the ones previously set for this prefix. 181 173 * 182 * @param string $prefix The prefix183 * @param string[]|string $paths The PSR-0 root directories184 * @param bool $prepend Whether to prepend the directories174 * @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 185 177 * 186 178 * @return void … … 188 180 public function add($prefix, $paths, $prepend = false) 189 181 { 182 $paths = (array) $paths; 190 183 if (!$prefix) { 191 184 if ($prepend) { 192 185 $this->fallbackDirsPsr0 = array_merge( 193 (array)$paths,186 $paths, 194 187 $this->fallbackDirsPsr0 195 188 ); … … 197 190 $this->fallbackDirsPsr0 = array_merge( 198 191 $this->fallbackDirsPsr0, 199 (array)$paths192 $paths 200 193 ); 201 194 } … … 206 199 $first = $prefix[0]; 207 200 if (!isset($this->prefixesPsr0[$first][$prefix])) { 208 $this->prefixesPsr0[$first][$prefix] = (array)$paths;201 $this->prefixesPsr0[$first][$prefix] = $paths; 209 202 210 203 return; … … 212 205 if ($prepend) { 213 206 $this->prefixesPsr0[$first][$prefix] = array_merge( 214 (array)$paths,207 $paths, 215 208 $this->prefixesPsr0[$first][$prefix] 216 209 ); … … 218 211 $this->prefixesPsr0[$first][$prefix] = array_merge( 219 212 $this->prefixesPsr0[$first][$prefix], 220 (array)$paths213 $paths 221 214 ); 222 215 } … … 227 220 * appending or prepending to the ones previously set for this namespace. 228 221 * 229 * @param string $prefix The prefix/namespace, with trailing '\\'230 * @param string[]|string $paths The PSR-4 base directories231 * @param bool $prepend Whether to prepend the directories222 * @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 232 225 * 233 226 * @throws \InvalidArgumentException … … 237 230 public function addPsr4($prefix, $paths, $prepend = false) 238 231 { 232 $paths = (array) $paths; 239 233 if (!$prefix) { 240 234 // Register directories for the root namespace. 241 235 if ($prepend) { 242 236 $this->fallbackDirsPsr4 = array_merge( 243 (array)$paths,237 $paths, 244 238 $this->fallbackDirsPsr4 245 239 ); … … 247 241 $this->fallbackDirsPsr4 = array_merge( 248 242 $this->fallbackDirsPsr4, 249 (array)$paths243 $paths 250 244 ); 251 245 } … … 257 251 } 258 252 $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; 259 $this->prefixDirsPsr4[$prefix] = (array)$paths;253 $this->prefixDirsPsr4[$prefix] = $paths; 260 254 } elseif ($prepend) { 261 255 // Prepend directories for an already registered namespace. 262 256 $this->prefixDirsPsr4[$prefix] = array_merge( 263 (array)$paths,257 $paths, 264 258 $this->prefixDirsPsr4[$prefix] 265 259 ); … … 268 262 $this->prefixDirsPsr4[$prefix] = array_merge( 269 263 $this->prefixDirsPsr4[$prefix], 270 (array)$paths264 $paths 271 265 ); 272 266 } … … 277 271 * replacing any others previously set for this prefix. 278 272 * 279 * @param string $prefix The prefix280 * @param string[]|string $paths The PSR-0 base directories273 * @param string $prefix The prefix 274 * @param list<string>|string $paths The PSR-0 base directories 281 275 * 282 276 * @return void … … 295 289 * replacing any others previously set for this namespace. 296 290 * 297 * @param string $prefix The prefix/namespace, with trailing '\\'298 * @param string[]|string $paths The PSR-4 base directories291 * @param string $prefix The prefix/namespace, with trailing '\\' 292 * @param list<string>|string $paths The PSR-4 base directories 299 293 * 300 294 * @throws \InvalidArgumentException … … 430 424 { 431 425 if ($file = $this->findFile($class)) { 432 (self::$includeFile)($file); 426 $includeFile = self::$includeFile; 427 $includeFile($file); 433 428 434 429 return true; … … 481 476 482 477 /** 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> 486 481 */ 487 482 public static function getRegisteredLoaders() … … 561 556 } 562 557 563 private static function initializeIncludeClosure(): void 558 /** 559 * @return void 560 */ 561 private static function initializeIncludeClosure() 564 562 { 565 563 if (self::$includeFile !== null) { … … 575 573 * @return void 576 574 */ 577 self::$includeFile = static function($file) {575 self::$includeFile = \Closure::bind(static function($file) { 578 576 include $file; 579 } ;577 }, null, null); 580 578 } 581 579 } -
cron-logger/tags/1.2.2/vendor/composer/InstalledVersions.php
r2936889 r3067274 99 99 foreach (self::getInstalled() as $installed) { 100 100 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; 102 102 } 103 103 } … … 120 120 public static function satisfies(VersionParser $parser, $packageName, $constraint) 121 121 { 122 $constraint = $parser->parseConstraints( $constraint);122 $constraint = $parser->parseConstraints((string) $constraint); 123 123 $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); 124 124 … … 329 329 $installed[] = self::$installedByVendor[$vendorDir]; 330 330 } 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; 332 334 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 333 335 self::$installed = $installed[count($installed) - 1]; … … 341 343 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 342 344 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; 344 348 } else { 345 349 self::$installed = array(); 346 350 } 347 351 } 348 $installed[] = self::$installed; 352 353 if (self::$installed !== array()) { 354 $installed[] = self::$installed; 355 } 349 356 350 357 return $installed; -
cron-logger/tags/1.2.2/vendor/composer/installed.php
r2936889 r3067274 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' 6ac0a6e4df6c4168adaed278efaa4cbc59a895bb',6 'reference' => 'fec4f5c6b21d3612292a1791bcf9061c8d56085a', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-master', 15 15 'version' => 'dev-master', 16 'reference' => ' 6ac0a6e4df6c4168adaed278efaa4cbc59a895bb',16 'reference' => 'fec4f5c6b21d3612292a1791bcf9061c8d56085a', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../', -
cron-logger/trunk/README.txt
r2936889 r3067274 4 4 Tags: tool, log, debug, cron, wp-cron 5 5 Requires at least: 5.3 6 Tested up to: 6.2.2 7 Stable tag: 1.2.1 6 Tested up to: 6.5.0 7 Stable tag: 1.2.2 8 Requires PHP: 8.0 8 9 License: GPLv3 9 10 License URI: http://www.gnu.org/licenses/gpl … … 28 29 29 30 == Changelog == 31 32 = 1.2.2 33 * Fix: PHP 8.2 warnings 30 34 31 35 = 1.2.1 -
cron-logger/trunk/classes/Components/Plugin.php
r2587145 r3067274 1 1 <?php 2 2 3 namespace CronLogger\Components; 3 4 … … 6 7 7 8 /** 8 * @property string path 9 * @property string url 10 * @property string basename 11 * @version 0.1.3 9 * @version 0.1.4 12 10 */ 13 11 abstract class Plugin { 14 12 15 /** 16 * @var ReflectionClass 17 */ 18 private $ref; 13 private ReflectionClass $ref; 19 14 20 private $tooLateForTextdomain; 15 private bool $tooLateForTextdomain; 16 public string $path; 17 public string $url; 18 public string $basename; 21 19 22 20 /** … … 36 34 register_deactivation_hook( $this->ref->getFileName(), array( $this, "onDeactivation" ) ); 37 35 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, "/"); 38 44 } 39 45 -
cron-logger/trunk/classes/Log.php
r2936889 r3067274 3 3 namespace CronLogger; 4 4 5 use wpdb;5 use CronLogger\Components\Database; 6 6 7 /** 8 * @property wpdb $wpdb 9 * @property string $table 10 */ 11 class Log { 7 class Log extends Database { 12 8 13 private $plugin;14 9 private $log_id = null; 15 private $errors = array(); 10 public $errors = array(); 11 public string $table; 16 12 17 public function __construct( Plugin $plugin ) { 18 $this->plugin = $plugin; 19 global $wpdb; 20 $this->wpdb = $wpdb; 13 public function init() { 21 14 $this->table = $this->wpdb->prefix . Plugin::TABLE_LOGS; 22 15 } 23 16 24 function start( $info = "" ) {17 function start( $info = "" ): void { 25 18 if ( $this->log_id != null ) { 26 19 error_log( "Only start logger once per session.", 4 ); … … 31 24 $this->table, 32 25 array( 33 'executed' => $this->plugin->timer->getStart(),26 'executed' => Plugin::instance()->timer->getStart(), 34 27 'duration' => 0, 35 28 'info' => "Running ⏳ $info", … … 44 37 } 45 38 46 function update( $duration, $info = null ) {39 function update( $duration, $info = null ): int { 47 40 48 41 if ( $this->log_id == null ) { … … 69 62 } 70 63 71 function addInfo( $message, $duration = null ) {64 function addInfo( $message, $duration = null ): void { 72 65 $result = $this->wpdb->insert( 73 66 $this->table, … … 92 85 } else { 93 86 $this->update( 94 $this->plugin->timer->getDuration()87 Plugin::instance()->timer->getDuration() 95 88 ); 96 89 } … … 98 91 } 99 92 100 function getList( $args = array() ) {93 function getList( $args = array() ): array { 101 94 $args = (object) array_merge( 102 95 array( … … 118 111 } 119 112 120 function getSublist( $log_id, $count = 50, $page = 0 ) {113 function getSublist( $log_id, $count = 50, $page = 0 ): array { 121 114 $offset = $count * $page; 122 115 … … 126 119 } 127 120 128 function clean() {121 function clean(): void { 129 122 $table = $this->table; 130 123 $days = apply_filters( Plugin::FILTER_EXPIRE, 14 ); … … 139 132 } 140 133 141 function createTable () {142 require_once( ABSPATH . 'wp-admin/includes/upgrade.php');134 function createTables() { 135 parent::createTables(); 143 136 dbDelta( "CREATE TABLE IF NOT EXISTS " . $this->table . " 144 137 ( -
cron-logger/trunk/classes/Page.php
r2587145 r3067274 10 10 11 11 12 class Page { 12 use CronLogger\Components\Component; 13 14 class Page extends Component { 13 15 14 16 const ARG_ITEMS = "cron-logs-items"; … … 18 20 const ARG_DURATION_MIN = "cron-logs-dm"; 19 21 20 public function __construct( Plugin $plugin ) { 21 $this->plugin = $plugin; 22 public function onCreate() { 22 23 add_action( 'admin_menu', array( $this, 'menu_pages' ) ); 23 24 } … … 126 127 echo $time->format( "Y-m-d H:i:s" ); 127 128 ?></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> 129 130 <td style="border-top: 3px solid #333;"><?php echo $log->info; ?></td> 130 131 </tr> … … 135 136 <tr data-parent-id="<?php echo $log->id; ?>"> 136 137 <td></td> 137 <td><?php echo getDurationString( $sub->duration ); ?></td>138 <td><?php echo $this->getDurationString( $sub->duration ); ?></td> 138 139 <td><?php echo $sub->info; ?></td> 139 140 </tr> … … 147 148 <script> 148 149 jQuery(function ($) { 149 var$logs = $('[data-log-id]');150 const $logs = $('[data-log-id]'); 150 151 $logs.on('click', function () { 151 varid = $(this).attr('data-log-id');152 const id = $(this).attr('data-log-id'); 152 153 console.log('clicked', id); 153 154 $('[data-parent-id=' + id + ']').toggle(); 154 155 }); 155 varisVisible = true;156 let isVisible = true; 156 157 $('[name=toggle_logs]').on('click', function () { 157 158 if (isVisible) { … … 168 169 } 169 170 171 private function getDurationString($duration ): string { 172 if ( $duration == null ) { 173 return ""; 174 } 175 176 return $duration . "s"; 177 } 178 170 179 } 171 180 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 7 7 use CronLogger\Services\WPCron; 8 8 9 /** 10 * @property WPCron wp_cron 11 * @property SolrPlugin solr 12 */ 9 13 10 class Services { 14 public function __construct( Plugin $plugin ) {15 11 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 ); 18 16 19 17 add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) ); … … 21 19 } 22 20 23 function plugins_loaded() {21 function plugins_loaded(): void { 24 22 do_action( Plugin::ACTION_INIT, Plugin::instance() ); 25 23 } -
cron-logger/trunk/classes/Services/SolrPlugin.php
r2587145 r3067274 4 4 5 5 6 use CronLogger\ Plugin;6 use CronLogger\Components\Component; 7 7 8 class SolrPlugin {9 public function __construct( Plugin $plugin ) { 10 $this->plugin = $plugin;8 class SolrPlugin extends Component { 9 10 public function onCreate(): void { 11 11 add_action( "solr_cron_start", array( $this, "onStart" ) ); 12 12 add_action( "solr_cron_finish", array( $this, "onFinish" ) ); 13 13 } 14 14 15 function onStart() {15 function onStart(): void { 16 16 $this->plugin->log->start( 'Solr cron.php' ); 17 17 $this->plugin->log->addInfo( "Solr cron.php starts" ); 18 18 } 19 19 20 function onFinish() {20 function onFinish(): void { 21 21 $this->plugin->log->update( $this->plugin->timer->getDuration(), "Solr finished 🔎 🎉" ); 22 22 } -
cron-logger/trunk/classes/Services/WPCron.php
r2587145 r3067274 4 4 5 5 6 use CronLogger\Components\Component; 6 7 use CronLogger\Plugin; 8 use WP_Post; 7 9 8 class WPCron {10 class WPCron extends Component { 9 11 10 var$times = array();12 private array $times = array(); 11 13 12 public function __construct( Plugin $plugin ) { 13 14 $this->log = $plugin->log; 15 $this->timer = $plugin->timer; 14 public function onCreate(): void { 16 15 17 16 if ( defined( 'DOING_CRON' ) && DOING_CRON ) { … … 25 24 } 26 25 27 function start() {26 function start(): void { 28 27 do_action( Plugin::ACTION_WP_CRON_START ); 29 $this-> log->start( "wp-cron.php" );28 $this->plugin->log->start( "wp-cron.php" ); 30 29 $this->addCronActions(); 31 30 } 32 31 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 🎉 ' ); 35 34 do_action( Plugin::ACTION_WP_CRON_FINISH ); 36 $this-> log->clean();35 $this->plugin->log->clean(); 37 36 } 38 37 39 function addCronActions() {38 function addCronActions(): void { 40 39 $crons = _get_cron_array(); 41 40 $registered = array(); … … 53 52 $msg = sprintf( __( "Registered hooks: %s", Plugin::DOMAIN ), implode( ', ', $registered ) ); 54 53 } 55 $this-> log->addInfo( $msg );54 $this->plugin->log->addInfo( $msg ); 56 55 } 57 56 58 function before_execute_cron_hook() {57 function before_execute_cron_hook(): void { 59 58 $this->times[ current_filter() ] = time(); 60 $this-> log->addInfo( "Starts " . current_filter() );59 $this->plugin->log->addInfo( "Starts " . current_filter() ); 61 60 } 62 61 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() ] ); 65 64 } 66 65 … … 70 69 * @param int $post_id 71 70 */ 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" ); 74 73 add_action( 'transition_post_status', array( $this, 'transition_post_status' ), 10, 3 ); 75 74 } … … 80 79 * @param $post 81 80 */ 82 public function publish_future_post_finish( $post ) {81 public function publish_future_post_finish( $post ): void { 83 82 remove_action( 'transition_post_status', array( $this, 'transition_post_status' ), 10 ); 84 83 } … … 89 88 * @param string $new_status 90 89 * @param string $old_status 91 * @param \WP_Post $post90 * @param WP_Post $post 92 91 */ 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( 95 94 "Status changed from <b>$old_status</b> -> <b>$new_status</b> of '{$post->post_title}'" 96 95 ); -
cron-logger/trunk/classes/Timer.php
r2587145 r3067274 6 6 class Timer { 7 7 8 private $start;8 private int $start; 9 9 10 10 public function __construct() { … … 12 12 } 13 13 14 function getStart() {14 function getStart(): int { 15 15 return $this->start; 16 16 } 17 17 18 function getDuration() {18 function getDuration(): int { 19 19 return time() - $this->start; 20 20 } -
cron-logger/trunk/classes/Updates.php
r2936889 r3067274 5 5 use CronLogger\Components\Update; 6 6 7 /**8 * @property Plugin $plugin9 */10 7 class Updates extends Update { 8 9 private Plugin $plugin; 11 10 12 11 public function __construct(Plugin $plugin) { … … 30 29 31 30 public function update_1(){ 31 global $wpdb; 32 32 $table = $this->plugin->log->table; 33 $ this->plugin->log->wpdb->query(33 $wpdb->query( 34 34 "ALTER TABLE $table ADD KEY (parent_id)" 35 35 ); -
cron-logger/trunk/plugin.php
r2936889 r3067274 3 3 * Plugin Name: Cron Logger 4 4 * Description: Logs for wp-cron.php runs. 5 * Version: 1.2. 15 * Version: 1.2.2 6 6 * Requires at least: 5.3 7 * Tested up to: 6. 2.27 * Tested up to: 6.5.0 8 8 * Author: Palasthotel <[email protected]> (Edward Bock) 9 9 * Author URI: https://palasthotel.de 10 10 * Domain Path: /languages 11 11 * Text Domain: cron-logger 12 * @copyright Copyright (c) 2023, Palasthotel 12 * Requires PHP: 8.0 13 * @copyright Palasthotel 13 14 * @package Palasthotel\CronLogger 14 15 */ … … 18 19 require_once dirname( __FILE__ ) . "/vendor/autoload.php"; 19 20 20 21 /**22 * @property Timer timer23 * @property Log log24 * @property Services services25 * @property Page page26 * @property Updates $updates27 */28 21 class Plugin extends Components\Plugin { 29 22 … … 44 37 const TABLE_LOGS = "cron_logs"; 45 38 const OPTION_VERSION = "_cron_logger_version"; 39 40 public Timer $timer; 41 public Log $log; 42 46 43 /** 47 44 * Plugin constructor 48 45 */ 49 function onCreate() {46 function onCreate(): void { 50 47 51 48 $this->loadTextdomain( … … 56 53 $this->timer = new Timer(); 57 54 $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 ); 61 58 } 62 59 … … 64 61 * on activation 65 62 */ 66 function onSiteActivation() {67 $this->log->createTable ();63 function onSiteActivation(): void { 64 $this->log->createTables(); 68 65 } 69 66 } -
cron-logger/trunk/vendor/composer/ClassLoader.php
r2936889 r3067274 46 46 private static $includeFile; 47 47 48 /** @var ?string*/48 /** @var string|null */ 49 49 private $vendorDir; 50 50 51 51 // PSR-4 52 52 /** 53 * @var array[] 54 * @psalm-var array<string, array<string, int>> 53 * @var array<string, array<string, int>> 55 54 */ 56 55 private $prefixLengthsPsr4 = array(); 57 56 /** 58 * @var array[] 59 * @psalm-var array<string, array<int, string>> 57 * @var array<string, list<string>> 60 58 */ 61 59 private $prefixDirsPsr4 = array(); 62 60 /** 63 * @var array[] 64 * @psalm-var array<string, string> 61 * @var list<string> 65 62 */ 66 63 private $fallbackDirsPsr4 = array(); … … 68 65 // PSR-0 69 66 /** 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>>> 72 72 */ 73 73 private $prefixesPsr0 = array(); 74 74 /** 75 * @var array[] 76 * @psalm-var array<string, string> 75 * @var list<string> 77 76 */ 78 77 private $fallbackDirsPsr0 = array(); … … 82 81 83 82 /** 84 * @var string[] 85 * @psalm-var array<string, string> 83 * @var array<string, string> 86 84 */ 87 85 private $classMap = array(); … … 91 89 92 90 /** 93 * @var bool[] 94 * @psalm-var array<string, bool> 91 * @var array<string, bool> 95 92 */ 96 93 private $missingClasses = array(); 97 94 98 /** @var ?string*/95 /** @var string|null */ 99 96 private $apcuPrefix; 100 97 101 98 /** 102 * @var self[]99 * @var array<string, self> 103 100 */ 104 101 private static $registeredLoaders = array(); 105 102 106 103 /** 107 * @param ?string$vendorDir104 * @param string|null $vendorDir 108 105 */ 109 106 public function __construct($vendorDir = null) … … 114 111 115 112 /** 116 * @return string[]113 * @return array<string, list<string>> 117 114 */ 118 115 public function getPrefixes() … … 126 123 127 124 /** 128 * @return array[] 129 * @psalm-return array<string, array<int, string>> 125 * @return array<string, list<string>> 130 126 */ 131 127 public function getPrefixesPsr4() … … 135 131 136 132 /** 137 * @return array[] 138 * @psalm-return array<string, string> 133 * @return list<string> 139 134 */ 140 135 public function getFallbackDirs() … … 144 139 145 140 /** 146 * @return array[] 147 * @psalm-return array<string, string> 141 * @return list<string> 148 142 */ 149 143 public function getFallbackDirsPsr4() … … 153 147 154 148 /** 155 * @return string[] Array of classname => path 156 * @psalm-return array<string, string> 149 * @return array<string, string> Array of classname => path 157 150 */ 158 151 public function getClassMap() … … 162 155 163 156 /** 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 166 158 * 167 159 * @return void … … 180 172 * appending or prepending to the ones previously set for this prefix. 181 173 * 182 * @param string $prefix The prefix183 * @param string[]|string $paths The PSR-0 root directories184 * @param bool $prepend Whether to prepend the directories174 * @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 185 177 * 186 178 * @return void … … 188 180 public function add($prefix, $paths, $prepend = false) 189 181 { 182 $paths = (array) $paths; 190 183 if (!$prefix) { 191 184 if ($prepend) { 192 185 $this->fallbackDirsPsr0 = array_merge( 193 (array)$paths,186 $paths, 194 187 $this->fallbackDirsPsr0 195 188 ); … … 197 190 $this->fallbackDirsPsr0 = array_merge( 198 191 $this->fallbackDirsPsr0, 199 (array)$paths192 $paths 200 193 ); 201 194 } … … 206 199 $first = $prefix[0]; 207 200 if (!isset($this->prefixesPsr0[$first][$prefix])) { 208 $this->prefixesPsr0[$first][$prefix] = (array)$paths;201 $this->prefixesPsr0[$first][$prefix] = $paths; 209 202 210 203 return; … … 212 205 if ($prepend) { 213 206 $this->prefixesPsr0[$first][$prefix] = array_merge( 214 (array)$paths,207 $paths, 215 208 $this->prefixesPsr0[$first][$prefix] 216 209 ); … … 218 211 $this->prefixesPsr0[$first][$prefix] = array_merge( 219 212 $this->prefixesPsr0[$first][$prefix], 220 (array)$paths213 $paths 221 214 ); 222 215 } … … 227 220 * appending or prepending to the ones previously set for this namespace. 228 221 * 229 * @param string $prefix The prefix/namespace, with trailing '\\'230 * @param string[]|string $paths The PSR-4 base directories231 * @param bool $prepend Whether to prepend the directories222 * @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 232 225 * 233 226 * @throws \InvalidArgumentException … … 237 230 public function addPsr4($prefix, $paths, $prepend = false) 238 231 { 232 $paths = (array) $paths; 239 233 if (!$prefix) { 240 234 // Register directories for the root namespace. 241 235 if ($prepend) { 242 236 $this->fallbackDirsPsr4 = array_merge( 243 (array)$paths,237 $paths, 244 238 $this->fallbackDirsPsr4 245 239 ); … … 247 241 $this->fallbackDirsPsr4 = array_merge( 248 242 $this->fallbackDirsPsr4, 249 (array)$paths243 $paths 250 244 ); 251 245 } … … 257 251 } 258 252 $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; 259 $this->prefixDirsPsr4[$prefix] = (array)$paths;253 $this->prefixDirsPsr4[$prefix] = $paths; 260 254 } elseif ($prepend) { 261 255 // Prepend directories for an already registered namespace. 262 256 $this->prefixDirsPsr4[$prefix] = array_merge( 263 (array)$paths,257 $paths, 264 258 $this->prefixDirsPsr4[$prefix] 265 259 ); … … 268 262 $this->prefixDirsPsr4[$prefix] = array_merge( 269 263 $this->prefixDirsPsr4[$prefix], 270 (array)$paths264 $paths 271 265 ); 272 266 } … … 277 271 * replacing any others previously set for this prefix. 278 272 * 279 * @param string $prefix The prefix280 * @param string[]|string $paths The PSR-0 base directories273 * @param string $prefix The prefix 274 * @param list<string>|string $paths The PSR-0 base directories 281 275 * 282 276 * @return void … … 295 289 * replacing any others previously set for this namespace. 296 290 * 297 * @param string $prefix The prefix/namespace, with trailing '\\'298 * @param string[]|string $paths The PSR-4 base directories291 * @param string $prefix The prefix/namespace, with trailing '\\' 292 * @param list<string>|string $paths The PSR-4 base directories 299 293 * 300 294 * @throws \InvalidArgumentException … … 430 424 { 431 425 if ($file = $this->findFile($class)) { 432 (self::$includeFile)($file); 426 $includeFile = self::$includeFile; 427 $includeFile($file); 433 428 434 429 return true; … … 481 476 482 477 /** 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> 486 481 */ 487 482 public static function getRegisteredLoaders() … … 561 556 } 562 557 563 private static function initializeIncludeClosure(): void 558 /** 559 * @return void 560 */ 561 private static function initializeIncludeClosure() 564 562 { 565 563 if (self::$includeFile !== null) { … … 575 573 * @return void 576 574 */ 577 self::$includeFile = static function($file) {575 self::$includeFile = \Closure::bind(static function($file) { 578 576 include $file; 579 } ;577 }, null, null); 580 578 } 581 579 } -
cron-logger/trunk/vendor/composer/InstalledVersions.php
r2936889 r3067274 99 99 foreach (self::getInstalled() as $installed) { 100 100 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; 102 102 } 103 103 } … … 120 120 public static function satisfies(VersionParser $parser, $packageName, $constraint) 121 121 { 122 $constraint = $parser->parseConstraints( $constraint);122 $constraint = $parser->parseConstraints((string) $constraint); 123 123 $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); 124 124 … … 329 329 $installed[] = self::$installedByVendor[$vendorDir]; 330 330 } 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; 332 334 if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { 333 335 self::$installed = $installed[count($installed) - 1]; … … 341 343 // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 342 344 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; 344 348 } else { 345 349 self::$installed = array(); 346 350 } 347 351 } 348 $installed[] = self::$installed; 352 353 if (self::$installed !== array()) { 354 $installed[] = self::$installed; 355 } 349 356 350 357 return $installed; -
cron-logger/trunk/vendor/composer/installed.php
r2936889 r3067274 4 4 'pretty_version' => 'dev-master', 5 5 'version' => 'dev-master', 6 'reference' => ' 6ac0a6e4df6c4168adaed278efaa4cbc59a895bb',6 'reference' => 'fec4f5c6b21d3612292a1791bcf9061c8d56085a', 7 7 'type' => 'library', 8 8 'install_path' => __DIR__ . '/../../', … … 14 14 'pretty_version' => 'dev-master', 15 15 'version' => 'dev-master', 16 'reference' => ' 6ac0a6e4df6c4168adaed278efaa4cbc59a895bb',16 'reference' => 'fec4f5c6b21d3612292a1791bcf9061c8d56085a', 17 17 'type' => 'library', 18 18 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.