This commit is contained in:
2020-10-06 14:27:47 +07:00
commit 586be80cf6
16613 changed files with 3274099 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
<?php foreach ($fields as $field): ?>
$this->addColumn('<?=
$table
?>', '<?=
$field['property']
?>', $this-><?=
$field['decorators']
?>);
<?php endforeach;
echo $this->render('_addForeignKeys', [
'table' => $table,
'foreignKeys' => $foreignKeys,
]);

View File

@@ -0,0 +1,7 @@
<?php
/**
* Creates a call for the method `yii\db\Migration::createTable()`
*/
/* @var $table string the name table */
/* @var $tableComment string the comment table */
?> $this->addCommentOnTable('<?= $table ?>', '<?= $tableComment ?>');

View File

@@ -0,0 +1,19 @@
<?php foreach ($foreignKeys as $column => $fkData): ?>
// creates index for column `<?= $column ?>`
$this->createIndex(
'<?= $fkData['idx'] ?>',
'<?= $table ?>',
'<?= $column ?>'
);
// add foreign key for table `<?= $fkData['relatedTable'] ?>`
$this->addForeignKey(
'<?= $fkData['fk'] ?>',
'<?= $table ?>',
'<?= $column ?>',
'<?= $fkData['relatedTable'] ?>',
'<?= $fkData['relatedColumn'] ?>',
'CASCADE'
);
<?php endforeach;

View File

@@ -0,0 +1,22 @@
<?php
/**
* Creates a call for the method `yii\db\Migration::createTable()`.
*/
/* @var $table string the name table */
/* @var $fields array the fields */
/* @var $foreignKeys array the foreign keys */
?> $this->createTable('<?= $table ?>', [
<?php foreach ($fields as $field):
if (empty($field['decorators'])): ?>
'<?= $field['property'] ?>',
<?php else: ?>
<?= "'{$field['property']}' => \$this->{$field['decorators']}" ?>,
<?php endif;
endforeach; ?>
]);
<?= $this->render('_addForeignKeys', [
'table' => $table,
'foreignKeys' => $foreignKeys,
]);

View File

@@ -0,0 +1,10 @@
<?php
echo $this->render('_dropForeignKeys', [
'table' => $table,
'foreignKeys' => $foreignKeys,
]);
foreach ($fields as $field): ?>
$this->dropColumn('<?= $table ?>', '<?= $field['property'] ?>');
<?php endforeach;

View File

@@ -0,0 +1,14 @@
<?php foreach ($foreignKeys as $column => $fkData): ?>
// drops foreign key for table `<?= $fkData['relatedTable'] ?>`
$this->dropForeignKey(
'<?= $fkData['fk'] ?>',
'<?= $table ?>'
);
// drops index for column `<?= $column ?>`
$this->dropIndex(
'<?= $fkData['idx'] ?>',
'<?= $table ?>'
);
<?php endforeach;

View File

@@ -0,0 +1,13 @@
<?php
/**
* Creates a call for the method `yii\db\Migration::dropTable()`.
*/
/* @var $table string the name table */
/* @var $foreignKeys array the foreign keys */
echo $this->render('_dropForeignKeys', [
'table' => $table,
'foreignKeys' => $foreignKeys,
]) ?>
$this->dropTable('<?= $table ?>');

View File

@@ -0,0 +1,14 @@
<?php
/**
* Creates a call for the method `yii\db\Migration::createTable()`.
*/
/* @var $foreignKeys array the foreign keys */
if (!empty($foreignKeys)):?>
* Has foreign keys to the tables:
*
<?php foreach ($foreignKeys as $fkData): ?>
* - `<?= $fkData['relatedTable'] ?>`
<?php endforeach;
endif;

View File

@@ -0,0 +1,56 @@
<?php
/**
* This view is used by console/controllers/MigrateController.php.
*
* The following variables are available in this view:
*/
/* @var $className string the new migration class name without namespace */
/* @var $namespace string the new migration class namespace */
/* @var $table string the name table */
/* @var $fields array the fields */
preg_match('/^add_(.+)_columns?_to_(.+)_table$/', $name, $matches);
$columns = $matches[1];
echo "<?php\n";
if (!empty($namespace)) {
echo "\nnamespace {$namespace};\n";
}
?>
use yii\db\Migration;
/**
* Handles adding <?= $columns ?> to table `<?= $table ?>`.
<?= $this->render('_foreignTables', [
'foreignKeys' => $foreignKeys,
]) ?>
*/
class <?= $className ?> extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
<?= $this->render('_addColumns', [
'table' => $table,
'fields' => $fields,
'foreignKeys' => $foreignKeys,
])
?>
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
<?= $this->render('_dropColumns', [
'table' => $table,
'fields' => $fields,
'foreignKeys' => $foreignKeys,
])
?>
}
}

