public override void Update()
        {
            if (_dashboardVersionManager.CurrentVersion == null)
            {
                _dashboardVersionManager.CurrentVersion = _dashboardVersionManager.Read();
            }

            if (_dashboardVersionManager.CurrentVersion.Document.UpgradeState != DashboardUpgradeState.Finished ||
                _dashboardVersionManager.CurrentVersion.Document.Version != DashboardVersionManager.CurrentDashboardVersion)
            {
                if (_dashboardVersionManager.CurrentVersion.Document.UpgradeState == DashboardUpgradeState.DeletingOldData ||
                    (_dashboardVersionManager.CurrentVersion.Document.Version != DashboardVersionManager.CurrentDashboardVersion &&
                     _dashboardVersionManager.CurrentVersion.Document.UpgradeState == DashboardUpgradeState.Finished))
                {
                    _dashboardVersionManager.CurrentVersion = StartDeletingOldData(_functionsStore, _dashboardVersionManager.CurrentVersion);
                    _dashboardVersionManager.CurrentVersion = StartDeletingOldData(_logsStore, _dashboardVersionManager.CurrentVersion);
                }

                if (_dashboardVersionManager.CurrentVersion.Document.UpgradeState == DashboardUpgradeState.DeletingOldData ||
                    _dashboardVersionManager.CurrentVersion.Document.UpgradeState == DashboardUpgradeState.RestoringArchive)
                {
                    _dashboardVersionManager.CurrentVersion = StartRestoringArchive(_dashboardVersionManager.CurrentVersion);
                }

                if (_dashboardVersionManager.CurrentVersion.Document.UpgradeState == DashboardUpgradeState.RestoringArchive)
                {
                    FinishUpdate(_dashboardVersionManager.CurrentVersion);
                }
            }

            base.Update();
        }
Example #2
0
        public IHttpActionResult UpgradeStatus()
        {
            if (_dashboardVersionManager.CurrentVersion == null)
            {
                _dashboardVersionManager.CurrentVersion = _dashboardVersionManager.Read();
            }

            return(Ok(_dashboardVersionManager.CurrentVersion.Document));
        }