<commit_before>using System;
using System.Diagnostics;
using System.Net;
using System.Text;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Publishing;
using Umbraco.Core.Sync;
using Umbraco.Web.Mvc;

namespace Umbraco.Web.Scheduling
{
    internal class ScheduledPublishing
    {
        private static bool _isPublishingRunning = false;
        
        public void Start(object sender)
        {
            using (DisposableTimer.DebugDuration<ScheduledPublishing>(() => "Scheduled publishing executing", () => "Scheduled publishing complete"))
            {
                //NOTE: sender will be the umbraco ApplicationContext

                var appContext = sender as ApplicationContext;
                if (appContext == null) return;

                if (_isPublishingRunning) return;

                _isPublishingRunning = true;
            
                try
                {
                    var umbracoBaseUrl = ServerEnvironmentHelper.GetCurrentServerUmbracoBaseUrl();
                    var url = string.Format("{0}/RestServices/ScheduledPublish/", umbracoBaseUrl);
                    using (var wc = new WebClient())
                    {
                        //pass custom the authorization header
                        wc.Headers.Set("Authorization", AdminTokenAuthorizeAttribute.GetAuthHeaderTokenVal(appContext));<commit_msg>Ensures the 'Index' portion of the path is used for scheduled publishing<commit_after>using System;
using System.Diagnostics;
using System.Net;
using System.Text;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Publishing;
using Umbraco.Core.Sync;
using Umbraco.Web.Mvc;

namespace Umbraco.Web.Scheduling
{
    internal class ScheduledPublishing
    {
        private static bool _isPublishingRunning = false;
        
        public void Start(object sender)
        {
            using (DisposableTimer.DebugDuration<ScheduledPublishing>(() => "Scheduled publishing executing", () => "Scheduled publishing complete"))
            {
                //NOTE: sender will be the umbraco ApplicationContext

                var appContext = sender as ApplicationContext;
                if (appContext == null) return;

                if (_isPublishingRunning) return;

                _isPublishingRunning = true;
            
                try
                {
                    var umbracoBaseUrl = ServerEnvironmentHelper.GetCurrentServerUmbracoBaseUrl();
                    var url = string.Format("{0}/RestServices/ScheduledPublish/Index", umbracoBaseUrl);
                    using (var wc = new WebClient())
                    {
                        //pass custom the authorization header
                        wc.Headers.Set("Authorization", AdminTokenAuthorizeAttribute.GetAuthHeaderTokenVal(appContext));
{'fraction_non_alphanumeric': 0.0764872521246459, 'fraction_numerical': 0.000708215297450425, 'mean_word_length': 2.131929046563193, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '972518', 'n_tokens_mistral': 729, 'n_tokens_neox': 676, 'n_words': 172}