private static PublishLastCompleted GetRequest(HttpRequestBase request)
        {
            if (request.Url == null) throw new InvalidOperationException("Missing Url");

            var parameters = new PublishLastCompleted
            {
                Source = request.Form["source"] ?? "master",
                Target = request.Form["target"] ?? "web",
                Language = request.Form["language"] ?? "en"
            };

            return parameters;
        }
예제 #2
0
        private dynamic LastCompleted(dynamic o)
        {
            var completedRequest = this.Bind<PublishLastCompletedRequest>();

            var parameters = new PublishLastCompleted
                {
                    Source = completedRequest.Source ?? "master",
                    Target = completedRequest.Target ?? "web",
                    Language = completedRequest.Language ?? "en"
                };
            
            var date = _publishService.GetLastCompletedRun(parameters);

            return Response.AsJson(date);
        }
예제 #3
0
		public DateTime GetLastCompletedRun(PublishLastCompleted completeParameters)
		{
			// please note http://stackoverflow.com/questions/12416141/get-the-date-time-that-sitecore-last-published

			var source = Sitecore.Configuration.Factory.GetDatabase(completeParameters.Source);
			var target = Sitecore.Configuration.Factory.GetDatabase(completeParameters.Target);
			
			var language = LanguageManager.GetLanguage(completeParameters.Language);


			Assert.IsNotNull(source, "Source database {0} cannot be found".Formatted(completeParameters.Source));
			Assert.IsNotNull(source, "Target database {0} cannot be found".Formatted(completeParameters.Target));
			Assert.IsNotNull(language, "Language {0} cannot be found".Formatted(completeParameters.Language));

			var date = source.Properties.GetLastPublishDate(target, language);
			return date;
		}