Install.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. Lib::loadClass('RouteBase');
  3. class Route_Install extends RouteBase {
  4. public function handleAuth() {
  5. if (!User::logged()) {
  6. throw new HttpException('Unauthorized', 401);
  7. }
  8. if (!User::isAdmin()) {
  9. throw new HttpException('Unauthorized - only for administrators', 401);
  10. }
  11. }
  12. public function defaultAction() {
  13. SE_Layout::gora();
  14. SE_Layout::menu();
  15. $this->menu();
  16. SE_Layout::dol();
  17. }
  18. private function menu() {
  19. $serversList = $this->fetchActiveLicences();
  20. ?>
  21. <div class="jumbotron">
  22. <div class="container">
  23. <form class="form-inline" method="POST">
  24. <input type="hidden" name="_task" value="createApp" />
  25. <label>Przygotuj kod źródłowy do aktualizacji na serwerze klienta:</label>
  26. <select name="server_id">
  27. <?php foreach ($serversList as $srv) : ?>
  28. <option name="<?php echo $srv->ID; ?>"><?php echo $srv->TODO__SRV_HOST_NAME_SHORT__OR__IP_FOR_MULTIPLE_DOMAINS; ?></option>
  29. <?php endforeach; ?>
  30. </select>
  31. <button type="submit" id="fldSbmtBtn" class="btn btn-primary" autocomplete="off">
  32. Generuj
  33. </button>
  34. </form>
  35. </div>
  36. </div>
  37. <script type="text/javascript">
  38. jQuery(document).ready(function () {
  39. jQuery('#fldSbmtBtn').on('click', function () {
  40. jQuery(this).text(jQuery(this).text() + '...').attr('disabled', 'disabled');
  41. jQuery(this).parent().submit();
  42. })
  43. });
  44. </script>
  45. <?php
  46. }
  47. public function createAppAction() {
  48. $args = array();
  49. $args['server_id'] = V::get('server_id', 0, $_REQUEST, 'int');
  50. SE_Layout::gora();
  51. SE_Layout::menu();
  52. //$this->menu($args['server_id']);// TODO: GO BACK BTN
  53. if (empty($args['server_id'])) {
  54. ?>
  55. <div class="alert alert-warning">
  56. Nie wybrano serwera/licencji.
  57. </div>
  58. <?php
  59. SE_Layout::dol();
  60. exit;
  61. }
  62. $this->generateApp($args['server_id']);
  63. SE_Layout::dol();
  64. }
  65. public function generateApp() {
  66. // 1763: $exec='cd '.$installer_dir.' && /Applications/SourceGuardian.app/Contents/MacOS/sgencoder -b-
  67. // '.INSTALL_SES_PROCESY_A::get_same_domains_for_install($h->SERVER_ADDRESS_SHORT).'
  68. // -r *.php
  69. // -x superedit-DB_PROCEDURES_CREATE.php
  70. // -x INI.php
  71. // -x .config_base_structure.php
  72. // ';
  73. //
  74. // INSTALL_SES_PROCESY_A::get_same_domains_for_install($h->SERVER_ADDRESS_SHORT):
  75. // $res2=DB::query("select SERVER_ADDRESS_SHORT from SES_PROCESY5_A where SERVER_ADDRESS_IP='".$h->SERVER_ADDRESS_IP."'");
  76. // while($h2=DB::fetch($res2)) {
  77. // $domain[]=' --domain '.$h2->SERVER_ADDRESS_SHORT;
  78. // ssh server@biuro.galeriaprzymorze.eu: PHP 5.5.20
  79. // ssh server@biuro.biall-net.pl
  80. // cd /Users/plabudda/procesy5-install-galeriaprzymorze.eu/
  81. // sudo chown -R server:admin SE/
  82. // /Applications/SourceGuardian.app/Contents/MacOS/sgencoder --phpversion 5.5 -b- --domain galeriaprzymorze.eu -r SE/*.php SE/se-lib/*.php SE/se-lib/*/*.php SE/se-lib/*/*/*.php SE/procesy/*.php SE/odt2xhtml/*.php -x superedit-DB_PROCEDURES_CREATE.php -x INI.php -x .config_base_structure.php
  83. }
  84. }