|
114 | 114 | } |
115 | 115 | } |
116 | 116 |
|
| 117 | + //check for sample files |
| 118 | + $fileName = trim($path, '.php'); |
| 119 | + $sampleFile = $fileName . '.sample.php'; |
| 120 | + $sampleFilePath = $cwd . '/config/' . $sampleFile; |
| 121 | + |
| 122 | + if (file_exists($sampleFilePath) && !$force) { |
| 123 | + CommandLine::system('Sample file found for '. $path); |
| 124 | + $answer = CommandLine::input('Use sample file for ' . $path . '?(y)', 'y'); |
| 125 | + if ($answer !== 'y') { |
| 126 | + CommandLine::system('Skipping...'); |
| 127 | + continue; |
| 128 | + } |
| 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 | + } |
| 143 | + |
117 | 144 | $contents = file_get_contents($source); |
118 | 145 | $contents = str_replace('<DATABASE HOST>', $host, $contents); |
119 | 146 | $contents = str_replace('<DATABASE NAME>', $name, $contents); |
120 | 147 | $contents = str_replace('<DATABASE USER>', $user, $contents); |
121 | 148 | $contents = str_replace('<DATABASE PASS>', $pass, $contents); |
122 | 149 |
|
123 | 150 | file_put_contents($destination, $contents); |
124 | | - |
| 151 | + |
125 | 152 | $config = include $destination; |
126 | 153 |
|
127 | 154 | $this->package('global')->service(null); |
128 | 155 | $this->package('global')->config(basename($path, '.php'), $config); |
129 | | - |
130 | 156 | } |
131 | 157 | } |
132 | 158 |
|
|
0 commit comments