Exemplo n.º 1
0
        public void Synchronize(int albumId, string synchId, bool isRecursive, bool overwriteThumb, bool overwriteOpt, bool regenerateMetadata)
        {
            IAlbum album = null;

            try
            {
                #region Check user authorization

                bool isUserAuthenticated = Util.IsAuthenticated;
                if (!isUserAuthenticated)
                {
                    return;
                }

                album = Factory.LoadAlbumInstance(albumId, true, true, false);

                if (!Util.IsUserAuthorized(SecurityActions.Synchronize, RoleController.GetGalleryServerRolesForUser(), albumId, album.GalleryId, false))
                {
                    return;
                }

                #endregion

                SynchronizationManager synchMgr = new SynchronizationManager(album.GalleryId);

                synchMgr.IsRecursive        = isRecursive;
                synchMgr.OverwriteThumbnail = overwriteThumb;
                synchMgr.OverwriteOptimized = overwriteOpt;
                synchMgr.RegenerateMetadata = regenerateMetadata;

                synchMgr.Synchronize(synchId, album, Util.UserName);

                // Sueetie Modified - Fix missing media object titles from GSP sync process
                SueetieMedia.PopulateMediaObjectTitles();
            }
            catch (Exception ex)
            {
                if (album != null)
                {
                    AppErrorController.LogError(ex, album.GalleryId);
                }
                else
                {
                    AppErrorController.LogError(ex);
                }
                throw;
            }
        }