<!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>[11588] sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory: Theme Directory: Add an email for failed theme imports from SVN.</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/11588">11588</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/11588","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>2022-02-21 08:18:07 +0000 (Mon, 21 Feb 2022)</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'>Theme Directory: Add an email for failed theme imports from SVN.
Theme Check still runs on theme updates via SVN, and will reject themes that do not need requirements.
See <a href="http://meta.trac.wordpress.org/ticket/5899">#5899</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsthemedirectoryclasswporgthemesuploadphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsthemedirectoryjobsclasssvnimportphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/jobs/class-svn-import.php</a></li>
<li><a href="#sitestrunkwordpressorgpublic_htmlwpcontentpluginsthemedirectorythemedirectoryphp">sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsthemedirectoryclasswporgthemesuploadphp"></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/theme-directory/class-wporg-themes-upload.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/theme-directory/class-wporg-themes-upload.php 2022-02-21 07:33:21 UTC (rev 11587)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php 2022-02-21 08:18:07 UTC (rev 11588)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -52,7 +52,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected $tmp_dir = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public $tmp_dir = '';
</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"> * Path to a temporary SVN checkout directory.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -59,7 +59,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected $tmp_svn_dir = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public $tmp_svn_dir = '';
</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"> * Path to temporary theme folder.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -66,7 +66,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected $theme_dir = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public $theme_dir = '';
</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"> * The uploaded theme.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -73,7 +73,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var WP_Theme
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected $theme;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public $theme;
</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"> * The theme slug being uploaded.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -80,7 +80,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected $theme_slug = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public $theme_slug = '';
</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"> * The theme post if it already exists in the repository.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -87,7 +87,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var WP_Post
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected $theme_post;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public $theme_post;
</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"> * The theme author (current user).
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -94,7 +94,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var WP_User
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected $author;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public $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"> * The theme readme.txt data.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -101,7 +101,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected $readme = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public $readme = array();
</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"> * Trac ticket information.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -108,7 +108,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var object
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected $trac_ticket;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public $trac_ticket;
</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"> * Trac changeset.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -115,7 +115,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var int
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected $trac_changeset = 0;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public $trac_changeset = 0;
</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"> * A Trac instance to communicate with theme.trac.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -122,7 +122,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var Trac
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected $trac;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public $trac;
</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"> * Theme import status, what the status of this theme version is.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -143,7 +143,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @var string
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- protected $commit_msg = '';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public $commit_msg = '';
</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"> * The list of headers to extract from readme.txt.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1760,7 +1760,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> (
</span><span class="cx" style="display: block; padding: 0 10px"> // When importing from SVN, include a 'Compare' link as the Changeset likely won't show a Diff unless the author did a `svn cp`.
</span><span class="cx" style="display: block; padding: 0 10px"> 'svn' === $this->importing_from && ! empty( $this->theme_post->max_version ) ?
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- "<https://themes.trac.wordpress.org/changeset?old_path={$this->theme_slug}/{$this->theme_post->max_version}&new_path={$this->theme_slug}/{$this->theme->display( 'Version' )}|Compare>" :
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ "<https://themes.trac.wordpress.org/changeset?old_path={$this->theme_slug}/{$this->theme_post->_last_live_version}&new_path={$this->theme_slug}/{$this->theme->display( 'Version' )}|Compare>" :
</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"> ];
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsthemedirectoryjobsclasssvnimportphp"></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/theme-directory/jobs/class-svn-import.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/theme-directory/jobs/class-svn-import.php 2022-02-21 07:33:21 UTC (rev 11587)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/jobs/class-svn-import.php 2022-02-21 08:18:07 UTC (rev 11588)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -105,7 +105,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> include_once dirname( __DIR__ ) . '/class-wporg-themes-upload.php';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( empty( $args['slug'] ) || empty( $args['version'] ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- trigger_error( 'Theme Import aborted, invalid input provided: ' . json_Encode( $args ), E_USER_WARNING );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ trigger_error( 'Theme Import aborted, invalid input provided: ' . json_encode( $args ), E_USER_WARNING );
</ins><span class="cx" style="display: block; padding: 0 10px"> return;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -114,16 +114,46 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $return = $uploader->process_update_from_svn(
</span><span class="cx" style="display: block; padding: 0 10px"> $args['slug'],
</span><span class="cx" style="display: block; padding: 0 10px"> $args['version'],
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $args['changeset'] ?? false,
- $args['author'] ?? false,
- $args['msg'] ?? ''
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $args['changeset'],
+ $args['author'],
+ $args['msg']
</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">- // TODO: Look at error result code, maybq re-queue in event of system issue, else email author with concerns (Theme Check, etc)
- // CC emails to themes team in event of having to contact the author?
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( is_wp_error( $return ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( is_wp_error( $return ) ) {
- throw new Exception( "Theme Import Failure: " . $return->get_error_code . ' ' . $return->get_error_message() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Retry once in the event of a WordPress.org issue exporting from themes.svn.wordpress.org.
+ if ( 'svn_error' === $return->get_error_code() ) {
+ if ( empty( $args['retry'] ) ) {
+ $args['retry'] = $return;
+ wp_schedule_single_event( time() + HOUR_IN_SECONDS, 'theme_directory_svn_import', $args );
+ return;
+ } else {
+ throw new Exception( 'Theme Import Failure: ' . $return->get_error_code() . ' ' . $return->get_error_message() );
+ }
+ }
+
+ // Otherwise email the author about this problem.
+ wp_mail(
+ // $uploader->author->user_email,
+ get_user_by( 'login', 'dd32' )->user_email, // TODO, DEBUG for now.
+ sprintf(
+ 'Theme Import Failure: %s [%d] %s',
+ $uploader->theme_post->post_title,
+ $args['changeset'],
+ $args['msg']
+ ),
+ sprintf(
+ "Hi %s,\n\nYour theme update for %s %s has failed some checks. Please see the below errors.\n\n%s\n\n----\nWordPress Theme Directory",
+ $uploader->author->user_email . ' ' .
+ ( $uploader->author->display_name ?: $uploader->author->user_login ),
+ $uploader->theme->display('Title'),
+ $uploader->theme->display('Version'),
+ $return->get_error_message(),
+ ),
+ [
+ 'From: "WordPress Theme Directory" <themes@wordpress.org>'
+ ]
+ );
</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"> }
</span></span></pre></div>
<a id="sitestrunkwordpressorgpublic_htmlwpcontentpluginsthemedirectorythemedirectoryphp"></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/theme-directory/theme-directory.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/theme-directory/theme-directory.php 2022-02-21 07:33:21 UTC (rev 11587)
+++ sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php 2022-02-21 08:18:07 UTC (rev 11588)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -532,6 +532,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $post = get_post( $post_id );
</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">+ // Keep track of the last live version.
+ update_post_meta( $post_id, '_last_live_version', get_post_meta( $post_id, '_live_version', true ) );
+
</ins><span class="cx" style="display: block; padding: 0 10px"> // Update current version. Used to prioritize localized themes.
</span><span class="cx" style="display: block; padding: 0 10px"> update_post_meta( $post_id, '_live_version', $version );
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre>
</div>
</div>
</body>
</html>