Commit 6538f84b authored by Damien McKenna's avatar Damien McKenna
Browse files

Issue #3268401 by DamienMcKenna, Mok7tar, robcarr, crutch, solideogloria,...

Issue #3268401 by DamienMcKenna, Mok7tar, robcarr, crutch, solideogloria, donpwinston: filectime() and filesize() receiving NULL values.
parent f18645a9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ By DamienMcKenna: Updated CHANGELOG.txt for recent 5.0.x changes already present
  opendir(private://backup_migrate/scheduled): failed to open dir.
#3262070 by WagnerMelo, Anybody, Grevil, hmendes, andregp, DamienMcKenna,
  bruno.bicudo: Show date & time when restore / backup was successful.
#3268401 by DamienMcKenna, Mok7tar, robcarr, crutch, solideogloria, donpwinston:
  filectime() and filesize() receiving NULL values.


Backup and Migrate 5.0.2, 2022-08-19
+3 −2
Original line number Diff line number Diff line
@@ -8,9 +8,10 @@ namespace Drupal\backup_migrate\Core\File;
interface BackupFileReadableInterface extends BackupFileInterface {

  /**
   * A path or stream that can be used in php file functions.
   * The realpath of the file on the server.
   *
   * @return string
   * @return string|null
   *   The path or stream URI to the file or NULL if the file does not exist.
   */
  public function realpath();

+0 −8
Original line number Diff line number Diff line
@@ -7,14 +7,6 @@ namespace Drupal\backup_migrate\Core\File;
 */
interface BackupFileWritableInterface extends BackupFileReadableInterface {

  /**
   * Get the realpath of the file.
   *
   * @return string
   *   The path or stream URI to the file or NULL if the file does not exist.
   */
  public function realpath();

  /**
   * Write a line to the file.
   *
+6 −6
Original line number Diff line number Diff line
@@ -52,10 +52,7 @@ class ReadableStreamBackupFile extends BackupFile implements BackupFileReadableI
  }

  /**
   * Get the realpath of the file.
   *
   * @return string
   *   The path or stream URI to the file or NULL if the file does not exist.
   * {@inheritdoc}
   */
  public function realpath() {
    if (file_exists($this->path)) {
@@ -192,8 +189,11 @@ class ReadableStreamBackupFile extends BackupFile implements BackupFileReadableI
   */
  protected function loadFileStats() {
    clearstatcache();
    $this->setMeta('filesize', filesize($this->realpath()));
    $this->setMeta('datestamp', filectime($this->realpath()));
    $path = $this->realpath();
    if (!empty($path)) {
      $this->setMeta('filesize', filesize($path));
      $this->setMeta('datestamp', filectime($path));
    }
  }

}