lib/legacy.js
/**
   * Update backup settings.
   * @param {Object} settings New settings.
   * @returns {boolean} true if there were any updates and they successfuly saved.
   */
Update backup settings.
@param {Object} settings New settings.
@returns {boolean} true if there were any updates and they successfuly saved.
Update backup settings . @param { Object } settings New settings . @returns { boolean } true if there were any updates and they successfuly saved .
async update(settings) {
    this.logMsg('Updating backup settings...');
    try {
      if (!isObject(settings)) {
        throw new Error('Backup settings have not been set!');
      }
      if (!isObject(this.data) && await this.validate()) {
        await this.load();
      }
      const updated = this.updateData(settings);
      if (updated === false) {
        this.logMsg('Cancel update since settings have not been changed.');
        return false;
      }
      await this.save();
      this.logMsg('Backup settings have been updated.');
      return true;
    } catch (e) {
      this.logError(`Failed to update backup settings: ${e.message}`);
      return false;
    }
  }
async update ( settings ) { this . logMsg ( 'Updating backup settings...' ) ; try { if ( ! isObject ( settings ) ) { throw new Error ( 'Backup settings have not been set!' ) ; } if ( ! isObject ( this . data ) && await this . validate ( ) ) { await this . load ( ) ; } const updated = this . updateData ( settings ) ; if ( updated === false ) { this . logMsg ( 'Cancel update since settings have not been changed.' ) ; return false ; } await this . save ( ) ; this . logMsg ( 'Backup settings have been updated.' ) ; return true ; } catch ( e ) { this . logError ( ` ${ e . message } ` ) ; return false ; } }
Update backup settings.
Update backup settings .
// Validate backup and load settings if they haven't been loaded. // Update data if needed.