View File

@@ -0,0 +1,78 @@
<?php
/**
* This view is used by console/controllers/MigrateController.php.
*
* The following variables are available in this view:
* @since 2.0.7
* @deprecated since 2.0.8
*/
/* @var $className string the new migration class name without namespace */
/* @var $namespace string the new migration class namespace */
/* @var $table string the name table */
/* @var $field_first string the name field first */
/* @var $field_second string the name field second */
echo "<?php\n";
if (!empty($namespace)) {
echo "\nnamespace {$namespace};\n";
}
?>
use yii\db\Migration;
/**
* Handles the creation of table `<?= $table ?>` which is a junction between
* table `<?= $field_first ?>` and table `<?= $field_second ?>`.
*/
class <?= $className ?> extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
$this->createTable('<?= $table ?>', [
'<?= $field_first ?>_id' => $this->integer(),
'<?= $field_second ?>_id' => $this->integer(),
'PRIMARY KEY(<?= $field_first ?>_id, <?= $field_second ?>_id)',
]);
$this->createIndex(
'idx-<?= $table . '-' . $field_first ?>_id',
'<?= $table ?>',
'<?= $field_first ?>_id'
);
$this->createIndex(
'idx-<?= $table . '-' . $field_second ?>_id',
'<?= $table ?>',
'<?= $field_second ?>_id'
);
$this->addForeignKey(
'fk-<?= $table . '-' . $field_first ?>_id',
'<?= $table ?>',
'<?= $field_first ?>_id',
'<?= $field_first ?>',
'id',
'CASCADE'
);
$this->addForeignKey(
'fk-<?= $table . '-' . $field_second ?>_id',
'<?= $table ?>',
'<?= $field_second ?>_id',
'<?= $field_second ?>',
'id',
'CASCADE'
);
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
$this->dropTable('<?= $table ?>');
}
}

View File

@@ -0,0 +1,61 @@
<?php
/**
* This view is used by console/controllers/MigrateController.php.
*
* The following variables are available in this view:
*/
/* @var $className string the new migration class name without namespace */
/* @var $namespace string the new migration class namespace */
/* @var $table string the name table */
/* @var $tableComment string the comment table */
/* @var $fields array the fields */
/* @var $foreignKeys array the foreign keys */
echo "<?php\n";
if (!empty($namespace)) {
echo "\nnamespace {$namespace};\n";
}
?>
use yii\db\Migration;
/**
* Handles the creation of table `<?= $table ?>`.
<?= $this->render('_foreignTables', [
'foreignKeys' => $foreignKeys,
]) ?>
*/
class <?= $className ?> extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
<?= $this->render('_createTable', [
'table' => $table,
'fields' => $fields,
'foreignKeys' => $foreignKeys,
])
?>
<?php if (!empty($tableComment)) {
echo $this->render('_addComments', [
'table' => $table,
'tableComment' => $tableComment,
]);
}
?>
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
<?= $this->render('_dropTable', [
'table' => $table,
'foreignKeys' => $foreignKeys,
])
?>
}
}

View File

@@ -0,0 +1,55 @@
<?php
/**
* This view is used by console/controllers/MigrateController.php.
*
* The following variables are available in this view:
*/
/* @var $className string the new migration class name without namespace */
/* @var $namespace string the new migration class namespace */
/* @var $table string the name table */
/* @var $fields array the fields */
preg_match('/^drop_(.+)_columns?_from_(.+)_table$/', $name, $matches);
$columns = $matches[1];
echo "<?php\n";
if (!empty($namespace)) {
echo "\nnamespace {$namespace};\n";
}
?>
use yii\db\Migration;
/**
* Handles dropping <?= $columns ?> from table `<?= $table ?>`.
<?= $this->render('_foreignTables', [
'foreignKeys' => $foreignKeys,
]) ?>
*/
class <?= $className ?> extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
<?= $this->render('_dropColumns', [
'table' => $table,
'fields' => $fields,
'foreignKeys' => $foreignKeys,
])
?>
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
<?= $this->render('_addColumns', [
'table' => $table,
'fields' => $fields,
'foreignKeys' => $foreignKeys,
])
?>
}
}

View File

@@ -0,0 +1,52 @@
<?php
/**
* This view is used by console/controllers/MigrateController.php.
*
* The following variables are available in this view:
*/
/* @var $className string the new migration class name without namespace */
/* @var $namespace string the new migration class namespace */
/* @var $table string the name table */
/* @var $fields array the fields */
echo "<?php\n";
if (!empty($namespace)) {
echo "\nnamespace {$namespace};\n";
}
?>
use yii\db\Migration;
/**
* Handles the dropping of table `<?= $table ?>`.
<?= $this->render('_foreignTables', [
'foreignKeys' => $foreignKeys,
]) ?>
*/
class <?= $className ?> extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
<?= $this->render('_dropTable', [
'table' => $table,
'foreignKeys' => $foreignKeys,
])
?>
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
<?= $this->render('_createTable', [
'table' => $table,
'fields' => $fields,
'foreignKeys' => $foreignKeys,
])
?>
}
}

