#!/usr/bin/env php getMessage(); die('Cannot initialize Phar'); } __HALT_COMPILER(); ?>  phing.phara:4:{s:7:"version";s:6:"2.13.0";s:5:"state";s:6:"stable";s:9:"builddate";s:8:"20151204";s:7:"authors";a:1:{s:12:"Michiel Rook";a:1:{s:6:"e-mail";s:13:"mrook@php.net";}}}5classes/phing/contrib/DocBlox/Parallel/WorkerPipe.php aaV P_2classes/phing/contrib/DocBlox/Parallel/Manager.php$aaV$'J01classes/phing/contrib/DocBlox/Parallel/Worker.phpaaV%classes/phing/RuntimeConfigurable.phpaaVh($classes/phing/listener/XmlLogger.php4aaV4~)classes/phing/listener/NoBannerLogger.php\ aaV\ Ile(classes/phing/listener/ProfileLogger.phpaaV3a3'classes/phing/listener/SilentLogger.php9aaV9,Ѷ*classes/phing/listener/AnsiColorLogger.phpaaV*~%classes/phing/listener/JsonLogger.phpaaV;,classes/phing/listener/TimestampedLogger.php%aaV%H"*classes/phing/listener/PearLogListener.phpnaaVn0Ghy'classes/phing/listener/TargetLogger.phpZaaVZÅ*classes/phing/listener/defaults.propertiesaaVA۶%classes/phing/listener/MailLogger.php aaV Ϫ*classes/phing/listener/HtmlColorLogger.phpaaV%(classes/phing/listener/DefaultLogger.php&aaV&F4classes/phing/listener/StreamRequiredBuildLogger.phpMaaVM)$,classes/phing/tasks/system/ConditionTask.php aaV +aaV>+B/classes/phing/tasks/system/AdhocTaskdefTask.phpX aaVX ̌+classes/phing/tasks/system/TryCatchTask.phpaaVY&classes/phing/tasks/system/CvsTask.php|;aaV|; Ί'classes/phing/tasks/system/FailTask.phpHaaVHb+classes/phing/tasks/system/UpToDateTask.php%aaV%* $classes/phing/tasks/system/Retry.phpaaV" a-classes/phing/tasks/system/EchoProperties.php1aaV1 mzc)classes/phing/tasks/system/AttribTask.phpaaVu -(classes/phing/tasks/system/ApplyTask.php_\aaV_\)pn+classes/phing/tasks/system/RecorderTask.php!aaV!:h(classes/phing/tasks/system/TouchTask.phpaaV,(classes/phing/tasks/system/AdhocTask.phpA aaVA S'classes/phing/tasks/system/XsltTask.php aaV ض'classes/phing/tasks/system/CopyTask.php]MaaV]MmҶ(classes/phing/tasks/system/MkdirTask.php aaV `w,classes/phing/tasks/system/ReflexiveTask.phpUaaVU6)classes/phing/tasks/system/DeleteTask.php.aaV."'classes/phing/tasks/system/WarnTask.phpaaV Ȁ4classes/phing/tasks/system/condition/OrCondition.phpaaV^4classes/phing/tasks/system/condition/OsCondition.php aaV 6classes/phing/tasks/system/condition/HttpCondition.php aaV Ua7classes/phing/tasks/system/condition/IsSetCondition.phpaaV؟y>classes/phing/tasks/system/condition/HasFreeSpaceCondition.php aaV Zg9classes/phing/tasks/system/condition/IsFalseCondition.phpaaV']5classes/phing/tasks/system/condition/NotCondition.phpaaV2%2classes/phing/tasks/system/condition/Condition.phpaaV5classes/phing/tasks/system/condition/AndCondition.phpaaV'VAclasses/phing/tasks/system/condition/ReferenceExistsCondition.phpaaV IY8classes/phing/tasks/system/condition/EqualsCondition.php aaV X;6classes/phing/tasks/system/condition/ConditionBase.php!aaV!om5classes/phing/tasks/system/condition/PhingVersion.phpaaVzw8classes/phing/tasks/system/condition/SocketCondition.phpaaVoYR2classes/phing/tasks/system/condition/IsFailure.phpraaVr/E5classes/phing/tasks/system/condition/XorCondition.php}aaV}R@classes/phing/tasks/system/condition/VersionCompareCondition.phpw aaVw Ÿö3classes/phing/tasks/system/condition/FilesMatch.phpaaVʬ:classes/phing/tasks/system/condition/ContainsCondition.php aaV tT;p8classes/phing/tasks/system/condition/IsTrueCondition.phpaaV)tA1classes/phing/tasks/system/PropertyPromptTask.php;aaV;P*classes/phing/tasks/system/PhpEvalTask.phpaaV lU,/classes/phing/tasks/system/AdhocTypedefTask.php aaV +classes/phing/tasks/system/LoadFileTask.php aaV nl)classes/phing/tasks/system/ImportTask.phppaaVpx(classes/phing/tasks/system/InputTask.phpaaV~ƶ,classes/phing/tasks/system/RecorderEntry.php&aaV&3(classes/phing/tasks/system/ChownTask.phpaaV}(classes/phing/tasks/system/ChmodTask.phpaaV+(classes/phing/tasks/system/PhingTask.phpzQaaVzQ,classes/phing/tasks/system/PhingCallTask.phpaaVP<'classes/phing/tasks/system/EchoTask.phpaaV*classes/phing/tasks/system/CvsPassTask.phpaaVQ,classes/phing/tasks/system/AvailableTask.phpYaaVYPM%classes/phing/tasks/system/IfTask.phpaaV$v+classes/phing/tasks/system/PropertyTask.phpEaaVEHa+classes/phing/tasks/system/MatchingTask.php*aaV*z'classes/phing/tasks/system/Basename.phpH aaVH yO.classes/phing/tasks/system/IncludePathTask.phpaaV )classes/phing/tasks/system/SwitchTask.phpLaaVLi)classes/phing/tasks/system/TstampTask.phpaaVu'classes/phing/tasks/system/MoveTask.phpaaV}*classes/phing/tasks/system/TypedefTask.php`aaV`.classes/phing/tasks/system/ResolvePathTask.phpaaV<'classes/phing/tasks/system/TempFile.phpPaaVPj'classes/phing/tasks/system/ExecTask.php8aaV8=kj-classes/phing/tasks/system/SequentialTask.phpaaVD0)classes/phing/tasks/system/AppendTask.php#aaV# ;y&classes/phing/tasks/system/Dirname.php aaV wö*classes/phing/tasks/system/WaitForTask.php aaV B*classes/phing/tasks/system/TaskdefTask.phpmaaVmDNu*classes/phing/tasks/ext/NotifySendTask.php aaV 2(classes/phing/tasks/ext/ParallelTask.php] aaV] VL+classes/phing/tasks/ext/HttpRequestTask.php aaV %"Z3classes/phing/tasks/ext/phk/PhkPackageWebAccess.phpaaVrT߶.classes/phing/tasks/ext/phk/PhkPackageTask.php5aaV5ބ7classes/phing/tasks/ext/phk/PhkPackageWebAccessPath.phpaaVy됣/classes/phing/tasks/ext/dbdeploy/DbmsSyntax.phpaaVW5classes/phing/tasks/ext/dbdeploy/DbmsSyntaxOracle.phpdaaVdgB1classes/phing/tasks/ext/dbdeploy/DbDeployTask.php3aaV35classes/phing/tasks/ext/dbdeploy/DbmsSyntaxSQLite.phpaaVCc6classes/phing/tasks/ext/dbdeploy/DbmsSyntaxFactory.php aaV =;4classes/phing/tasks/ext/dbdeploy/DbmsSyntaxMsSql.phpaaVPn4classes/phing/tasks/ext/dbdeploy/DbmsSyntaxMysql.phpaaVQPL4classes/phing/tasks/ext/dbdeploy/DbmsSyntaxPgSQL.phpsaaVsv.classes/phing/tasks/ext/PhpCodeSnifferTask.phpe]aaVe]ty>%classes/phing/tasks/ext/PatchTask.php+aaV+Զ4classes/phing/tasks/ext/phpdoc/PhpDocumentorTask.php5aaV5<classes/phing/tasks/ext/phpdoc/PhpDocumentorExternalTask.phpaaV|޶:classes/phing/tasks/ext/phpdoc/PhingPhpDocumentorSetup.php"aaV" Ѷ5classes/phing/tasks/ext/phpdoc/PhpDocumentor2Task.phpHaaVHhY\~8classes/phing/tasks/ext/phpdoc/PhpDocumentor2Wrapper.phpIaaVI<0Aclasses/phing/tasks/ext/phpdoc/PhingPhpDocumentorErrorTracker.php aaV }V'classes/phing/tasks/ext/CapsuleTask.php<aaV<PP\7classes/phing/tasks/ext/coverage/CoverageReportTask.phpLaaVLeG>ƶ3classes/phing/tasks/ext/coverage/CoverageMerger.php(aaV(mG7classes/phing/tasks/ext/coverage/CoverageMergerTask.php aaV ^{܍:classes/phing/tasks/ext/coverage/CoverageThresholdTask.php:aaV:9Qo6classes/phing/tasks/ext/coverage/CoverageSetupTask.phpaaVݨx>classes/phing/tasks/ext/coverage/CoverageReportTransformer.php8aaV8+classes/phing/tasks/ext/svn/SvnCopyTask.phpaaV+/classes/phing/tasks/ext/svn/SvnCheckoutTask.phpaaV o3classes/phing/tasks/ext/svn/SvnLastRevisionTask.phpk aaVk -classes/phing/tasks/ext/svn/SvnExportTask.php}aaV}x2+classes/phing/tasks/ext/svn/SvnInfoTask.php2aaV2+!*classes/phing/tasks/ext/svn/SvnLogTask.phpB aaVB Svݶ-classes/phing/tasks/ext/svn/SvnSwitchTask.php> aaV> 0A߶-classes/phing/tasks/ext/svn/SvnCommitTask.php` aaV` Hb-classes/phing/tasks/ext/svn/SvnUpdateTask.phpzaaVzbͶ+classes/phing/tasks/ext/svn/SvnListTask.phpdaaVdf+classes/phing/tasks/ext/svn/SvnBaseTask.php%aaV%%P'classes/phing/tasks/ext/SymlinkTask.phpaaV^`2classes/phing/tasks/ext/ioncube/IoncubeComment.phpaaV׶6classes/phing/tasks/ext/ioncube/IoncubeLicenseTask.phpaaV)co6classes/phing/tasks/ext/ioncube/IoncubeEncoderTask.php<aaV<Zi|)classes/phing/tasks/ext/FtpDeployTask.phph:aaVh:cf-classes/phing/tasks/ext/ReplaceRegexpTask.phpaaV#tk>classes/phing/tasks/ext/phpmd/PHPMDRendererRemoveFromCache.phpaaV\}j+classes/phing/tasks/ext/phpmd/PHPMDTask.php})aaV})RL7classes/phing/tasks/ext/phpmd/PHPMDFormatterElement.phpaaV6!̴%classes/phing/tasks/ext/ThrowTask.phpaaVm+classes/phing/tasks/ext/XmlPropertyTask.phpd aaVd ͓/classes/phing/tasks/ext/ssh/Ssh2MethodParam.php\aaV\@- 'classes/phing/tasks/ext/ssh/SshTask.php3 aaV3 0h'classes/phing/tasks/ext/ssh/ScpTask.phpZ3aaVZ3;1+9classes/phing/tasks/ext/ssh/Ssh2MethodConnectionParam.php aaV Ÿ,classes/phing/tasks/ext/PearPackage2Task.phpM+aaVM+i( 5classes/phing/tasks/ext/phploc/PHPLocXMLFormatter.php3aaV3*85classes/phing/tasks/ext/phploc/PHPLocCSVFormatter.php;aaV;R9classes/phing/tasks/ext/phploc/PHPLocFormatterFactory.php aaV :+6classes/phing/tasks/ext/phploc/PHPLocTextFormatter.phpaaV&"9classes/phing/tasks/ext/phploc/PHPLocFormatterElement.php aaV _+E-classes/phing/tasks/ext/phploc/PHPLocTask.php&aaV&眶:classes/phing/tasks/ext/phploc/AbstractPHPLocFormatter.php aaV f.classes/phing/tasks/ext/pdo/PDOSQLExecTask.php*KaaV*KM VO'classes/phing/tasks/ext/pdo/PDOTask.phpaaVq0classes/phing/tasks/ext/pdo/PDOQuerySplitter.phpaaV.5classes/phing/tasks/ext/pdo/DummyPDOQuerySplitter.php aaV 1ݶ5classes/phing/tasks/ext/pdo/PgsqlPDOQuerySplitter.php(aaV( ~5classes/phing/tasks/ext/pdo/XMLPDOResultFormatter.phpaaVk=p7classes/phing/tasks/ext/pdo/PlainPDOResultFormatter.php aaV 27classes/phing/tasks/ext/pdo/DefaultPDOQuerySplitter.phpXaaVX~:classes/phing/tasks/ext/pdo/PDOSQLExecFormatterElement.php!aaV!;2classes/phing/tasks/ext/pdo/PDOResultFormatter.phpaaVS:)classes/phing/tasks/ext/StopwatchTask.phpaaVUD(classes/phing/tasks/ext/FileSizeTask.php_ aaV_ O۶4classes/phing/tasks/ext/creole/CreoleSQLExecTask.phpRJaaVRJ$+-classes/phing/tasks/ext/creole/CreoleTask.phpHaaVHֶ/classes/phing/tasks/ext/git/GitCheckoutTask.phpaaV-classes/phing/tasks/ext/git/GitCommitTask.phpaaaVa*classes/phing/tasks/ext/git/GitLogTask.phpaaV@p,classes/phing/tasks/ext/git/GitCloneTask.php/aaV/XĶ+classes/phing/tasks/ext/git/GitPullTask.php-'aaV-'b")classes/phing/tasks/ext/git/GitGcTask.phpmaaVmX+-classes/phing/tasks/ext/git/GitBranchTask.php aaV ΂9+classes/phing/tasks/ext/git/GitPushTask.phpaaV;+classes/phing/tasks/ext/git/GitBaseTask.phpaaV9*classes/phing/tasks/ext/git/GitTagTask.php)aaV) ,classes/phing/tasks/ext/git/GitMergeTask.phpaaVֶ,classes/phing/tasks/ext/git/GitFetchTask.phpaaVI0+classes/phing/tasks/ext/git/GitInitTask.php aaV jbq'classes/phing/tasks/ext/JslLintTask.php;+aaV;+0(classes/phing/tasks/ext/ComposerTask.phpaaV9 (classes/phing/tasks/ext/FileSyncTask.phpX>aaVX>5classes/phing/tasks/ext/simpletest/SimpleTestTask.phpaaVGN@Eclasses/phing/tasks/ext/simpletest/SimpleTestDebugResultFormatter.phpaaVY-Eclasses/phing/tasks/ext/simpletest/SimpleTestPlainResultFormatter.phpn aaVn HEAclasses/phing/tasks/ext/simpletest/SimpleTestFormatterElement.php_ aaV_ tnEclasses/phing/tasks/ext/simpletest/SimpleTestCountResultFormatter.phpaaVBACclasses/phing/tasks/ext/simpletest/SimpleTestXmlResultFormatter.phpaaVhPGclasses/phing/tasks/ext/simpletest/SimpleTestSummaryResultFormatter.phpaaV9@classes/phing/tasks/ext/simpletest/SimpleTestResultFormatter.phppaaVp.'classes/phing/tasks/ext/PhpLintTask.phps"aaVs"o0classes/phing/tasks/ext/ExportPropertiesTask.phpIaaVIv$classes/phing/tasks/ext/HttpTask.phpaaV=(classes/phing/tasks/ext/ManifestTask.php|#aaV|#k-classes/phing/tasks/ext/apigen/ApiGenTask.php*aaV*&classes/phing/tasks/ext/SmartyTask.phpMaaVM`U%<classes/phing/tasks/ext/liquibase/LiquibaseChangeLogTask.php_aaV_c d7classes/phing/tasks/ext/liquibase/LiquibaseDiffTask.phpaaV2✍9classes/phing/tasks/ext/liquibase/LiquibaseUpdateTask.phpuaaVu>;classes/phing/tasks/ext/liquibase/AbstractLiquibaseTask.php:*aaV:*4u6classes/phing/tasks/ext/liquibase/LiquibaseTagTask.phphaaVhw;classes/phing/tasks/ext/liquibase/LiquibaseRollbackTask.phpaaV\8classes/phing/tasks/ext/liquibase/LiquibaseDbDocTask.phpaaV73classes/phing/tasks/ext/liquibase/LiquibaseTask.php.aaV.2#classes/phing/tasks/ext/rSTTask.php_/aaV_/M6+classes/phing/tasks/ext/PearPackageTask.php9aaV9eS*classes/phing/tasks/ext/AutoloaderTask.php aaV a2&#classes/phing/tasks/ext/ZipTask.php*aaV*oV'classes/phing/tasks/ext/HttpGetTask.phpaaV0classes/phing/tasks/ext/ZendCodeAnalyzerTask.php aaV &classes/phing/tasks/ext/JsHintTask.php aaV Y5DKclasses/phing/tasks/ext/phpunit/formatter/SummaryPHPUnitResultFormatter.phpaaV<Jclasses/phing/tasks/ext/phpunit/formatter/Crap4jPHPUnitResultFormatter.php3 aaV3 yIclasses/phing/tasks/ext/phpunit/formatter/PlainPHPUnitResultFormatter.phpMaaVMODclasses/phing/tasks/ext/phpunit/formatter/PHPUnitResultFormatter.phpaaVgfJclasses/phing/tasks/ext/phpunit/formatter/CloverPHPUnitResultFormatter.php7 aaV7 ytEGclasses/phing/tasks/ext/phpunit/formatter/XMLPHPUnitResultFormatter.phpaaV~/classes/phing/tasks/ext/phpunit/PHPUnitUtil.phpaaVhm忶5classes/phing/tasks/ext/phpunit/PHPUnitTestRunner.phpN,aaVN,H4classes/phing/tasks/ext/phpunit/FormatterElement.phpGaaVGh-classes/phing/tasks/ext/phpunit/BatchTest.php>aaV>$Ձ5classes/phing/tasks/ext/phpunit/PHPUnitReportTask.php aaV k7Ƕ/classes/phing/tasks/ext/phpunit/PHPUnitTask.phpv@aaVv@[42classes/phing/tasks/ext/property/PathToFileSet.phpaaVmu .classes/phing/tasks/ext/property/RegexTask.phpaaVxPǶ?classes/phing/tasks/ext/property/AbstractPropertySetterTask.phptaaVtxk%classes/phing/tasks/ext/UntarTask.phpaaV-ζ+classes/phing/tasks/ext/jsmin/JsMinTask.phpaaV.L-classes/phing/tasks/ext/PackageAsPathTask.phpaaV{:classes/phing/tasks/ext/zendguard/ZendGuardLicenseTask.phpBaaVBy9classes/phing/tasks/ext/zendguard/ZendGuardEncodeTask.php<aaV<h*classes/phing/tasks/ext/Service/Amazon.phpu aaVu V"_-classes/phing/tasks/ext/Service/Amazon/S3.phpaaV,7classes/phing/tasks/ext/Service/Amazon/S3/S3GetTask.php aaV @7classes/phing/tasks/ext/Service/Amazon/S3/S3PutTask.php+aaV+Fp(classes/phing/tasks/ext/FileHashTask.phpoaaVoP6'classes/phing/tasks/ext/VersionTask.phpaaVZ+classes/phing/tasks/ext/GrowlNotifyTask.phpq<aaVq<c+classes/phing/tasks/ext/ExtractBaseTask.phpaaVpC$classes/phing/tasks/ext/MailTask.phpaaV4classes/phing/tasks/ext/phar/PharMetadataElement.php?aaV?O-classes/phing/tasks/ext/phar/PharDataTask.php#aaV#^ -classes/phing/tasks/ext/phar/PharMetadata.phpaaVrAF0classes/phing/tasks/ext/phar/PharPackageTask.phpQ.aaVQ.T8#classes/phing/tasks/ext/TarTask.php!<aaV!<<classes/phing/tasks/ext/pdepend/PhpDependAnalyzerElement.php^ aaV^ n:classes/phing/tasks/ext/pdepend/PhpDependLoggerElement.php1 aaV1 91classes/phing/tasks/ext/pdepend/PhpDependTask.php<aaV<͙.classes/phing/tasks/ext/SymfonyConsole/Arg.php aaV } =classes/phing/tasks/ext/SymfonyConsole/SymfonyConsoleTask.phpaaV1classes/phing/tasks/ext/inifile/IniFileConfig.phpaaV w/classes/phing/tasks/ext/inifile/IniFileTask.php$aaV$ƛ 1classes/phing/tasks/ext/inifile/IniFileRemove.php%aaV%cAclasses/phing/tasks/ext/zendserverdeploymenttool/zsdtBaseTask.php aaV Eclasses/phing/tasks/ext/zendserverdeploymenttool/zsdtValidateTask.phpaaVm#dAclasses/phing/tasks/ext/zendserverdeploymenttool/zsdtPackTask.phpaaV6D*'classes/phing/tasks/ext/XmlLintTask.phpuaaVufض%classes/phing/tasks/ext/UnzipTask.php aaV I[<classes/phing/tasks/ext/phpcs/PhpCodeSnifferTask_Wrapper.phpcaaVcN>classes/phing/tasks/ext/phpcs/Reports_PhingRemoveFromCache.php aaV PMG/classes/phing/tasks/ext/pearpackage/Fileset.phpaaVxzO+classes/phing/tasks/ext/WikiPublishTask.php$)aaV$)zꣶ'classes/phing/tasks/defaults.propertiesaaVJ= classes/phing/UnknownElement.php8 aaV8 7. (classes/phing/ConfigurationException.php aaV t[ٶclasses/phing/Diagnostics.phpaaV classes/phing/TaskContainer.phpaaV7F.+classes/phing/system/io/WinNTFileSystem.phpaaVt(classes/phing/system/io/OutputStream.phpaaV|o&classes/phing/system/io/FileWriter.phpIaaVI6classes/phing/system/io/FileParserFactoryInterface.phpaaV]&classes/phing/system/io/FileReader.phpaaVU*classes/phing/system/io/BufferedReader.phppaaVp:ܶ/classes/phing/system/io/FileParserInterface.phpaaV*classes/phing/system/io/UnixFileSystem.php(aaV(µ<¶-classes/phing/system/io/FileParserFactory.php`aaV`?3,classes/phing/system/io/FileOutputStream.php aaV \[.classes/phing/system/io/OutputStreamWriter.php aaV <"classes/phing/system/io/Writer.phpaaV )classes/phing/system/io/IniFileParser.php aaV >ڶ'classes/phing/system/io/IOException.phpaaVg>d"classes/phing/system/io/Reader.php aaV un&(classes/phing/system/io/StringReader.php aaV P+classes/phing/system/io/FileInputStream.php aaV (classes/phing/system/io/FilterReader.phpaaV{$*classes/phing/system/io/YamlFileParser.php aaV ՘0+classes/phing/system/io/Win32FileSystem.php DaaV DiM&)classes/phing/system/io/ConsoleReader.php aaV e"-classes/phing/system/io/InputStreamReader.phpaaV9_'classes/phing/system/io/PrintStream.php aaV ݶ&classes/phing/system/io/FileSystem.phpkaaVksv %classes/phing/system/io/PhingFile.phpaaVw)*classes/phing/system/io/BufferedWriter.php aaV ?n'classes/phing/system/io/InputStream.phpNaaVNx(2classes/phing/system/lang/NullPointerException.php\aaV\Yɜ+3classes/phing/system/lang/FileNotFoundException.php_aaV_ )classes/phing/system/lang/EventObject.phpaaVF/classes/phing/system/lang/SecurityException.phpYaaVYg'classes/phing/system/lang/Character.phpaaV_Ҧ&classes/phing/system/util/Register.phpaaVR#classes/phing/system/util/Timer.php aaV (classes/phing/system/util/Properties.php:$aaV:$ƶ"classes/phing/SubBuildListener.phpk aaVk B7classes/phing/Phing.phpaaV|*classes/phing/mappers/FirstMatchMapper.phpaaV3z(classes/phing/mappers/IdentityMapper.phpaaV֛`'classes/phing/mappers/ChainedMapper.phpaaV9%classes/phing/mappers/MergeMapper.phpI aaVI H)classes/phing/mappers/ContainerMapper.phpYaaVY!{S(classes/phing/mappers/FileNameMapper.php<aaV<)classes/phing/mappers/CompositeMapper.phpaaVG&classes/phing/mappers/RegexpMapper.php~aaV~f^#'classes/phing/mappers/FlattenMapper.phpaaVA'[$classes/phing/mappers/GlobMapper.phpaaV#classes/phing/lib/Capsule.phpaaVgDkclasses/phing/Project.phpaaV>~ȶ classes/phing/BuildException.phpUaaVUF+classes/phing/Task.phpaaVsƶclasses/phing/BuildLogger.phpb aaVb GEc"classes/phing/ProjectComponent.php" aaV" Z؞classes/phing/TaskAdapter.php aaV C?Q$classes/phing/input/InputHandler.phpaaVh䏶2classes/phing/input/MultipleChoiceInputRequest.phpaaV8N+classes/phing/input/DefaultInputHandler.php aaV Z4$classes/phing/input/InputRequest.php> aaV> #3)classes/phing/input/YesNoInputRequest.phpaaV!classes/phing/BuildEvent.phpaaV+a*classes/phing/filters/ExpandProperties.php`aaV`9%classes/phing/filters/PrefixLines.phpGaaVG&2w%classes/phing/filters/TabToSpaces.phpaaVU \)classes/phing/filters/StripWhitespace.php aaV <˶'classes/phing/filters/ReplaceRegexp.php1aaV1()classes/phing/filters/StripLineBreaks.phpaaVi$classes/phing/filters/TidyFilter.phpaaV*classes/phing/filters/BaseFilterReader.phpaaVlQ$classes/phing/filters/XsltFilter.php,aaV,xE%classes/phing/filters/IconvFilter.phpYaaVY$ݶ,classes/phing/filters/LineContainsRegexp.phpMaaVMe˶$classes/phing/filters/HeadFilter.phpaaV~^&classes/phing/filters/ConcatFilter.phpMaaVMz'$classes/phing/filters/TailFilter.phpaaVԌ/classes/phing/filters/ReplaceTokensWithFile.php/aaV/⟕-'classes/phing/filters/EscapeUnicode.phpaaVj+classes/phing/filters/StripLineComments.phpaaVÙ'classes/phing/filters/ReplaceTokens.php(7aaV(71P)classes/phing/filters/ChainableReader.phpFaaVFpY[$classes/phing/filters/SortFilter.phpaaVO%classes/phing/filters/SuffixLines.phpxaaVxYM(classes/phing/filters/XincludeFilter.phpaaVx/;/classes/phing/filters/BaseParamFilterReader.phpw aaVw F-*classes/phing/filters/StripPhpComments.phpaaV'*classes/phing/filters/TranslateGettext.php&aaV&~*classes/phing/filters/PhpArrayMapLines.phpaaV|Q0classes/phing/filters/util/ChainReaderHelper.phpaaV@ʶ1classes/phing/filters/util/IniFileTokenReader.php;aaV;&classes/phing/filters/LineContains.php aaV sT classes/phing/util/LogWriter.phpq aaVq 'classes/phing/util/DirectoryScanner.phphaaVh׶ö*classes/phing/util/regexp/RegexpEngine.php aaV m1$classes/phing/util/regexp/Regexp.phpaaV{d(classes/phing/util/regexp/PregEngine.phpaaVP?@ classes/phing/util/DataStore.phpaaV$classes/phing/util/PathTokenizer.php9aaV9ՠ)classes/phing/util/ExtendedFileStream.phpsaaVsw纶(classes/phing/util/SourceFileScanner.phpmaaVmme classes/phing/util/FileUtils.php89aaV89)classes/phing/util/PearPackageScanner.php!aaV!>C2#classes/phing/util/StringHelper.php5 aaV5 Bsclasses/phing/BuildListener.php7 aaV7 =Ѷclasses/phing/Target.php&-aaV&-W޶*classes/phing/parser/AbstractSAXParser.phpaaV]Ŷ(classes/phing/parser/DataTypeHandler.phpaaV~m,classes/phing/parser/ProjectConfigurator.phpA8aaVA8^XbŶ$classes/phing/parser/ExpatParser.php5aaV5|](classes/phing/parser/PhingXMLContext.phpFaaVFT#,classes/phing/parser/ExpatParseException.php4aaV4܍1$classes/phing/parser/RootHandler.php aaV !j!classes/phing/parser/Location.php aaV 3(classes/phing/parser/AbstractHandler.php; aaV; !k'classes/phing/parser/ElementHandler.phpFaaVFLv+classes/phing/parser/CustomChildCreator.php#aaV#6@&classes/phing/parser/TargetHandler.phpaaVYes'classes/phing/parser/ProjectHandler.php`aaV`le %classes/phing/IntrospectionHelper.php_aaV_& classes/phing/types/Excludes.phpaaV ͚#classes/phing/types/Commandline.php:aaV:)classes/phing/types/ExcludesNameEntry.phpaaVo)classes/phing/types/PhingFilterReader.phpaaVҶ classes/phing/types/FileList.phpaaV-m#classes/phing/types/TokenReader.phpaaV"H"classes/phing/types/PatternSet.php>aaV>SY 'classes/phing/types/AbstractFileSet.phpCKaaVCK5classes/phing/types/FileSet.phpaaV$ֶclasses/phing/types/Path.php>aaV>X !0classes/phing/types/selectors/ExtendSelector.phpaaVu2classes/phing/types/selectors/MajoritySelector.phpc aaVc z~D/classes/phing/types/selectors/SelectorUtils.php aaV 3&,classes/phing/types/selectors/OrSelector.phpG aaVG g70classes/phing/types/selectors/SelectSelector.phpaaV11classes/phing/types/selectors/PresentSelector.phpaaV2classes/phing/types/selectors/ContainsSelector.phpaaVU-classes/phing/types/selectors/AndSelector.php aaV =&.classes/phing/types/selectors/FileSelector.php}aaV}~p`8classes/phing/types/selectors/ContainsRegexpSelector.phpaaV8 7classes/phing/types/selectors/BaseSelectorContainer.php+aaV+3classes/phing/types/selectors/SelectorContainer.phpaaV,S7.classes/phing/types/selectors/NoneSelector.php, aaV, 9P1classes/phing/types/selectors/SelectorScanner.phpaaVg0classes/phing/types/selectors/DependSelector.phpfaaVf2classes/phing/types/selectors/FilenameSelector.phpaaV4classes/phing/types/selectors/ExtendFileSelector.phpaaVzҶ.classes/phing/types/selectors/BaseSelector.php^ aaV^ =".classes/phing/types/selectors/TypeSelector.phpSaaVSޢ.classes/phing/types/selectors/SizeSelector.php$aaV$/:ȶ4classes/phing/types/selectors/BaseExtendSelector.php+ aaV+ C!h-classes/phing/types/selectors/NotSelector.phpXaaVX/classes/phing/types/selectors/DepthSelector.phpaaV(.classes/phing/types/selectors/DateSelector.phpaaVOg classes/phing/types/DataType.phpaaV44*classes/phing/types/PearPackageFileSet.phpaaVP_v#classes/phing/types/FilterChain.php!aaV! 'classes/phing/types/defaults.propertiesaaVT#classes/phing/types/TokenSource.php2aaV2Nd(#classes/phing/types/Description.phpaaVBض)classes/phing/types/RegularExpression.phpgaaVge4!classes/phing/types/Parameter.php? aaV? o%classes/phing/types/PropertyValue.phpaaVHclasses/phing/types/DirSet.phpaaV ¶'classes/phing/types/IterableFileSet.phpaaV'classes/phing/types/Parameterizable.php?aaV?%!classes/phing/types/Reference.phpVaaVV}classes/phing/types/Mapper.php#aaV#$etc/phpunit-frames.xslgaaVgetc/phpunit-noframes.xsl>aaV>DJetc/str.replace.function.xslaaVM  etc/phing-grammar.rngƉaaVƉ)Pɶ etc/log.xslaaVNJ^etc/coverage-frames.xslaaV@䰬etc/VERSION.TXTaaVkŶ bin/phing.phpaaV`S% bin/phing.bataaV  bin/phingaaVjX02 * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://docblox-project.org */ /** * Class that represents a named pipe for a Worker. * * This class manages the named pipe for a worker and is able to push and pull * specific data to facilitate IPC (interprocess communication). * * @category DocBlox * @package Parallel * @author Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://docblox-project.org */ class DocBlox_Parallel_WorkerPipe { /** @var DocBlox_Parallel_Worker worker class that is associated */ protected $worker; /** @var string Path to the pipe */ protected $path; /** * Initializes the named pipe. * * @param DocBlox_Parallel_Worker $worker Associated worker. */ public function __construct(DocBlox_Parallel_Worker $worker) { $this->worker = $worker; $this->path = tempnam(sys_get_temp_dir(), 'dpm_'); posix_mkfifo($this->path, 0750); } /** * If the named pipe was not cleaned up, do so now. */ public function __destruct() { if (file_exists($this->path)) { $this->release(); } } /** * Pull the worker data into the named pipe. * * @return void */ public function pull() { $this->writePipeContents(); } /** * Push the worker data back onto the worker and release the pipe. * * @return void */ public function push() { list($result, $error, $return_code) = $this->readPipeContents(); $this->release(); $this->worker->setResult($result); $this->worker->setError($error); $this->worker->setReturnCode($return_code); } /** * Convenience method to show relation to readPipeContents. * * @return void */ protected function writePipeContents() { // push the gathered data onto a name pipe $pipe = fopen($this->path, 'w'); fwrite( $pipe, serialize( array( $this->worker->getResult(), $this->worker->getError(), $this->worker->getReturnCode() ) ) ); fclose($pipe); } /** * Returns the unserialized contents of the pipe. * * @return array */ protected function readPipeContents() { $pipe = @fopen($this->path, 'r+'); if (! $pipe) { $arguments = $this->worker->getArguments(); return array( '', 'Worker died unexpectedly', 255 ); } $result = unserialize(fread($pipe, filesize($this->path))); fclose($pipe); return $result; } /** * Releases the pipe. * * @return void */ protected function release() { @unlink($this->path); } } * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://docblox-project.org */ /** * Manager class for Parallel processes. * * This class will manage the workers and make sure all processes are executed * in parallel and not too many at the same time. * * @category DocBlox * @package Parallel * @author Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://docblox-project.org */ class DocBlox_Parallel_Manager extends ArrayObject { /** @var int The maximum number of processes to run simultaneously */ protected $process_limit = 2; /** @var boolean Tracks whether this manager is currently executing */ protected $is_running = false; /** * Tries to autodetect the optimal number of process by counting the number * of processors. * * @param array $input Input for the array object. * @param int $flags flags for the array object. * @param string $iterator_class Iterator class for this array object. */ public function __construct( $input = array(), $flags = 0, $iterator_class = "ArrayIterator" ) { parent::__construct($input, $flags, $iterator_class); if (is_readable('/proc/cpuinfo')) { $processors = 0; exec("cat /proc/cpuinfo | grep processor | wc -l", $processors); $this->setProcessLimit(reset($processors)); } } /** * Adds a worker to the queue. * * This method will prepare a worker to be executed in parallel once the * execute method is invoked. * A fluent interface is provided so that you can chain multiple workers * in one call. * * Example: * * $cb1 = function () { var_dump('a'); sleep(1); }; * $cb2 = function () { var_dump('b'); sleep(1); }; * * $mgr = new DocBlox_Parallel_Manager(); * $mgr->setProcessLimit(2) * ->addWorker(new DocBlox_Parallel_Worker($cb1)) * ->addWorker(new DocBlox_Parallel_Worker($cb2)) * ->execute(); * * @param int $index The key for this worker. * @param DocBlox_Parallel_Worker $newval The worker to add onto the queue. * * @see DocBlox_Parallel_Manager::execute() * * @throws RuntimeException if this method is invoked while the * manager is busy executing tasks. * @throws InvalidArgumentException if the provided element is not of type * DocBlox_Parallel_Worker. * * @return void */ public function offsetSet($index, $newval) { if (!$newval instanceof DocBlox_Parallel_Worker) { throw new InvalidArgumentException( 'Provided element must be of type DocBlox_Parallel_Worker' ); } if ($this->isRunning()) { throw new RuntimeException( 'Workers may not be added during execution of the manager' ); } parent::offsetSet($index, $newval); } /** * Convenience method to make the addition of workers explicit and allow a * fluent interface. * * @param DocBlox_Parallel_Worker $worker The worker to add onto the queue. * * @return self */ public function addWorker(DocBlox_Parallel_Worker $worker) { $this[] = $worker; return $this; } /** * Sets how many processes at most to execute at the same time. * * A fluent interface is provided so that you can chain multiple workers * in one call. * * @param int $process_limit The limit, minimum of 1 * * @see DocBlox_Parallel_Manager::addWorker() for an example * * @return self */ public function setProcessLimit($process_limit) { if ($process_limit < 1) { throw new InvalidArgumentException( 'Number of simultaneous processes may not be less than 1' ); } $this->process_limit = $process_limit; return $this; } /** * Returns the current limit on the amount of processes that can be * executed at the same time. * * @return int */ public function getProcessLimit() { return $this->process_limit; } /** * Returns whether the manager is executing the workers. * * @return boolean */ public function isRunning() { return $this->is_running; } /** * Executes each worker. * * This method loops through the list of workers and tries to fork as * many times as the ProcessLimit dictates at the same time. * * @return void */ public function execute() { /** @var int[] $processes */ $processes = $this->startExecution(); /** @var DocBlox_Parallel_Worker $worker */ foreach ($this as $worker) { // if requirements are not met, execute workers in series. if (!$this->checkRequirements()) { $worker->execute(); continue; } $this->forkAndRun($worker, $processes); } $this->stopExecution($processes); } /** * Notifies manager that execution has started, checks requirements and * returns array for child processes. * * If forking is not available because library requirements are not met * than the list of workers is processed in series and a E_USER_NOTICE is * triggered. * * @return int[] */ protected function startExecution() { $this->is_running = true; // throw a E_USER_NOTICE if the requirements are not met. if (!$this->checkRequirements()) { trigger_error( 'The PCNTL extension is not available, running workers in series ' . 'instead of parallel', E_USER_NOTICE ); } return array(); } /** * Waits for all processes to have finished and notifies the manager that * execution has stopped. * * @param int[] &$processes List of running processes. * * @return void */ protected function stopExecution(array &$processes) { // starting of processes has ended but some processes might still be // running wait for them to finish while (!empty($processes)) { pcntl_waitpid(array_shift($processes), $status); } /** @var DocBlox_Parallel_Worker $worker */ foreach ($this as $worker) { $worker->pipe->push(); } $this->is_running = false; } /** * Forks the current process and calls the Worker's execute method OR * handles the parent process' execution. * * This is the really tricky part of the forking mechanism. Here we invoke * {@link http://www.php.net/manual/en/function.pcntl-fork.php pcntl_fork} * and either execute the forked process or deal with the parent's process * based on in which process we are. * * To fully understand what is going on here it is recommended to read the * PHP manual page on * {@link http://www.php.net/manual/en/function.pcntl-fork.php pcntl_fork} * and associated articles. * * If there are more workers than may be ran simultaneously then this method * will wait until a slot becomes available and then starts the next worker. * * @param DocBlox_Parallel_Worker $worker The worker to process. * @param int[] &$processes The list of running processes. * * @throws RuntimeException if we are unable to fork. * * @return void */ protected function forkAndRun( DocBlox_Parallel_Worker $worker, array &$processes ) { $worker->pipe = new DocBlox_Parallel_WorkerPipe($worker); // fork the process and register the PID $pid = pcntl_fork(); switch ($pid) { case -1: throw new RuntimeException('Unable to establish a fork'); case 0: // Child process $worker->execute(); $worker->pipe->pull(); // Kill -9 this process to prevent closing of shared file handlers. // Not doing this causes, for example, MySQL connections to be cleaned. posix_kill(getmypid(), SIGKILL); default: // Parent process // Keep track if the worker children $processes[] = $pid; if (count($processes) >= $this->getProcessLimit()) { pcntl_waitpid(array_shift($processes), $status); } break; } } /** * Returns true when all requirements are met. * * @return bool */ protected function checkRequirements() { return (bool) (extension_loaded('pcntl')); } } * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://docblox-project.org */ /** * Class that represents the execution of a single task within a parallelized * frame. * * @category DocBlox * @package Parallel * @author Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://docblox-project.org */ class DocBlox_Parallel_Worker { /** @var callback the task to execute for this worker */ protected $task = null; /** @var mixed[] A list of argument to pass to the task */ protected $arguments = array(); /** @var int The return code to tell the parent process how it went */ protected $return_code = -1; /** @var mixed The result of the given task */ protected $result = ''; /** @var string The error message, if an error occurred */ protected $error = ''; /** * Creates the worker and sets the task to execute optionally including * the arguments that need to be passed to the task. * * @param callback $task The task to invoke upon execution. * @param mixed[] $arguments The arguments to provide to the task. */ public function __construct($task, array $arguments = array()) { $this->setTask($task); $this->arguments = $arguments; } /** * Returns the list of arguments as provided in the constructor. * * @see DocBlox_Parallel_Worker::__construct() * * @return mixed[] */ public function getArguments() { return $this->arguments; } /** * Returns the task as provided in the constructor. * * @see DocBlox_Parallel_Worker::__construct() * * @return callback */ public function getTask() { return $this->task; } /** * Returns the available return code. * * This method may return -1 if no return code is available yet. * * @return int */ public function getReturnCode() { return $this->return_code; } /** * Sets the return code for this worker. * * Recommended is to use the same codes as are used with * {@link http://www.gnu.org/software/bash/manual/html_node/Exit-Status.html * exit codes}. * * In short: 0 means that the task succeeded and a any other positive value * indicates an error condition. * * @param int $return_code Recommended to be a positive number * * @throw InvalidArgumentException if the code is not a number or negative * * @return void */ public function setReturnCode($return_code) { if (!is_numeric($return_code) || ($return_code < 0)) { throw new InvalidArgumentException( 'Expected the return code to be a positive number' ); } $this->return_code = $return_code; } /** * Returns the error message associated with the return code. * * @return string */ public function getError() { return $this->error; } /** * Sets the error message. * * @param string $error The error message. * * @return void */ public function setError($error) { $this->error = $error; } /** * Returns the result for this task run. * * @return null|mixed */ public function getResult() { return $this->result; } /** * Sets the result for this task run. * * @param mixed $result The value that is returned by the task; can be anything. * * @return void */ public function setResult($result) { $this->result = $result; } /** * Invokes the task with the given arguments and processes the output. * * @return void. */ public function execute() { $this->setReturnCode(0); try { $this->setResult( call_user_func_array($this->getTask(), $this->getArguments()) ); } catch (Exception $e) { $this->setError($e->getMessage()); $this->setReturnCode($e->getCode()); } } /** * Sets the task for this worker and validates whether it is callable. * * @param callback $task The task to execute when the execute method * is invoked. * * @throws InvalidArgumentException if the given argument is not a callback. * * @see DocBlox_Parallel_Worker::__construct() * @see DocBlox_Parallel_Worker::execute() * * @return void */ protected function setTask($task) { if (!is_callable($task)) { throw new InvalidArgumentException( 'Worker task is not a callable object' ); } $this->task = $task; } } . */ /** * Wrapper class that holds the attributes of a Task (or elements * nested below that level) and takes care of configuring that element * at runtime. * * SMART-UP INLINE DOCS * * @author Andreas Aderhold * @author Hans Lellelid * @version $Id: 465efa4e9b1232a9ede67d3a3adadbe1fbafb7e2 $ * @package phing */ class RuntimeConfigurable { private $elementTag = null; /** @var array $children */ private $children = array(); /** @var object|Task $wrappedObject */ private $wrappedObject = null; /** @var array $attributes */ private $attributes = array(); /** @var string $characters */ private $characters = ""; /** @var bool $proxyConfigured */ private $proxyConfigured = false; /** * @param Task|object $proxy * @param mixed $elementTag The element to wrap. */ public function __construct($proxy, $elementTag) { $this->wrappedObject = $proxy; $this->elementTag = $elementTag; if ($proxy instanceof Task) { $proxy->setRuntimeConfigurableWrapper($this); } } /** * @return object|Task */ public function getProxy() { return $this->wrappedObject; } /** * @param object|Task $proxy * * @return void */ public function setProxy($proxy) { $this->wrappedObject = $proxy; $this->proxyConfigured = false; } /** * Set's the attributes for the wrapped element. * * @param array $attributes * * @return void */ public function setAttributes($attributes) { $this->attributes = $attributes; } /** * Returns the AttributeList of the wrapped element. * * @return array */ public function getAttributes() { return $this->attributes; } /** * Adds child elements to the wrapped element. * * @param RuntimeConfigurable $child * * @return void */ public function addChild(RuntimeConfigurable $child) { $this->children[] = $child; } /** * Returns the child with index * * @param int $index * * @return RuntimeConfigurable */ public function getChild($index) { return $this->children[(int) $index]; } /** * Add characters from #PCDATA areas to the wrapped element. * * @param string $data * * @return void */ public function addText($data) { $this->characters .= (string) $data; } public function getElementTag() { return $this->elementTag; } /** * Configure the wrapped element and all children. * * @param Project $project * * @return void * * @throws BuildException * @throws Exception */ public function maybeConfigure(Project $project) { if ($this->proxyConfigured) { return; } $id = null; // DataType configured in ProjectConfigurator // if ( is_a($this->wrappedObject, "DataType") ) // return; if ($this->attributes || (isset($this->characters) && $this->characters != '')) { ProjectConfigurator::configure($this->wrappedObject, $this->attributes, $project); if (isset($this->attributes["id"])) { $id = $this->attributes["id"]; } if (isset($this->characters) && $this->characters != '') { ProjectConfigurator::addText($project, $this->wrappedObject, (string) $this->characters); } if ($id !== null) { $project->addReference($id, $this->wrappedObject); } } /*if ( is_array($this->children) && !empty($this->children) ) { // Configure all child of this object ... foreach ($this->children as $child) { $child->maybeConfigure($project); ProjectConfigurator::storeChild($project, $this->wrappedObject, $child->wrappedObject, strtolower($child->getElementTag())); } }*/ $this->proxyConfigured = true; } } . */ require_once 'phing/BuildLogger.php'; require_once 'phing/listener/DefaultLogger.php'; require_once 'phing/system/util/Timer.php'; /** * Generates a file in the current directory with * an XML description of what happened during a build. * The default filename is "log.xml", but this can be overridden * with the property XmlLogger.file. * * @author Michiel Rook * @version $Id: 534a60eca6b0c4803103b490663a64d85b052e5a $ * @package phing.listener */ class XmlLogger implements BuildLogger { /** XML element name for a build. */ const BUILD_TAG = "build"; /** XML element name for a target. */ const TARGET_TAG = "target"; /** XML element name for a task. */ const TASK_TAG = "task"; /** XML element name for a message. */ const MESSAGE_TAG = "message"; /** XML attribute name for a name. */ const NAME_ATTR = "name"; /** XML attribute name for a time. */ const TIME_ATTR = "time"; /** XML attribute name for a message priority. */ const PRIORITY_ATTR = "priority"; /** XML attribute name for a file location. */ const LOCATION_ATTR = "location"; /** XML attribute name for an error description. */ const ERROR_ATTR = "error"; /** XML element name for a stack trace. */ const STACKTRACE_TAG = "stacktrace"; /** * @var DOMDocument The XML document created by this logger. */ private $doc; /** * @var int Start time for entire build. */ private $buildTimerStart = 0; /** * @var DOMElement Top-level (root) build element */ private $buildElement; /** * @var array DOMElement[] The parent of the element being processed. */ private $elementStack = array(); /** * @var array int[] Array of millisecond times for the various elements being processed. */ private $timesStack = array(); /** * @var int */ private $msgOutputLevel = Project::MSG_DEBUG; /** * @var OutputStream Stream to use for standard output. */ private $out; /** * @var OutputStream Stream to use for error output. */ private $err; /** * @var string Name of filename to create. */ private $outFilename; /** * Constructs a new BuildListener that logs build events to an XML file. */ public function __construct() { $this->doc = new DOMDocument("1.0", "UTF-8"); $this->doc->formatOutput = true; } /** * Fired when the build starts, this builds the top-level element for the * document and remembers the time of the start of the build. * * @param BuildEvent Ignored. */ public function buildStarted(BuildEvent $event) { $this->buildTimerStart = Phing::currentTimeMillis(); $this->buildElement = $this->doc->createElement(XmlLogger::BUILD_TAG); array_push($this->elementStack, $this->buildElement); array_push($this->timesStack, $this->buildTimerStart); } /** * Fired when the build finishes, this adds the time taken and any * error stacktrace to the build element and writes the document to disk. * * @param BuildEvent $event An event with any relevant extra information. * Will not be null. * @throws BuildException */ public function buildFinished(BuildEvent $event) { $elapsedTime = Phing::currentTimeMillis() - $this->buildTimerStart; $this->buildElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime)); if ($event->getException() != null) { $this->buildElement->setAttribute(XmlLogger::ERROR_ATTR, $event->getException()->getMessage()); $errText = $this->doc->createCDATASection($event->getException()->getTraceAsString()); $stacktrace = $this->doc->createElement(XmlLogger::STACKTRACE_TAG); $stacktrace->appendChild($errText); $this->buildElement->appendChild($stacktrace); } $this->doc->appendChild($this->buildElement); $outFilename = $event->getProject()->getProperty("XmlLogger.file"); if ($outFilename == null) { $outFilename = "log.xml"; } try { $stream = $this->out; if ($stream === null) { $stream = new FileOutputStream($outFilename); } // Yes, we could just stream->write() but this will eventually be the better // way to do this (when we need to worry about charset conversions. $writer = new OutputStreamWriter($stream); $writer->write($this->doc->saveXML()); $writer->close(); } catch (IOException $exc) { try { $stream->close(); // in case there is a stream open still ... } catch (Exception $x) { } throw new BuildException("Unable to write log file.", $exc); } // cleanup:remove the buildElement $this->buildElement = null; array_pop($this->elementStack); array_pop($this->timesStack); } /** * Fired when a target starts building, remembers the current time and the name of the target. * * @param BuildEvent $event An event with any relevant extra information. * Will not be null. */ public function targetStarted(BuildEvent $event) { $target = $event->getTarget(); $targetElement = $this->doc->createElement(XmlLogger::TARGET_TAG); $targetElement->setAttribute(XmlLogger::NAME_ATTR, $target->getName()); array_push($this->timesStack, Phing::currentTimeMillis()); array_push($this->elementStack, $targetElement); } /** * Fired when a target finishes building, this adds the time taken * to the appropriate target element in the log. * * @param BuildEvent $event An event with any relevant extra information. * Will not be null. */ public function targetFinished(BuildEvent $event) { $targetTimerStart = array_pop($this->timesStack); $targetElement = array_pop($this->elementStack); $elapsedTime = Phing::currentTimeMillis() - $targetTimerStart; $targetElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime)); $parentElement = $this->elementStack[count($this->elementStack) - 1]; $parentElement->appendChild($targetElement); } /** * Fired when a task starts building, remembers the current time and the name of the task. * * @param BuildEvent $event An event with any relevant extra information. * Will not be null. */ public function taskStarted(BuildEvent $event) { $task = $event->getTask(); $taskElement = $this->doc->createElement(XmlLogger::TASK_TAG); $taskElement->setAttribute(XmlLogger::NAME_ATTR, $task->getTaskName()); $taskElement->setAttribute(XmlLogger::LOCATION_ATTR, $task->getLocation()->toString()); array_push($this->timesStack, Phing::currentTimeMillis()); array_push($this->elementStack, $taskElement); } /** * Fired when a task finishes building, this adds the time taken * to the appropriate task element in the log. * * @param BuildEvent $event An event with any relevant extra information. * Will not be null. */ public function taskFinished(BuildEvent $event) { $taskTimerStart = array_pop($this->timesStack); $taskElement = array_pop($this->elementStack); $elapsedTime = Phing::currentTimeMillis() - $taskTimerStart; $taskElement->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime)); $parentElement = $this->elementStack[count($this->elementStack) - 1]; $parentElement->appendChild($taskElement); } /** * Fired when a message is logged, this adds a message element to the * most appropriate parent element (task, target or build) and records * the priority and text of the message. * * @param BuildEvent An event with any relevant extra information. * Will not be null. */ public function messageLogged(BuildEvent $event) { $priority = $event->getPriority(); if ($priority > $this->msgOutputLevel) { return; } $messageElement = $this->doc->createElement(XmlLogger::MESSAGE_TAG); switch ($priority) { case Project::MSG_ERR: $name = "error"; break; case Project::MSG_WARN: $name = "warn"; break; case Project::MSG_INFO: $name = "info"; break; default: $name = "debug"; break; } $messageElement->setAttribute(XmlLogger::PRIORITY_ATTR, $name); if (function_exists('mb_convert_encoding')) { $messageConverted = mb_convert_encoding($event->getMessage(), 'UTF-8'); } else { $messageConverted = utf8_encode($event->getMessage()); } $messageText = $this->doc->createCDATASection($messageConverted); $messageElement->appendChild($messageText); if (!empty($this->elementStack)) { $this->elementStack[count($this->elementStack) - 1]->appendChild($messageElement); } } /** * Set the msgOutputLevel this logger is to respond to. * * Only messages with a message level lower than or equal to the given * level are output to the log. * *

