| Conditions | 6 |
| Paths | 12 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public static function executeThemeCommands() |
||
| 25 | { |
||
| 26 | $config = Configuration::get(); |
||
| 27 | $themeName = isset($config['theme']['name']) ? $config['theme']['name'] : ''; |
||
| 28 | $commands = isset($config['commands']['postInstallTheme']) ? $config['commands']['postInstallTheme'] : []; |
||
| 29 | if ( ! $themeName || ! $commands ) { |
||
| 30 | return; |
||
| 31 | } |
||
| 32 | |||
| 33 | $rootDir = getcwd(); |
||
| 34 | $themeDir = "{$rootDir}/wp-content/themes/{$themeName}"; |
||
| 35 | |||
| 36 | // Change into the theme directory. |
||
| 37 | chdir($themeDir); |
||
| 38 | |||
| 39 | // Run commands. |
||
| 40 | foreach ($commands as $command) { |
||
| 41 | system($command); |
||
| 42 | } |
||
| 43 | |||
| 44 | // Change back to root directory. |
||
| 45 | chdir($rootDir); |
||
| 46 | } |
||
| 47 | } |
||
| 48 |