Skip to content

Commit 6030be9

Browse files
committed
removed dependency of onboarding-data module and bug fix
1 parent 36a1760 commit 6030be9

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

bootstrap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use NewfoldLabs\WP\Module\Onboarding\Compatibility\Safe_Mode;
88
use NewfoldLabs\WP\Module\Onboarding\Compatibility\Status;
99
use NewfoldLabs\WP\Module\Onboarding\TaskManagers\ImageSideloadTaskManager;
10+
use NewfoldLabs\WP\Module\Onboarding\Tasks\ImageSideloadTask;
1011

1112
use function NewfoldLabs\WP\ModuleLoader\register;
1213

includes/TaskManagers/ImageSideloadTaskManager.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace NewfoldLabs\WP\Module\Onboarding\TaskManagers;
44

55
use NewfoldLabs\WP\Module\Onboarding\Tasks\ImageSideloadTask;
6-
use NewfoldLabs\WP\Module\Onboarding\Data\Options;
76

87
/**
98
* Task Manager for Image Sideloading
@@ -17,14 +16,14 @@ class ImageSideloadTaskManager {
1716
*
1817
* @var string
1918
*/
20-
const QUEUE_OPTION = 'nfd_image_sideload_queue';
19+
const QUEUE_OPTION = 'nfd_module_onboarding_image_sideload_queue';
2120

2221
/**
2322
* Option name for storing the processing status
2423
*
2524
* @var string
2625
*/
27-
const STATUS_OPTION = 'nfd_image_sideload_status';
26+
const STATUS_OPTION = 'nfd_module_onboarding_image_sideload_status';
2827

2928
/**
3029
* Add a task to the queue
@@ -62,7 +61,7 @@ public static function add_to_queue( ImageSideloadTask $task ) {
6261
* @return array
6362
*/
6463
public static function get_queue() {
65-
$queue = get_option( Options::get_option_name( self::QUEUE_OPTION ), array() );
64+
$queue = get_option( self::QUEUE_OPTION, array() );
6665
if ( ! is_array( $queue ) ) {
6766
$queue = array();
6867
}
@@ -76,7 +75,7 @@ public static function get_queue() {
7675
* @return void
7776
*/
7877
public static function set_queue( $queue ) {
79-
update_option( Options::get_option_name( self::QUEUE_OPTION ), $queue );
78+
update_option( self::QUEUE_OPTION, $queue );
8079
}
8180

8281
/**
@@ -85,7 +84,7 @@ public static function set_queue( $queue ) {
8584
* @return string
8685
*/
8786
public static function get_status() {
88-
return get_option( Options::get_option_name( self::STATUS_OPTION ), 'idle' );
87+
return get_option( self::STATUS_OPTION, 'idle' );
8988
}
9089

9190
/**
@@ -95,7 +94,7 @@ public static function get_status() {
9594
* @return void
9695
*/
9796
public static function set_status( $status ) {
98-
update_option( Options::get_option_name( self::STATUS_OPTION ), $status );
97+
update_option( self::STATUS_OPTION, $status );
9998
}
10099

101100
/**

includes/Tasks/ImageSideloadTask.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ public function execute() {
4848
return $result;
4949
}
5050

51+
if ( false === $result ) {
52+
return new \WP_Error( 'upload_failed', 'Image upload returned false' );
53+
}
54+
5155
// Update post content with new image URLs
5256
if ( ! empty( $result ) ) {
5357
$content_updated = SiteGenImageService::update_post_content_with_new_image_urls( $this->post_id, $result );

0 commit comments

Comments
 (0)