Check for working .htaccess via AJAX

Fixes https://github.com/owncloud/core/issues/12650
This commit is contained in:
Lukas Reschke 2014-12-06 15:34:53 +01:00
Родитель 94eb2e782f
Коммит 2b76227180
4 изменённых файлов: 10 добавлений и 20 удалений

Просмотреть файл

@ -49,11 +49,16 @@
var afterCall = function(data, statusText, xhr) { var afterCall = function(data, statusText, xhr) {
var messages = []; var messages = [];
if (xhr.status === 200 && data) { if (xhr.status === 200 && data) {
if (!data.serverhasinternetconnection) { if (!data.serverHasInternetConnection) {
messages.push( messages.push(
t('core', 'This server has no working internet connection. This means that some of the features like mounting of external storage, notifications about updates or installation of 3rd party apps don´t work. Accessing files from remote and sending of notification emails might also not work. We suggest to enable internet connection for this server if you want to have all features.') t('core', 'This server has no working internet connection. This means that some of the features like mounting of external storage, notifications about updates or installation of 3rd party apps don´t work. Accessing files from remote and sending of notification emails might also not work. We suggest to enable internet connection for this server if you want to have all features.')
); );
} }
if(!data.dataDirectoryProtected) {
messages.push(
t('core', 'Your data directory and your files are probably accessible from the internet. The .htaccess file is not working. We strongly suggest that you configure your webserver in a way that the data directory is no longer accessible or you move the data directory outside the webserver document root.')
);
}
} else { } else {
messages.push(t('core', 'Error occurred while checking server setup')); messages.push(t('core', 'Error occurred while checking server setup'));
} }

Просмотреть файл

@ -9,7 +9,6 @@ OC_Util::checkAdminUser();
OC_App::setActiveNavigationEntry("admin"); OC_App::setActiveNavigationEntry("admin");
$template = new OC_Template('settings', 'admin', 'user'); $template = new OC_Template('settings', 'admin', 'user');
$htAccessWorking = OC_Util::isHtaccessWorking();
$entries = OC_Log_Owncloud::getEntries(3); $entries = OC_Log_Owncloud::getEntries(3);
$entriesRemaining = count(OC_Log_Owncloud::getEntries(4)) > 3; $entriesRemaining = count(OC_Log_Owncloud::getEntries(4)) > 3;
@ -32,7 +31,6 @@ $template->assign('mail_smtpname', $config->getSystemValue("mail_smtpname", ''))
$template->assign('mail_smtppassword', $config->getSystemValue("mail_smtppassword", '')); $template->assign('mail_smtppassword', $config->getSystemValue("mail_smtppassword", ''));
$template->assign('entries', $entries); $template->assign('entries', $entries);
$template->assign('entriesremain', $entriesRemaining); $template->assign('entriesremain', $entriesRemaining);
$template->assign('htaccessworking', $htAccessWorking);
$template->assign('readOnlyConfigEnabled', OC_Helper::isReadOnlyConfigEnabled()); $template->assign('readOnlyConfigEnabled', OC_Helper::isReadOnlyConfigEnabled());
$template->assign('isLocaleWorking', OC_Util::isSetLocaleWorking()); $template->assign('isLocaleWorking', OC_Util::isSetLocaleWorking());
$template->assign('isPhpCharSetUtf8', OC_Util::isPhpCharSetUtf8()); $template->assign('isPhpCharSetUtf8', OC_Util::isPhpCharSetUtf8());

Просмотреть файл

@ -17,7 +17,8 @@ if (OC_Util::isInternetConnectionEnabled()) {
} }
OCP\JSON::success( OCP\JSON::success(
array( array (
'serverhasinternetconnection' => $hasInternet 'serverHasInternetConnection' => $hasInternet,
'dataDirectoryProtected' => OC_Util::isHtaccessWorking()
) )
); );

Просмотреть файл

@ -83,20 +83,6 @@ if (!$_['isConnectedViaHTTPS']) {
<?php <?php
} }
// is htaccess working ?
if (!$_['htaccessworking']) {
?>
<div class="section">
<h2><?php p($l->t('Security Warning')); ?></h2>
<span class="securitywarning">
<?php p($l->t('Your data directory and your files are probably accessible from the internet. The .htaccess file is not working. We strongly suggest that you configure your webserver in a way that the data directory is no longer accessible or you move the data directory outside the webserver document root.')); ?>
</span>
</div>
<?php
}
// is read only config enabled // is read only config enabled
if ($_['readOnlyConfigEnabled']) { if ($_['readOnlyConfigEnabled']) {
?> ?>
@ -206,7 +192,7 @@ if ($_['suggestedOverwriteWebroot']) {
} }
?> ?>
<div id="postsetupchecks" class="section"> <div id="postsetupchecks" class="section">
<h2><?php p($l->t('Connectivity Checks'));?></h2> <h2><?php p($l->t('Configuration Checks'));?></h2>
<div class="loading"></div> <div class="loading"></div>
<div class="success hidden"><?php p($l->t('No problems found'));?></div> <div class="success hidden"><?php p($l->t('No problems found'));?></div>
<div class="errors hidden"></div> <div class="errors hidden"></div>