installation.php 7.5 KB

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