Commit 3dbfd3ea by Alexander Makarov

Gii: renamed action "new" to "create"

parent 986a8b0c
...@@ -28,7 +28,7 @@ class CodeFile extends Object ...@@ -28,7 +28,7 @@ class CodeFile extends Object
/** /**
* The code file is new. * The code file is new.
*/ */
const OP_NEW = 'new'; const OP_CREATE = 'create';
/** /**
* The code file already exists, and the new one may need to overwrite it. * The code file already exists, and the new one may need to overwrite it.
*/ */
...@@ -68,7 +68,7 @@ class CodeFile extends Object ...@@ -68,7 +68,7 @@ class CodeFile extends Object
if (is_file($path)) { if (is_file($path)) {
$this->operation = file_get_contents($path) === $content ? self::OP_SKIP : self::OP_OVERWRITE; $this->operation = file_get_contents($path) === $content ? self::OP_SKIP : self::OP_OVERWRITE;
} else { } else {
$this->operation = self::OP_NEW; $this->operation = self::OP_CREATE;
} }
} }
...@@ -79,7 +79,7 @@ class CodeFile extends Object ...@@ -79,7 +79,7 @@ class CodeFile extends Object
public function save() public function save()
{ {
$module = Yii::$app->controller->module; $module = Yii::$app->controller->module;
if ($this->operation === self::OP_NEW) { if ($this->operation === self::OP_CREATE) {
$dir = dirname($this->path); $dir = dirname($this->path);
if (!is_dir($dir)) { if (!is_dir($dir)) {
$mask = @umask(0); $mask = @umask(0);
......
...@@ -250,7 +250,7 @@ abstract class Generator extends Model ...@@ -250,7 +250,7 @@ abstract class Generator extends Model
$hasError = true; $hasError = true;
$lines[] = "generating $relativePath\n<span class=\"error\">$error</span>"; $lines[] = "generating $relativePath\n<span class=\"error\">$error</span>";
} else { } else {
$lines[] = $file->operation === CodeFile::OP_NEW ? " generated $relativePath" : " overwrote $relativePath"; $lines[] = $file->operation === CodeFile::OP_CREATE ? " generated $relativePath" : " overwrote $relativePath";
} }
} else { } else {
$lines[] = " skipped $relativePath"; $lines[] = " skipped $relativePath";
......
...@@ -53,7 +53,7 @@ use yii\gii\CodeFile; ...@@ -53,7 +53,7 @@ use yii\gii\CodeFile;
if ($file->operation === CodeFile::OP_SKIP) { if ($file->operation === CodeFile::OP_SKIP) {
echo '&nbsp;'; echo '&nbsp;';
} else { } else {
echo Html::checkBox("answers[{$file->id}]", isset($answers) ? isset($answers[$file->id]) : ($file->operation === CodeFile::OP_NEW)); echo Html::checkBox("answers[{$file->id}]", isset($answers) ? isset($answers[$file->id]) : ($file->operation === CodeFile::OP_CREATE));
} }
?> ?>
</td> </td>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment