@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | return Command::SUCCESS; |
| 59 | 59 | |
| 60 | 60 | } catch (\Exception $e) { |
| 61 | - $this->error('❌ Composer update failed: ' . $e->getMessage()); |
|
| 61 | + $this->error('❌ Composer update failed: '.$e->getMessage()); |
|
| 62 | 62 | return Command::FAILURE; |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | ->run($command); |
| 76 | 76 | |
| 77 | 77 | if (!$process->successful()) { |
| 78 | - throw new \Exception('Composer install failed: ' . $process->errorOutput()); |
|
| 78 | + throw new \Exception('Composer install failed: '.$process->errorOutput()); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | $this->line(' ✓ Dependencies installed successfully'); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | ->run($command); |
| 94 | 94 | |
| 95 | 95 | if (!$process->successful()) { |
| 96 | - throw new \Exception('Composer update failed: ' . $process->errorOutput()); |
|
| 96 | + throw new \Exception('Composer update failed: '.$process->errorOutput()); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | $this->line(' ✓ Dependencies updated successfully'); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | } catch (\Exception $e) { |
| 75 | 75 | $this->progressBar->finish(); |
| 76 | 76 | $this->newLine(2); |
| 77 | - $this->error('❌ Update failed: ' . $e->getMessage()); |
|
| 77 | + $this->error('❌ Update failed: '.$e->getMessage()); |
|
| 78 | 78 | $this->restoreEnvironment(); |
| 79 | 79 | |
| 80 | 80 | return Command::FAILURE; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | ->run('npm install --silent'); |
| 227 | 227 | |
| 228 | 228 | if (!$process->successful()) { |
| 229 | - throw new \Exception('NPM install failed: ' . $process->errorOutput()); |
|
| 229 | + throw new \Exception('NPM install failed: '.$process->errorOutput()); |
|
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | ->run('npm run build'); |
| 242 | 242 | |
| 243 | 243 | if (!$buildProcess->successful()) { |
| 244 | - throw new \Exception('Asset build failed: ' . $buildProcess->errorOutput()); |
|
| 244 | + throw new \Exception('Asset build failed: '.$buildProcess->errorOutput()); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | $this->progressBar->advance(); |
@@ -276,10 +276,10 @@ discard block |
||
| 276 | 276 | $this->line(' ✓ Smarty compiled template cache cleared'); |
| 277 | 277 | } else { |
| 278 | 278 | $this->warn(' ⚠ Could not clear Smarty cache automatically'); |
| 279 | - $this->line(' Please clear manually: ' . config('ytake-laravel-smarty.compile_path')); |
|
| 279 | + $this->line(' Please clear manually: '.config('ytake-laravel-smarty.compile_path')); |
|
| 280 | 280 | } |
| 281 | 281 | } catch (\Exception $e) { |
| 282 | - $this->warn(' ⚠ Smarty cache clear failed: ' . $e->getMessage()); |
|
| 282 | + $this->warn(' ⚠ Smarty cache clear failed: '.$e->getMessage()); |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
@@ -313,10 +313,10 @@ discard block |
||
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | $this->addMissingEnvVars($envPath, $missingKeys); |
| 316 | - $this->line(" ✓ Merged " . count($missingKeys) . " new environment variables"); |
|
| 316 | + $this->line(" ✓ Merged ".count($missingKeys)." new environment variables"); |
|
| 317 | 317 | |
| 318 | 318 | } catch (\Exception $e) { |
| 319 | - $this->warn(' ⚠ Environment merge failed: ' . $e->getMessage()); |
|
| 319 | + $this->warn(' ⚠ Environment merge failed: '.$e->getMessage()); |
|
| 320 | 320 | } |
| 321 | 321 | } |
| 322 | 322 | |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | $content .= "\n"; |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | - $content .= "\n# New settings added from .env.example on " . now()->toDateTimeString() . "\n"; |
|
| 359 | + $content .= "\n# New settings added from .env.example on ".now()->toDateTimeString()."\n"; |
|
| 360 | 360 | |
| 361 | 361 | foreach ($missingKeys as $key => $value) { |
| 362 | 362 | $content .= "$key=$value\n"; |
@@ -88,10 +88,19 @@ |
||
| 88 | 88 | { |
| 89 | 89 | $steps = 3; // prepare, finalize, cleanup |
| 90 | 90 | |
| 91 | - if (!$this->option('skip-git')) $steps++; |
|
| 92 | - if (!$this->option('skip-composer')) $steps++; |
|
| 93 | - if (!$this->option('skip-npm')) $steps += 2; // install + build |
|
| 94 | - if (!$this->option('skip-db')) $steps++; |
|
| 91 | + if (!$this->option('skip-git')) { |
|
| 92 | + $steps++; |
|
| 93 | + } |
|
| 94 | + if (!$this->option('skip-composer')) { |
|
| 95 | + $steps++; |
|
| 96 | + } |
|
| 97 | + if (!$this->option('skip-npm')) { |
|
| 98 | + $steps += 2; |
|
| 99 | + } |
|
| 100 | + // install + build |
|
| 101 | + if (!$this->option('skip-db')) { |
|
| 102 | + $steps++; |
|
| 103 | + } |
|
| 95 | 104 | |
| 96 | 105 | $steps++; // smarty cache clear |
| 97 | 106 | $steps++; // env merge |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | return Command::SUCCESS; |
| 66 | 66 | |
| 67 | 67 | } catch (\Exception $e) { |
| 68 | - $this->error('❌ Failed to start Tmux UI: ' . $e->getMessage()); |
|
| 68 | + $this->error('❌ Failed to start Tmux UI: '.$e->getMessage()); |
|
| 69 | 69 | return Command::FAILURE; |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | $process = Process::timeout($timeout)->tty()->run($command); |
| 124 | 124 | |
| 125 | 125 | if (!$process->successful()) { |
| 126 | - throw new \Exception('Tmux session failed to start: ' . $process->errorOutput()); |
|
| 126 | + throw new \Exception('Tmux session failed to start: '.$process->errorOutput()); |
|
| 127 | 127 | } |
| 128 | 128 | } else { |
| 129 | 129 | // Start in background |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | return Command::SUCCESS; |
| 77 | 77 | |
| 78 | 78 | } catch (\Exception $e) { |
| 79 | - $this->error('❌ Git update failed: ' . $e->getMessage()); |
|
| 79 | + $this->error('❌ Git update failed: '.$e->getMessage()); |
|
| 80 | 80 | return Command::FAILURE; |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -103,10 +103,10 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | private function stashChanges(): void |
| 105 | 105 | { |
| 106 | - $process = Process::run('git stash push -m "Auto-stash before update on ' . now()->toDateTimeString() . '"'); |
|
| 106 | + $process = Process::run('git stash push -m "Auto-stash before update on '.now()->toDateTimeString().'"'); |
|
| 107 | 107 | |
| 108 | 108 | if (!$process->successful()) { |
| 109 | - throw new \Exception('Failed to stash changes: ' . $process->errorOutput()); |
|
| 109 | + throw new \Exception('Failed to stash changes: '.$process->errorOutput()); |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | $this->line(' ✓ Changes stashed successfully'); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $process = Process::run('git branch --show-current'); |
| 121 | 121 | |
| 122 | 122 | if (!$process->successful()) { |
| 123 | - throw new \Exception('Failed to get current branch: ' . $process->errorOutput()); |
|
| 123 | + throw new \Exception('Failed to get current branch: '.$process->errorOutput()); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | return trim($process->output()); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $process = Process::timeout(300)->run('git fetch --prune'); |
| 135 | 135 | |
| 136 | 136 | if (!$process->successful()) { |
| 137 | - throw new \Exception('Failed to fetch changes: ' . $process->errorOutput()); |
|
| 137 | + throw new \Exception('Failed to fetch changes: '.$process->errorOutput()); |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $process = Process::timeout(300)->run($pullCommand); |
| 166 | 166 | |
| 167 | 167 | if (!$process->successful()) { |
| 168 | - throw new \Exception('Failed to pull changes: ' . $process->errorOutput()); |
|
| 168 | + throw new \Exception('Failed to pull changes: '.$process->errorOutput()); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | $this->line(' ✓ Changes pulled successfully'); |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | return Command::SUCCESS; |
| 71 | 71 | |
| 72 | 72 | } catch (\Exception $e) { |
| 73 | - $this->error('❌ Database update failed: ' . $e->getMessage()); |
|
| 73 | + $this->error('❌ Database update failed: '.$e->getMessage()); |
|
| 74 | 74 | return Command::FAILURE; |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | try { |
| 84 | 84 | DB::connection()->getPdo(); |
| 85 | 85 | |
| 86 | - $dbConfig = config('database.connections.' . config('database.default')); |
|
| 86 | + $dbConfig = config('database.connections.'.config('database.default')); |
|
| 87 | 87 | $driver = $dbConfig['driver'] ?? null; |
| 88 | 88 | |
| 89 | 89 | // Detect actual database type for MySQL-compatible drivers |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | return $driver; |
| 105 | 105 | |
| 106 | 106 | } catch (\Exception $e) { |
| 107 | - $this->error(' ✗ Database connection failed: ' . $e->getMessage()); |
|
| 107 | + $this->error(' ✗ Database connection failed: '.$e->getMessage()); |
|
| 108 | 108 | return null; |
| 109 | 109 | } |
| 110 | 110 | } |
@@ -160,9 +160,9 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | $timestamp = now()->format('Y-m-d_H-i-s'); |
| 162 | 162 | $filename = "nntmux_backup_{$timestamp}.sql"; |
| 163 | - $fullPath = $backupPath . '/' . $filename; |
|
| 163 | + $fullPath = $backupPath.'/'.$filename; |
|
| 164 | 164 | |
| 165 | - $dbConfig = config('database.connections.' . config('database.default')); |
|
| 165 | + $dbConfig = config('database.connections.'.config('database.default')); |
|
| 166 | 166 | |
| 167 | 167 | if (in_array($dbType, ['mysql', 'mariadb'])) { |
| 168 | 168 | $this->createMysqlCompatibleBackup($dbConfig, $fullPath, $dbType); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | } catch (\Exception $e) { |
| 176 | - $this->warn(' ⚠ Backup creation failed: ' . $e->getMessage()); |
|
| 176 | + $this->warn(' ⚠ Backup creation failed: '.$e->getMessage()); |
|
| 177 | 177 | } |
| 178 | 178 | } |
| 179 | 179 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | escapeshellarg($dbConfig['host']), |
| 189 | 189 | escapeshellarg($dbConfig['port']), |
| 190 | 190 | escapeshellarg($dbConfig['username']), |
| 191 | - !empty($dbConfig['password']) ? '-p' . escapeshellarg($dbConfig['password']) : '', |
|
| 191 | + !empty($dbConfig['password']) ? '-p'.escapeshellarg($dbConfig['password']) : '', |
|
| 192 | 192 | escapeshellarg($dbConfig['database']), |
| 193 | 193 | escapeshellarg($fullPath) |
| 194 | 194 | ); |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | exec($command, $output, $returnVar); |
| 197 | 197 | |
| 198 | 198 | if ($returnVar === 0 && file_exists($fullPath) && filesize($fullPath) > 0) { |
| 199 | - $this->line(" ✓ $dbType backup created: " . basename($fullPath)); |
|
| 199 | + $this->line(" ✓ $dbType backup created: ".basename($fullPath)); |
|
| 200 | 200 | } else { |
| 201 | 201 | // Fallback to mysqldump if mariadb-dump failed |
| 202 | 202 | if ($dbType === 'mariadb') { |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | exec($fallbackCommand, $output, $returnVar); |
| 205 | 205 | |
| 206 | 206 | if ($returnVar === 0 && file_exists($fullPath) && filesize($fullPath) > 0) { |
| 207 | - $this->line(" ✓ MySQL backup created (fallback): " . basename($fullPath)); |
|
| 207 | + $this->line(" ✓ MySQL backup created (fallback): ".basename($fullPath)); |
|
| 208 | 208 | } else { |
| 209 | 209 | $this->warn(' ⚠ Backup creation failed'); |
| 210 | 210 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | exec($command, $output, $returnVar); |
| 233 | 233 | |
| 234 | 234 | if ($returnVar === 0 && file_exists($fullPath) && filesize($fullPath) > 0) { |
| 235 | - $this->line(" ✓ PostgreSQL backup created: " . basename($fullPath)); |
|
| 235 | + $this->line(" ✓ PostgreSQL backup created: ".basename($fullPath)); |
|
| 236 | 236 | } else { |
| 237 | 237 | $this->warn(' ⚠ PostgreSQL backup creation failed'); |
| 238 | 238 | } |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | $this->line(" ℹ Database optimization skipped (unsupported type: $dbType)"); |
| 293 | 293 | } |
| 294 | 294 | } catch (\Exception $e) { |
| 295 | - $this->warn(' ⚠ Database optimization failed: ' . $e->getMessage()); |
|
| 295 | + $this->warn(' ⚠ Database optimization failed: '.$e->getMessage()); |
|
| 296 | 296 | } |
| 297 | 297 | } |
| 298 | 298 | |
@@ -301,9 +301,9 @@ discard block |
||
| 301 | 301 | */ |
| 302 | 302 | private function optimizeMysqlCompatible(string $dbType): void |
| 303 | 303 | { |
| 304 | - $dbConfig = config('database.connections.' . config('database.default')); |
|
| 304 | + $dbConfig = config('database.connections.'.config('database.default')); |
|
| 305 | 305 | $tables = DB::select('SHOW TABLES'); |
| 306 | - $tableKey = 'Tables_in_' . $dbConfig['database']; |
|
| 306 | + $tableKey = 'Tables_in_'.$dbConfig['database']; |
|
| 307 | 307 | |
| 308 | 308 | $optimizedCount = 0; |
| 309 | 309 | foreach ($tables as $table) { |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - $this->line(" ✓ $dbType tables optimized ($optimizedCount/" . count($tables) . ")"); |
|
| 319 | + $this->line(" ✓ $dbType tables optimized ($optimizedCount/".count($tables).")"); |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | /** |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | DB::statement('VACUUM ANALYZE'); |
| 329 | 329 | $this->line(' ✓ PostgreSQL database optimized (VACUUM ANALYZE)'); |
| 330 | 330 | } catch (\Exception $e) { |
| 331 | - $this->warn(' ⚠ PostgreSQL optimization failed: ' . $e->getMessage()); |
|
| 331 | + $this->warn(' ⚠ PostgreSQL optimization failed: '.$e->getMessage()); |
|
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | return false; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - $cacheKey = $cacheKey ?? 'file_hash_' . md5($filePath); |
|
| 20 | + $cacheKey = $cacheKey ?? 'file_hash_'.md5($filePath); |
|
| 21 | 21 | $currentHash = md5_file($filePath); |
| 22 | 22 | $lastHash = Cache::get($cacheKey); |
| 23 | 23 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $operation(); |
| 76 | 76 | $results[$type] = 'success'; |
| 77 | 77 | } catch (\Exception $e) { |
| 78 | - $results[$type] = 'failed: ' . $e->getMessage(); |
|
| 78 | + $results[$type] = 'failed: '.$e->getMessage(); |
|
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | $memoryUsage = memory_get_usage(true); |
| 115 | 115 | $memoryLimit = ini_get('memory_limit'); |
| 116 | 116 | |
| 117 | - if ($memoryUsage > (int)$memoryLimit * 0.8) { |
|
| 117 | + if ($memoryUsage > (int) $memoryLimit * 0.8) { |
|
| 118 | 118 | $recommendations[] = 'Consider increasing PHP memory_limit'; |
| 119 | 119 | } |
| 120 | 120 | |