| | 302 | function runEvironmentSpecificTasks() |
|---|
| | 303 | { |
|---|
| | 304 | if($evironment = $this->guessEnvironment()){ |
|---|
| | 305 | $method_name = 'run'.$evironment.'Tasks'; |
|---|
| | 306 | if(method_exists($this, $method_name)){ |
|---|
| | 307 | $this->$method_name(); |
|---|
| | 308 | } |
|---|
| | 309 | } |
|---|
| | 310 | } |
|---|
| | 311 | |
|---|
| | 312 | // Environment specific tasks |
|---|
| | 313 | |
|---|
| | 314 | function guessEnvironment() |
|---|
| | 315 | { |
|---|
| | 316 | if(AK_WINDOWS){ |
|---|
| | 317 | if(file_exists('C:/xampp/apache/conf/httpd.conf')){ |
|---|
| | 318 | return 'DefaultXamppOnWindows'; |
|---|
| | 319 | } |
|---|
| | 320 | } |
|---|
| | 321 | return false; |
|---|
| | 322 | } |
|---|
| | 323 | |
|---|
| | 324 | function runDefaultXamppOnWindowsTasks() |
|---|
| | 325 | { |
|---|
| | 326 | // XAMPP has mod_rewrite disabled by default so we will try to enable it. |
|---|
| | 327 | $http_conf = file_get_contents('C:/xampp/apache/conf/httpd.conf'); |
|---|
| | 328 | if(strstr($http_conf, '#LoadModule rewrite_module')){ |
|---|
| | 329 | $this->yield('Enabling mod_rewrite'); |
|---|
| | 330 | file_put_contents('C:/xampp/apache/conf/httpd.conf.akelos', $http_conf); |
|---|
| | 331 | file_put_contents('C:/xampp/apache/conf/httpd.conf', |
|---|
| | 332 | str_replace( |
|---|
| | 333 | '#LoadModule rewrite_module', |
|---|
| | 334 | 'LoadModule rewrite_module', |
|---|
| | 335 | $http_conf |
|---|
| | 336 | )); |
|---|
| | 337 | |
|---|
| | 338 | $this->yield('Restarting Apache'); |
|---|
| | 339 | // Stop apache |
|---|
| | 340 | exec('C:\xampp\apache\bin\pv -f -k apache.exe -q'); |
|---|
| | 341 | exec('rm C:\xampp\apache\logs\httpd.pid'); |
|---|
| | 342 | |
|---|
| | 343 | // Start Apache in the background |
|---|
| | 344 | $shell = new COM('WScript.Shell'); |
|---|
| | 345 | $shell->Run('C:\xampp\apache\bin\apache.exe', 0, false); |
|---|
| | 346 | } |
|---|
| | 347 | |
|---|
| | 348 | $my_cnf = @file_get_contents('C:/xampp/mysql/bin/my.cnf'); |
|---|
| | 349 | // InnoDB engine is not enabled by default on XAMPP we need it enabled in order to use transactions |
|---|
| | 350 | if(strstr($my_cnf, '#innodb_')){ |
|---|
| | 351 | $this->yield('Enabling InnoDB MySQL engine.'); |
|---|
| | 352 | file_put_contents('C:/xampp/mysql/bin/my.cnf.akelos', $my_cnf); |
|---|
| | 353 | file_put_contents('C:/xampp/mysql/bin/my.cnf', |
|---|
| | 354 | str_replace( |
|---|
| | 355 | array('skip-innodb', '#innodb_', '#set-variable = innodb'), |
|---|
| | 356 | array('#skip-innodb', 'innodb_', 'set-variable = innodb') |
|---|
| | 357 | ,$my_cnf)); |
|---|
| | 358 | |
|---|
| | 359 | $this->yield('Restarting MySQL server.'); |
|---|
| | 360 | $shell = new COM('WScript.Shell'); |
|---|
| | 361 | $shell->Run('C:\xampp\mysql\bin\mysqladmin --user=pma --password= shutdown', 0, false); |
|---|
| | 362 | $shell = new COM('WScript.Shell'); |
|---|
| | 363 | $shell->Run('C:\xampp\mysql\bin\mysqld --defaults-file=C:\xampp\mysql\bin\my.cnf --standalone --console', 0, false); |
|---|
| | 364 | } |
|---|
| | 365 | } |
|---|