installation.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2011-2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. script('core', 'install');
  8. ?>
  9. <input type='hidden' id='hasMySQL' value='<?php p($_['hasMySQL']) ?>'>
  10. <input type='hidden' id='hasSQLite' value='<?php p($_['hasSQLite']) ?>'>
  11. <input type='hidden' id='hasPostgreSQL' value='<?php p($_['hasPostgreSQL']) ?>'>
  12. <input type='hidden' id='hasOracle' value='<?php p($_['hasOracle']) ?>'>
  13. <form method="post" class="guest-box install-form">
  14. <input type="hidden" name="install" value="true">
  15. <?php if (count($_['errors']) > 0): ?>
  16. <fieldset class="warning">
  17. <legend><strong><?php p($l->t('Error'));?></strong></legend>
  18. <?php foreach ($_['errors'] as $err): ?>
  19. <p>
  20. <?php if (is_array($err)):?>
  21. <?php p($err['error']); ?>
  22. <span class='hint'><?php p($err['hint']); ?></span>
  23. <?php else: ?>
  24. <?php p($err); ?>
  25. <?php endif; ?>
  26. </p>
  27. <?php endforeach; ?>
  28. </fieldset>
  29. <?php endif; ?>
  30. <?php if (!$_['htaccessWorking']): ?>
  31. <fieldset class="warning">
  32. <legend><strong><?php p($l->t('Security warning'));?></strong></legend>
  33. <p><?php p($l->t('Your data directory and files are probably accessible from the internet because the .htaccess file does not work.'));?><br>
  34. <?php print_unescaped($l->t(
  35. 'For information how to properly configure your server, please see the <a href="%s" target="_blank" rel="noreferrer noopener">documentation</a>.',
  36. [link_to_docs('admin-install')]
  37. )); ?></p>
  38. </fieldset>
  39. <?php endif; ?>
  40. <fieldset id="adminaccount">
  41. <legend><?php print_unescaped($l->t('Create an <strong>admin account</strong>')); ?></legend>
  42. <p>
  43. <label for="adminlogin"><?php p($l->t('Login')); ?></label>
  44. <input type="text" name="adminlogin" id="adminlogin"
  45. value="<?php p($_['adminlogin']); ?>"
  46. autocomplete="off" autocapitalize="none" spellcheck="false" autofocus required>
  47. </p>
  48. <p class="groupbottom">
  49. <label for="adminpass"><?php p($l->t('Password')); ?></label>
  50. <input type="password" name="adminpass" data-typetoggle="#show" id="adminpass"
  51. value="<?php p($_['adminpass']); ?>"
  52. autocomplete="off" autocapitalize="none" spellcheck="false" required>
  53. <button id="show" class="toggle-password" aria-label="<?php p($l->t('Show password')); ?>">
  54. <img src="<?php print_unescaped(image_path('', 'actions/toggle.svg')); ?>" alt="<?php p($l->t('Toggle password visibility')); ?>">
  55. </button>
  56. </p>
  57. </fieldset>
  58. <?php if (!$_['directoryIsSet'] or !$_['dbIsSet'] or count($_['errors']) > 0): ?>
  59. <fieldset id="advancedHeader">
  60. <legend><a id="showAdvanced" tabindex="0" href="#"><?php p($l->t('Storage & database')); ?><img src="<?php print_unescaped(image_path('core', 'actions/caret.svg')); ?>" /></a></legend>
  61. </fieldset>
  62. <?php endif; ?>
  63. <?php if (!$_['directoryIsSet'] or count($_['errors']) > 0): ?>
  64. <fieldset id="datadirField">
  65. <div id="datadirContent">
  66. <label for="directory"><?php p($l->t('Data folder')); ?></label>
  67. <input type="text" name="directory" id="directory"
  68. placeholder="<?php p(OC::$SERVERROOT . '/data'); ?>"
  69. value="<?php p($_['directory']); ?>"
  70. autocomplete="off" autocapitalize="none" spellcheck="false">
  71. </div>
  72. </fieldset>
  73. <?php endif; ?>
  74. <?php if (!$_['dbIsSet'] or count($_['errors']) > 0): ?>
  75. <fieldset id='databaseBackend'>
  76. <?php if ($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle']) {
  77. $hasOtherDB = true;
  78. } else {
  79. $hasOtherDB = false;
  80. } //other than SQLite?>
  81. <legend><?php p($l->t('Configure the database')); ?></legend>
  82. <div id="selectDbType">
  83. <?php foreach ($_['databases'] as $type => $label): ?>
  84. <?php if (count($_['databases']) === 1): ?>
  85. <p class="info">
  86. <?php p($l->t('Only %s is available.', [$label])); ?>
  87. <?php p($l->t('Install and activate additional PHP modules to choose other database types.')); ?><br>
  88. <a href="<?php print_unescaped(link_to_docs('admin-source_install')); ?>" target="_blank" rel="noreferrer noopener">
  89. <?php p($l->t('For more details check out the documentation.')); ?> ↗</a>
  90. </p>
  91. <input type="hidden" id="dbtype" name="dbtype" value="<?php p($type) ?>">
  92. <?php else: ?>
  93. <input type="radio" name="dbtype" value="<?php p($type) ?>" id="<?php p($type) ?>"
  94. <?php print_unescaped($_['dbtype'] === $type ? 'checked="checked" ' : '') ?>/>
  95. <label class="<?php p($type) ?>" for="<?php p($type) ?>"><?php p($label) ?></label>
  96. <?php endif; ?>
  97. <?php endforeach; ?>
  98. </div>
  99. </fieldset>
  100. <?php if ($hasOtherDB): ?>
  101. <fieldset id='databaseField'>
  102. <div id="use_other_db">
  103. <p class="grouptop">
  104. <label for="dbuser"><?php p($l->t('Database account')); ?></label>
  105. <input type="text" name="dbuser" id="dbuser"
  106. value="<?php p($_['dbuser']); ?>"
  107. autocomplete="off" autocapitalize="none" spellcheck="false">
  108. </p>
  109. <p class="groupmiddle">
  110. <label for="dbpass"><?php p($l->t('Database password')); ?></label>
  111. <input type="password" name="dbpass" id="dbpass"
  112. value="<?php p($_['dbpass']); ?>"
  113. autocomplete="off" autocapitalize="none" spellcheck="false">
  114. <button id="show" class="toggle-password" aria-label="<?php p($l->t('Show password')); ?>">
  115. <img src="<?php print_unescaped(image_path('', 'actions/toggle.svg')); ?>" alt="<?php p($l->t('Toggle password visibility')); ?>">
  116. </button>
  117. </p>
  118. <p class="groupmiddle">
  119. <label for="dbname"><?php p($l->t('Database name')); ?></label>
  120. <input type="text" name="dbname" id="dbname"
  121. value="<?php p($_['dbname']); ?>"
  122. autocomplete="off" autocapitalize="none" spellcheck="false"
  123. pattern="[0-9a-zA-Z$_-]+">
  124. </p>
  125. <?php if ($_['hasOracle']): ?>
  126. <div id="use_oracle_db">
  127. <p class="groupmiddle">
  128. <label for="dbtablespace" class="infield"><?php p($l->t('Database tablespace')); ?></label>
  129. <input type="text" name="dbtablespace" id="dbtablespace"
  130. value="<?php p($_['dbtablespace']); ?>"
  131. autocomplete="off" autocapitalize="none" spellcheck="false">
  132. </p>
  133. </div>
  134. <?php endif; ?>
  135. <p class="groupbottom">
  136. <label for="dbhost"><?php p($l->t('Database host')); ?></label>
  137. <input type="text" name="dbhost" id="dbhost"
  138. value="<?php p($_['dbhost']); ?>"
  139. autocomplete="off" autocapitalize="none" spellcheck="false">
  140. </p>
  141. <p class="info">
  142. <?php p($l->t('Please specify the port number along with the host name (e.g., localhost:5432).')); ?>
  143. </p>
  144. </div>
  145. </fieldset>
  146. <?php endif; ?>
  147. <?php endif; ?>
  148. <?php if (!$_['dbIsSet'] or count($_['errors']) > 0): ?>
  149. <div id="sqliteInformation" class="notecard warning">
  150. <legend><?php p($l->t('Performance warning'));?></legend>
  151. <p><?php p($l->t('You chose SQLite as database.'));?></p>
  152. <p><?php p($l->t('SQLite should only be used for minimal and development instances. For production we recommend a different database backend.'));?></p>
  153. <p><?php p($l->t('If you use clients for file syncing, the use of SQLite is highly discouraged.')); ?></p>
  154. </div>
  155. <?php endif ?>
  156. <div class="icon-loading-dark float-spinner">&nbsp;</div>
  157. <div class="buttons"><input type="submit" class="primary" value="<?php p($l->t('Install')); ?>" data-finishing="<?php p($l->t('Installing …')); ?>"></div>
  158. <p class="info">
  159. <span class="icon-info-white"></span>
  160. <?php p($l->t('Need help?'));?>
  161. <a target="_blank" rel="noreferrer noopener" href="<?php p(link_to_docs('admin-install')); ?>"><?php p($l->t('See the documentation'));?> ↗</a>
  162. </p>
  163. </form>