protected function schemaConfiguration(Task $task) { // Adds schema(s) to task foreach ($this->schemas as $pair) { $fileSet = new FileSet(); $fileSet->setDir($pair[0]); $fileSet->setIncludes($pair[1]); $task->addSchemaFileset($fileSet); } // Sets up output dir, for class, SQL or conf output $task->setOutputDirectory(new PhingFile($this->outputDir)); }
/** * Reads the corresponding actions and templates of the cronk (if any) from cronk.xml * and creates two references "cronkTemplate" and "cronkAction" which can be used to access these files */ public function main() { $templates = array(); $actionPath = ""; $action = null; $module = null; $cronkName = $this->project->getUserProperty("cronkName"); // Setup and load the DOM of the cronk $DOM = new DOMDocument("1.0", "UTF-8"); $DOM->load($this->getFile()); $DOMSearcher = new DOMXPath($DOM); $DOMSearcher->registerNamespace("default", "http://agavi.org/agavi/1.0/config"); $DOMSearcher->registerNamespace("ae", "http://agavi.org/agavi/config/global/envelope/1.0"); $cronkTemplates = $DOMSearcher->query("//ae:parameter[@name='" . $cronkName . "']//ae:parameter[@name='template']"); if ($cronkTemplates->length > 0) { foreach ($cronkTemplates as $template) { $templates[] = $template->nodeValue; } } // fetch action and module $action = $DOMSearcher->query("//ae:parameter[@name='" . $cronkName . "']//ae:parameter[@name='action']")->item(0); $module = $DOMSearcher->query("//ae:parameter[@name='" . $cronkName . "']//ae:parameter[@name='module']")->item(0); $actionName = str_replace(".", "/", $action->nodeValue); // add agavi action,validation, view and templates $cronkFS = new FileSet(); $cronkFS->setDir($this->project->getUserProperty("PATH_Icinga") . "/app/modules/" . $module->nodeValue); $cronkIncludes = "actions/" . $actionName . "Action.class.php"; $cronkIncludes .= ",templates/" . $actionName . "*.class.php"; $cronkIncludes .= ",validate/" . $actionName . ".xml"; $cronkIncludes .= ",views/" . $actionName . "*.class.php"; $cronkFS->setIncludes($cronkIncludes); // add templates $templateFs = new FileSet(); $templateFs->setDir($this->project->getUserProperty("PATH_Icinga") . "/app/modules/Cronks/data/xml/"); $includes = ""; $first = true; foreach ($templates as $template) { $includes .= ($first ? '' : ',') . $template . ".xml"; } // export to phing $templateFs->setIncludes($includes); $this->project->addReference("cronkTemplates", $templateFs); $this->project->addReference("cronkAction", $cronkFS); }
/** * Sets the set of include patterns. Patterns may be separated by a comma * or a space. * * @param string $includes the string containing the include patterns * @return void */ public function setIncludes($includes) { $this->fileset->setIncludes($includes); }
/** * Returns a file descriptior with the sql files * @return FileSet */ protected function getSQLDescriptors() { $xml = $this->getManifest()->getManifestAsSimpleXML(); $db = $xml->Database; $sqlList = new FileSet(); $sqlList->setDir($this->project->getUserProperty("PATH_Icinga")); $includes = null; if (!$db->SQLRoutines) { $sqlList->setExcludes("**"); } return $sqlList; foreach ($db->SQLRoutines->children() as $type => $content) { $type = (string) $type; $content = $this->getPath((string) $content); switch ($type) { case 'File': if ($includes != "") { $includes .= ","; } $includes .= $content; break; case 'Folder': if ($includes != "") { $includes .= ","; } $includes .= $content . "/**"; break; } } $sqlList->setIncludes($includes); return $sqlList; }