Skip to content

Commit

Permalink
Update wp-document-revisions.php
Browse files Browse the repository at this point in the history
  • Loading branch information
EarthlingDavey committed Dec 19, 2024
1 parent 7700d86 commit 96c24f7
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class WPDocumentRevisions

private $home_url = '';
private $site_url = '';
private $wp_document_revisions;
private $wp_document_revisions = null;

public function __construct()
{
Expand Down Expand Up @@ -87,7 +87,7 @@ private function getDateFromUrl(string $url): ?string
}

/**
* Retry missing file, with date from attachment guid.
* Retry missing document/file, with date from attachment guid.
*
* This function has been added because files are not being served correctly
* when the published date has been updated. In the function, we check if the
Expand Down Expand Up @@ -133,12 +133,11 @@ public function retryFilesNotFound($file, $attachment_id)
return $file;
}

// Lets replace the date with the one from the attachment's guid.
// Let's replace the date with the one from the attachment's guid.
$new_file = str_replace($dates['file'], $dates['guid'], $file);

// If the new file exists, return it.
if (is_file($new_file)) {
error_log('DOC_DEBUG: get_attached_file_filter: ' . $dates['file'] . ' -> ' . $dates['guid']);
return $new_file;
}

Expand Down

0 comments on commit 96c24f7

Please sign in to comment.