Skip to content

Commit 0d2c985

Browse files
Merge pull request #542 from Smartling/WP-910
add debug (WP-910)
2 parents 39c3a25 + 9285755 commit 0d2c985

File tree

11 files changed

+26
-15
lines changed

11 files changed

+26
-15
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "smartling/wordpress-connector",
33
"license": "GPL-2.0-or-later",
4-
"version": "3.9.9",
4+
"version": "3.9.10",
55
"description": "",
66
"type": "wordpress-plugin",
77
"repositories": [

inc/Smartling/Bootstrap.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ private function initializeBuildInContentTypes(ContainerBuilder $di): void
437437
* Post types and taxonomies are registered on 'init' hook, but this code is executed on 'plugins_loaded' hook,
438438
* so we need to postpone dynamic handlers execution
439439
*/
440-
add_action($action, static function () use ($di) {
440+
add_action($action, static function () use ($action, $di) {
441441
// registering taxonomies first.
442442
$dynTermDefinitions = apply_filters(ExportedAPI::FILTER_SMARTLING_REGISTER_CUSTOM_TAXONOMY, []);
443443
if (!is_iterable($dynTermDefinitions)) {
@@ -452,6 +452,9 @@ private function initializeBuildInContentTypes(ContainerBuilder $di): void
452452
if (!is_iterable($externalDefinitions)) {
453453
self::$loggerInstance->critical('External definitions not iterable after filter ' . ExportedAPI::FILTER_SMARTLING_REGISTER_CUSTOM_POST_TYPE . '. This is most likely due to an error outside of the plugins code.');
454454
}
455+
$registeredTypes = array_column(array_column($externalDefinitions, 'type'), 'identifier');
456+
self::$loggerInstance->debug('Registered custom post types: ' .
457+
implode(', ', $registeredTypes) . ", action=$action, count=" . count($registeredTypes));
455458
foreach ($externalDefinitions as $externalDefinition) {
456459
CustomPostType::registerCustomType($di, $externalDefinition);
457460
}

inc/Smartling/Jobs/DownloadTranslationJob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function getJobHookName(): string
3232
return self::JOB_HOOK_NAME;
3333
}
3434

35-
public function run(): void
35+
public function run(string $source): void
3636
{
3737
$this->getLogger()->debug('Started Translation Download Job.');
3838

inc/Smartling/Jobs/JobAbstract.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ private function tryRunJob(string $source = ''): void
191191
{
192192
$this->placeLockFlag(source: $source);
193193
try {
194-
$this->run();
194+
$this->run($source);
195195
} finally {
196196
try {
197197
$this->dropLockFlag();

inc/Smartling/Jobs/JobInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ public function uninstall(): void;
1010

1111
public function getJobHookName(): string;
1212

13-
public function run(): void;
13+
public function run(string $source): void;
1414
}

inc/Smartling/Jobs/LastModifiedCheckJob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function getJobHookName(): string
3535
return self::JOB_HOOK_NAME;
3636
}
3737

38-
public function run(): void
38+
public function run(string $source): void
3939
{
4040
$this->getLogger()->info('Started Last-Modified Check Job.');
4141

inc/Smartling/Jobs/SubmissionCollectorJob.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private function fixEmptyFileUriSubmissions(int $iterationLimit = 100): void
5555
} while (0 < count($submissions));
5656
}
5757

58-
public function run(): void
58+
public function run(string $source): void
5959
{
6060
$this->getLogger()->info('Started Submission Collector Job.');
6161
$this->fixEmptyFileUriSubmissions();

inc/Smartling/Jobs/UploadJob.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,20 @@ public function getJobHookName(): string
3434
return self::JOB_HOOK_NAME;
3535
}
3636

37-
public function run(): void
37+
public function run(string $source): void
3838
{
39-
$this->getLogger()->debug('Started UploadJob.');
39+
$message = 'UploadJob';
40+
if ($source !== '') {
41+
$message .= ", source=\"$source\"";
42+
}
43+
$message .= '.';
44+
$this->getLogger()->debug("Started $message");
4045

4146
$this->processUploadQueue();
4247

4348
$this->processCloning();
4449

45-
$this->getLogger()->debug('Finished UploadJob.');
50+
$this->getLogger()->debug("Finished $message");
4651
}
4752

4853
private function processUploadQueue(): void

readme.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Tags: translation, localization, localisation, translate, multilingual, smartlin
44
Requires at least: 5.5
55
Tested up to: 6.4.1
66
Requires PHP: 8.0
7-
Stable tag: 3.9.9
7+
Stable tag: 3.9.10
88
License: GPLv2 or later
99

1010
Translate content in WordPress quickly and seamlessly with Smartling, the industry-leading Translation Management System.
@@ -62,6 +62,9 @@ Additional information on the Smartling Connector for WordPress can be found [he
6262
3. Track translation status within WordPress from the Submissions Board. View overall progress of submitted translation requests as well as resend updated content.
6363

6464
== Changelog ==
65+
= 3.9.10 =
66+
* Added logging of registered post types
67+
6568
= 3.9.9 =
6669
* Fixed submissions not being uploaded when related assets list has multiple entries that point to the same content
6770

smartling-connector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Plugin Name: Smartling Connector
1212
* Plugin URI: https://www.smartling.com/products/automate/integrations/wordpress/
1313
* Description: Integrate your WordPress site with Smartling to upload your content and download translations.
14-
* Version: 3.9.9
14+
* Version: 3.9.10
1515
* Author: Smartling
1616
* Author URI: https://www.smartling.com
1717
* License: GPL-2.0+

0 commit comments

Comments
 (0)