Constants for the message levels are in Project.php. The order of * the levels, from least to most verbose, is: * *

    *
  • Project::MSG_ERR
  • *
  • Project::MSG_WARN
  • *
  • Project::MSG_INFO
  • *
  • Project::MSG_VERBOSE
  • *
  • Project::MSG_DEBUG
  • *
* * The default message level for DefaultLogger is Project::MSG_ERR. * * @param int $level The logging level for the logger. * @see BuildLogger#setMessageOutputLevel() */ public function setMessageOutputLevel($level) { $this->msgOutputLevel = (int) $level; } /** * Sets the output stream. * @param OutputStream $output * @see BuildLogger#setOutputStream() */ public function setOutputStream(OutputStream $output) { $this->out = $output; } /** * Sets the error stream. * @param OutputStream $err * @see BuildLogger#setErrorStream() */ public function setErrorStream(OutputStream $err) { $this->err = $err; } /** * Sets this logger to produce emacs (and other editor) friendly output. * * @param bool $emacsMode true if output is to be unadorned so that emacs and other editors * can parse files names, etc. */ public function setEmacsMode($emacsMode) { } /** * @return DOMDocument */ public function getDoc() { return $this->doc; } /** * @return int */ public function getBuildTimerStart() { return $this->buildTimerStart; } /** * @return DOMElement */ public function getBuildElement() { return $this->buildElement; } public function setBuildElement($elem) { $this->buildElement = $elem; } /** * @return array */ public function getElementStack() { return $this->elementStack; } /** * @return array */ public function getTimesStack() { return $this->timesStack; } /** * @return int */ public function getMsgOutputLevel() { return $this->msgOutputLevel; } /** * @return OutputStream */ public function getOut() { return $this->out; } /** * @return OutputStream */ public function getErr() { return $this->err; } /** * @return string */ public function getOutFilename() { return $this->outFilename; } } . */ require_once 'phing/listener/DefaultLogger.php'; /** * Extends DefaultLogger to strip out empty targets. * * @author Andreas Aderhold * @copyright 2001,2002 THYRELL. All rights reserved * @version $Id: fde85729a4da71d69341a94fb05cbaa1f7c40d5b $ * @package phing.listener */ class NoBannerLogger extends DefaultLogger { private $targetName = null; /** * @param BuildEvent $event */ public function targetStarted(BuildEvent $event) { $target = $event->getTarget(); $this->targetName = $target->getName(); } /** * @param BuildEvent $event */ public function targetFinished(BuildEvent $event) { $this->targetName = null; } /** * @param BuildEvent $event */ public function messageLogged(BuildEvent $event) { if ($event->getPriority() > $this->msgOutputLevel || null === $event->getMessage() || trim( $event->getMessage() === "" ) ) { return; } if ($this->targetName !== null) { $msg = PHP_EOL . $event->getProject()->getName() . ' > ' . $this->targetName . ':' . PHP_EOL; $this->printMessage($msg, $this->out, $event->getPriority()); $this->targetName = null; } parent::messageLogged($event); } } . */ include_once 'phing/listener/DefaultLogger.php'; include_once 'phing/BuildEvent.php'; /** * This is a special logger that is designed to profile builds. * * @author Siad Ardroumli * @package phing.listener */ class ProfileLogger extends DefaultLogger { private $profileData = array(); protected static $dateFormat = DATE_RFC2822; /** * Logs a message to say that the target has started. * * @param BuildEvent $event * An event with any relevant extra information. Must not be * null. */ public function targetStarted(BuildEvent $event) { if (@date_default_timezone_get() === 'UTC') { date_default_timezone_set('Europe/Berlin'); } $now = Phing::currentTimeMillis(); $name = "Target " . $event->getTarget()->getName(); $this->logStart($event, $now, $name); $this->profileData[] = $now; } /** * Logs a message to say that the target has finished. * * @param BuildEvent $event * An event with any relevant extra information. Must not be * null. */ public function targetFinished(BuildEvent $event) { $start = array_pop($this->profileData); $name = "Target " . $event->getTarget()->getName(); $this->logFinish($event, $start, $name); } /** * Logs a message to say that the task has started. * * @param BuildEvent $event * An event with any relevant extra information. Must not be * null. */ public function taskStarted(BuildEvent $event) { $name = $event->getTask()->getTaskName(); $now = Phing::currentTimeMillis(); $this->logStart($event, $now, $name); $this->profileData[] = $now; } /** * Logs a message to say that the task has finished. * * @param BuildEvent $event * An event with any relevant extra information. Must not be * null. */ public function taskFinished(BuildEvent $event) { $start = array_pop($this->profileData); $name = $event->getTask()->getTaskName(); $this->logFinish($event, $start, $name); } private function logFinish(BuildEvent $event, $start, $name) { $msg = null; if ($start != null) { $diff = self::formatTime(Phing::currentTimeMillis() - $start); $msg = Phing::getProperty("line.separator") . $name . ": finished " . date(self::$dateFormat, time()) . " (" . $diff . ")"; } else { $msg = Phing::getProperty("line.separator") . $name . ": finished " . date(self::$dateFormat, time()) . " (unknown duration, start not detected)"; } $this->printMessage($msg, $this->out, $event->getPriority()); } private function logStart(BuildEvent $event, $start, $name) { $msg = Phing::getProperty("line.separator") . $name . ": started " . date(self::$dateFormat, $start); $this->printMessage($msg, $this->out, $event->getPriority()); } } . */ include_once 'phing/listener/DefaultLogger.php'; /** * A logger which logs nothing but build failure and what task might output. * * @author Siad Ardroumli * @package phing.listener */ class SilentLogger extends DefaultLogger { public function buildStarted(BuildEvent $event) { // log nothing } public function buildFinished(BuildEvent $event) { if ($event->getException() != null) { parent::buildFinished($event); } } public function targetStarted(BuildEvent $event) { // log nothing } public function targetFinished(BuildEvent $event) { // log nothing } public function taskStarted(BuildEvent $event) { // log nothing } public function taskFinished(BuildEvent $event) { // log nothing } } . */ require_once 'phing/listener/DefaultLogger.php'; include_once 'phing/system/util/Properties.php'; /** * Uses ANSI Color Code Sequences to colorize messages * sent to the console. * * If used with the -logfile option, the output file * will contain all the necessary escape codes to * display the text in colorized mode when displayed * in the console using applications like cat, more, * etc. * * This is designed to work on terminals that support ANSI * color codes. It works on XTerm, ETerm, Mindterm, etc. * It also works on Win9x (with ANSI.SYS loaded.) * * NOTE: * It doesn't work on WinNT's COMMAND.COM even with * ANSI.SYS loaded. * * The default colors used for differentiating * the message levels can be changed by editing the * phing/listener/defaults.properties file. * * This file contains 5 key/value pairs: * AnsiColorLogger.ERROR_COLOR=2;31 * AnsiColorLogger.WARNING_COLOR=2;35 * AnsiColorLogger.INFO_COLOR=2;36 * AnsiColorLogger.VERBOSE_COLOR=2;32 * AnsiColorLogger.DEBUG_COLOR=2;34 * * Another option is to pass a system variable named * ant.logger.defaults, with value set to the path of * the file that contains user defined Ansi Color * Codes, to the java command using -D option. * * To change these colors use the following chart: * * ANSI COLOR LOGGER CONFIGURATION * * Format for AnsiColorLogger.*= * Attribute;Foreground;Background * * Attribute is one of the following: * 0 -> Reset All Attributes (return to normal mode) * 1 -> Bright (Usually turns on BOLD) * 2 -> Dim * 3 -> Underline * 5 -> link * 7 -> Reverse * 8 -> Hidden * * Foreground is one of the following: * 30 -> Black * 31 -> Red * 32 -> Green * 33 -> Yellow * 34 -> Blue * 35 -> Magenta * 36 -> Cyan * 37 -> White * * Background is one of the following: * 40 -> Black * 41 -> Red * 42 -> Green * 43 -> Yellow * 44 -> Blue * 45 -> Magenta * 46 -> Cyan * 47 -> White * * @author Hans Lellelid (Phing) * @author Magesh Umasankar (Ant) * @package phing.listener * @version $Id: eccc8da05ad1fbe73d38da7fca7ecb4816beabd0 $ */ class AnsiColorLogger extends DefaultLogger { const ATTR_NORMAL = 0; const ATTR_BRIGHT = 1; const ATTR_DIM = 2; const ATTR_UNDERLINE = 3; const ATTR_BLINK = 5; const ATTR_REVERSE = 7; const ATTR_HIDDEN = 8; const FG_BLACK = 30; const FG_RED = 31; const FG_GREEN = 32; const FG_YELLOW = 33; const FG_BLUE = 34; const FG_MAGENTA = 35; const FG_CYAN = 36; const FG_WHITE = 37; const BG_BLACK = 40; const BG_RED = 41; const BG_GREEN = 42; const BG_YELLOW = 44; const BG_BLUE = 44; const BG_MAGENTA = 45; const BG_CYAN = 46; const BG_WHITE = 47; const PREFIX = "\x1b["; const SUFFIX = "m"; const SEPARATOR = ';'; const END_COLOR = "\x1b[0m"; // self::PREFIX . self::SUFFIX; private $errColor; private $warnColor; private $infoColor; private $verboseColor; private $debugColor; private $colorsSet = false; /** * Construct new AnsiColorLogger * Perform initializations that cannot be done in var declarations. */ public function __construct() { parent::__construct(); $this->errColor = self::PREFIX . self::ATTR_NORMAL . self::SEPARATOR . self::FG_RED . self::SUFFIX; $this->warnColor = self::PREFIX . self::ATTR_NORMAL . self::SEPARATOR . self::FG_MAGENTA . self::SUFFIX; $this->infoColor = self::PREFIX . self::ATTR_NORMAL . self::SEPARATOR . self::FG_CYAN . self::SUFFIX; $this->verboseColor = self::PREFIX . self::ATTR_NORMAL . self::SEPARATOR . self::FG_GREEN . self::SUFFIX; $this->debugColor = self::PREFIX . self::ATTR_NORMAL . self::SEPARATOR . self::FG_BLUE . self::SUFFIX; } /** * Set the colors to use from a property file specified by the * special ant property ant.logger.defaults */ final private function setColors() { $userColorFile = Phing::getProperty("phing.logger.defaults"); $systemColorFile = new PhingFile(Phing::getResourcePath("phing/listener/defaults.properties")); $in = null; try { $prop = new Properties(); if ($userColorFile !== null) { $prop->load($userColorFile); } else { $prop->load($systemColorFile); } $err = $prop->getProperty("AnsiColorLogger.ERROR_COLOR"); $warn = $prop->getProperty("AnsiColorLogger.WARNING_COLOR"); $info = $prop->getProperty("AnsiColorLogger.INFO_COLOR"); $verbose = $prop->getProperty("AnsiColorLogger.VERBOSE_COLOR"); $debug = $prop->getProperty("AnsiColorLogger.DEBUG_COLOR"); if ($err !== null) { $this->errColor = self::PREFIX . $err . self::SUFFIX; } if ($warn !== null) { $this->warnColor = self::PREFIX . $warn . self::SUFFIX; } if ($info !== null) { $this->infoColor = self::PREFIX . $info . self::SUFFIX; } if ($verbose !== null) { $this->verboseColor = self::PREFIX . $verbose . self::SUFFIX; } if ($debug !== null) { $this->debugColor = self::PREFIX . $debug . self::SUFFIX; } } catch (IOException $ioe) { //Ignore exception - we will use the defaults. } } /** * @see DefaultLogger#printMessage * @param string $message * @param OutputStream $stream * @param int $priority */ final protected function printMessage($message, OutputStream $stream, $priority) { if ($message !== null) { if (!$this->colorsSet) { $this->setColors(); $this->colorsSet = true; } switch ($priority) { case Project::MSG_ERR: $message = $this->errColor . $message . self::END_COLOR; break; case Project::MSG_WARN: $message = $this->warnColor . $message . self::END_COLOR; break; case Project::MSG_INFO: $message = $this->infoColor . $message . self::END_COLOR; break; case Project::MSG_VERBOSE: $message = $this->verboseColor . $message . self::END_COLOR; break; case Project::MSG_DEBUG: $message = $this->debugColor . $message . self::END_COLOR; break; } $stream->write($message . PHP_EOL); } } } . */ require_once 'phing/listener/XmlLogger.php'; /** * Generates a file in the current directory with * an JSON description of what happened during a build. * The default filename is "log.json", but this can be overridden * with the property JsonLogger.file. * * @author Siad Ardroumli * @package phing.listener */ class JsonLogger extends XmlLogger { /** * Fired when the build finishes, this adds the time taken and any * error stacktrace to the build element and writes the document to disk. * * @param BuildEvent $event An event with any relevant extra information. * Will not be null. * @throws BuildException */ public function buildFinished(BuildEvent $event) { $elapsedTime = Phing::currentTimeMillis() - $this->getBuildTimerStart(); $this->getBuildElement()->setAttribute(XmlLogger::TIME_ATTR, DefaultLogger::formatTime($elapsedTime)); if ($event->getException() != null) { $this->getBuildElement()->setAttribute(XmlLogger::ERROR_ATTR, $event->getException()->getMessage()); $errText = $this->getDoc()->createCDATASection($event->getException()->getTraceAsString()); $stacktrace = $this->getDoc()->createElement(XmlLogger::STACKTRACE_TAG); $stacktrace->appendChild($errText); $this->getBuildElement()->appendChild($stacktrace); } $this->getDoc()->appendChild($this->getBuildElement()); $outFilename = $event->getProject()->getProperty("JsonLogger.file"); if ($outFilename == null) { $outFilename = "log.json"; } try { $stream = $this->getOut(); if ($stream === null) { $stream = new FileOutputStream($outFilename); } $writer = new OutputStreamWriter($stream); $writer->write($this->xml2js(simplexml_import_dom($this->getDoc()))); $writer->close(); } catch (IOException $exc) { try { $stream->close(); // in case there is a stream open still ... } catch (Exception $x) { } throw new BuildException("Unable to write log file.", $exc); } // cleanup:remove the buildElement $this->setBuildElement(null); array_pop($this->getElementStack()); array_pop($this->getTimesStack()); } private function xml2js(SimpleXMLElement $xmlnode, $isRoot = true) { $jsnode = array(); if (!$isRoot) { if (count($xmlnode->attributes()) > 0){ $jsnode["@attribute"] = array(); foreach($xmlnode->attributes() as $key => $value) $jsnode["@attribute"][$key] = (string)$value; } $textcontent = trim((string) $xmlnode); if (count($textcontent) > 0) $jsnode['_'] = $textcontent; foreach ($xmlnode->children() as $childxmlnode) { $childname = $childxmlnode->getName(); if (!array_key_exists($childname, $jsnode)) $jsnode[$childname] = array(); array_push($jsnode[$childname], $this->xml2js($childxmlnode, false)); } return $jsnode; } else { $nodename = $xmlnode->getName(); $jsnode[$nodename] = array(); array_push($jsnode[$nodename], $this->xml2js($xmlnode, false)); return json_encode($jsnode, JSON_PRETTY_PRINT); } } } . */ include_once 'phing/listener/DefaultLogger.php'; /** * Like a normal logger, except with timed outputs. * * @author Siad Ardroumli * @package phing.listener */ class TimestampedLogger extends DefaultLogger { /** * what appears between the old message and the new */ public static $SPACER = ' - at '; /** * This is an override point: the message that indicates whether a build failed. * Subclasses can change/enhance the message. * * @return string The classic "BUILD FAILED" plus a timestamp */ protected function getBuildFailedMessage() { return parent::getBuildFailedMessage() . self::$SPACER . date('n/d/Y h:m a'); } /** * This is an override point: the message that indicates that a build succeeded. * Subclasses can change/enhance the message. * * @return string The classic "BUILD SUCCESSFUL" plus a timestamp */ protected function getBuildSuccessfulMessage() { return parent::getBuildSuccessfulMessage() . self::$SPACER . date('n/d/Y h:m a'); } } . */ require_once 'phing/BuildListener.php'; /** * Writes build messages to PEAR Log. * * By default it will log to file in current directory w/ name 'phing.log'. You can customize * this behavior by setting properties: * - pear.log.type * - pear.log.name * - pear.log.ident (note that this class changes ident to project name) * - pear.log.conf (note that array values are currently unsupported in Phing property files) * * * phing -f build.xml -logger phing.listener.PearLogger -Dpear.log.type=file -Dpear.log.name=/path/to/log.log * * * @author Hans Lellelid * @version $Id: 63dcb060d3671bbf7d28433c4871c89c0119c5c1 $ * @see BuildEvent * @package phing.listener */ class PearLogListener implements BuildListener { /** * Size of the left column in output. The default char width is 12. * @var int */ const LEFT_COLUMN_SIZE = 12; /** * Time that the build started * @var int */ protected $startTime; /** * Maps Phing Project::MSG_* constants to PEAR_LOG_* constants. * @var array */ protected static $levelMap = array( Project::MSG_DEBUG => PEAR_LOG_DEBUG, Project::MSG_INFO => PEAR_LOG_INFO, Project::MSG_VERBOSE => PEAR_LOG_NOTICE, Project::MSG_WARN => PEAR_LOG_WARNING, Project::MSG_ERR => PEAR_LOG_ERR ); /** * Whether logging has been configured. * @var boolean */ protected $logConfigured = false; /** * @var Log PEAR Log object. */ protected $logger; /** * Configure the logger. */ protected function configureLogging() { $type = Phing::getDefinedProperty('pear.log.type'); $name = Phing::getDefinedProperty('pear.log.name'); $ident = Phing::getDefinedProperty('pear.log.ident'); $conf = Phing::getDefinedProperty('pear.log.conf'); if ($type === null) { $type = 'file'; } if ($name === null) { $name = 'phing.log'; } if ($ident === null) { $ident = 'phing'; } if ($conf === null) { $conf = array(); } include_once 'Log.php'; if (!class_exists('Log')) { throw new BuildException("Cannot find PEAR Log class for use by PearLogger."); } $this->logger = Log::singleton($type, $name, $ident, $conf, self::$levelMap[$this->msgOutputLevel]); } /** * Get the configured PEAR logger to use. * This method just ensures that logging has been configured and returns the configured logger. * @return Log */ protected function logger() { if (!$this->logConfigured) { $this->configureLogging(); } return $this->logger; } /** * Sets the start-time when the build started. Used for calculating * the build-time. * * @param BuildEvent The BuildEvent */ public function buildStarted(BuildEvent $event) { $this->startTime = Phing::currentTimeMillis(); $this->logger()->setIdent($event->getProject()->getName()); $this->logger()->info("Starting build with buildfile: " . $event->getProject()->getProperty("phing.file")); } /** * Logs whether the build succeeded or failed, and any errors that * occurred during the build. Also outputs the total build-time. * * @param BuildEvent The BuildEvent * @see BuildEvent::getException() */ public function buildFinished(BuildEvent $event) { $error = $event->getException(); if ($error === null) { $msg = "Finished successful build."; } else { $msg = "Build failed. [reason: " . $error->getMessage() . "]"; } $this->logger()->log( $msg . " Total time: " . DefaultLogger::formatTime(Phing::currentTimeMillis() - $this->startTime) ); } /** * Logs the current target name * * @param BuildEvent The BuildEvent * @see BuildEvent::getTarget() */ public function targetStarted(BuildEvent $event) { } /** * Fired when a target has finished. We don't need specific action on this * event. So the methods are empty. * * @param BuildEvent The BuildEvent * @see BuildEvent::getException() */ public function targetFinished(BuildEvent $event) { } /** * Fired when a task is started. We don't need specific action on this * event. So the methods are empty. * * @param BuildEvent The BuildEvent * @see BuildEvent::getTask() */ public function taskStarted(BuildEvent $event) { } /** * Fired when a task has finished. We don't need specific action on this * event. So the methods are empty. * * @param BuildEvent The BuildEvent * @see BuildEvent::getException() */ public function taskFinished(BuildEvent $event) { } /** * Logs a message to the configured PEAR logger. * * @param BuildEvent The BuildEvent * @see BuildEvent::getMessage() */ public function messageLogged(BuildEvent $event) { if ($event->getPriority() <= $this->msgOutputLevel) { $msg = ""; if ($event->getTask() !== null) { $name = $event->getTask(); $name = $name->getTaskName(); $msg = str_pad("[$name] ", self::LEFT_COLUMN_SIZE, " ", STR_PAD_LEFT); } $msg .= $event->getMessage(); $this->logger()->log($msg, self::$levelMap[$event->getPriority()]); } } } . */ require_once 'phing/listener/AnsiColorLogger.php'; /** * Extends AnsiColorLogger to display times for each target * * @author Patrick McAndrew * @copyright 2013. All rights reserved * @version $Id: e5ae611d970cd766f7f23fe5a70c6483e66aceb5 $ * @package phing.listener */ class TargetLogger extends AnsiColorLogger { private $targetName = null; private $targetStartTime; /** * @param BuildEvent $event */ public function targetStarted(BuildEvent $event) { parent::targetStarted($event); $target = $event->getTarget(); $this->targetName = $target->getName(); $this->targetStartTime = Phing::currentTimeMillis(); } /** * @param BuildEvent $event */ public function targetFinished(BuildEvent $event) { $msg = PHP_EOL . "Target time: " . self::formatTime( Phing::currentTimeMillis() - $this->targetStartTime ) . PHP_EOL; $event->setMessage($msg, Project::MSG_INFO); $this->messageLogged($event); $this->targetName = null; } } #################################################### # # ANSI COLOR LOGGER CONFIGURATION # # Format for AnsiColorLogger.*= # Attribute;Foreground;Background # # Attribute is one of the following: # 0 -> Reset All Attributes (return to normal mode) # 1 -> Bright (Usually turns on BOLD) # 2 -> Dim # 3 -> Underline # 5 -> link # 7 -> Reverse # 8 -> Hidden # # Foreground is one of the following: # 30 -> Black # 31 -> Red # 32 -> Green # 33 -> Yellow # 34 -> Blue # 35 -> Magenta # 36 -> Cyan # 37 -> White # # Background is one of the following: # 40 -> Black # 41 -> Red # 42 -> Green # 43 -> Yellow # 44 -> Blue # 45 -> Magenta # 46 -> Cyan # 47 -> White # #################################################### AnsiColorLogger.ERROR_COLOR=01;31 AnsiColorLogger.WARNING_COLOR=01;35 AnsiColorLogger.INFO_COLOR=00;36 AnsiColorLogger.VERBOSE_COLOR=00;32 AnsiColorLogger.DEBUG_COLOR=01;34 . */ require_once 'phing/listener/DefaultLogger.php'; include_once 'phing/system/util/Properties.php'; /** * Uses PEAR Mail package to send the build log to one or * more recipients. * * @author Michiel Rook * @package phing.listener * @version $Id: 130043b9c5265eac0037f234cad0c2cbe5a73c11 $ */ class MailLogger extends DefaultLogger { private $_mailMessage = ""; private $_from = "phing@phing.info"; private $_subject = "Phing build result"; private $_tolist = null; /** * Construct new MailLogger */ public function __construct() { parent::__construct(); @require_once 'Mail.php'; if (!class_exists('Mail')) { throw new BuildException('Need the PEAR Mail package to send logs'); } $from = Phing::getDefinedProperty('phing.log.mail.from'); $subject = Phing::getDefinedProperty('phing.log.mail.subject'); $tolist = Phing::getDefinedProperty('phing.log.mail.recipients'); if (!empty($from)) { $this->_from = $from; } if (!empty($subject)) { $this->_subject = $subject; } if (!empty($tolist)) { $this->_tolist = $tolist; } } /** * @see DefaultLogger#printMessage * @param string $message * @param OutputStream $stream * @param int $priority */ final protected function printMessage($message, OutputStream $stream, $priority) { if ($message !== null) { $this->_mailMessage .= $message . "\n"; } } /** * Sends the mail * * @see DefaultLogger#buildFinished * @param BuildEvent $event */ public function buildFinished(BuildEvent $event) { parent::buildFinished($event); if (empty($this->_tolist)) { return; } $hdrs = array( 'From' => $this->_from, 'Subject' => $this->_subject . (empty($event) ? " (build successful)" : " (build failed)") ); $mail = Mail::factory('mail'); $mail->send($this->_tolist, $hdrs, $this->_mailMessage); } } . */ require_once 'phing/listener/DefaultLogger.php'; include_once 'phing/system/util/Properties.php'; /** * Uses CSS class that must be defined in the HTML page * where the Phing output is displayed. * * If used with the -logfile option, the output * will contain the text wrapped in html elements * with those css classes. * * The default classes used for differentiating * the message levels can be changed by editing the * phing/listener/defaults.properties file. * * This file can contain 5 key/value pairs: * HtmlColorLogger.ERROR_CLASS=_your_css_class_name_ * HtmlColorLogger.WARNING_CLASS=_your_css_class_name_ * HtmlColorLogger.INFO_CLASS=_your_css_class_name_ * HtmlColorLogger.VERBOSE_CLASS=_your_css_class_name_ * HtmlColorLogger.DEBUG_CLASS=_your_css_class_name_ * * This stems from the Ansi Color Logger done by Hans Lellelid: * * @author Anton Stöckl (Phing HTML Color Logger) * @author Hans Lellelid (Phing Ansi Color Logger) * @author Magesh Umasankar (Ant) * @package phing.listener * @version $Id: 5288eb0042a1c3bf2b1d34ed509a6c46adce87fd $ */ class HtmlColorLogger extends DefaultLogger { const CLASS_ERR = 'phing_err'; const CLASS_VERBOSE = 'phing_verbose'; const CLASS_DEBUG = 'phing_debug'; const CLASS_WARN = 'phing_warn'; const CLASS_INFO = 'phing_info'; const PREFIX = ''; const END_COLOR = ''; private $errColor; private $warnColor; private $infoColor; private $verboseColor; private $debugColor; private $colorsSet = false; /** * Construct new HtmlColorLogger * Perform initializations that cannot be done in var declarations. */ public function __construct() { parent::__construct(); $this->errColor = self::PREFIX . self::CLASS_ERR . self::SUFFIX; $this->warnColor = self::PREFIX . self::CLASS_WARN . self::SUFFIX; $this->infoColor = self::PREFIX . self::CLASS_INFO . self::SUFFIX; $this->verboseColor = self::PREFIX . self::CLASS_VERBOSE . self::SUFFIX; $this->debugColor = self::PREFIX . self::CLASS_DEBUG . self::SUFFIX; } /** * Set the colors to use from a property file specified in the * special phing property file "phing/listener/defaults.properties". */ final private function setColors() { $systemColorFile = new PhingFile(Phing::getResourcePath("phing/listener/defaults.properties")); try { $prop = new Properties(); $prop->load($systemColorFile); $err = $prop->getProperty("HtmlColorLogger.ERROR_CLASS"); $warn = $prop->getProperty("HtmlColorLogger.WARNING_CLASS"); $info = $prop->getProperty("HtmlColorLogger.INFO_CLASS"); $verbose = $prop->getProperty("HtmlColorLogger.VERBOSE_CLASS"); $debug = $prop->getProperty("HtmlColorLogger.DEBUG_CLASS"); if ($err !== null) { $this->errColor = self::PREFIX . $err . self::SUFFIX; } if ($warn !== null) { $this->warnColor = self::PREFIX . $warn . self::SUFFIX; } if ($info !== null) { $this->infoColor = self::PREFIX . $info . self::SUFFIX; } if ($verbose !== null) { $this->verboseColor = self::PREFIX . $verbose . self::SUFFIX; } if ($debug !== null) { $this->debugColor = self::PREFIX . $debug . self::SUFFIX; } } catch (IOException $ioe) { //Ignore exception - we will use the defaults. } } /** * @see DefaultLogger#printMessage * @param string $message * @param OutputStream $stream * @param int $priority */ final protected function printMessage($message, OutputStream $stream, $priority) { if ($message !== null) { if (!$this->colorsSet) { $this->setColors(); $this->colorsSet = true; } $search = array('<', '>'); $replace = array('<', '>'); $message = str_replace($search, $replace, $message); $search = array("\t", "\n", "\r"); $replace = array('   ', '
', ''); $message = str_replace($search, $replace, $message); if (preg_match('@^( +)([^ ].+)@', $message, $matches)) { $len = strlen($matches[1]); $space = ' '; for ($i = 1; $i < $len; $i++) { $space .= ' '; } $message = $space . $matches[2]; } switch ($priority) { case Project::MSG_ERR: $message = $this->errColor . $message . self::END_COLOR; break; case Project::MSG_WARN: $message = $this->warnColor . $message . self::END_COLOR; break; case Project::MSG_INFO: $message = $this->infoColor . $message . self::END_COLOR; break; case Project::MSG_VERBOSE: $message = $this->verboseColor . $message . self::END_COLOR; break; case Project::MSG_DEBUG: $message = $this->debugColor . $message . self::END_COLOR; break; } $stream->write($message . '
'); } } } . */ require_once 'phing/listener/StreamRequiredBuildLogger.php'; include_once 'phing/BuildEvent.php'; /** * Writes a build event to the console. * * Currently, it only writes which targets are being executed, and * any messages that get logged. * * @author Andreas Aderhold * @copyright 2001,2002 THYRELL. All rights reserved * @version $Id: 87e06a24aac53cc2f19fc0574489ae2f657de4bc $ * @see BuildEvent * @package phing.listener */ class DefaultLogger implements StreamRequiredBuildLogger { /** * Size of the left column in output. The default char width is 12. * @var int */ const LEFT_COLUMN_SIZE = 12; /** * The message output level that should be used. The default is * Project::MSG_VERBOSE. * @var int */ protected $msgOutputLevel = Project::MSG_ERR; /** * Time that the build started * @var int */ protected $startTime; /** * @var OutputStream Stream to use for standard output. */ protected $out; /** * @var OutputStream Stream to use for error output. */ protected $err; protected $emacsMode = false; /** * Construct a new default logger. */ public function __construct() { } /** * Set the msgOutputLevel this logger is to respond to. * * Only messages with a message level lower than or equal to the given * level are output to the log. * *

