Skip to content

Not found .json (settings) at first run #68

Open
@MicheleAnnunziata

Description

@MicheleAnnunziata

The first time incrementalbackup is run there is an exception caused by not reading the json file (which does not exist) in the destination folder. I made the example with Tar. I found the error in the getSetting method of the Tar class

Screenshot (17)

It always ($settings_file) true and at the first time _destination->read goes in exception because the .json file will not be found

<?php
/**
     * Get the backup settings, # of backups and backup unix timestamps.
     *
     * @return mixed|object
     */
    public function getSettings()
    {
        //$settings_file = $this->_destination->getPath() . DIRECTORY_SEPARATOR . $this->getSettingsFile();
 $settings_file = $this->_destination->read(DIRECTORY_SEPARATOR . $this->getSettingsFile());
        if ($settings_file) {
            return json_decode($settings_file);
        } // first time to backup.
        else {
            return (object)array(
                "number" => 0,
                "backups" => array()
            );
        }
    }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions