#include "version.h"
#include "config.h"
+#include "configfile.h"
namespace OCC {
// to beta channel
}
+ // updateSegment (see configfile.h)
+ ConfigFile cfg;
+ auto updateSegment = cfg.updateSegment();
+ query.addQueryItem(QLatin1String("updatesegment"), QString::number(updateSegment));
+
return query;
}
static const char showInExplorerNavigationPaneC[] = "showInExplorerNavigationPane";
static const char skipUpdateCheckC[] = "skipUpdateCheck";
static const char updateCheckIntervalC[] = "updateCheckInterval";
+static const char updateSegmentC[] = "updateSegment";
static const char geometryC[] = "geometry";
static const char timeoutC[] = "timeout";
static const char chunkSizeC[] = "chunkSize";
settings.sync();
}
+int ConfigFile::updateSegment() const
+{
+ QSettings settings(configFile(), QSettings::IniFormat);
+ int segment = settings.value(QLatin1String(updateSegmentC), -1).toInt();
+
+ // Invalid? (Unset at the very first launch)
+ if(segment < 0 || segment > 99) {
+ // Save valid segment value, normally has to be done only once.
+ segment = qrand() % 99;
+ settings.setValue(QLatin1String(updateSegmentC), segment);
+ }
+
+ return segment;
+}
+
int ConfigFile::maxLogLines() const
{
QSettings settings(configFile(), QSettings::IniFormat);
bool skipUpdateCheck(const QString &connection = QString()) const;
void setSkipUpdateCheck(bool, const QString &);
+ /** Query-parameter 'updatesegment' for the update check, value between 0 and 99.
+ Used to throttle down desktop release rollout in order to keep the update servers alive at peak times.
+ See: https://github.com/nextcloud/client_updater_server/pull/36 */
+ int updateSegment() const;
+
void saveGeometryHeader(QHeaderView *header);
void restoreGeometryHeader(QHeaderView *header);