diff --git a/src/classes/base-sync.ts b/src/classes/base-sync.ts index 2d1106973..f4a2bb436 100644 --- a/src/classes/base-sync.ts +++ b/src/classes/base-sync.ts @@ -243,7 +243,7 @@ export class CoreSyncBaseProvider { if (!siteId) { // No site ID defined, sync all sites. this.logger.debug(`Try to sync '${syncFunctionLog}' in all sites.`); - promise = this.sitesProvider.getSitesIds(); + promise = this.sitesProvider.getLoggedInSitesIds(); } else { this.logger.debug(`Try to sync '${syncFunctionLog}' in site '${siteId}'.`); promise = Promise.resolve([siteId]); diff --git a/src/providers/sites.ts b/src/providers/sites.ts index 759b89372..9ae995e8b 100644 --- a/src/providers/sites.ts +++ b/src/providers/sites.ts @@ -1050,6 +1050,19 @@ export class CoreSitesProvider { }); } + /** + * Get the list of IDs of sites stored and not logged out. + * + * @return {Promise} Promise resolved when the sites IDs are retrieved. + */ + getLoggedInSitesIds(): Promise { + return this.appDB.getRecords(this.SITES_TABLE, {loggedOut : 0}).then((sites) => { + return sites.map((site) => { + return site.id; + }); + }); + } + /** * Get the list of IDs of sites stored. *