public function fire() { $filename = date('Y-m-d-His-') . $this->input->getArgument('name') . '.php'; $path = migrationPath($filename); // @codeCoverageIgnoreStart if (is_file($migrationCandidates = $_SERVER['PHWOOLCON_ROOT_PATH'] . '/vendor/phwoolcon/migrations.php')) { $candidates = (include $migrationCandidates); $chooseTarget = $this->input->getOption('choose-target'); if (!$chooseTarget && isset($candidates['selected']) && isset($candidates['candidates'][$candidates['selected']])) { $path = $candidates['candidates'][$candidates['selected']] . '/' . $filename; } elseif (count($candidates['candidates']) == 1) { $path = reset($candidates['candidates']) . '/' . $filename; } elseif (count($candidates['candidates']) > 1) { $targets = array_merge([''], array_keys($candidates['candidates'])); unset($targets[0]); $choose = $this->interactive->choice('Please choose migration target: ', $targets, reset($targets)); $candidates['selected'] = $choose; fileSaveArray($migrationCandidates, $candidates); $path = $candidates['candidates'][$choose] . '/' . $filename; } } // @codeCoverageIgnoreEnd file_put_contents($path, $this->template()); $this->output->writeln("<info>Created Migration:</info> {$filename}"); }
public static function register(Di $di) { $environment = isset($_SERVER['PHWOOLCON_ENV']) ? $_SERVER['PHWOOLCON_ENV'] : 'production'; // @codeCoverageIgnoreStart if (is_file($cacheFile = storagePath('cache/config-' . $environment . '.php'))) { static::$config = (include $cacheFile); Config::get('app.cache_config') or static::clearCache(); return; } // @codeCoverageIgnoreEnd $defaultFiles = glob($_SERVER['PHWOOLCON_CONFIG_PATH'] . '/*.php'); $environmentFiles = glob($_SERVER['PHWOOLCON_CONFIG_PATH'] . '/' . $environment . '/*.php'); $config = new PhalconConfig(static::loadFiles($defaultFiles)); $environmentSettings = static::loadFiles($environmentFiles); $environmentSettings['environment'] = $environment; $environmentConfig = new PhalconConfig($environmentSettings); $config->merge($environmentConfig); $di->remove('config'); $di->setShared('config', $config); static::$config = $config->toArray(); Config::get('database.default') and static::loadDb($config); // @codeCoverageIgnoreStart if (Config::get('app.cache_config')) { is_dir($cacheDir = dirname($cacheFile)) or mkdir($cacheDir, 0777, true); fileSaveArray($cacheFile, static::$config, function ($content) { $replacement = <<<'EOF' $_SERVER['PHWOOLCON_ROOT_PATH'] . ' EOF; return str_replace("'{$_SERVER['PHWOOLCON_ROOT_PATH']}", $replacement, $content); }); } // @codeCoverageIgnoreEnd }
public function writeRemoteCoverage() { $coverage = $this->getTestResultObject()->getCodeCoverage(); $coverage->stop(); $data = $coverage->getData(true); foreach ($data as $file => &$lines) { foreach ($lines as $line => &$executed) { $executed and $executed = 1; } unset($executed); } unset($lines); fileSaveArray($this->generateRemoteCoverageFile(), $data); }
public function setWorkerStarted($flag = true) { fileSaveArray($this->workerStarted, $flag); }
protected function updateServiceInfo($key, $data = null) { $info = $this->getServiceInfo(); if ($key == 'shift') { if (isset($info['current'])) { $info['old'] = $info['current']; unset($info['current']); } } else { $info[$key] = $data; } $file = $this->runDir . 'service-info.php'; fileSaveArray($file, $info); // Reset opcache and stat cache opcache_reset(); clearstatcache(); return $this; }
protected function logUndefinedLocaleString($string, $package) { $package = (string) $package; if (isset($this->undefinedStrings[$this->currentLocale][$package][$string])) { return; } Log::warning("I18n: locale string not found: '{$string}'"); is_file($this->undefinedStringsLogFile) and $this->undefinedStrings = (include $this->undefinedStringsLogFile); $this->undefinedStrings[$this->currentLocale][$package][$string] = true; fileSaveArray($this->undefinedStringsLogFile, $this->undefinedStrings); }