View File

@@ -0,0 +1,48 @@
<?php
/* @var $file string|null */
/* @var $line int|null */
/* @var $class string|null */
/* @var $method string|null */
/* @var $index int */
/* @var $lines string[] */
/* @var $begin int */
/* @var $end int */
/* @var $args array */
/* @var $handler \yii\web\ErrorHandler */
?>
<li class="<?= ($index === 1 || !$handler->isCoreFile($file)) ? 'application' : '' ?> call-stack-item"
data-line="<?= (int) ($line - $begin) ?>">
<div class="element-wrap">
<div class="element">
<span class="item-number"><?= (int) $index ?>.</span>
<span class="text"><?= $file !== null ? 'in ' . $handler->htmlEncode($file) : '' ?></span>
<span class="at">
<?= $line !== null ? 'at line' : '' ?>
<span class="line"><?= $line !== null ? $line + 1 : '' ?></span>
</span>
<?php if ($method !== null): ?>
<span class="call">
<?= $file !== null ? '&ndash;' : '' ?>
<?= ($class !== null ? $handler->addTypeLinks("$class::$method") : $handler->htmlEncode($method)) . '(' . $handler->argumentsToString($args) . ')' ?>
</span>
<?php endif; ?>
</div>
</div>
<?php if (!empty($lines)): ?>
<div class="code-wrap">
<div class="error-line"></div>
<?php for ($i = $begin; $i <= $end; ++$i): ?><div class="hover-line"></div><?php endfor; ?>
<div class="code">
<?php for ($i = $begin; $i <= $end; ++$i): ?><span class="lines-item"><?= (int) ($i + 1) ?></span><?php endfor; ?>
<pre>
<?php
// fill empty lines with a whitespace to avoid rendering problems in opera
for ($i = $begin; $i <= $end; ++$i) {
echo (trim($lines[$i]) === '') ? " \n" : strtr($handler->traceLine, ['{file}' => $file, '{line}' => $i + 1, '{html}' => $handler->htmlEncode($lines[$i])]);
}
?>
</pre>
</div>
</div>
<?php endif; ?>
</li>

View File

