Example #1
0
 /// <summary>
 ///  reads installed packages, writes it out to disk...
 /// </summary>
 public void ReadInstalledPackages()
 {
     LogHelper.Info(typeof(PackageSync), "Reading Installed Packages"); 
     foreach (var p in InstalledPackage.GetAllInstalledPackages())
     {
         LogHelper.Info(typeof(PackageSync), string.Format("Package {0} {1} {2}", p.Data.Name, p.Data.PackageGuid, p.Data.RepositoryGuid));
         uSyncPackageInfo package = new uSyncPackageInfo(p.Data.Name, p.Data.PackageGuid, p.Data.RepositoryGuid);
         package.Save(); 
     }
 }
Example #2
0
        public bool PackageBusinessActions(uSyncPackageInfo pack, Installer _installer)
        {

            LogHelper.Info(typeof(PackageSync), String.Format("performing business logic for {0}", pack.Name));
            _installer.LoadConfig(pack.TempPackageFolder);
            _installer.InstallBusinessLogic(pack.PackageId, pack.TempPackageFolder);

            pack.Status = "custom";
            pack.Save();

            if (!String.IsNullOrEmpty(_installer.Control))
            {
                // custom bit - not sure how this is going to work ? 
                // because you can't really do it silently
            }

            pack.Status = "complete";
            pack.Save();

            // clean up...
            _installer.InstallCleanUp(pack.PackageId, pack.TempPackageFolder);
            BizLogicAction.ReRegisterActionsAndHandlers();

            return true; 
        }
Example #3
0
        public static uSyncPackageInfo Import(string file)
        {
              XElement element = XElement.Load(file);

              if (element != null)
              {

                  uSyncPackageInfo newPackage = new uSyncPackageInfo();

                  newPackage.Name = element.Attribute("name").Value; 
                  newPackage.PackageGuid = element.Attribute("packageGuid").Value;
                  newPackage.RepoGuid = element.Attribute("repoGuid").Value;
                  newPackage.Status = element.Attribute("status").Value;
                  newPackage.PackageId = int.Parse(element.Attribute("packageId").Value);
                  newPackage.TempPackageFolder = element.Attribute("tempFolder").Value;

                  return (newPackage);
              }
              return null; 
        }
Example #4
0
        public bool PackageFileActions(uSyncPackageInfo pack, Installer _installer)
        {
            LogHelper.Info(typeof(PackageSync), String.Format("Performing File Actions for {0}", pack.Name));

            bool reboot = false; 
            Repository _repo = Repository.getByGuid(pack.RepoGuid);

            if (_repo.HasConnection())
            {

                LogHelper.Info(typeof(PackageSync), "Repo Has Connection");

                umbraco.cms.businesslogic.packager.repositories.Package p = _repo.Webservice.PackageByGuid(pack.PackageGuid);

                string file = _repo.fetch(pack.PackageGuid);
                LogHelper.Info(typeof(PackageSync), String.Format("Fetched {0}", file));

                if (!String.IsNullOrEmpty(file))
                {
                    string import = _installer.Import(file);
                    LogHelper.Info(typeof(PackageSync), String.Format("Install {0}", import));

                    _installer.LoadConfig(import);

                    int pId = _installer.CreateManifest(import, pack.PackageGuid, pack.RepoGuid);

                    LogHelper.Info(typeof(PackageSync), String.Format("Installing Files for {0}", pack.Name));
                    _installer.InstallFiles(pId, import);

                    pack.PackageId = pId;
                    pack.TempPackageFolder = import;

                    pack.Status = "business";
                    pack.Save();

                    if (_installer.ContainsUnsecureFiles)
                    {
                        LogHelper.Info(typeof(PackageSync), String.Format("Package {0} has dll's will reboot...", pack.Name));
                        // we are going to reboot, because things have changed. 
                        // best thing to do is wait
                        System.Threading.Thread.Sleep(2000);
                        reboot = true; // we'll set this true, we don't want to do any more packages this pass.
                    }
                    else
                    {
                        // do the buisness stuff...
                        PackageBusinessActions(pack, _installer); 
                    }
                }
            }
            return reboot; 
        }