|
115 | 115 | } |
116 | 116 |
|
117 | 117 | //check for sample files |
118 | | - $fileName = trim($path, '.php'); |
| 118 | + $fileName = basename($path, '.php'); |
119 | 119 | $sampleFile = $fileName . '.sample.php'; |
120 | 120 | $sampleFilePath = $cwd . '/config/' . $sampleFile; |
121 | 121 |
|
122 | 122 | if (file_exists($sampleFilePath) && !$force) { |
123 | 123 | CommandLine::system('Sample file found for '. $path); |
124 | 124 | $answer = CommandLine::input('Use sample file for ' . $path . '?(y)', 'y'); |
125 | | - if ($answer !== 'y') { |
126 | | - CommandLine::system('Skipping...'); |
| 125 | + if ($answer === 'y') { |
| 126 | + $contents = file_get_contents($sampleFilePath); |
| 127 | + $contents = str_replace('<DATABASE HOST>', $host, $contents); |
| 128 | + $contents = str_replace('<DATABASE NAME>', $name, $contents); |
| 129 | + $contents = str_replace('<DATABASE USER>', $user, $contents); |
| 130 | + $contents = str_replace('<DATABASE PASS>', $pass, $contents); |
| 131 | + |
| 132 | + file_put_contents($destination, $contents); |
| 133 | + $config = include $destination; |
| 134 | + |
| 135 | + $this->package('global')->service(null); |
| 136 | + $this->package('global')->config(basename($path, '.php'), $config); |
127 | 137 | continue; |
128 | 138 | } |
129 | | - |
130 | | - $contents = file_get_contents($sampleFilePath); |
131 | | - $contents = str_replace('<DATABASE HOST>', $host, $contents); |
132 | | - $contents = str_replace('<DATABASE NAME>', $name, $contents); |
133 | | - $contents = str_replace('<DATABASE USER>', $user, $contents); |
134 | | - $contents = str_replace('<DATABASE PASS>', $pass, $contents); |
135 | | - |
136 | | - file_put_contents($destination, $contents); |
137 | | - $config = include $destination; |
138 | | - |
139 | | - $this->package('global')->service(null); |
140 | | - $this->package('global')->config(basename($path, '.php'), $config); |
141 | | - continue; |
142 | 139 | } |
143 | 140 |
|
144 | 141 | $contents = file_get_contents($source); |
|
0 commit comments