Commit f16ef262 by Qiang Xue

replaced exported value with serialized one.

parent f09c78aa
...@@ -193,7 +193,7 @@ abstract class Generator extends Model ...@@ -193,7 +193,7 @@ abstract class Generator extends Model
$attributes[] = 'template'; $attributes[] = 'template';
$path = $this->getStickyDataFile(); $path = $this->getStickyDataFile();
if (is_file($path)) { if (is_file($path)) {
$result = @include($path); $result = unserialize(file_get_contents($path));
if (is_array($result)) { if (is_array($result)) {
foreach ($stickyAttributes as $name) { foreach ($stickyAttributes as $name) {
if (isset($result[$name])) { if (isset($result[$name])) {
...@@ -218,7 +218,7 @@ abstract class Generator extends Model ...@@ -218,7 +218,7 @@ abstract class Generator extends Model
} }
$path = $this->getStickyDataFile(); $path = $this->getStickyDataFile();
@mkdir(dirname($path), 0755, true); @mkdir(dirname($path), 0755, true);
file_put_contents($path, "<?php\nreturn " . var_export($values, true) . ";\n"); file_put_contents($path, serialize($values));
} }
/** /**
...@@ -227,7 +227,7 @@ abstract class Generator extends Model ...@@ -227,7 +227,7 @@ abstract class Generator extends Model
*/ */
public function getStickyDataFile() public function getStickyDataFile()
{ {
return Yii::$app->getRuntimePath() . '/gii-' . Yii::getVersion() . '/' . str_replace('\\', '-', get_class($this)) . '.php'; return Yii::$app->getRuntimePath() . '/gii-' . Yii::getVersion() . '/' . str_replace('\\', '-', get_class($this)) . '.data';
} }
/** /**
......
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