first commit

This commit is contained in:
2026-01-25 18:18:09 +08:00
commit 509312e604
8136 changed files with 2349298 additions and 0 deletions

View File

@ -0,0 +1,24 @@
<?php
/**
* @var \yii\web\View $this
* @var array $fields
* @var string $table
* @var array $foreignKeys
*/
?>
<?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,8 @@
<?php
/**
* Creates a call for the method `yii\db\Migration::createTable()`
*
* @var string $table the name table
* @var string $tableComment the comment table
*/
?> $this->addCommentOnTable('<?= $table ?>', '<?= $tableComment ?>');

View File

@ -0,0 +1,27 @@
<?php
/**
* @var array $foreignKeys
* @var string $table
*/
?>
<?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,24 @@
<?php
/**
* Creates a call for the method `yii\db\Migration::createTable()`.
*
* @var \yii\web\View $this
* @var string $table the name table
* @var array $fields the fields
* @var array $foreignKeys 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,17 @@
<?php
/**
* @var \yii\web\View $this
* @var string $table
* @var array $foreignKeys
* @var array $fields
*/
echo $this->render('_dropForeignKeys', [
'table' => $table,
'foreignKeys' => $foreignKeys,
]);
foreach ($fields as $field): ?>
$this->dropColumn('<?= $table ?>', '<?= $field['property'] ?>');
<?php endforeach;

View File

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

View File

@ -0,0 +1,15 @@
<?php
/**
* Creates a call for the method `yii\db\Migration::createTable()`.
*
* @var array $foreignKeys 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,57 @@
<?php
/**
* This view is used by console/controllers/MigrateController.php.
*
* The following variables are available in this view:
*
* @var \yii\web\View $this
* @var string $className the new migration class name without namespace
* @var string $namespace the new migration class namespace
* @var string $table the name table
* @var array $fields the fields
* @var array $foreignKeys
*/
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,80 @@
<?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 string $className the new migration class name without namespace
* @var string $namespace the new migration class namespace
* @var string $table the name table
* @var string $field_first the name field first
* @var string $field_second 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,64 @@
<?php
/**
* This view is used by console/controllers/MigrateController.php.
*
* The following variables are available in this view:
*
* @var \yii\web\View $this
* @var string $className the new migration class name without namespace
* @var string $namespace the new migration class namespace
* @var string $table the name table
* @var string $tableComment the comment table
* @var array $fields the fields
* @var array $foreignKeys 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,57 @@
<?php
/**
* This view is used by console/controllers/MigrateController.php.
*
* The following variables are available in this view:
*
* @var \yii\web\View $this
* @var string $className the new migration class name without namespace
* @var string $namespace the new migration class namespace
* @var string $table the name table
* @var array $fields the fields
* @var array $foreignKeys
*/
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,56 @@
<?php
/**
* This view is used by console/controllers/MigrateController.php.
*
* The following variables are available in this view:
*
* @var \yii\web\View $this
* @var string $className the new migration class name without namespace
* @var string $namespace the new migration class namespace
* @var string $table the name table
* @var array $fields the fields
* @var array $foreignKeys
*/
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,58 @@
<?php
/**
* @var string|null $file
* @var int|null $line
* @var string|null $class
* @var string|null $method
* @var int $index
* @var string[] $lines
* @var int $begin
* @var int $end
* @var array $args
* @var \yii\web\ErrorHandler $handler
*/
$html = <<<HTML
IDE
<svg class="icon icon--new-window" focusable="false" aria-hidden="true" width="16" height="16">
<use href="#new-window"></use>
</svg>
HTML;
?>
<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>
<?php if ($handler->traceLine !== '{html}'): ?>
<span> &ndash; </span>
<?= strtr($handler->traceLine, ['{file}' => $file, '{line}' => $line + 1, '{html}' => $html]) ?>
<?php endif; ?>
<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" : $handler->htmlEncode($lines[$i]);
}
?></pre>
</div>
</div>
<?php endif; ?>
</li>

View File

@ -0,0 +1,93 @@
<?php
/**
* @var \yii\web\View $this
* @var \Throwable $exception
* @var \yii\web\ErrorHandler $handler
*/
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,25 @@
<?php
/**
* @var \yii\base\Exception $exception
* @var \yii\web\ErrorHandler $handler
*/
?>
<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,88 @@
<?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' => [
'af', 'ar', 'az', 'be', 'bg', 'bs', 'ca', 'cs', 'da', 'de', 'el', 'es', 'et', 'fa', 'fi', 'fr', 'he', 'hi',
'pt-BR', 'ro', 'hr', 'hu', 'hy', 'id', 'it', 'ja', 'ka', 'kk', 'ko', 'kz', 'lt', 'lv', 'ms', 'nb-NO', 'nl',
'pl', 'pt', 'ru', 'sk', 'sl', 'sr', 'sr-Latn', 'sv', 'tg', 'th', 'tr', 'uk', 'uz', 'uz-Cy', 'vi', 'zh-CN',
'zh-TW'
],
// 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', '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' => [
'.*',
'/.*',
'/messages',
'/tests',
'/runtime',
'/vendor',
'/BaseYii.php',
],
// '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,
*/
];

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

@ -0,0 +1,54 @@
<?php
/**
* This view is used by console/controllers/MigrateController.php.
*
* The following variables are available in this view:
*
* @var string $className the new migration class name without namespace
* @var string $namespace the new migration class namespace
*/
echo "<?php\n";
if (!empty($namespace)) {
echo "\nnamespace {$namespace};\n";
}
?>
use yii\db\Migration;
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;
}
*/
}