本文整理汇总了PHP中Phing::getMsgOutputLevel方法的典型用法代码示例。如果您正苦于以下问题:PHP Phing::getMsgOutputLevel方法的具体用法?PHP Phing::getMsgOutputLevel怎么用?PHP Phing::getMsgOutputLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phing
的用法示例。
在下文中一共展示了Phing::getMsgOutputLevel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: warn
/**
* Prints warning message to screen if -debug was used.
*/
function warn($msg)
{
if (Phing::getMsgOutputLevel() === PROJECT_MSG_DEBUG) {
print "[IntrospectionHelper] " . $msg . "\n";
}
}
示例2: 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.");
}
}
示例3: warn
/**
* Prints warning message to screen if -debug was used.
* @param string $msg
*/
public function warn($msg)
{
if (Phing::getMsgOutputLevel() === Project::MSG_DEBUG) {
print "[IntrospectionHelper] " . $msg . "\n";
}
}