本文整理汇总了PHP中ProjectConfigurator类的典型用法代码示例。如果您正苦于以下问题:PHP ProjectConfigurator类的具体用法?PHP ProjectConfigurator怎么用?PHP ProjectConfigurator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProjectConfigurator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: nextQuery
/**
* Returns next query from SQL source, null if no more queries left
*
* In case of "row" delimiter type this searches for strings containing only
* delimiters. In case of "normal" delimiter type, this uses simple regular
* expression logic to search for delimiters.
*
* @return string|null
*/
public function nextQuery()
{
$sql = "";
$hasQuery = false;
while (($line = $this->sqlReader->readLine()) !== null) {
$delimiter = $this->parent->getDelimiter();
$project = $this->parent->getOwningTarget()->getProject();
$line = ProjectConfigurator::replaceProperties($project, trim($line), $project->getProperties());
if ($line != $delimiter && (StringHelper::startsWith("//", $line) || StringHelper::startsWith("--", $line) || StringHelper::startsWith("#", $line))) {
continue;
}
if (strlen($line) > 4 && strtoupper(substr($line, 0, 4)) == "REM ") {
continue;
}
// MySQL supports defining new delimiters
if (preg_match('/DELIMITER [\'"]?([^\'" $]+)[\'"]?/i', $line, $matches)) {
$this->parent->setDelimiter($matches[1]);
continue;
}
if ($this->sqlBacklog !== "") {
$sql = $this->sqlBacklog;
$this->sqlBacklog = "";
}
$sql .= " " . $line . "\n";
// SQL defines "--" as a comment to EOL
// and in Oracle it may contain a hint
// so we cannot just remove it, instead we must end it
if (strpos($line, "--") !== false) {
$sql .= "\n";
}
// DELIM_ROW doesn't need this (as far as i can tell)
if ($this->delimiterType == PDOSQLExecTask::DELIM_NORMAL) {
$reg = "#((?:\"(?:\\\\.|[^\"])*\"?)+|'(?:\\\\.|[^'])*'?|" . preg_quote($delimiter) . ")#";
$sqlParts = preg_split($reg, $sql, 0, PREG_SPLIT_DELIM_CAPTURE);
$this->sqlBacklog = "";
foreach ($sqlParts as $sqlPart) {
// we always want to append, even if it's a delim (which will be stripped off later)
$this->sqlBacklog .= $sqlPart;
// we found a single (not enclosed by ' or ") delimiter, so we can use all stuff before the delim as the actual query
if ($sqlPart === $delimiter) {
$sql = $this->sqlBacklog;
$this->sqlBacklog = "";
$hasQuery = true;
}
}
}
if ($hasQuery || $this->delimiterType == PDOSQLExecTask::DELIM_ROW && $line == $delimiter) {
// this assumes there is always a delimter on the end of the SQL statement.
$sql = StringHelper::substring($sql, 0, strlen($sql) - strlen($delimiter) - ($this->delimiterType == PDOSQLExecTask::DELIM_ROW ? 2 : 1));
return $sql;
}
}
// Catch any statements not followed by ;
if ($sql !== "") {
return $sql;
}
return null;
}
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:67,代码来源:DefaultPDOQuerySplitter.php
示例2: main
/**
* Executes this target.
*/
public function main()
{
if ($this->name === null) {
throw new BuildException('The name attribute must be specified');
}
/* Words cannot describe how ridiculously fucking stupid this is. Phing
* seems to resolve properties only once, ever, so in order to run a
* target multiple times with different properties we'll have to create
* a new project, parse the build file all over again, copy everything
* over from the current project, execute the new target, and then copy
* everything back. Fuck. */
$project = new Project();
try {
foreach ($this->project->getBuildListeners() as $listener) {
$project->addBuildListener($listener);
}
$project->setInputHandler($this->project->getInputHandler());
$this->project->copyUserProperties($project);
$this->project->copyInheritedProperties($project);
foreach ($this->project->getProperties() as $name => $property) {
if ($project->getProperty($name) === null) {
$project->setNewProperty($name, $property);
}
}
$project->init();
ProjectConfigurator::configureProject($project, new PhingFile($this->project->getProperty('phing.file')));
Phing::setCurrentProject($project);
$project->executeTarget($this->name);
} catch (BuildException $be) {
if ($this->exceptionsFatal) {
throw $be;
} else {
$this->log('Ignoring build exception: ' . $be->getMessage(), Project::MSG_WARN);
$this->log('Continuing build', Project::MSG_INFO);
}
}
Phing::setCurrentProject($this->project);
/**
* :NOTE: copy all user properties so that child task may overwrite
* properties that were already set in the parent project
*
* using the Project::copyUserProperties() will result in
* properties not adjusted to the new value.
*/
foreach ($project->getUserProperties() as $name => $property) {
$this->project->setUserProperty($name, $property);
}
$project->copyInheritedProperties($this->project);
foreach ($project->getProperties() as $name => $property) {
if ($this->project->getProperty($name) === null) {
$this->project->setNewProperty($name, $property);
}
}
/* Fuck. */
unset($project);
}
开发者ID:horros,项目名称:agavi,代码行数:59,代码来源:AgaviExecutetargetTask.php
示例3: main
/**
* @return void
* @throws \BuildException
*/
public function main()
{
if (realpath($this->pathToChainFolder) === false) {
throw new \BuildException('invalid path to chain folder');
}
foreach ($this->chains as $chain) {
$file = new \PhingFile($this->pathToChainFolder . '/' . $chain . '.xml');
\ProjectConfigurator::configureProject($this->project, $file);
}
}
开发者ID:elnebuloso,项目名称:phing-commons,代码行数:14,代码来源:ImportChainsTask.php
示例4: read
/**
* Returns the filtered stream.
* The original stream is first read in fully, and the Phing properties are expanded.
*
* @return mixed the filtered stream, or -1 if the end of the resulting stream has been reached.
*
* @exception IOException if the underlying stream throws an IOException
* during reading
*/
function read($len = null)
{
$buffer = $this->in->read($len);
if ($buffer === -1) {
return -1;
}
$project = $this->getProject();
$buffer = ProjectConfigurator::replaceProperties($project, $buffer, $project->getProperties(), $this->logLevel);
return $buffer;
}
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:19,代码来源:ExpandProperties.php
示例5: nextQuery
/**
* Returns entire SQL source
*
* @return string|null
*/
public function nextQuery()
{
$sql = null;
while (($line = $this->sqlReader->readLine()) !== null) {
$delimiter = $this->parent->getDelimiter();
$project = $this->parent->getOwningTarget()->getProject();
$line = ProjectConfigurator::replaceProperties($project, trim($line), $project->getProperties());
if ($line != $delimiter && (StringHelper::startsWith("//", $line) || StringHelper::startsWith("--", $line) || StringHelper::startsWith("#", $line))) {
continue;
}
$sql .= " " . $line . "\n";
}
return $sql;
}
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:19,代码来源:DummyPDOQuerySplitter.php
示例6: initPhingProperties
protected function initPhingProperties(Project $project)
{
// Apply all file properties, then all non-file properties
$properties = new Properties();
foreach ($this->fileProps as $key => $value) {
$properties->put($key, $value);
}
foreach ($this->customProps as $key => $value) {
$properties->put($key, $value);
}
// Then swap out placeholder values
foreach ($properties->getProperties() as $key => $value) {
$value = ProjectConfigurator::replaceProperties($project, $value, $properties->getProperties());
$project->setProperty($key, $value);
}
}
开发者ID:halfer,项目名称:Meshing,代码行数:16,代码来源:Task.php
示例7: nextQuery
/**
* Returns entire SQL source
*
* @return string|null
*/
public function nextQuery()
{
$sql = null;
while (($line = $this->sqlReader->readLine()) !== null) {
$delimiter = $this->parent->getDelimiter();
$project = $this->parent->getOwningTarget()->getProject();
$line = ProjectConfigurator::replaceProperties($project, trim($line), $project->getProperties());
if ($line != $delimiter && (StringHelper::startsWith("//", $line) || StringHelper::startsWith("--", $line) || StringHelper::startsWith("#", $line))) {
continue;
}
$sql .= " " . $line . "\n";
/**
* fix issue with PDO and wrong formated multistatements
* @issue 1108
*/
if (StringHelper::endsWith($delimiter, $line)) {
break;
}
}
return $sql;
}
开发者ID:xxspartan16,项目名称:BMS-Market,代码行数:26,代码来源:DummyPDOQuerySplitter.php
示例8: main
/**
* Executes this task.
*/
public function main()
{
if ($this->file === null) {
throw new BuildException('The file attribute must be specified');
}
$return = getcwd();
try {
/* Resolve paths correctly: Everything we do as far as
* configuration is concerned should be relative to the
* new project file. */
chdir($this->file->getAbsoluteFile()->getParent());
$project = new AgaviProxyProject($this->project);
$project->addReference('phing.parsing.context', new AgaviProxyXmlContext($project));
$project->setUserProperty('phing.file', $this->file->getAbsolutePath());
$project->init();
Phing::setCurrentProject($project);
ProjectConfigurator::configureProject($project, $this->file);
foreach ($project->getTargets() as $name => $target) {
/* Make sure we don't add proxy targets back to our own project. */
if ($target instanceof AgaviProxyTarget && $target->getTarget()->getProject() === $this->project) {
continue;
}
if (array_key_exists($name, $this->project->getTargets())) {
throw new BuildException(sprintf('Target conflict: %s already exists in project (attempted to add from %s)', $name, $this->file->getAbsolutePath()));
}
$proxy = new AgaviProxyTarget();
$proxy->setName($name);
$proxy->setDescription($target->getDescription());
$proxy->setTarget($target);
$this->project->addTarget($name, $proxy);
}
Phing::setCurrentProject($this->project);
$this->log(sprintf('Importing external build file %s', $this->file->getAbsolutePath()), Project::MSG_INFO);
} catch (Exception $e) {
$this->log(sprintf('Could not read %s: %s (skipping)', $this->file->getAbsolutePath(), $e->getMessage()), Project::MSG_WARN);
}
/* Go back from whence we came. */
chdir($return);
}
开发者ID:philippjenni,项目名称:icinga-web,代码行数:42,代码来源:AgaviImportTask.php
示例9: init
/**
* Executes initialization actions required to setup the project. Usually
* this method handles the attributes of a tag.
*
* @param string the tag that comes in
* @param array attributes the tag carries
* @param object the ProjectConfigurator object
* @throws ExpatParseException if attributes are incomplete or invalid
* @access public
*/
function init($tag, $attrs)
{
$def = null;
$name = null;
$id = null;
$desc = null;
$baseDir = null;
$ver = null;
// some shorthands
$project = $this->configurator->project;
$buildFileParent = $this->configurator->buildFileParent;
foreach ($attrs as $key => $value) {
if ($key === "default") {
$def = $value;
} elseif ($key === "name") {
$name = $value;
} elseif ($key === "id") {
$id = $value;
} elseif ($key === "basedir") {
$baseDir = $value;
} elseif ($key === "description") {
$desc = $value;
} elseif ($key === "phingVersion") {
$ver = $value;
} else {
throw new ExpatParseException("Unexpected attribute '{$key}'");
}
}
// these things get done no matter what
if (null != $name) {
$canonicalName = self::canonicalName($name);
$this->configurator->setCurrentProjectName($canonicalName);
$path = (string) $this->configurator->getBuildFile();
$project->setUserProperty("phing.file.{$canonicalName}", $path);
$project->setUserProperty("phing.dir.{$canonicalName}", dirname($path));
}
if (!$this->configurator->isIgnoringProjectTag()) {
if ($def === null) {
throw new ExpatParseException("The default attribute of project is required");
}
$project->setDefaultTarget($def);
if ($name !== null) {
$project->setName($name);
$project->addReference($name, $project);
}
if ($id !== null) {
$project->addReference($id, $project);
}
if ($desc !== null) {
$project->setDescription($desc);
}
if ($ver !== null) {
$project->setPhingVersion($ver);
}
if ($project->getProperty("project.basedir") !== null) {
$project->setBasedir($project->getProperty("project.basedir"));
} else {
if ($baseDir === null) {
$project->setBasedir($buildFileParent->getAbsolutePath());
} else {
// check whether the user has specified an absolute path
$f = new PhingFile($baseDir);
if ($f->isAbsolute()) {
$project->setBasedir($baseDir);
} else {
$project->setBaseDir($project->resolveFile($baseDir, new PhingFile(getcwd())));
}
}
}
}
}
开发者ID:kalaspuffar,项目名称:php-orm-benchmark,代码行数:81,代码来源:ProjectHandler.php
示例10: configureProject
/**
* set up to run the named project
*
* @param filename name of project file to run
* @throws BuildException
*/
protected function configureProject($filename)
{
$this->logBuffer = "";
$this->fullLogBuffer = "";
$this->project = new Project();
$this->project->init();
$f = new PhingFile($filename);
$this->project->setUserProperty("phing.file", $f->getAbsolutePath());
$this->project->addBuildListener(new PhingTestListener($this));
ProjectConfigurator::configureProject($this->project, new PhingFile($filename));
}
开发者ID:rozwell,项目名称:phing,代码行数:17,代码来源:BuildFileTest.php
示例11: replaceProperties
/**
* Replace ${} style constructions in the given value with the
* string value of the corresponding data types. This method is
* static.
*
* @param object the project that should be used for property look-ups
* @param string the string to be scanned for property references
* @param array proeprty keys
* @return string the replaced string or <code>null</code> if the string
* itself was null
*/
public static function replaceProperties(Project $project, $value, $keys)
{
if ($value === null) {
return null;
}
// These are a "hack" to support static callback for preg_replace_callback()
// make sure these get initialized every time
self::$propReplaceProperties = $keys;
self::$propReplaceProject = $project;
// Because we're not doing anything special (like multiple passes),
// regex is the simplest / fastest. PropertyTask, though, uses
// the old parsePropertyString() method, since it has more stringent
// requirements.
$sb = preg_replace_callback('/\\$\\{([^}]+)\\}/', array('ProjectConfigurator', 'replacePropertyCallback'), $value);
return $sb;
}
开发者ID:vjousse,项目名称:symfony-1.3---1.4,代码行数:27,代码来源:ProjectConfigurator.php
示例12: AgaviProxyBuildLogger
$GLOBALS['LOGGER'] = Phing::import($GLOBALS['LOGGER']);
$logger = new AgaviProxyBuildLogger(new $GLOBALS['LOGGER']());
$logger->setMessageOutputLevel($GLOBALS['VERBOSE'] ? Project::MSG_VERBOSE : Project::MSG_INFO);
$logger->setOutputStream($GLOBALS['OUTPUT']);
$logger->setErrorStream($GLOBALS['ERROR']);
$project->addBuildListener($logger);
$project->setInputHandler(new DefaultInputHandler());
$project->setUserProperty('phing.file', $GLOBALS['BUILD']->getAbsolutePath());
$project->setUserProperty('phing.version', Phing::getPhingVersion());
/* Phing fucks with the cwd. Really, brilliant. */
$project->setUserProperty('application.startdir', START_DIRECTORY);
foreach ($GLOBALS['PROPERTIES'] as $name => $value) {
$project->setUserProperty($name, $value);
}
$project->init();
ProjectConfigurator::configureProject($project, $GLOBALS['BUILD']);
Phing::setCurrentProject($project);
if ($GLOBALS['SHOW_LIST'] === true) {
input_help_display();
$GLOBALS['OUTPUT']->write(PHP_EOL);
$GLOBALS['OUTPUT']->write('Targets:' . PHP_EOL);
$size = 0;
$targets = array();
foreach ($project->getTargets() as $target) {
$name = $target->getName();
$nameSize = strlen($name);
$description = $target->getDescription();
if ($description !== null) {
$size = $nameSize > $size ? $nameSize : $size;
$targets[$name] = $description;
}
开发者ID:philippjenni,项目名称:icinga-web,代码行数:31,代码来源:agavi.php
示例13: runBuild
/**
* Executes the build.
* @return void
*/
function runBuild()
{
if (!$this->readyToRun) {
return;
}
$project = new Project();
self::setCurrentProject($project);
set_error_handler(array('Phing', 'handlePhpError'));
$error = null;
$this->addBuildListeners($project);
$this->addInputHandler($project);
// set this right away, so that it can be used in logging.
$project->setUserProperty("phing.file", $this->buildFile->getAbsolutePath());
try {
$project->fireBuildStarted();
$project->init();
} catch (Exception $exc) {
$project->fireBuildFinished($exc);
throw $exc;
}
$project->setUserProperty("phing.version", $this->getPhingVersion());
$e = self::$definedProps->keys();
while (count($e)) {
$arg = (string) array_shift($e);
$value = (string) self::$definedProps->getProperty($arg);
$project->setUserProperty($arg, $value);
}
unset($e);
$project->setUserProperty("phing.file", $this->buildFile->getAbsolutePath());
// first use the Configurator to create the project object
// from the given build file.
try {
ProjectConfigurator::configureProject($project, $this->buildFile);
} catch (Exception $exc) {
$project->fireBuildFinished($exc);
restore_error_handler();
self::unsetCurrentProject();
throw $exc;
}
// make sure that we have a target to execute
if (count($this->targets) === 0) {
$this->targets[] = $project->getDefaultTarget();
}
// make sure that minimum required phing version is satisfied
try {
$this->comparePhingVersion($project->getPhingVersion());
} catch (Exception $exc) {
$project->fireBuildFinished($exc);
restore_error_handler();
self::unsetCurrentProject();
throw $exc;
}
// execute targets if help param was not given
if (!$this->projectHelp) {
try {
$project->executeTargets($this->targets);
} catch (Exception $exc) {
$project->fireBuildFinished($exc);
restore_error_handler();
self::unsetCurrentProject();
throw $exc;
}
}
// if help is requested print it
if ($this->projectHelp) {
try {
$this->printDescription($project);
$this->printTargets($project);
} catch (Exception $exc) {
$project->fireBuildFinished($exc);
restore_error_handler();
self::unsetCurrentProject();
throw $exc;
}
}
// finally {
if (!$this->projectHelp) {
$project->fireBuildFinished(null);
}
restore_error_handler();
self::unsetCurrentProject();
}
开发者ID:hkilter,项目名称:OpenSupplyChains,代码行数:86,代码来源:phing.php
示例14: processFile
/**
* Execute phing file.
*
* @return void
*/
private function processFile()
{
$buildFailed = false;
$savedDir = $this->dir;
$savedPhingFile = $this->phingFile;
$savedTarget = $this->newTarget;
$savedBasedirAbsPath = null;
// this is used to save the basedir *if* we change it
try {
if ($this->newProject === null) {
$this->reinit();
}
$this->initializeProject();
if ($this->dir !== null) {
$dirAbsPath = $this->dir->getAbsolutePath();
// BE CAREFUL! -- when the basedir is changed for a project,
// all calls to getAbsolutePath() on a relative-path dir will
// be made relative to the project's basedir! This means
// that subsequent calls to $this->dir->getAbsolutePath() will be WRONG!
// We need to save the current project's basedir first.
$savedBasedirAbsPath = $this->getProject()->getBasedir()->getAbsolutePath();
$this->newProject->setBasedir($this->dir);
// Now we must reset $this->dir so that it continues to resolve to the same
// path.
$this->dir = new PhingFile($dirAbsPath);
if ($savedDir !== null) {
// has been set explicitly
$this->newProject->setInheritedProperty("project.basedir", $this->dir->getAbsolutePath());
}
} else {
// Since we're not changing the basedir here (for file resolution),
// we don't need to worry about any side-effects in this scanrio.
$this->dir = $this->getProject()->getBasedir();
}
$this->overrideProperties();
if ($this->phingFile === null) {
$this->phingFile = "build.xml";
}
$fu = new FileUtils();
$file = $fu->resolveFile($this->dir, $this->phingFile);
$this->phingFile = $file->getAbsolutePath();
$this->log("Calling Buildfile '" . $this->phingFile . "' with target '" . $this->newTarget . "'");
$this->newProject->setUserProperty("phing.file", $this->phingFile);
ProjectConfigurator::configureProject($this->newProject, new PhingFile($this->phingFile));
if ($this->newTarget === null) {
$this->newTarget = $this->newProject->getDefaultTarget();
}
// Are we trying to call the target in which we are defined?
if ($this->newProject->getBaseDir() == $this->project->getBaseDir() && $this->newProject->getProperty("phing.file") == $this->project->getProperty("phing.file") && $this->getOwningTarget() !== null && $this->newTarget == $this->getOwningTarget()->getName()) {
throw new BuildException("phing task calling its own parent target");
}
$this->addReferences();
$this->newProject->executeTarget($this->newTarget);
} catch (Exception $e) {
$buildFailed = true;
$this->log($e->getMessage(), Project::MSG_ERR);
if (Phing::getMsgOutputLevel() <= Project::MSG_DEBUG) {
$lines = explode("\n", $e->getTraceAsString());
foreach ($lines as $line) {
$this->log($line, Project::MSG_DEBUG);
}
}
// important!!! continue on to perform cleanup tasks.
}
// reset environment values to prevent side-effects.
$this->newProject = null;
$pkeys = array_keys($this->properties);
foreach ($pkeys as $k) {
$this->properties[$k]->setProject(null);
}
$this->dir = $savedDir;
$this->phingFile = $savedPhingFile;
$this->newTarget = $savedTarget;
// If the basedir for any project was changed, we need to set that back here.
if ($savedBasedirAbsPath !== null) {
chdir($savedBasedirAbsPath);
}
if ($this->haltOnFailure && $buildFailed) {
throw new BuildException("Execution of the target buildfile failed. Aborting.");
}
}
开发者ID:umesecke,项目名称:phing,代码行数:86,代码来源:PhingTask.php
示例15: importFile
/**
* Parse a Phing build file and copy the properties, tasks, data types and
* targets it defines into the current project.
*
* @throws BuildException
* @return void
*/
protected function importFile(PhingFile $file)
{
$ctx = $this->project->getReference("phing.parsing.context");
$cfg = $ctx->getConfigurator();
// Import xml file into current project scope
// Since this is delayed until after the importing file has been
// processed, the properties and targets of this new file may not take
// effect if they have alreday been defined in the outer scope.
$this->log("Importing file from {$file->getAbsolutePath()}", Project::MSG_VERBOSE);
ProjectConfigurator::configureProject($this->project, $file);
}
开发者ID:alangalipaud,项目名称:ProjetQCM,代码行数:18,代码来源:ImportTask.php
示例16: main
/**
* Parse a Phing build file and copy the properties, tasks, data types and
* targets it defines into the current project.
*
* @return void
*/
public function main()
{
if (!isset($this->file)) {
throw new BuildException("Missing attribute 'file'");
}
$file = new PhingFile($this->file);
if (!$file->isAbsolute()) {
$file = new PhingFile($this->project->getBasedir(), $this->file);
}
if (!$file->exists()) {
$msg = "Unable to find build file: {$file->getPath()}";
if ($this->optional) {
$this->log($msg . '... skipped');
return;
} else {
throw new BuildException($msg);
}
}
$ctx = $this->project->getReference("phing.parsing.context");
$cfg = $ctx->getConfigurator();
if (null !== $cfg && $cfg->isParsing()) {
// because there isn't a top level implicit target in phing like there is
// in Ant 1.6, we will be called as soon as our xml is parsed. This isn't
// really what we want to have happen. Instead we will register ourself
// with the parse context to be called at the end of the current file's
// parse phase.
$cfg->delayTaskUntilParseEnd($this);
} else {
// Import xml file into current project scope
// Since this is delayed until after the importing file has been
// processed, the properties and targets of this new file may not take
// effect if they have alreday been defined in the outer scope.
$this->log("Importing configuration from {$file->getName()}", Project::MSG_VERBOSE);
ProjectConfigurator::configureProject($this->project, $file);
$this->log("Configuration imported.", Project::MSG_VERBOSE);
}
}
开发者ID:sergeytsivin,项目名称:haru,代码行数:43,代码来源:ImportTask.php
示例17: main
/**
* Parse a Phing build file and copy the properties, tasks, data types and
* targets it defines into the current project.
*
* @throws BuildException
* @return void
*/
public function main()
{
if (!isset($this->file)) {
throw new BuildException("Missing attribute 'file'");
}
if ($this->getOwningTarget() == null || $this->getOwningTarget()->getName() != '') {
throw new BuildException("import only allowed as a top-level task");
}
$file = new PhingFile($this->file);
if (!$file->isAbsolute()) {
$file = new PhingFile($this->project->getBasedir(), $this->file);
}
if (!$file->exists()) {
$msg = "Unable to find build file: {$file->getPath()}";
if ($this->optional) {
$this->log($msg . '... skipped');
return;
} else {
throw new BuildException($msg);
}
}
$ctx = $this->project->getReference("phing.parsing.context");
$cfg = $ctx->getConfigurator();
// Import xml file into current project scope
// Since this is delayed until after the importing file has been
// processed, the properties and targets of this new file may not take
// effect if they have alreday been defined in the outer scope.
$this->log("Importing file from {$file->getAbsolutePath()}", Project::MSG_VERBOSE);
ProjectConfigurator::configureProject($this->project, $file);
}
开发者ID:codebubb,项目名称:web_ssh,代码行数:37,代码来源:ImportTask.php
示例18: runStatements
/**
* read in lines and execute them
* @throws SQLException, IOException
*/
public function runStatements(Reader $reader, $out = null)
{
$sql = "";
$line = "";
$in = new BufferedReader($reader);
try {
while (($line = $in->readLine()) !== null) {
$line = trim($line);
$line = ProjectConfigurator::replaceProperties($this->project, $line, $this->project->getProperties());
if (StringHelper::startsWith("//", $line) || StringHelper::startsWith("--", $line) || StringHelper::startsWith("#", $line)) {
continue;
}
if (strlen($line) > 4 && strtoupper(substr($line, 0, 4)) == "REM ") {
continue;
}
$sql .= " " . $line;
$sql = trim($sql);
// SQL defines "--" as a comment to EOL
// and in Oracle it may contain a hint
// so we cannot just remove it, instead we must end it
if (strpos($line, "--") !== false) {
$sql .= "\n";
}
if ($this->delimiterType == self::DELIM_NORMAL && StringHelper::endsWith($this->delimiter, $sql) || $this->delimiterType == self::DELIM_ROW && $line == $this->delimiter) {
$this->log("SQL: " . $sql, PROJECT_MSG_VERBOSE);
$this->execSQL(StringHelper::substring($sql, 0, strlen($sql) - strlen($this->delimiter) - 1), $out);
$sql = "";
}
}
// Catch any statements not followed by ;
if ($sql !== "") {
$this->execSQL($sql, $out);
}
} catch (SQLException $e) {
throw new BuildException("Error running statements", $e);
}
}
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:41,代码来源:CreoleSQLExecTask.php
示例19: runStatements
/**
* read in lines and execute them
* @param Reader $reader
* @param null $out
* @throws BuildException
*/
public function runStatements(Reader $reader, $out = null)
{
$sql = "";
$line = "";
$buffer = '';
if (is_array($this->filterChains) && !empty($this->filterChains)) {
$in = FileUtils::getChainedReader(new BufferedReader($reader), $this->filterChains, $this->getProject());
while (-1 !== ($read = $in->read())) {
// -1 indicates EOF
$buffer .= $read;
}
$lines = explode("\n", $buffer);
} else {
$in = new BufferedReader($reader);
while (($line = $in->readLine()) !== null) {
$lines[] = $line;
}
}
try {
foreach ($lines as $line) {
$line = trim($line);
$line = ProjectConfigurator::replaceProperties($this->project, $line, $this->project->getProperties());
if (StringHelper::startsWith("//", $line) || StringHelper::startsWith("--", $line) || StringHelper::startsWith("#", $line)) {
continue;
}
if (strlen($line) > 4 && strtoupper(substr($line, 0, 4)) == "REM ") {
continue;
}
$sql .= " " . $line;
$sql = trim($sql);
// SQL defines "--" as a comment to EOL
// and in Oracle it may contain a hint
// so we cannot just remove it, instead we must end it
if (strpos($line, "--") !== false) {
$sql .= "\n";
}
if ($this->delimiterType == self::DELIM_NORMAL && StringHelper::endsWith($this->delimiter, $sql) || $this->delimiterType == self::DELIM_ROW && $line == $this->delimiter) {
$this->log("SQL: " . $sql, Project::MSG_VERBOSE);
$this->execSQL(StringHelper::substring($sql, 0, strlen($sql) - strlen($this->delimiter)), $out);
$sql = "";
}
}
// Catch any statements not followed by ;
if ($sql !== "") {
$this->execSQL($sql, $out);
}
} catch (SQLException $e) {
throw new BuildException("Error running statements", $e);
}
}
开发者ID:nhallpot,项目名称:CSCrew2015-back,代码行数:56,代码来源:CreoleSQLExecTask.php
示例20: runStatements
/**
* Read the statements from the .sql file and execute them.
* Lines starting with '//', '--' or 'REM ' are ignored.
*
* Developer note: must be public in order to be called from
* sudo-"inner" class PropelSQLExecTransaction.
*
* @param Reader $reader
* @param $out Optional output stream.
* @throws PDOException
* @throws IOException
*/
public function runStatements(Reader $reader, $out = null)
{
$sql = "";
$line = "";
$sqlBacklog = "";
$hasQuery = false;
$in = new BufferedReader($reader);
$parser['pointer'] = 0;
$parser['isInString'] = false;
$parser['stringQuotes'] = "";
$parser['backslashCount'] = 0;
$parser['parsedString'] = "";
$sqlParts = array();
while (($line = $in->readLine()) !== null) {
$line = trim($line);
$line = ProjectConfigurator::replaceProperties($this->project, $line, $this->project->getProperties());
if (StringHelper::startsWith("//", $line) || StringHelper::startsWith("--", $line) || StringHelper::startsWith("#", $line)) {
continue;
}
if (strlen($line) > 4 && strtoupper(substr($line, 0, 4)) == "REM ") {
continue;
}
if ($sqlBacklog !== "") {
$sql = $sqlBacklog;
$sqlBacklog = "";
}
$sql .= " " . $line . PHP_EOL;
// SQL defines "--" as a comment to EOL
// and in Oracle it may contain a hint
// so we cannot just remove it, instead we must end it
if (strpos($line, "--") !== false) {
$sql .= PHP_EOL;
}
// DELIM_ROW doesn't need this (as far as i can tell)
if ($this->delimiterType == self::DELIM_NORMAL) {
// old regex, being replaced due to segfaults:
// See: http://propel.phpdb.org/trac/ticket/294
//$reg = "#((?:\"(?:\\\\.|[^\"])*\"?)+|'(?:\\\\.|[^'])*'?|" . preg_quote($this->delimiter) . ")#";
//$sqlParts = preg_split($reg, $sql, 0, PREG_SPLIT_DELIM_CAPTURE);
$i = $parser['pointer'];
$c = strlen($sql);
while ($i < $c) {
$char = $sql[$i];
switch ($char) {
case "\\":
$parser['backslashCount']++;
$this->log("c{$i}: found " . $parser['backslashCount'] . " backslash(es)", Project::MSG_VERBOSE);
break;
case "'&qu
|
请发表评论