Exemplo n.º 1
0
        /// <summary>
        /// Execute the opreation...
        /// </summary>
        public void execute(IniFileManager manager, Deployment deployment)
        {
            var val = deployment.ExpandPaths(this.value);

            switch (this.ensureDir)
            {
            case "dir":
                UtilsSystem.EnsureDirectoryExists(val, true);
                break;

            case "file":
                UtilsSystem.EnsureDirectoryExists(val, false);
                break;
            }

            // If this is a directory or file, make sure we properly quote when
            // writting the PHP.ini, because whitespaces in a path will break
            // most settings
            if (this.ensureDir == "dir" || this.ensureDir == "file")
            {
                if (!val.StartsWith("\""))
                {
                    val = "\"" + val + "\"";
                }
            }

            if (this.multivalue)
            {
                manager.UpdateOrCreateMultivalueDirective(this.key, val, this.section ?? "AUTODEPLOY", this.comment, this.host);
            }
            else
            {
                manager.UpdateOrCreateDirective(this.key, val, this.section ?? "AUTODEPLOY", this.comment, this.host);
            }
        }