Constants for the message levels are in Project.php. The order of * the levels, from least to most verbose, is: * *

    *
  • Project::MSG_ERR
  • *
  • Project::MSG_WARN
  • *
  • Project::MSG_INFO
  • *
  • Project::MSG_VERBOSE
  • *
  • Project::MSG_DEBUG
  • *
* * The default message level for DefaultLogger is Project::MSG_ERR. * * @param int $level The logging level for the logger. * @see BuildLogger#setMessageOutputLevel() */ public function setMessageOutputLevel($level) { $this->msgOutputLevel = (int) $level; } /** * Sets the output stream. * @param OutputStream $output * @see BuildLogger#setOutputStream() */ public function setOutputStream(OutputStream $output) { $this->out = $output; } /** * Sets the error stream. * @param OutputStream $err * @see BuildLogger#setErrorStream() */ public function setErrorStream(OutputStream $err) { $this->err = $err; } /** * Sets this logger to produce emacs (and other editor) friendly output. * * @param bool $emacsMode true if output is to be unadorned so that * emacs and other editors can parse files names, etc. */ public function setEmacsMode($emacsMode) { $this->emacsMode = $emacsMode; } /** * Sets the start-time when the build started. Used for calculating * the build-time. * * @param BuildEvent $event * @internal param The $object BuildEvent */ public function buildStarted(BuildEvent $event) { $this->startTime = Phing::currentTimeMillis(); if ($this->msgOutputLevel >= Project::MSG_INFO) { $this->printMessage( "Buildfile: " . $event->getProject()->getProperty("phing.file"), $this->out, Project::MSG_INFO ); } } /** * Prints whether the build succeeded or failed, and any errors that * occurred during the build. Also outputs the total build-time. * * @param BuildEvent $event * @internal param The $object BuildEvent * @see BuildEvent::getException() */ public function buildFinished(BuildEvent $event) { $error = $event->getException(); if ($error === null) { $msg = PHP_EOL . $this->getBuildSuccessfulMessage() . PHP_EOL; } else { $msg = PHP_EOL . $this->getBuildFailedMessage() . PHP_EOL; if (Project::MSG_VERBOSE <= $this->msgOutputLevel || !($error instanceof BuildException)) { $msg .= $error->__toString() . PHP_EOL; } else { $msg .= $error->getMessage(); } } $msg .= PHP_EOL . "Total time: " . self::formatTime(Phing::currentTimeMillis() - $this->startTime) . PHP_EOL; if ($error === null) { $this->printMessage($msg, $this->out, Project::MSG_VERBOSE); } else { $this->printMessage($msg, $this->err, Project::MSG_ERR); } } /** * Get the message to return when a build failed. * @return string The classic "BUILD FAILED" */ protected function getBuildFailedMessage() { return "BUILD FAILED"; } /** * Get the message to return when a build succeeded. * @return string The classic "BUILD FINISHED" */ protected function getBuildSuccessfulMessage() { return "BUILD FINISHED"; } /** * Prints the current target name * * @param BuildEvent $event * @internal param The $object BuildEvent * @see BuildEvent::getTarget() */ public function targetStarted(BuildEvent $event) { if (Project::MSG_INFO <= $this->msgOutputLevel && $event->getTarget()->getName() != '' ) { $showLongTargets = $event->getProject()->getProperty("phing.showlongtargets"); $msg = PHP_EOL . $event->getProject()->getName() . ' > ' . $event->getTarget()->getName( ) . ($showLongTargets ? ' [' . $event->getTarget()->getDescription() . ']' : '') . ':' . PHP_EOL; $this->printMessage($msg, $this->out, $event->getPriority()); } } /** * Fired when a target has finished. We don't need specific action on this * event. So the methods are empty. * * @param BuildEvent $event * @internal param The $object BuildEvent * @see BuildEvent::getException() */ public function targetFinished(BuildEvent $event) { } /** * Fired when a task is started. We don't need specific action on this * event. So the methods are empty. * * @param BuildEvent $event * @internal param The $object BuildEvent * @see BuildEvent::getTask() */ public function taskStarted(BuildEvent $event) { } /** * Fired when a task has finished. We don't need specific action on this * event. So the methods are empty. * * @param BuildEvent $event The BuildEvent * @see BuildEvent::getException() */ public function taskFinished(BuildEvent $event) { } /** * Print a message to the stdout. * * @param BuildEvent $event * @see BuildEvent::getMessage() */ public function messageLogged(BuildEvent $event) { $priority = $event->getPriority(); if ($priority <= $this->msgOutputLevel) { $msg = ""; if ($event->getTask() !== null && !$this->emacsMode) { $name = $event->getTask(); $name = $name->getTaskName(); $msg = str_pad("[$name] ", self::LEFT_COLUMN_SIZE, " ", STR_PAD_LEFT); } $msg .= $event->getMessage(); if ($priority != Project::MSG_ERR) { $this->printMessage($msg, $this->out, $priority); } else { $this->printMessage($msg, $this->err, $priority); } } } /** * Formats a time micro integer to human readable format. * * @param integer The time stamp * @return string */ public static function formatTime($micros) { $seconds = $micros; $minutes = $seconds / 60; if ($minutes > 1) { return sprintf( "%1.0f minute%s %0.2f second%s", $minutes, ($minutes === 1 ? " " : "s "), $seconds - floor($seconds / 60) * 60, ($seconds % 60 === 1 ? "" : "s") ); } else { return sprintf("%0.4f second%s", $seconds, ($seconds % 60 === 1 ? "" : "s")); } } /** * Prints a message to console. * * @param string $message The message to print. * Should not be null. * @param OutputStream|resource $stream The stream to use for message printing. * @param int $priority The priority of the message. * (Ignored in this implementation.) * @throws IOException * @return void */ protected function printMessage($message, OutputStream $stream, $priority) { $stream->write($message . PHP_EOL); } } . */ require_once 'phing/BuildLogger.php'; /** * Interface for build loggers that require that out/err streams be set in order to function. * * This is just an empty sub-interface to BuildLogger, but is used by Phing to throw * graceful errors when classes like phing.listener.DefaultLogger are being used as * -listener. * * @author Hans Lellelid * @version $Id: e02403f7640929e2b0650bcaf270709fe6281b3c $ * @see BuildEvent * @see Project::addBuildListener() * @package phing */ interface StreamRequiredBuildLogger extends BuildLogger { } . */ require_once 'phing/tasks/system/condition/ConditionBase.php'; /** * task as a generalization of * *

