<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[11369] sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin: SVN Watcher: Reports: Avoid some PHP Notices, and compress the versions contributed to table.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://meta.trac.wordpress.org/changeset/11369">11369</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://meta.trac.wordpress.org/changeset/11369","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>dd32</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2021-12-14 04:39:01 +0000 (Tue, 14 Dec 2021)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>SVN Watcher: Reports: Avoid some PHP Notices, and compress the versions contributed to table. Instead of showing `3.0, 3.1, .... 5.8` just show `3.0-5.8`.
See <a href="http://meta.trac.wordpress.org/ticket/5978">#5978</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporgtracwatcheradminlisttablephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/list-table.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporgtracwatcheradminreportspagephp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/reports-page.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginswporgtracwatcheradminuiphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/ui.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporgtracwatcheradminlisttablephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/list-table.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/list-table.php 2021-12-14 01:37:15 UTC (rev 11368)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/list-table.php 2021-12-14 04:39:01 UTC (rev 11369)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -56,22 +56,26 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $args['version'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $where .= $wpdb->prepare( ' AND version LIKE %s', $wpdb->esc_like( $args['version'] ) . '%' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $where .= $wpdb->prepare( ' AND r.version LIKE %s', $wpdb->esc_like( $args['version'] ) . '%' );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $args['branch'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $where .= $wpdb->prepare( ' AND branch LIKE %s', $wpdb->esc_like( $args['branch'] ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $where .= $wpdb->prepare( ' AND r.branch LIKE %s', $wpdb->esc_like( $args['branch'] ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! empty( $args['revisions'] ) && preg_match( '!(?P<start>\d+):(?P<end>\d+)!', $args['revisions'], $m ) ) {
- $where .= $wpdb->prepare( ' AND id BETWEEN %d AND %d', $m['start'], $m['end'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $args['revisions'] ) && preg_match( '!(?P<start>\d+)[:-](?P<end>(HEAD|\d+))!', $args['revisions'], $m ) ) {
+ if ( 'HEAD' === $m['end'] ) {
+ $where .= $wpdb->prepare( ' AND r.id > %d', $m['start'] );
+ } else {
+ $where .= $wpdb->prepare( ' AND r.id BETWEEN %d AND %d', $m['start'], $m['end'] );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $args['revisions'] ) && preg_match( '!^[\d,]+$!', $args['revisions'], $m ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $ids = implode(',', array_map( 'intval', explode( ',', $args['revisions'] ) ) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $where .= " AND id IN({$ids})";
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $where .= " AND r.id IN({$ids})";
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $args['author'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $where .= $wpdb->prepare( ' AND author = %s', $args['author'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $where .= $wpdb->prepare( ' AND r.author = %s', $args['author'] );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $args['s'] ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -79,14 +83,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $join .= "LEFT JOIN {$props_table} p ON r.id = p.revision";
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> $where .= $wpdb->prepare(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ' AND ( message LIKE %s OR p.prop_name LIKE %s )',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ' AND ( r.message LIKE %s OR p.prop_name LIKE %s )',
</ins><span class="cx" style="display: block; padding: 0 10px"> '%' . $wpdb->esc_like( $args['s'] ) . '%',
</span><span class="cx" style="display: block; padding: 0 10px"> '%' . $wpdb->esc_like( $args['s'] ) . '%',
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // $where .= ' AND r.id IN( 46290, 51195, 50933, 50810 )';
-
</del><span class="cx" style="display: block; padding: 0 10px"> $this->items = $wpdb->get_results(
</span><span class="cx" style="display: block; padding: 0 10px"> "SELECT SQL_CALC_FOUND_ROWS r.* FROM {$rev_table} r
</span><span class="cx" style="display: block; padding: 0 10px"> {$join}
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -116,13 +118,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $revisions = wp_list_pluck( $this->items, 'id' );
</span><span class="cx" style="display: block; padding: 0 10px"> $revisions = implode( ',', array_map( 'intval', $revisions ) );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $props_list = $wpdb->get_results( $wpdb->prepare(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $props_list = $wpdb->get_results(
</ins><span class="cx" style="display: block; padding: 0 10px"> "SELECT revision,user_id,prop_name
</span><span class="cx" style="display: block; padding: 0 10px"> FROM {$props_table}
</span><span class="cx" style="display: block; padding: 0 10px"> WHERE revision IN({$revisions})
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- ORDER BY LENGTH(prop_name) DESC
- "
- ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ ORDER BY LENGTH(prop_name) DESC"
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $this->items as $i => $details ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $this->items[$i]->props = wp_list_pluck(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -214,12 +215,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $views = [
</span><span class="cx" style="display: block; padding: 0 10px"> 'all' => '<a href="' . esc_url( $url ) . '">All</a>',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'unknown-props' => '<a href="' . esc_url( add_query_arg( [ 'unknown-props' => 1 ], $url ) ) . '">Unknown Props</a>',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'unknown-props' => '<a href="' . esc_url( add_query_arg( 'unknown-props', 1, $url ) ) . '">Unknown Props</a>',
</ins><span class="cx" style="display: block; padding: 0 10px"> ];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( defined( 'WP_CORE_LATEST_RELEASE' ) && 'core' === $this->svn['slug'] ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $v = sprintf( '%.1f', ((float)WP_CORE_LATEST_RELEASE+0.1) );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $views['commits-to-trunk'] = '<a href="' . esc_url( add_query_arg( [ 'version' => $v ], $url ) ) . '">Commits to ' . $v .'</a>';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $views['commits-to-trunk'] = '<a href="' . esc_url( add_query_arg( 'version', $v, $url ) ) . '">Commits to ' . $v .'</a>';
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> return $views;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -344,7 +345,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $output .= sprintf(
</span><span class="cx" style="display: block; padding: 0 10px"> '<span class="user" data-prop="%s" data-user="%s">',
</span><span class="cx" style="display: block; padding: 0 10px"> esc_attr( $prop ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- esc_attr( $user->user_login )
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ esc_attr( $user->user_login ?? '' )
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $user ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $output .= '<a href="' . esc_url( $profile ) . '" target="_blank">';
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporgtracwatcheradminreportspagephp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/reports-page.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/reports-page.php 2021-12-14 01:37:15 UTC (rev 11368)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/reports-page.php 2021-12-14 04:39:01 UTC (rev 11369)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -5,10 +5,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> global $wpdb;
</span><span class="cx" style="display: block; padding: 0 10px"> $url = add_query_arg( 'page', $_REQUEST['page'], admin_url( 'admin.php' ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $what = $_REQUEST['what'] ?? '';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $version = $_REQUEST['version'] ?? (WP_CORE_LATEST_RELEASE+0.1);
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $version = $_REQUEST['version'] ?? null;
</ins><span class="cx" style="display: block; padding: 0 10px"> $revisions = $_REQUEST['revisions'] ?? '';
</span><span class="cx" style="display: block; padding: 0 10px"> $branch = $_REQUEST['branch'] ?? '';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $is_core = ( 'core' === $details['slug'] );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Default to the latest version for core.
+ if ( $is_core && is_null( $version ) ) {
+ $version = sprintf( '%.1f', WP_CORE_LATEST_RELEASE + 0.1 );
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $url = add_query_arg( 'version', $version, $url );
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="wrap">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -20,7 +26,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <li><a href="<?php echo $url; ?>&what=typos">Props typos matching filter</a></li>
</span><span class="cx" style="display: block; padding: 0 10px"> <li><a href="<?php echo $url; ?>&what=raw-contributors-and-committers">All Props+Committers matching filter grouped together</a></li>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php if ( $is_core ) { ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> <li><a href="<?php echo $url; ?>&what=versions-contributed">Versions which users have contributed to. Ignores filter.</a></li>
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <?php } ?>
</ins><span class="cx" style="display: block; padding: 0 10px"> </ol>
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <form>
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -28,7 +36,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> <input type="hidden" name="what" value="<?php echo esc_attr( $what ); ?>">
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> <?php
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( 'core' === $details['slug'] ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( $is_core ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> echo '<select name="version"><option value="">Version</option>';
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( get_wordpress_versions() as $v ) {
</span><span class="cx" style="display: block; padding: 0 10px"> printf(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -56,7 +64,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Revision range.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- echo '<input type="text" name="revisions" placeholder="Revs: 1:50 or 1,2,4,5" value="' . esc_attr( $revisions ) .'">';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ echo '<input type="text" name="revisions" placeholder="Revs: 1:HEAD or 1,2,4,5" value="' . esc_attr( $revisions ) .'">';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> echo '<input type="submit" class="button button-primary" value="Filter">';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -69,8 +77,12 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Revisions.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! empty( $revisions ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( false !== strpos( $revisions, ':' ) || false !== strpos( $revisions, '-' ) ) {
- $where .= $wpdb->prepare( ' AND r.id BETWEEN %d AND %d', preg_split( '![-:]!', $revisions ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( preg_match( '!(?P<start>\d+)[:-](?P<end>(HEAD|\d+))!', $args['revisions'], $m ) ) {
+ if ( 'HEAD' === $m['end'] ) {
+ $where .= $wpdb->prepare( ' AND r.id > %d', $m['start'] );
+ } else {
+ $where .= $wpdb->prepare( ' AND r.id BETWEEN %d AND %d', $m['start'], $m['end'] );
+ }
</ins><span class="cx" style="display: block; padding: 0 10px"> } elseif ( false !== strpos( $revisions, ',' ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $ids = implode( ',', array_map( 'intval', explode( ',', $revisions ) ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $where .= " AND r.id IN({$ids})";
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -200,6 +212,80 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ORDER BY `count` DESC"
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Compress the versions list down to a smaller range.
+ $compress = function( $versions ) {
+ $in = $versions;
+ $out = [];
+ if ( ! is_array( $versions ) ) {
+ $versions = preg_split( '![,\s]+!', $versions );
+ }
+
+ // Don't try to compress only a few versions.
+ if ( count( $versions ) <= 2 ) {
+ return $in;
+ }
+
+ // [ X.Y => 0, X.Y+1 => 1, ... ]
+ $versions = array_flip( $versions );
+
+ $not_a_version = [
+ '0.9', '1.1', '1.2', '1.4', '1.7', '1.8', '1.9',
+ ];
+
+ // 2.4 + 2.5 are special. 2.4 was skipped, and many users only have a 2.4 or a 2.5 prop. Give them both versions if they have either.
+ if ( isset( $versions['2.5'] ) || isset( $versions['2.4'] ) ) {
+ $versions['2.5'] = $version['2.4'] = 1;
+ }
+
+ $i = 0; // This counter is just here to protect against infinite loops should something go wrong.
+ while ( $versions && $i++ < 40 ) {
+ $min = sprintf( '%.1f', min( array_keys( $versions ) ) );
+ $max = sprintf( '%.1f', max( array_keys( $versions ) ) );
+ if ( $min === $max ) {
+ $out[] = $min;
+ break;
+ } elseif ( $max - $min < 0.2 ) {
+ $out[] = "{$min}-{$max}";
+ break;
+ }
+
+ foreach ( range( $min, $max+0.1, 0.1 ) as $v ) {
+ $v = sprintf( '%.1f', $v );
+
+ if ( in_array( $v, $not_a_version ) ) {
+ unset( $versions[ $v ] );
+ continue;
+ }
+
+ if ( ! isset( $versions[ $v ] ) ) {
+ $last = sprintf( '%.1f', $v - 0.1 );
+
+ if ( $last == $min ) {
+ $out[] = $last;
+ unset( $versions[ $v ] );
+ break;
+ } elseif ( $last - $min < 0.15 ) {
+ // No point doing 1-2, just do 1, 2
+ $out[] = $min;
+ $out[] = $last;
+ } else {
+ $out[] = "{$min}-{$last}";
+ }
+ break;
+ } elseif ( $v == $max ) {
+ $out[] = "{$min}-{$max}"; // (5)";
+ unset( $versions[ $v ] );
+ break;
+ } else {
+ // no break. We're between a start, and end version.
+ }
+ unset( $versions[ $v ] );
+ }
+ }
+
+ return implode( ', ', $out );
+ };
+
</ins><span class="cx" style="display: block; padding: 0 10px"> echo '<table class="widefat striped">';
</span><span class="cx" style="display: block; padding: 0 10px"> echo '<thead><tr><th>Prop</th><th>Count</th><th>Versions</th></tr></thead>';
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $details as $p ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -222,7 +308,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $profile,
</span><span class="cx" style="display: block; padding: 0 10px"> $p->count,
</span><span class="cx" style="display: block; padding: 0 10px"> esc_attr( $p->versions ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $p->versions
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $compress( $p->versions )
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> echo '</table>';
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginswporgtracwatcheradminuiphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/ui.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/ui.php 2021-12-14 01:37:15 UTC (rev 11368)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-trac-watcher/admin/ui.php 2021-12-14 04:39:01 UTC (rev 11369)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -77,12 +77,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> function display_list_table( $details ) {
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $url = add_query_arg( 'page', $_REQUEST['page'], admin_url( 'admin.php' ) );
</ins><span class="cx" style="display: block; padding: 0 10px"> $table = new Commits_List_Table( $details );
</span><span class="cx" style="display: block; padding: 0 10px"> $table->prepare_items( $_REQUEST );
</span><span class="cx" style="display: block; padding: 0 10px"> ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <div class="wrap propstable">
</span><span class="cx" style="display: block; padding: 0 10px"> <h2><?php echo esc_html( $details['name'] ); ?> Props</h2>
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- <form method="GET" action="<?php echo esc_url( add_query_arg() ); ?>">
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ <form method="GET" action="<?php echo esc_url( $url ); ?>">
</ins><span class="cx" style="display: block; padding: 0 10px"> <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
</span><span class="cx" style="display: block; padding: 0 10px"> <?php $table->search_box( 'Search', 's' ); ?>
</span><span class="cx" style="display: block; padding: 0 10px"> <?php $table->display(); ?>
</span></span></pre>
</div>
</div>
</body>
</html>