Automattic\WooCommerce\Internal\ProductFeed\Storage
JsonFileFeed::get_file_url
{@inheritDoc}
Метод класса: JsonFileFeed{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$JsonFileFeed = new JsonFileFeed(); $JsonFileFeed->get_file_url(): ?string;
Код JsonFileFeed::get_file_url() JsonFileFeed::get file url WC 10.5.2
public function get_file_url(): ?string {
if ( ! $this->file_completed ) {
return null;
}
$upload_dir = $this->get_upload_dir();
// Move the file to the upload directory if it is in temp.
if ( $this->is_temp_filepath ) {
$tmp_path = $this->file_path;
$this->file_path = $upload_dir['path'] . $this->file_name;
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
if ( ! @copy( $tmp_path, $this->file_path ) ) {
$error = error_get_last();
$error_message = is_array( $error ) ? $error['message'] : 'Unknown error';
throw new Exception(
esc_html(
sprintf(
/* translators: %1$s: file path, %2$s: error message */
__( 'Unable to move feed file %1$s to upload directory: %2$s', 'woocommerce' ),
$this->file_path,
$error_message
)
)
);
}
unlink( $tmp_path );
$this->is_temp_filepath = false;
}
// Generate the URL.
$this->file_url = $upload_dir['url'] . $this->file_name;
return $this->file_url;
}