This task supports boolean logic as well as pluggable conditions * to decide, whether a property should be set.

* *

This task does not extend Task to take advantage of * ConditionBase.

* * @author Andreas Aderhold * @copyright 2001,2002 THYRELL. All rights reserved * @version $Id: 4778e42a996baf0141a3c1b2de65f5e8fec17fef $ * @package phing.tasks.system */ class ConditionTask extends ConditionBase { /** @var string $property */ private $property; /** @var string $value */ private $value = "true"; /** * The name of the property to set. Required. * @param string $p * @return void */ public function setProperty($p) { $this->property = $p; } /** * The value for the property to set. Defaults to "true". * @param string $v * @return void */ public function setValue($v) { $this->value = $v; } /** * See whether our nested condition holds and set the property. * @throws BuildException * @return void */ public function main() { if ($this->countConditions() > 1) { throw new BuildException("You must not nest more than one condition into "); } if ($this->countConditions() < 1) { throw new BuildException("You must nest a condition into "); } $cs = $this->getIterator(); if ($cs->current()->evaluate()) { $this->project->setProperty($this->property, $this->value); } } } . */ require_once 'phing/Task.php'; require_once 'phing/Diagnostics.php'; require_once 'phing/system/io/PrintStream.php'; require_once 'phing/Phing.php'; /** * This is a task that hands off work to the Diagnostics module. * It lets you run diagnostics in an IDE. * * @author Siad Ardroumli * @package phing.tasks.system */ class DiagnosticsTask extends Task { /** * Execute the task. * This delegates to the Diagnostics class. * @throws BuildException on error. */ public function main() { Diagnostics::doReport(new PrintStream(Phing::getOutputStream())); } } . */ require_once 'phing/Task.php'; require_once 'phing/system/io/FileSystem.php'; include_once 'phing/mappers/FileNameMapper.php'; include_once 'phing/tasks/system/PhingTask.php'; /** * task * * Task definition for the foreach task. This task takes a list with * delimited values, and executes a target with set param. * * Usage: * * * Attributes: * list --> The list of values to process, with the delimiter character, * indicated by the "delimiter" attribute, separating each value. * target --> The target to call for each token, passing the token as the * parameter with the name indicated by the "param" attribute. * param --> The name of the parameter to pass the tokens in as to the * target. * delimiter --> The delimiter string that separates the values in the "list" * parameter. The default is ",". * * @author Jason Hines * @author Hans Lellelid * @version $Id: 46bd390ab29b8784b4a07b2a91afcba295b7d334 $ * @package phing.tasks.system */ class ForeachTask extends Task { /** Delimter-separated list of values to process. */ private $list; /** Name of parameter to pass to callee */ private $param; /** Name of absolute path parameter to pass to callee */ private $absparam; /** Delimiter that separates items in $list */ private $delimiter = ','; /** * PhingCallTask that will be invoked w/ calleeTarget. * @var PhingCallTask */ private $callee; /** Array of filesets */ private $filesets = array(); /** Instance of mapper **/ private $mapperElement; /** * Array of filelists * @var array */ private $filelists = array(); /** * Target to execute. * @var string */ private $calleeTarget; /** * Total number of files processed * @var integer */ private $total_files = 0; /** * Total number of directories processed * @var integer */ private $total_dirs = 0; public function init() { $this->callee = $this->project->createTask("phingcall"); $this->callee->setOwningTarget($this->getOwningTarget()); $this->callee->setTaskName($this->getTaskName()); $this->callee->setLocation($this->getLocation()); $this->callee->init(); } /** * This method does the work. * @throws BuildException * @return void */ public function main() { if ($this->list === null && count($this->filesets) == 0 && count($this->filelists) == 0) { throw new BuildException("Need either list, nested fileset or nested filelist to iterate through"); } if ($this->param === null) { throw new BuildException("You must supply a property name to set on each iteration in param"); } if ($this->calleeTarget === null) { throw new BuildException("You must supply a target to perform"); } $callee = $this->callee; $callee->setTarget($this->calleeTarget); $callee->setInheritAll(true); $callee->setInheritRefs(true); $mapper = null; if ($this->mapperElement !== null) { $mapper = $this->mapperElement->getImplementation(); } if (trim($this->list)) { $arr = explode($this->delimiter, $this->list); $total_entries = 0; foreach ($arr as $value) { $value = trim($value); $premapped = ''; if ($mapper !== null) { $premapped = $value; $value = $mapper->main($value); if ($value === null) { continue; } $value = array_shift($value); } $this->log( "Setting param '$this->param' to value '$value'" . ($premapped ? " (mapped from '$premapped')" : ''), Project::MSG_VERBOSE ); $prop = $callee->createProperty(); $prop->setOverride(true); $prop->setName($this->param); $prop->setValue($value); $callee->main(); $total_entries++; } } // filelists foreach ($this->filelists as $fl) { $srcFiles = $fl->getFiles($this->project); $this->process($callee, $fl->getDir($this->project), $srcFiles, array()); } // filesets foreach ($this->filesets as $fs) { $ds = $fs->getDirectoryScanner($this->project); $srcFiles = $ds->getIncludedFiles(); $srcDirs = $ds->getIncludedDirectories(); $this->process($callee, $fs->getDir($this->project), $srcFiles, $srcDirs); } if ($this->list === null) { $this->log( "Processed {$this->total_dirs} directories and {$this->total_files} files", Project::MSG_VERBOSE ); } else { $this->log( "Processed $total_entries entr" . ($total_entries > 1 ? 'ies' : 'y') . " in list", Project::MSG_VERBOSE ); } } /** * Processes a list of files & directories * * @param Task $callee * @param PhingFile $fromDir * @param array $srcFiles * @param array $srcDirs */ protected function process(Task $callee, PhingFile $fromDir, $srcFiles, $srcDirs) { $mapper = null; if ($this->mapperElement !== null) { $mapper = $this->mapperElement->getImplementation(); } $filecount = count($srcFiles); $this->total_files += $filecount; for ($j = 0; $j < $filecount; $j++) { $value = $srcFiles[$j]; $premapped = ""; if ($this->absparam) { $prop = $callee->createProperty(); $prop->setOverride(true); $prop->setName($this->absparam); $prop->setValue($fromDir . FileSystem::getFileSystem()->getSeparator() . $value); } if ($mapper !== null) { $premapped = $value; $value = $mapper->main($value); if ($value === null) { continue; } $value = array_shift($value); } if ($this->param) { $this->log( "Setting param '$this->param' to value '$value'" . ($premapped ? " (mapped from '$premapped')" : ''), Project::MSG_VERBOSE ); $prop = $callee->createProperty(); $prop->setOverride(true); $prop->setName($this->param); $prop->setValue($value); } $callee->main(); } $dircount = count($srcDirs); $this->total_dirs += $dircount; for ($j = 0; $j < $dircount; $j++) { $value = $srcDirs[$j]; $premapped = ""; if ($this->absparam) { $prop = $callee->createProperty(); $prop->setOverride(true); $prop->setName($this->absparam); $prop->setValue($fromDir . FileSystem::getFileSystem()->getSeparator() . $value); } if ($mapper !== null) { $premapped = $value; $value = $mapper->main($value); if ($value === null) { continue; } $value = array_shift($value); } if ($this->param) { $this->log( "Setting param '$this->param' to value '$value'" . ($premapped ? " (mapped from '$premapped')" : ''), Project::MSG_VERBOSE ); $prop = $callee->createProperty(); $prop->setOverride(true); $prop->setName($this->param); $prop->setValue($value); } $callee->main(); } } /** * @param $list */ public function setList($list) { $this->list = (string) $list; } /** * @param $target */ public function setTarget($target) { $this->calleeTarget = (string) $target; } /** * @param $param */ public function setParam($param) { $this->param = (string) $param; } /** * @param $absparam */ public function setAbsparam($absparam) { $this->absparam = (string) $absparam; } /** * @param $delimiter */ public function setDelimiter($delimiter) { $this->delimiter = (string) $delimiter; } /** * Nested adder, adds a set of files (nested fileset attribute). * * @param FileSet $fs * @return void */ public function addFileSet(FileSet $fs) { $this->filesets[] = $fs; } /** * Nested creator, creates one Mapper for this task * * @return object The created Mapper type object * @throws BuildException */ public function createMapper() { if ($this->mapperElement !== null) { throw new BuildException("Cannot define more than one mapper", $this->location); } $this->mapperElement = new Mapper($this->project); return $this->mapperElement; } /** * @return Property */ public function createProperty() { return $this->callee->createProperty(); } /** * Supports embedded element. * @return FileList */ public function createFileList() { $num = array_push($this->filelists, new FileList()); return $this->filelists[$num - 1]; } } . */ require_once 'phing/tasks/system/AdhocTask.php'; /** * A class for creating adhoc tasks in build file. * * * bar = $bar; * } * * function main() { * $this->log("In FooTest: " . $this->bar); * } * } * * ]]> * * * * * @author Hans Lellelid * @version $Id: c0cdcd2c07fd4b81ac8f1b7cbc50a4031b3d5ddd $ * @package phing.tasks.system */ class AdhocTaskdefTask extends AdhocTask { /** * The tag that refers to this task. */ private $name; /** * Set the tag that will represent this adhoc task/type. * @param string $name */ public function setName($name) { $this->name = $name; } /** Main entry point */ public function main() { if ($this->name === null) { throw new BuildException("The name attribute is required for adhoc task definition.", $this->location); } $taskdefs = $this->getProject()->getTaskDefinitions(); if (!isset($taskdefs[$this->name])) { $this->execute(); $classes = $this->getNewClasses(); if (count($classes) < 1) { throw new BuildException("You must define at least one class for AdhocTaskdefTask."); } $classname = array_pop($classes); // instantiate it to make sure it is an instance of Task $t = new $classname(); if (!($t instanceof Task)) { throw new BuildException("The adhoc class you defined must be an instance of phing.Task", $this->location); } $this->log("Task " . $this->name . " will be handled by class " . $classname, Project::MSG_VERBOSE); $this->project->addTaskDefinition($this->name, $classname); } } } . */ include_once 'phing/Task.php'; /** * A wrapper task that lets you run tasks(s) when another set * of tasks fails. * * Inspired by {@link http://ant-contrib.sourceforge.net/tasks/tasks/trycatch.html} * * @author Michiel Rook * @version $Id: 2059a94a0c48659f29e244115f17cae9e0b4b65b $ * @package phing.tasks.system */ class TryCatchTask extends Task { protected $propertyName = ""; protected $referenceName = ''; protected $tryContainer = null; protected $catchContainer = null; protected $finallyContainer = null; /** * Main method * * @throws BuildException * @return void */ public function main() { $exc = null; if (empty($this->tryContainer)) { throw new BuildException('A nested element is required'); } try { $this->tryContainer->perform(); } catch (BuildException $e) { if (!empty($this->propertyName)) { $this->project->setProperty($this->propertyName, $e->getMessage()); } if (!empty($this->referenceName)) { $this->project->addReference($this->referenceName, $e); } if (!empty($this->catchContainer)) { $this->catchContainer->perform(); } else { $exc = $e; } } if (!empty($this->finallyContainer)) { $this->finallyContainer->perform(); } if (!empty($exc)) { throw $exc; } } /** * Sets the name of the property that will * contain the exception message. * * @param string $property */ public function setProperty($property) { $this->propertyName = (string) $property; } /** * Sets the name of the reference that will * contain the exception. * * @param Exception $reference * * @return void */ public function setReference($reference) { $this->referenceName = $reference; } /** * Add nested element * * @param SequentialTask $container */ public function addTry(SequentialTask $container) { $this->tryContainer = $container; } /** * Add nested element * * @param SequentialTask $container */ public function addCatch(SequentialTask $container) { $this->catchContainer = $container; } /** * Add nested element * * @param SequentialTask $container */ public function addFinally(SequentialTask $container) { $this->finallyContainer = $container; } } . */ require_once 'phing/Task.php'; include_once 'phing/tasks/system/ExecTask.php'; include_once 'phing/types/Commandline.php'; /** * Task for performing CVS operations. * * NOTE: This implementation has been moved here from Cvs.java with * the addition of some accessors for extensibility. Another task * can extend this with some customized output processing. * * @author Hans Lellelid (Phing) * @author costin@dnt.ro (Ant) * @author stefano@apache.org (Ant) * @author Wolfgang Werner (Ant) * @author Kevin Ross (Ant) * @version $Id: c8232b68045eec9d40b1bda18c4b758c6cfbd80f $ * @package phing.tasks.system */ class CvsTask extends Task { /** * Default compression level to use, if compression is enabled via * setCompression( true ). */ const DEFAULT_COMPRESSION_LEVEL = 3; private $cmd; /** * List of Commandline children * @var array Commandline[] */ private $commandlines = array(); /** * the CVSROOT variable. */ private $cvsRoot; /** * the CVS_RSH variable. */ private $cvsRsh; /** * the package/module to check out. */ private $cvsModule; /** * the default command. */ private static $default_command = "checkout"; /** * the CVS command to execute. */ private $command = null; /** * suppress information messages. */ private $quiet = false; /** * compression level to use. */ private $compression = 0; /** * report only, don't change any files. */ private $noexec = false; /** * CVS port */ private $port = 0; /** * CVS password file * @var File */ private $passFile = null; /** * the directory where the checked out files should be placed. * @var File */ private $dest; private $error; private $output; /** * If true it will stop the build if cvs exits with error. * Default is false. (Iulian) * @var boolean */ private $failOnError = false; public function init() { $this->cmd = new Commandline(); } /** * Sets up the environment for toExecute and then runs it. * @param Commandline $toExecute * @throws BuildException */ protected function runCommand(Commandline $toExecute) { // We are putting variables into the script's environment // and not removing them (!) This should be fine, but is // worth remembering and testing. if ($this->port > 0) { putenv("CVS_CLIENT_PORT=" . $this->port); } // Need a better cross platform integration with , so // use the same filename. if ($this->passFile === null) { $defaultPassFile = new PhingFile(Phing::getProperty("cygwin.user.home", Phing::getProperty("user.home")) . DIRECTORY_SEPARATOR . ".cvspass"); if ($defaultPassFile->exists()) { $this->setPassfile($defaultPassFile); } } if ($this->passFile !== null) { if ($this->passFile->isFile() && $this->passFile->canRead()) { putenv("CVS_PASSFILE=" . $this->passFile->__toString()); $this->log("Using cvs passfile: " . $this->passFile->__toString(), Project::MSG_INFO); } elseif (!$this->passFile->canRead()) { $this->log( "cvs passfile: " . $this->passFile->__toString() . " ignored as it is not readable", Project::MSG_WARN ); } else { $this->log( "cvs passfile: " . $this->passFile->__toString() . " ignored as it is not a file", Project::MSG_WARN ); } } if ($this->cvsRsh !== null) { putenv("CVS_RSH=" . $this->cvsRsh); } // Use the ExecTask to handle execution of the command $exe = new ExecTask($this->project); $exe->setProject($this->project); //exe.setAntRun(project); if ($this->dest === null) { $this->dest = $this->project->getBaseDir(); } if (!$this->dest->exists()) { $this->dest->mkdirs(); } if ($this->output !== null) { $exe->setOutput($this->output); } if ($this->error !== null) { $exe->setError($this->error); } $exe->setDir($this->dest); if (is_object($toExecute)) { $toExecuteStr = $toExecute->__toString(); // unfortunately no more automagic for initial 5.0.0 release :( } $exe->setCommand($toExecuteStr); try { $actualCommandLine = $toExecuteStr; // we converted to string above $this->log($actualCommandLine, Project::MSG_INFO); $retCode = $exe->main(); $this->log("retCode=" . $retCode, Project::MSG_DEBUG); /*Throw an exception if cvs exited with error. (Iulian)*/ if ($this->failOnError && $retCode !== 0) { throw new BuildException("cvs exited with error code " . $retCode . PHP_EOL . "Command line was [" . $toExecute->describeCommand() . "]", $this->getLocation()); } } catch (IOException $e) { if ($this->failOnError) { throw new BuildException($e, $this->getLocation()); } else { $this->log("Caught exception: " . $e, Project::MSG_WARN); } } catch (BuildException $e) { if ($this->failOnError) { throw $e; } else { $t = $e->getCause(); if ($t === null) { $t = $e; } $this->log("Caught exception: " . $t, Project::MSG_WARN); } } catch (Exception $e) { if ($this->failOnError) { throw new BuildException($e, $this->getLocation()); } else { $this->log("Caught exception: " . $e, Project::MSG_WARN); } } } /** * * @throws Exception * @return void */ public function main() { $savedCommand = $this->getCommand(); if ($this->getCommand() === null && empty($this->commandlines)) { // re-implement legacy behaviour: $this->setCommand(self::$default_command); } $c = $this->getCommand(); $cloned = null; if ($c !== null) { $cloned = $this->cmd->__copy(); $cloned->createArgument(true)->setLine($c); $this->addConfiguredCommandline($cloned, true); } try { for ($i = 0, $vecsize = count($this->commandlines); $i < $vecsize; $i++) { $this->runCommand($this->commandlines[$i]); } // finally { if ($cloned !== null) { $this->removeCommandline($cloned); } $this->setCommand($savedCommand); } catch (Exception $e) { // finally { if ($cloned !== null) { $this->removeCommandline($cloned); } $this->setCommand($savedCommand); throw $e; } } /** * The CVSROOT variable. * * @param string $root */ public function setCvsRoot($root) { // Check if not real cvsroot => set it to null if ($root !== null) { if (trim($root) == "") { $root = null; } } $this->cvsRoot = $root; } public function getCvsRoot() { return $this->cvsRoot; } /** * The CVS_RSH variable. * * @param rsh */ public function setCvsRsh($rsh) { // Check if not real cvsrsh => set it to null if ($rsh !== null) { if (trim($rsh) == "") { $rsh = null; } } $this->cvsRsh = $rsh; } public function getCvsRsh() { return $this->cvsRsh; } /** * Port used by CVS to communicate with the server. * * @param int $port */ public function setPort($port) { $this->port = $port; } /** * @return int */ public function getPort() { return $this->port; } /** * Password file to read passwords from. * * @param PhingFile $passFile * @internal param $passFile */ public function setPassfile(PhingFile $passFile) { $this->passFile = $passFile; } /** * @return File */ public function getPassFile() { return $this->passFile; } /** * The directory where the checked out files should be placed. * * @param PhingFile $dest */ public function setDest(PhingFile $dest) { $this->dest = $dest; } /** * @return File */ public function getDest() { return $this->dest; } /** * The package/module to operate upon. * * @param $m * @internal param string $p */ public function setModule($m) { $this->cvsModule = $m; } public function getModule() { return $this->cvsModule; } /** * The tag of the package/module to operate upon. * @param string $p */ public function setTag($p) { // Check if not real tag => set it to null if ($p !== null && trim($p) !== "") { $this->appendCommandArgument("-r"); $this->appendCommandArgument($p); } } /** * This needs to be public to allow configuration * of commands externally. * @param $arg */ public function appendCommandArgument($arg) { $this->cmd->createArgument()->setValue($arg); } /** * Use the most recent revision no later than the given date. * @param p */ public function setDate($p) { if ($p !== null && trim($p) !== "") { $this->appendCommandArgument("-D"); $this->appendCommandArgument($p); } } /** * The CVS command to execute. * @param string $c */ public function setCommand($c) { $this->command = $c; } /** * @return null */ public function getCommand() { return $this->command; } /** * If true, suppress informational messages. * @param boolean $q */ public function setQuiet($q) { $this->quiet = $q; } /** * If true, report only and don't change any files. * * @param boolean $ne */ public function setNoexec($ne) { $this->noexec = (boolean) $ne; } /** * Stop the build process if the command exits with * a return code other than 0. * Defaults to false. * @param boolean $failOnError */ public function setFailOnError($failOnError) { $this->failOnError = (boolean) $failOnError; } /** * Configure a commandline element for things like cvsRoot, quiet, etc. * @param $c * @return string */ protected function configureCommandline($c) { if ($c === null) { return; } $c->setExecutable("cvs"); if ($this->cvsModule !== null) { $c->createArgument()->setLine($this->cvsModule); } if ($this->compression > 0 && $this->compression < 10) { $c->createArgument(true)->setValue("-z" . $this->compression); } if ($this->quiet) { $c->createArgument(true)->setValue("-q"); } if ($this->noexec) { $c->createArgument(true)->setValue("-n"); } if ($this->cvsRoot !== null) { $c->createArgument(true)->setLine("-d" . $this->cvsRoot); } } /** * @param Commandline $c * @return bool */ protected function removeCommandline(Commandline $c) { $idx = array_search($c, $this->commandlines, true); if ($idx === false) { return false; } $this->commandlines = array_splice($this->commandlines, $idx, 1); return true; } /** * Configures and adds the given Commandline. * @param Commandline $c * @param bool|If $insertAtStart * @internal param If $insertAtStart true, c is */ public function addConfiguredCommandline(Commandline $c, $insertAtStart = false) { if ($c === null) { return; } $this->configureCommandline($c); if ($insertAtStart) { array_unshift($this->commandlines, $c); } else { array_push($this->commandlines, $c); } } /** * If set to a value 1-9 it adds -zN to the cvs command line, else * it disables compression. * @param int $level */ public function setCompressionLevel($level) { $this->compression = $level; } /** * If true, this is the same as compressionlevel="3". * * @param boolean $usecomp If true, turns on compression using default * level, AbstractCvsTask.DEFAULT_COMPRESSION_LEVEL. */ public function setCompression($usecomp) { $this->setCompressionLevel( $usecomp ? self::DEFAULT_COMPRESSION_LEVEL : 0 ); } /** * File to which output should be written. * @param PhingFile $f * @internal param PhingFile $output */ public function setOutput(PhingFile $f) { $this->output = $f; } /** * File to which error output should be written. * @param PhingFile $f * @internal param PhingFile $output */ public function setError(PhingFile $f) { $this->error = $f; } } . */ require_once 'phing/Task.php'; /** * Exits the active build, giving an additional message * if available. * * @author Hans Lellelid (Phing) * @author Nico Seessle (Ant) * * @package phing.tasks.system */ class FailTask extends Task { /** @var string $message */ protected $message; protected $ifCondition; protected $unlessCondition; /** * A message giving further information on why the build exited. * * @param string $value message to output * * @return void */ public function setMsg($value) { $this->setMessage($value); } /** * A message giving further information on why the build exited. * * @param string $value message to output * * @return void */ public function setMessage($value) { $this->message = $value; } /** * Only fail if a property of the given name exists in the current project. * * @param $c property name * * @return void */ public function setIf($c) { $this->ifCondition = $c; } /** * Only fail if a property of the given name does not * exist in the current project. * * @param $c property name * * @return void */ public function setUnless($c) { $this->unlessCondition = $c; } /** * {@inheritdoc} * * @return void * * @throws BuildException */ public function main() { if ($this->testIfCondition() && $this->testUnlessCondition()) { if ($this->message !== null) { throw new BuildException($this->message); } else { throw new BuildException("No message"); } } } /** * Set a multiline message. * * @param string $msg * * @return void */ public function addText($msg) { if ($this->message === null) { $this->message = ""; } $this->message .= $this->project->replaceProperties($msg); } /** * @return boolean */ protected function testIfCondition() { if ($this->ifCondition === null || $this->ifCondition === "") { return true; } return $this->project->getProperty($this->ifCondition) !== null; } /** * @return boolean */ protected function testUnlessCondition() { if ($this->unlessCondition === null || $this->unlessCondition === "") { return true; } return $this->project->getProperty($this->unlessCondition) === null; } } . */ require_once 'phing/Task.php'; include_once 'phing/tasks/system/condition/Condition.php'; include_once 'phing/tasks/system/PropertyTask.php'; include_once 'phing/util/DirectoryScanner.php'; include_once 'phing/util/SourceFileScanner.php'; include_once 'phing/mappers/MergeMapper.php'; /** * Sets the given property if the specified target has a timestamp * greater than all of the source files. * * @author Hans Lellelid (Phing) * @author William Ferguson (Ant) * @author Hiroaki Nakamura (Ant) * @author Stefan Bodewig (Ant) * @version $Id: 301cee4487571b8fb8233e75db4e7b3750219df2 $ * @package phing.tasks.system */ class UpToDateTask extends Task implements Condition { private $_property; private $_value; private $_sourceFile; private $_targetFile; private $sourceFileSets = array(); private $_filelists = array(); protected $mapperElement = null; /** * The property to set if the target file is more up-to-date than * (each of) the source file(s). * * @param string $property the name of the property to set if Target is up-to-date. */ public function setProperty($property) { $this->_property = $property; } /** * Get property name * @return string property the name of the property to set if Target is up-to-date. */ public function getProperty() { return $this->_property; } /** * The value to set the named property to if the target file is more * up-to-date than (each of) the source file(s). Defaults to 'true'. * * @param the $value * @internal param the $value value to set the property to if Target is up-to-date */ public function setValue($value) { $this->_value = $value; } /** * Returns the value, or "true" if a specific value wasn't provided. */ private function getValue() { return ($this->_value !== null) ? $this->_value : "true"; } /** * The file which must be more up-to-date than (each of) the source file(s) * if the property is to be set. * * @param the $file * @internal param the $file file we are checking against. */ public function setTargetFile($file) { if (is_string($file)) { $file = new PhingFile($file); } $this->_targetFile = $file; } /** * The file that must be older than the target file * if the property is to be set. * * @param the $file * @internal param the $file file we are checking against the target file. */ public function setSrcfile($file) { if (is_string($file)) { $file = new PhingFile($file); } $this->_sourceFile = $file; } /** * Nested element. * * @deprecated Deprecated since Phing 2.4.0 */ public function createSrcfiles() { $fs = new FileSet(); $this->sourceFileSets[] = $fs; return $fs; } /** * Nested element. * @param FileSet $fs */ public function addFileset(FileSet $fs) { $this->sourceFileSets[] = $fs; } /** * Supports embedded element. * @return FileList */ public function createFileList() { $num = array_push($this->_filelists, new FileList()); return $this->_filelists[$num - 1]; } /** * Defines the FileNameMapper to use (nested mapper element). */ public function createMapper() { if ($this->mapperElement !== null) { throw new BuildException("Cannot define more than one mapper", $this->location); } $this->mapperElement = new Mapper($this->getProject()); return $this->mapperElement; } /** * Evaluate (all) target and source file(s) to * see if the target(s) is/are up-to-date. * @throws BuildException * @return boolean */ public function evaluate() { if (count($this->sourceFileSets) == 0 && count($this->_filelists) == 0 && $this->_sourceFile === null) { throw new BuildException("At least one srcfile or a nested " . " or element must be set."); } if ((count($this->sourceFileSets) > 0 || count($this->_filelists) > 0) && $this->_sourceFile !== null) { throw new BuildException("Cannot specify both the srcfile " . "attribute and a nested " . "or element."); } if ($this->_targetFile === null && $this->mapperElement === null) { throw new BuildException("The targetfile attribute or a nested " . "mapper element must be set."); } // if the target file is not there, then it can't be up-to-date if ($this->_targetFile !== null && !$this->_targetFile->exists()) { return false; } // if the source file isn't there, throw an exception if ($this->_sourceFile !== null && !$this->_sourceFile->exists()) { throw new BuildException($this->_sourceFile->getAbsolutePath() . " not found."); } $upToDate = true; for ($i = 0, $size = count($this->sourceFileSets); $i < $size && $upToDate; $i++) { $fs = $this->sourceFileSets[$i]; $ds = $fs->getDirectoryScanner($this->project); $upToDate = $upToDate && $this->scanDir( $fs->getDir($this->project), $ds->getIncludedFiles() ); } for ($i = 0, $size = count($this->_filelists); $i < $size && $upToDate; $i++) { $fl = $this->_filelists[$i]; $srcFiles = $fl->getFiles($this->project); $upToDate = $upToDate && $this->scanDir( $fs->getDir($this->project), $srcFiles ); } if ($this->_sourceFile !== null) { if ($this->mapperElement === null) { $upToDate = $upToDate && ($this->_targetFile->lastModified() >= $this->_sourceFile->lastModified()); } else { $sfs = new SourceFileScanner($this); $upToDate = $upToDate && count( $sfs->restrict( $this->_sourceFile->getAbsolutePath(), null, null, $this->mapperElement->getImplementation() ) ) === 0; } } return $upToDate; } /** * Sets property to true if target file(s) have a more recent timestamp * than (each of) the corresponding source file(s). * @throws BuildException */ public function main() { if ($this->_property === null) { throw new BuildException("property attribute is required.", $this->location); } $upToDate = $this->evaluate(); if ($upToDate) { $property = $this->project->createTask('property'); $property->setName($this->getProperty()); $property->setValue($this->getValue()); $property->setOverride(true); $property->main(); // execute if ($this->mapperElement === null) { $this->log( "File \"" . $this->_targetFile->getAbsolutePath() . "\" is up-to-date.", Project::MSG_VERBOSE ); } else { $this->log( "All target files are up-to-date.", Project::MSG_VERBOSE ); } } } /** * @param PhingFile $srcDir * @param $files * @return bool */ protected function scanDir(PhingFile $srcDir, $files) { $sfs = new SourceFileScanner($this); $mapper = null; $dir = $srcDir; if ($this->mapperElement === null) { $mm = new MergeMapper(); $mm->setTo($this->_targetFile->getAbsolutePath()); $mapper = $mm; $dir = null; } else { $mapper = $this->mapperElement->getImplementation(); } return (count($sfs->restrict($files, $srcDir, $dir, $mapper)) === 0); } } . */ require_once 'phing/BuildException.php'; require_once 'phing/Project.php'; require_once 'phing/Task.php'; require_once 'phing/TaskContainer.php'; /** * Retries the nested task a set number of times. * * @author Siad Ardroumli * @package phing.tasks.system */ class Retry extends Task implements TaskContainer { /** * Task to execute n times. * * @var Task $nestedTask */ private $nestedTask; /** * Set retry count to 1 by default. * * @var int $retryCount */ private $retryCount = 1; /** * The time to wait between retries in seconds, default to 0. * * @var int $retryDelay */ private $retryDelay = 0; /** * Set the task. * * @param Task $t the task to retry. * * @throws BuildException */ public function addTask(Task $t) { if ($this->nestedTask !== null) { throw new BuildException( 'The retry task container accepts a single nested task' . ' (which may be a sequential task container)' ); } $this->nestedTask = $t; } /** * Set the number of times to retry the task. * * @param int $n the number to use. */ public function setRetryCount($n) { $this->retryCount = $n; } /** * Set the delay between retries (in seconds). * * @param int $retryDelay the time between retries. * * @throws BuildException */ public function setRetryDelay($retryDelay) { if ($retryDelay < 0) { throw new BuildException( 'retryDelay must be a non-negative number' ); } $this->retryDelay = $retryDelay; } /** * Perform the work. * * @throws BuildException if there is an error. */ public function main() { $errorMessages = ''; for ($i = 0; $i <= $this->retryCount; $i++) { try { $this->nestedTask->perform(); break; } catch (Exception $e) { $errorMessages .= $e->getMessage(); if ($i >= $this->retryCount) { $taskName = $this->nestedTask->getTaskName(); $exceptionMessage = <<retryCount}] attempts; giving up Error messages: $errorMessages EXCEPTION_MESSAGE; throw new BuildException( $exceptionMessage, $this->getLocation() ); } if ($this->retryDelay > 0) { $msg = sprintf( 'Attempt [%s]: error occurred; retrying after %s s...', $i, $this->retryDelay); } else { $msg = sprintf( 'Attempt [%s]: error occurred; retrying...', $i ); } $this->log($msg, Project::MSG_INFO); $errorMessages .= PHP_EOL; if ($this->retryDelay > 0) { sleep($this->retryDelay); } } } } } . */ /** * Displays all the current properties in the build. The output can be sent to * a file if desired. * * Attribute "destfile" defines a file to send the properties to. This can be * processed as a standard property file later. * * Attribute "prefix" defines a prefix which is used to filter the properties * only those properties starting with this prefix will be echoed. * * By default, the "failonerror" attribute is enabled. If an error occurs while * writing the properties to a file, and this attribute is enabled, then a * BuildException will be thrown. If disabled, then IO errors will be reported * as a log statement, but no error will be thrown. * * Examples:
 *  <echoproperties  />
 * 
Report the current properties to the log. * *
 *  <echoproperties destfile="my.properties" />
 * 
Report the current properties to the file "my.properties", and will * fail the build if the file could not be created or written to. * *
 *  <echoproperties destfile="my.properties" failonerror="false"
 *      prefix="phing" />
 * 
Report all properties beginning with 'phing' to the file * "my.properties", and will log a message if the file could not be created or * written to, but will still allow the build to continue. * * @author Siad Ardroumli * @package phing.tasks.system */ class EchoProperties extends Task { /** * the properties element. */ private static $PROPERTIES = "properties"; /** * the property element. */ private static $PROPERTY = "property"; /** * name attribute for property, testcase and testsuite elements. */ private static $ATTR_NAME = "name"; /** * value attribute for property elements. */ private static $ATTR_VALUE = "value"; /** * the input file. * @var PhingFile */ private $inFile = null; /** * File object pointing to the output file. If this is null, then * we output to the project log, not to a file. * @var PhingFile */ private $destfile = null; /** * If this is true, then errors generated during file output will become * build errors, and if false, then such errors will be logged, but not * thrown. * @var boolean */ private $failonerror = true; /** @var string $format */ private $format = "text"; /** @var string $prefix */ private $prefix = ''; /** @var string $regex */ private $regex = ''; /** * Sets the input file. * * @param string|PhingFile $file the input file */ public function setSrcfile($file) { if (is_string($file)) { $this->inFile = new PhingFile($file); } else { $this->inFile = $file; } } /** * Set a file to store the property output. If this is never specified, * then the output will be sent to the Phing log. * * @param string|PhingFile $destfile file to store the property output */ public function setDestfile($destfile) { if (is_string($destfile)) { $this->destfile = new PhingFile($destfile); } else { $this->destfile = $destfile; } } /** * If true, the task will fail if an error occurs writing the properties * file, otherwise errors are just logged. * * @param failonerror true if IO exceptions are reported as build * exceptions, or false if IO exceptions are ignored. */ public function setFailOnError($failonerror) { $this->failonerror = $failonerror; } /** * If the prefix is set, then only properties which start with this * prefix string will be recorded. If regex is not set and if this * is never set, or it is set to an empty string or null, * then all properties will be recorded.

* * For example, if the attribute is set as: *

<echoproperties  prefix="phing." />
* then the property "phing.home" will be recorded, but "phing-example" * will not. * * @param string $prefix The new prefix value */ public function setPrefix($prefix) { if ($prefix != null && strlen($prefix) != 0) { $this->prefix = $prefix; } } /** * If the regex is set, then only properties whose names match it * will be recorded. If prefix is not set and if this is never set, * or it is set to an empty string or null, then all * properties will be recorded.

* * For example, if the attribute is set as: *

<echoproperties  prefix=".*phing.*" />
* then the properties "phing.home" and "user.phing" will be recorded, * but "phing-example" will not. * * @param string $regex The new regex value */ public function setRegex($regex) { if ($regex != null && strlen($regex) != 0) { $this->regex = $regex; } } /** * Set the output format - xml or text. * @param string $ea an enumerated FormatAttribute value */ public function setFormat($ea) { $this->format = $ea; } /** * Run the task. * * @throws BuildException trouble, probably file IO */ public function main() { if ($this->prefix != null && $this->regex != null) { throw new BuildException("Please specify either prefix or regex, but not both", $this->getLocation()); } //copy the properties file $allProps = array(); /* load properties from file if specified, otherwise use Phing's properties */ if ($this->inFile == null) { // add phing properties $allProps = $this->getProject()->getProperties(); } elseif ($this->inFile != null) { if ($this->inFile->exists() && $this->inFile->isDirectory()) { $message = "srcfile is a directory!"; $this->failOnErrorAction(null, $message, Project::MSG_ERR); return; } if ($this->inFile->exists() && !$this->inFile->canRead()) { $message = "Can not read from the specified srcfile!"; $this->failOnErrorAction(null, $message, Project::MSG_ERR); return; } try { $props = new Properties(); $props->load(new PhingFile($this->inFile)); $allProps = $props->getProperties(); } catch (IOException $ioe) { $message = "Could not read file " . $this->inFile->getAbsolutePath(); $this->failOnErrorAction($ioe, $message, Project::MSG_WARN); return; } } $os = null; try { if ($this->destfile == null) { $os = Phing::getOutputStream(); $this->saveProperties($allProps, $os); $this->log($os, Project::MSG_INFO); } else { if ($this->destfile->exists() && $this->destfile->isDirectory()) { $message = "destfile is a directory!"; $this->failOnErrorAction(null, $message, Project::MSG_ERR); return; } if ($this->destfile->exists() && !$this->destfile->canWrite()) { $message = "Can not write to the specified destfile!"; $this->failOnErrorAction(null, $message, Project::MSG_ERR); return; } $os = new FileOutputStream($this->destfile); $this->saveProperties($allProps, $os); } } catch (IOException $ioe) { $this->failOnErrorAction($ioe); } } /** * @param Exception $exception * @param string $message * @param int $level * @throws BuildException */ private function failOnErrorAction(Exception $exception = null, $message = '', $level = Project::MSG_INFO) { if ($this->failonerror) { throw new BuildException( $exception !== null ? $exception : $message, $this->getLocation() ); } else { $this->log( $exception !== null && $message === '' ? $exception->getMessage() : $message, $level ); } } /** * Send the key/value pairs in the hashtable to the given output stream. * Only those properties matching the prefix constraint will be * sent to the output stream. * The output stream will be closed when this method returns. * * @param array $allProps propfile to save * @param OutputStream $os output stream * @throws IOException on output errors * @throws BuildException on other errors */ protected function saveProperties($allProps, $os) { ksort($allProps); $props = new Properties(); if ($this->regex !== '') { $a = new ArrayIterator($allProps); $i = new RegexIterator($a, $this->regex, RegexIterator::MATCH, RegexIterator::USE_KEY); $allProps = iterator_to_array($i); } if ($this->prefix !== '') { $a = new ArrayIterator($allProps); $i = new RegexIterator( $a, '~^' . preg_quote($this->prefix, '~') . '.*~', RegexIterator::MATCH, RegexIterator::USE_KEY ); $allProps = iterator_to_array($i); } foreach ($allProps as $name => $value) { $props->setProperty($name, $value); } if ($this->format === "text") { $this->textSaveProperties($props, $os, "Phing properties"); } elseif ($this->format === "xml") { $this->xmlSaveProperties($props, $os); } } /** * Output the properties as xml output. * @param Properties $props the properties to save * @param OutputStream $os the output stream to write to (Note this gets closed) * @throws BuildException */ protected function xmlSaveProperties(Properties $props, OutputStream $os) { $doc = new DOMDocument('1.0', 'UTF-8'); $doc->formatOutput = true; $rootElement = $doc->createElement(self::$PROPERTIES); $properties = $props->getProperties(); ksort($properties); foreach ($properties as $key => $value) { $propElement = $doc->createElement(self::$PROPERTY); $propElement->setAttribute(self::$ATTR_NAME, $key); $propElement->setAttribute(self::$ATTR_VALUE, $value); $rootElement->appendChild($propElement); } try { $doc->appendChild($rootElement); $os->write($doc->saveXML()); } catch (IOException $ioe) { throw new BuildException("Unable to write XML file", $ioe); } } /** * @param Properties $props the properties to record * @param OutputStream $os record the properties to this output stream * @param string $header prepend this header to the property output * @throws BuildException on an I/O error during a write. */ protected function textSaveProperties(Properties $props, OutputStream $os, $header) { try { $props->storeOutputStream($os, $header); } catch (IOException $ioe) { throw new BuildException($ioe, $this->getLocation()); } } } . */ include_once 'phing/tasks/system/ApplyTask.php'; include_once 'phing/Phing.php'; include_once 'phing/Project.php'; include_once 'phing/BuildException.php'; include_once 'phing/system/io/PhingFile.php'; include_once 'phing/util/StringHelper.php'; /** * Changes the attributes of a file or all files inside specified directories. * Right now it has effect only under Windows. Each of the 4 possible * permissions has its own attribute, matching the arguments for the `attrib` * command. * * Example: * ``` *