/** * Displays the list of existing job queues. * * @param array $arguments (optional) * @param array $options (optional) */ public function execute($arguments = array(), $options = array()) { if ($arguments["src"] === "none") { $arguments["src"] = null; } if ($arguments["reporting"] != "full" && $arguments["reporting"] != "incremental" && $arguments["reporting"] != "cache" && $arguments["reporting"] != "file") { throw new Exception("Invalid value for argument: reporting. The value 'incremental', 'cache', 'file' or 'full' are expected, but '" . $arguments["reporting"] . "' is given!"); } else { if ($arguments["rebuild"] != "yes" && $arguments["rebuild"] != "no") { throw new Exception("Invalid value for argument: rebuild. The value 'yes' or 'no' are expected, but '" . $arguments["rebuild"] . "' is given!"); } else { if ($arguments["src"] != null && (!file_exists($arguments["src"]) || !is_readable($arguments["src"]))) { throw new Exception("Invalid value for argument: src. The file '" . $arguments["src"] . "' doesn't exist or is not readable!"); } } } $project = ProjectConfiguration::getActive(); $this->basedir = $project->getRootDir(); // Add plugin dirs.. $this->dirs = XmlParser::getPluginDirs($this->basedir . "/plugins"); // DB $this->dbmanager = new sfDatabaseManager($this->configuration); // XML Validator $this->validator = new XmlValidator(null, false, true, $arguments["reporting"] == "cache"); // Truncating cache if ($arguments["rebuild"] == "yes") { afValidatorCachePeer::clearCache(); } if ($arguments["log"] !== null) { $this->log = $arguments["log"]; } $this->args = $arguments; $this->logSection("\nXML Config validation is starting.. (this may take a while)\n" . "Validation type: " . $arguments["reporting"] . " \n" . "Will flush cache: " . $arguments["rebuild"] . " ", null, null, "ERROR"); if ($arguments["reporting"] != "file" && $arguments["src"] == null) { foreach ($this->dirs as $dir) { $scan = substr($dir, 0, 1) == "/" ? $dir : $this->basedir . "/apps/" . $arguments['application'] . "/" . $dir; $this->readConfigs($scan); } } else { $this->validator->readXmlDocument($arguments["src"], true); $result = $this->validator->validateXmlDocument(true); $this->logSection($result[1] === null ? "valid: " : "error: ", $arguments["src"], null, $result[0]); if ($result[1]) { echo Util::arrayToString(array("file" => $tmp, "message" => $result[1]->getMessage())); return true; } } if ($arguments["reporting"] == "full") { $this->printTotal(); } return 0; }