bash_install_check.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * 2016-04-06 by plabudda
  4. *
  5. */
  6. ini_set('max_execution_time', 300);
  7. ini_set('memory_limit', '512M');
  8. define('DS', DIRECTORY_SEPARATOR);
  9. define('APP_PATH_ROOT', dirname(__FILE__));
  10. define('APP_PATH_WWW', dirname(__FILE__));
  11. define('APP_PATH_CONFIG', APP_PATH_ROOT . DS . 'config');
  12. // set ini to log errors into error log file
  13. ini_set('display_startup_errors', '0');
  14. ini_set('log_errors', '1');
  15. ini_set('error_log', '/var/log/apache2/error_log');// TODO: php.ini ?
  16. require_once APP_PATH_ROOT . DS . 'se-lib' . DS . 'Lib.php';
  17. Lib::loadClass('V');
  18. Lib::loadClass('Config');
  19. Lib::loadClass('DB');
  20. Lib::loadClass('User');
  21. if (isset($_SERVER["argv"][1])) {
  22. $_SERVER['SERVER_NAME'] = $_SERVER["argv"][1];
  23. }
  24. else if (empty($_SERVER["argv"]) && V::get('task', '', $_GET) == 'info') {
  25. $info = array();
  26. $info['max_execution_time'] = ini_get('max_execution_time');
  27. $info['memory_limit'] = ini_get('memory_limit');
  28. echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">info (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($info);echo'</pre>';
  29. ini_set('max_execution_time', 300);
  30. ini_set('memory_limit', '512M');
  31. $info = array();
  32. $info['max_execution_time'] = ini_get('max_execution_time');
  33. $info['memory_limit'] = ini_get('memory_limit');
  34. echo'<pre style="max-height:200px;overflow:auto;border:1px solid red;text-align:left;">info (' . __CLASS__ . '::' . __FUNCTION__ . ':' . __LINE__ . '): ';print_r($info);echo'</pre>';
  35. }
  36. else {
  37. die("\n The second argument should be server domain - e.g. biuro.biall-net.pl \n");
  38. }
  39. // TODO: check install
  40. Lib::loadClass('Router');
  41. Router::getRoute('Config')->reinstall();
  42. $cronTaskName = 'checkInstall';
  43. $keyToken = 'bash_install_check';
  44. $token = Router::getRoute('Cron')->generateCliAuthToken($keyToken, $cronTaskName, 300 * 10);
  45. $string = Router::getRoute('Cron')->executeCurlTastByToken($cronTaskName, $keyToken, $token);
  46. echo "DBG: string -----------------------\n{$string}\nEOF string---------------------------------\n";
  47. {
  48. echo "Router::getRoute('FileStorage')->reinstall() ...\n";
  49. Router::getRoute('FileStorage')->reinstall();
  50. echo "\nRouter::getRoute('FileStorage')->reinstall() DONE\n";
  51. }
  52. die(".EOF - OK\n");
  53. ?>