@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $this->app->semaphore()->unlock(); |
82 | 82 | |
83 | 83 | if ( is_wp_error( $result ) ) { |
84 | - /* @var WP_Error $result */ |
|
84 | + /* @var WP_Error $result */ |
|
85 | 85 | return $this->app->response()->error( $result ); |
86 | 86 | } |
87 | 87 | |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | |
114 | 114 | $this->app->semaphore()->unlock(); |
115 | 115 | |
116 | - if ( is_wp_error( $result ) ) { |
|
117 | - /* @var WP_Error $result */ |
|
118 | - update_option( '_wogh_import_error', $result->get_error_message() ); |
|
116 | + if ( is_wp_error( $result ) ) { |
|
117 | + /* @var WP_Error $result */ |
|
118 | + update_option( '_wogh_import_error', $result->get_error_message() ); |
|
119 | 119 | |
120 | 120 | return $this->app->response()->error( $result ); |
121 | 121 | } |
@@ -128,10 +128,10 @@ discard block |
||
128 | 128 | /** |
129 | 129 | * Export all the posts in the database to GitHub. |
130 | 130 | * |
131 | - * @param int $user_id |
|
132 | - * @param boolean $force |
|
133 | - * @return boolean |
|
134 | - */ |
|
131 | + * @param int $user_id |
|
132 | + * @param boolean $force |
|
133 | + * @return boolean |
|
134 | + */ |
|
135 | 135 | public function export_all( $user_id = 0, $force = false ) { |
136 | 136 | if ( ! $this->app->semaphore()->is_open() ) { |
137 | 137 | return $this->app->response()->error( new WP_Error( |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | // Maybe move option updating out of this class/upgrade message display? |
153 | 153 | if ( is_wp_error( $result ) ) { |
154 | - /* @var WP_Error $result */ |
|
154 | + /* @var WP_Error $result */ |
|
155 | 155 | update_option( '_wogh_export_error', $result->get_error_message() ); |
156 | 156 | |
157 | 157 | return $this->app->response()->error( $result ); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $this->app->semaphore()->unlock(); |
190 | 190 | |
191 | 191 | if ( is_wp_error( $result ) ) { |
192 | - /* @var WP_Error $result */ |
|
192 | + /* @var WP_Error $result */ |
|
193 | 193 | return $this->app->response()->error( $result ); |
194 | 194 | } |
195 | 195 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $this->app->semaphore()->unlock(); |
223 | 223 | |
224 | 224 | if ( is_wp_error( $result ) ) { |
225 | - /* @var WP_Error $result */ |
|
225 | + /* @var WP_Error $result */ |
|
226 | 226 | return $this->app->response()->error( $result ); |
227 | 227 | } |
228 | 228 |
@@ -29,36 +29,36 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * Updates all of the current posts in the database on master. |
31 | 31 | * |
32 | - * @param bool $force |
|
33 | - * |
|
34 | - * @return string|WP_Error |
|
35 | - */ |
|
32 | + * @param bool $force |
|
33 | + * |
|
34 | + * @return string|WP_Error |
|
35 | + */ |
|
36 | 36 | public function full( $force = false ) { |
37 | 37 | $posts = $this->app->database()->fetch_all_supported( $force ); |
38 | 38 | |
39 | 39 | if ( is_wp_error( $posts ) ) { |
40 | - /* @var WP_Error $posts */ |
|
40 | + /* @var WP_Error $posts */ |
|
41 | 41 | return $posts; |
42 | 42 | } |
43 | 43 | |
44 | - $error = false; |
|
44 | + $error = false; |
|
45 | 45 | |
46 | - foreach ( $posts as $post ) { |
|
47 | - $result = $this->update( $post->id() ); |
|
48 | - if ( is_wp_error( $result ) ) { |
|
49 | - if ( $error ) { |
|
50 | - $error->add( $result->get_error_code(), $result->get_error_message() ); |
|
51 | - } else { |
|
52 | - $error = $result; |
|
53 | - } |
|
54 | - } |
|
55 | - } |
|
46 | + foreach ( $posts as $post ) { |
|
47 | + $result = $this->update( $post->id() ); |
|
48 | + if ( is_wp_error( $result ) ) { |
|
49 | + if ( $error ) { |
|
50 | + $error->add( $result->get_error_code(), $result->get_error_message() ); |
|
51 | + } else { |
|
52 | + $error = $result; |
|
53 | + } |
|
54 | + } |
|
55 | + } |
|
56 | 56 | |
57 | - if ( is_wp_error( $error ) ) { |
|
58 | - return $error; |
|
59 | - } |
|
57 | + if ( is_wp_error( $error ) ) { |
|
58 | + return $error; |
|
59 | + } |
|
60 | 60 | |
61 | - return __( 'Export to GitHub completed successfully.', 'writing-on-github' ); |
|
61 | + return __( 'Export to GitHub completed successfully.', 'writing-on-github' ); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $post = $this->app->database()->fetch_by_id( $post_id ); |
89 | 89 | |
90 | 90 | if ( is_wp_error( $post ) ) { |
91 | - /* @var WP_Error $post */ |
|
91 | + /* @var WP_Error $post */ |
|
92 | 92 | return $post; |
93 | 93 | } |
94 | 94 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $post = $this->app->database()->fetch_by_id( $post_id ); |
223 | 223 | |
224 | 224 | if ( is_wp_error( $post ) ) { |
225 | - /* @var WP_Error $post */ |
|
225 | + /* @var WP_Error $post */ |
|
226 | 226 | return $post; |
227 | 227 | } |
228 | 228 | |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | $result = $this->app->api()->persist()->delete_file( $github_path, $post->sha(), $message ); |
243 | 243 | |
244 | 244 | if ( is_wp_error( $result ) ) { |
245 | - /* @var WP_Error $result */ |
|
245 | + /* @var WP_Error $result */ |
|
246 | 246 | return $result; |
247 | 247 | } |
248 | 248 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | */ |
42 | 42 | protected function call( $method, $endpoint, $body = array() ) { |
43 | 43 | if ( is_wp_error( $error = $this->can_call() ) ) { |
44 | - /* @var WP_Error $error */ |
|
44 | + /* @var WP_Error $error */ |
|
45 | 45 | return $error; |
46 | 46 | } |
47 | 47 |
@@ -26,18 +26,18 @@ discard block |
||
26 | 26 | $this->app = $app; |
27 | 27 | } |
28 | 28 | |
29 | - /** |
|
30 | - * Imports a payload. |
|
31 | - * @param Writing_On_GitHub_Payload $payload |
|
32 | - * |
|
33 | - * @return string|WP_Error |
|
34 | - */ |
|
29 | + /** |
|
30 | + * Imports a payload. |
|
31 | + * @param Writing_On_GitHub_Payload $payload |
|
32 | + * |
|
33 | + * @return string|WP_Error |
|
34 | + */ |
|
35 | 35 | public function payload( Writing_On_GitHub_Payload $payload ) { |
36 | 36 | |
37 | 37 | $result = $this->app->api()->fetch()->compare( $payload->get_before_commit_id() ); |
38 | 38 | |
39 | 39 | if ( is_wp_error( $result ) ) { |
40 | - /* @var WP_Error $result */ |
|
40 | + /* @var WP_Error $result */ |
|
41 | 41 | return $result; |
42 | 42 | } |
43 | 43 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * import blob by files |
55 | 55 | * @param Writing_On_GitHub_File_Info[] $files |
56 | - * |
|
56 | + * |
|
57 | 57 | * @return string|WP_Error |
58 | 58 | */ |
59 | 59 | protected function import_files( $files ) { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $result = $this->app->api()->fetch()->tree_recursive(); |
93 | 93 | |
94 | 94 | if ( is_wp_error( $result ) ) { |
95 | - /* @var WP_Error $result */ |
|
95 | + /* @var WP_Error $result */ |
|
96 | 96 | return $result; |
97 | 97 | } |
98 | 98 | |
@@ -105,16 +105,16 @@ discard block |
||
105 | 105 | return __( 'Payload processed', 'writing-on-github' ); |
106 | 106 | } |
107 | 107 | |
108 | - /** |
|
109 | - * Do compare |
|
110 | - * @param Writing_On_GitHub_File_Info[]|WP_Error $files |
|
111 | - * @param int[] &$delete_ids |
|
112 | - * |
|
113 | - * @return string|WP_Error |
|
114 | - */ |
|
108 | + /** |
|
109 | + * Do compare |
|
110 | + * @param Writing_On_GitHub_File_Info[]|WP_Error $files |
|
111 | + * @param int[] &$delete_ids |
|
112 | + * |
|
113 | + * @return string|WP_Error |
|
114 | + */ |
|
115 | 115 | protected function compare( $files, &$delete_ids ) { |
116 | 116 | if ( is_wp_error( $files ) ) { |
117 | - /* @var WP_Error $files */ |
|
117 | + /* @var WP_Error $files */ |
|
118 | 118 | return $files; |
119 | 119 | } |
120 | 120 |