本文整理匯總了PHP中Task::log方法的典型用法代碼示例。如果您正苦於以下問題:PHP Task::log方法的具體用法?PHP Task::log怎麽用?PHP Task::log使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Task
的用法示例。
在下文中一共展示了Task::log方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: realLog
protected function realLog($level, $message, array $context = [])
{
$message = self::interpolateContext($message, $context);
switch ($level) {
case self::DEBUG:
$level = \Project::MSG_DEBUG;
break;
case self::INFO:
$level = \Project::MSG_VERBOSE;
break;
case self::NOTICE:
$level = \Project::MSG_VERBOSE;
break;
case self::WARNING:
$level = \Project::MSG_WARN;
break;
case self::ERROR:
case self::CRITICAL:
case self::ALERT:
case self::EMERGENCY:
$level = \Project::MSG_ERR;
break;
default:
$level = \Project::MSG_INFO;
}
$this->task->log($message, $level);
return NULL;
}
示例2: parse
/**
* Searches for tables in the database. Maybe we want to search also the views.
* @param Database $database The Database model class to add tables to.
* @return int
*/
public function parse(Database $database, Task $task = null)
{
$tables = array();
$stmt = $this->dbh->query("SELECT OBJECT_NAME FROM USER_OBJECTS WHERE OBJECT_TYPE = 'TABLE'");
$seqPattern = $this->getGeneratorConfig()->getBuildProperty('oracleAutoincrementSequencePattern');
if ($task) {
$task->log("Reverse Engineering Table Structures", Project::MSG_VERBOSE);
}
// First load the tables (important that this happen before filling out details of tables)
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
if (strpos($row['OBJECT_NAME'], '$') !== false) {
// this is an Oracle internal table or materialized view - prune
continue;
}
if (strtoupper($row['OBJECT_NAME']) == strtoupper($this->getMigrationTable())) {
continue;
}
$table = new Table($row['OBJECT_NAME']);
$table->setIdMethod($database->getDefaultIdMethod());
if ($task) {
$task->log("Adding table '" . $table->getName() . "'", Project::MSG_VERBOSE);
}
$database->addTable($table);
// Add columns, primary keys and indexes.
$this->addColumns($table);
$this->addPrimaryKey($table);
$this->addIndexes($table);
$pkColumns = $table->getPrimaryKey();
if (count($pkColumns) == 1 && $seqPattern) {
$seqName = str_replace('${table}', $tableName, $seqPattern);
$seqName = strtoupper($seqName);
$stmt2 = $this->dbh->query("SELECT * FROM USER_SEQUENCES WHERE SEQUENCE_NAME = '" . $seqName . "'");
$hasSeq = $stmt2->fetch(PDO::FETCH_ASSOC);
if ($hasSeq) {
$pkColumns[0]->setAutoIncrement(true);
$idMethodParameter = new IdMethodParameter();
$idMethodParameter->setValue($seqName);
$table->addIdMethodParameter($idMethodParameter);
}
}
$tables[] = $table;
}
if ($task) {
$task->log("Reverse Engineering Foreign Keys", Project::MSG_VERBOSE);
}
foreach ($tables as $table) {
if ($task) {
$task->log("Adding foreign keys for table '" . $table->getName() . "'", Project::MSG_VERBOSE);
}
$this->addForeignKeys($table);
}
return count($tables);
}
示例3: finished
/**
* Executes the task at once if it's directly beneath the <project> tag.
*/
protected function finished()
{
if ($this->task !== null && $this->target === null && $this->container === null) {
try {
$this->task->perform();
} catch (Exception $e) {
$this->task->log($e->getMessage(), Project::MSG_ERR);
throw $e;
}
}
}
示例4: parse
/**
* Searches for tables in the database. Maybe we want to search also the views.
* @param Database $database The Database model class to add tables to.
*/
public function parse(Database $database, Task $task = null)
{
$tables = array();
$stmt = $this->dbh->query("SELECT OBJECT_NAME FROM USER_OBJECTS WHERE OBJECT_TYPE = 'TABLE'");
if ($task) {
$task->log("Reverse Engineering Table Structures", Project::MSG_VERBOSE);
}
// First load the tables (important that this happen before filling out details of tables)
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
if (strpos($row['OBJECT_NAME'], '$') !== false) {
// this is an Oracle internal table or materialized view - prune
continue;
}
if (strtoupper($name) == strtoupper($this->getMigrationTable())) {
continue;
}
$table = new Table($row['OBJECT_NAME']);
if ($task) {
$task->log("Adding table '" . $table->getName() . "'", Project::MSG_VERBOSE);
}
$database->addTable($table);
// Add columns, primary keys and indexes.
$this->addColumns($table);
$this->addPrimaryKey($table);
$this->addIndexes($table);
$tables[] = $table;
}
if ($task) {
$task->log("Reverse Engineering Foreign Keys", Project::MSG_VERBOSE);
}
foreach ($tables as $table) {
if ($task) {
$task->log("Adding foreign keys for table '" . $table->getName() . "'", Project::MSG_VERBOSE);
}
$this->addForeignKeys($table);
}
return count($tables);
}
示例5: process
public static function process($mapFile, $targetURL, Task $task)
{
$mapFile = realpath($mapFile);
if (!file_exists($mapFile)) {
throw new BuildException("SourceMap.php: File not found: {$mapFile}");
}
$relative = pathinfo($mapFile, PATHINFO_DIRNAME);
$task->log($relative);
// fix mapping paths
$map = json_decode(file_get_contents($mapFile));
$map->file = str_replace("\\", "/", $targetURL);
$arr = array();
$prefix = "/weblocal/";
foreach ($map->sources as $source) {
$path = self::fixPath($relative, $source);
if ($path === false) {
throw new BuildException("SourceMap.php: Unable to resolve path: {$source}");
}
$matches = 0;
$plugin = false;
if (preg_match('/\\/Plugin\\/([\\w\\d]+)\\/weblocal\\//', $path, $matches) === 1) {
$plugin = strtolower($matches[1]);
}
$str = str_replace("\\", "/", $path);
$str = preg_replace("/^.*\\/weblocal/", "", $str);
if ($plugin !== false) {
$str = "/" . $plugin . $str;
}
$task->log($str);
$arr[] = $str;
}
$map->sources = $arr;
$map = json_encode($map);
$map = str_replace("\\/", "/", $map);
file_put_contents($mapFile, $map);
return $arr;
}
示例6: parse
/**
*
*/
public function parse(Database $database, Task $task = null)
{
// $this->addVendorInfo = $this->getGeneratorConfig()->getBuildProperty('addVendorInfo');
$stmt = $this->dbh->query('
SELECT NAME
FROM MSysObjects
WHERE Type In (1,4,6) AND Left([Name],4)<>"MSYS"');
// First load the tables (important that this happen before filling out details of tables)
$tables = array();
if ($task) {
$task->log("Reverse Engineering Tables", Project::MSG_VERBOSE);
}
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$name = $row[0];
if ($name == $this->getMigrationTable()) {
continue;
}
if ($task) {
$task->log(" Adding table '" . $name . "'", Project::MSG_VERBOSE);
}
$table = new Table($name);
$database->addTable($table);
$tables[] = $table;
}
// Now populate only columns.
if ($task) {
$task->log("Reverse Engineering Columns", Project::MSG_VERBOSE);
}
foreach ($tables as $table) {
if ($task) {
$task->log(" Adding columns for table '" . $table->getName() . "'", Project::MSG_VERBOSE);
}
$this->addColumns($table);
}
// Now add indices and constraints.
if ($task) {
$task->log("Reverse Engineering Indices And Constraints", Project::MSG_VERBOSE);
}
foreach ($tables as $table) {
if ($task) {
$task->log(" Adding indices and constraints for table '" . $table->getName() . "'", Project::MSG_VERBOSE);
}
$this->addForeignKeys($table);
$this->addIndexes($table);
$this->addPrimaryKey($table);
if ($this->addVendorInfo) {
$this->addTableVendorInfo($table);
}
}
return count($tables);
}
示例7: parse
/**
*
*/
public function parse(Database $database, Task $task = null)
{
$this->addVendorInfo = $this->getGeneratorConfig()->getBuildProperty('addVendorInfo');
$stmt = $this->dbh->query("SHOW FULL TABLES");
// First load the tables (important that this happen before filling out details of tables)
$tables = array();
if ($task) {
$task->log("Reverse Engineering Tables", Project::MSG_VERBOSE);
}
while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
$name = $row[0];
$type = $row[1];
if ($name == $this->getMigrationTable() || $type != "BASE TABLE") {
continue;
}
if ($task) {
$task->log(" Adding table '" . $name . "'", Project::MSG_VERBOSE);
}
$table = new Table($name);
$table->setIdMethod($database->getDefaultIdMethod());
$database->addTable($table);
$tables[] = $table;
}
// Now populate only columns.
if ($task) {
$task->log("Reverse Engineering Columns", Project::MSG_VERBOSE);
}
foreach ($tables as $table) {
if ($task) {
$task->log(" Adding columns for table '" . $table->getName() . "'", Project::MSG_VERBOSE);
}
$this->addColumns($table);
}
// Now add indices and constraints.
if ($task) {
$task->log("Reverse Engineering Indices And Constraints", Project::MSG_VERBOSE);
}
foreach ($tables as $table) {
if ($task) {
$task->log(" Adding indices and constraints for table '" . $table->getName() . "'", Project::MSG_VERBOSE);
}
$this->addForeignKeys($table);
$this->addIndexes($table);
$this->addPrimaryKey($table);
if ($this->addVendorInfo) {
$this->addTableVendorInfo($table);
}
}
return count($tables);
}
示例8: log
public function log($message, $type = Zeclib_MigrationLogger::TYPE_INFO)
{
static $levels = array(Zeclib_MigrationLogger::TYPE_DEBUG => Project::MSG_DEBUG, Zeclib_MigrationLogger::TYPE_INFO => Project::MSG_INFO, Zeclib_MigrationLogger::TYPE_WARNING => Project::MSG_WARN, Zeclib_MigrationLogger::TYPE_ERROR => Project::MSG_ERR);
$this->task->log($message, $levels[$type]);
}
示例9: parse
/**
*
*/
public function parse(Database $database, Task $task = null)
{
$stmt = $this->dbh->query("SELECT version() as ver");
$nativeVersion = $stmt->fetchColumn();
if (!$nativeVersion) {
throw new EngineException("Failed to get database version");
}
$arrVersion = sscanf($nativeVersion, '%*s %d.%d');
$version = sprintf("%d.%d", $arrVersion[0], $arrVersion[1]);
// Clean up
$stmt = null;
$stmt = $this->dbh->query("SELECT c.oid,\n c.relname, n.nspname\n FROM pg_class c join pg_namespace n on (c.relnamespace=n.oid)\n WHERE c.relkind = 'r'\n AND n.nspname NOT IN ('information_schema','pg_catalog')\n AND n.nspname NOT LIKE 'pg_temp%'\n AND n.nspname NOT LIKE 'pg_toast%'\n ORDER BY relname");
$tableWraps = array();
// First load the tables (important that this happen before filling out details of tables)
if ($task) {
$task->log("Reverse Engineering Tables", Project::MSG_VERBOSE);
}
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$name = $row['relname'];
$namespacename = $row['nspname'];
if ($name == $this->getMigrationTable()) {
continue;
}
if ($task) {
$task->log(" Adding table '" . $name . "' in schema '" . $namespacename . "'", Project::MSG_VERBOSE);
}
$oid = $row['oid'];
$table = new Table($name);
if ($namespacename != 'public') {
$table->setSchema($namespacename);
}
$table->setIdMethod($database->getDefaultIdMethod());
$database->addTable($table);
// Create a wrapper to hold these tables and their associated OID
$wrap = new stdClass();
$wrap->table = $table;
$wrap->oid = $oid;
$tableWraps[] = $wrap;
}
// Now populate only columns.
if ($task) {
$task->log("Reverse Engineering Columns", Project::MSG_VERBOSE);
}
foreach ($tableWraps as $wrap) {
if ($task) {
$task->log(" Adding columns for table '" . $wrap->table->getName() . "'", Project::MSG_VERBOSE);
}
$this->addColumns($wrap->table, $wrap->oid, $version);
}
// Now add indexes and constraints.
if ($task) {
$task->log("Reverse Engineering Indices And Constraints", Project::MSG_VERBOSE);
}
foreach ($tableWraps as $wrap) {
if ($task) {
$task->log(" Adding indices and constraints for table '" . $wrap->table->getName() . "'", Project::MSG_VERBOSE);
}
$this->addForeignKeys($wrap->table, $wrap->oid, $version);
$this->addIndexes($wrap->table, $wrap->oid, $version);
$this->addPrimaryKey($wrap->table, $wrap->oid, $version);
}
// TODO - Handle Sequences ...
return count($tableWraps);
}
示例10: log
/**
* Logs an event.
*
* @param string The message to log.
* @param int The priority of the message.
*/
public function log($message, $level = Project::MSG_INFO)
{
if ($this->quiet === false) {
parent::log($message, $level);
}
}