@@ -0,0 +1,90 @@
<?php
/* @var $exception \yii\web\HttpException|\Exception */
/* @var $handler \yii\web\ErrorHandler */
if ($exception instanceof \yii\web\HttpException) {
$code = $exception->statusCode;
} else {
$code = $exception->getCode();
}
$name = $handler->getExceptionName($exception);
if ($name === null) {
$name = 'Error';
}
if ($code) {
$name .= " (#$code)";
}
if ($exception instanceof \yii\base\UserException) {
$message = $exception->getMessage();
} else {
$message = 'An internal server error occurred.';
}
if (method_exists($this, 'beginPage')) {
$this->beginPage();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title><?= $handler->htmlEncode($name) ?></title>
<style>
body {
font: normal 9pt "Verdana";
color: #000;
background: #fff;
}
h1 {
font: normal 18pt "Verdana";
color: #f00;
margin-bottom: .5em;
}
h2 {
font: normal 14pt "Verdana";
color: #800000;
margin-bottom: .5em;
}
h3 {
font: bold 11pt "Verdana";
}
p {
font: normal 9pt "Verdana";
color: #000;
}
.version {
color: gray;
font-size: 8pt;
border-top: 1px solid #aaa;
padding-top: 1em;
margin-bottom: 1em;
}
</style>
</head>
<body>
<h1><?= $handler->htmlEncode($name) ?></h1>
<h2><?= nl2br($handler->htmlEncode($message)) ?></h2>
<p>
The above error occurred while the Web server was processing your request.
</p>
<p>
Please contact us if you think this is a server error. Thank you.
</p>
<div class="version">
<?= date('Y-m-d H:i:s') ?>
</div>
<?php if (method_exists($this, 'endBody')): ?>
<?php $this->endBody() // to allow injecting code into body (mostly by Yii Debug Toolbar)?>
<?php endif ?>
</body>
</html>
<?php if (method_exists($this, 'endPage')): ?>
<?php $this->endPage() ?>
<?php endif ?>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,23 @@
<?php
/* @var $exception \yii\base\Exception */
/* @var $handler \yii\web\ErrorHandler */
?>
<div class="previous">
<span class="arrow">&crarr;</span>
<h2>
<span>Caused by:</span>
<?php $name = $handler->getExceptionName($exception) ?>
<?php if ($name !== null): ?>
<span><?= $handler->htmlEncode($name) ?></span> &ndash;
<?= $handler->addTypeLinks(get_class($exception)) ?>
<?php else: ?>
<span><?= $handler->htmlEncode(get_class($exception)) ?></span>
<?php endif; ?>
</h2>
<h3><?= nl2br($handler->htmlEncode($exception->getMessage())) ?></h3>
<p>in <span class="file"><?= $exception->getFile() ?></span> at line <span class="line"><?= $exception->getLine() ?></span></p>
<?php if ($exception instanceof \yii\db\Exception && !empty($exception->errorInfo)): ?>
<pre>Error Info: <?= $handler->htmlEncode(print_r($exception->errorInfo, true)) ?></pre>
<?php endif ?>
<?= $handler->renderPreviousExceptions($exception) ?>
</div>

View File

@@ -0,0 +1,84 @@
<?php
return [
// string, required, root directory of all source files
'sourcePath' => __DIR__ . DIRECTORY_SEPARATOR . '..',
// array, required, list of language codes that the extracted messages
// should be translated to. For example, ['zh-CN', 'de'].
'languages' => ['de'],
// string, the name of the function for translating messages.
// Defaults to 'Yii::t'. This is used as a mark to find the messages to be
// translated. You may use a string for single function name or an array for
// multiple function names.
'translator' => 'Yii::t',
// boolean, whether to sort messages by keys when merging new messages
// with the existing ones. Defaults to false, which means the new (untranslated)
// messages will be separated from the old (translated) ones.
'sort' => false,
// boolean, whether to remove messages that no longer appear in the source code.
// Defaults to false, which means these messages will NOT be removed.
'removeUnused' => false,
// boolean, whether to mark messages that no longer appear in the source code.
// Defaults to true, which means each of these messages will be enclosed with a pair of '@@' marks.
'markUnused' => true,
// array, list of patterns that specify which files (not directories) should be processed.
// If empty or not set, all files will be processed.
// See helpers/FileHelper::findFiles() for pattern matching rules.
// If a file/directory matches both a pattern in "only" and "except", it will NOT be processed.
'only' => ['*.php'],
// array, list of patterns that specify which files/directories should NOT be processed.
// If empty or not set, all files/directories will be processed.
// See helpers/FileHelper::findFiles() for pattern matching rules.
// If a file/directory matches both a pattern in "only" and "except", it will NOT be processed.
'except' => [
'.svn',
'.git',
'.gitignore',
'.gitkeep',
'.hgignore',
'.hgkeep',
'/messages',
],
// 'php' output format is for saving messages to php files.
'format' => 'php',
// Root directory containing message translations.
'messagePath' => __DIR__,
// boolean, whether the message file should be overwritten with the merged messages
'overwrite' => true,
/*
// File header used in generated messages files
'phpFileHeader' => '',
// PHPDoc used for array of messages with generated messages files
'phpDocBlock' => null,
*/
/*
// Message categories to ignore
'ignoreCategories' => [
'yii',
],
*/
/*
// 'db' output format is for saving messages to database.
'format' => 'db',
// Connection component to use. Optional.
'db' => 'db',
// Custom source message table. Optional.
// 'sourceMessageTable' => '{{%source_message}}',
// Custom name for translation message table. Optional.
// 'messageTable' => '{{%message}}',
*/
/*
// 'po' output format is for saving messages to gettext po files.
'format' => 'po',
// Root directory containing message translations.
'messagePath' => __DIR__ . DIRECTORY_SEPARATOR . 'messages',
// Name of the file that will be used for translations.
'catalog' => 'messages',
// boolean, whether the message file should be overwritten with the merged messages
'overwrite' => true,
*/
];

55
vendor/yiisoft/yii2/views/migration.php vendored Normal file
View File

@@ -0,0 +1,55 @@
<?php
/**
* This view is used by console/controllers/MigrateController.php.
*
* The following variables are available in this view:
*/
/* @var $className string the new migration class name without namespace */
/* @var $namespace string the new migration class namespace */
echo "<?php\n";
if (!empty($namespace)) {
echo "\nnamespace {$namespace};\n";
}
?>
use yii\db\Migration;
/**
* Class <?= $className . "\n" ?>
*/
class <?= $className ?> extends Migration
{
/**
* {@inheritdoc}
*/
public function safeUp()
{
}
/**
* {@inheritdoc}
*/
public function safeDown()
{
echo "<?= $className ?> cannot be reverted.\n";
return false;
}
/*
// Use up()/down() to run migration code without a transaction.
public function up()
{
}
public function down()
{
echo "<?= $className ?> cannot be reverted.\n";
return false;
}
*/
}