Beispiel #1
0
        public static void ProcessPublishWebContent(PublishWebContentOperation publishWebContent)
        {
            // Hardcoded security for now
            string targetContainerName = publishWebContent.TargetContainerName;

            if (targetContainerName != "www-aaltoglobalimpact-org" && targetContainerName != "www-weconomy-fi" &&
                targetContainerName != "hacktheball-protonit-net" &&
                targetContainerName != "www-protonit-net" && targetContainerName != "www-caloom-com" && targetContainerName != "www-earthhouse-fi" &&
                targetContainerName != "demowww-norssi-protonit-net" && targetContainerName != "demowww-foip-protonit-net" && targetContainerName != "b-base-protonit-net")
            {
                return;
            }
            DateTime currPublishTimeUtc   = DateTime.UtcNow;
            string   targetRootFolderName = currPublishTimeUtc.ToString("yyyy-MM-dd_hh-mm-ss");
            string   sourceOwner          = publishWebContent.SourceOwner;
            string   sourceRoot           = publishWebContent.SourcePathRoot;
            string   sourceContainerName  = publishWebContent.SourceContainerName;
            // Sync website
            string       targetWebsiteRoot = targetRootFolderName;
            VirtualOwner owner             = VirtualOwner.FigureOwner(sourceOwner);
            string       sourceWebsiteRoot = sourceOwner + "/" + sourceRoot;

            WebContentSync(sourceContainerName, sourceWebsiteRoot, targetContainerName, targetWebsiteRoot,
                           RenderWebSupport.CopyAsIsSyncHandler);
            // Copy Media
            string mediaFolderName = "AaltoGlobalImpact.OIP/MediaContent";
            string targetMediaRoot = targetRootFolderName + "/" + mediaFolderName;
            string sourceMediaRoot = sourceOwner + "/" + mediaFolderName;

            WebContentSync(sourceContainerName, sourceMediaRoot, targetContainerName, targetMediaRoot,
                           RenderWebSupport.CopyAsIsSyncHandler);
            // Copy render required data
            string[] renderRequiredFolders = new string[] { "AaltoGlobalImpact.OIP/NodeSummaryContainer", "AaltoGlobalImpact.OIP/TextContent",
                                                            "AaltoGlobalImpact.OIP/AddressAndLocationCollection" };
            foreach (string renderRequiredFolder in renderRequiredFolders)
            {
                string targetFolder = targetRootFolderName + "/" + renderRequiredFolder;
                string sourceFolder = sourceOwner + "/" + renderRequiredFolder;
                WebContentSync(sourceContainerName, sourceFolder, targetContainerName, targetFolder,
                               RenderWebSupport.CopyAsIsSyncHandler);
            }
            var lastUpdateFileBlob = StorageSupport.GetBlob(targetContainerName, RenderWebSupport.LastUpdateFileName);

            lastUpdateFileBlob.UploadBlobText(targetRootFolderName);
            var currentToServeBlob = StorageSupport.GetBlob(targetContainerName, RenderWebSupport.CurrentToServeFileName);

            currentToServeBlob.UploadBlobText(targetRootFolderName);
        }