]> source.dussan.org Git - nextcloud-server.git/commitdiff
Move UTF-8 check to setup
authorLukas Reschke <lukas@owncloud.com>
Tue, 24 Feb 2015 22:34:38 +0000 (23:34 +0100)
committerLukas Reschke <lukas@owncloud.com>
Tue, 24 Feb 2015 22:51:36 +0000 (23:51 +0100)
Nobody reads the warnings anyways and so we should enforce it at installation time... Also allows us to get rid of some duplicated code.

To test change the `default_charset` to something other than `utf-8` or `UTF-8`, both should work fine with that change here. An error should then get shown.

We already set those default charsets in the shipped .user.ini and .htaccess

lib/private/util.php
settings/admin.php
settings/templates/admin.php

index 8ffb9e35badec72ff0d293d5e6f0dfcf4bf90784..44ddc26fc31f3220d70c9b58b589c83249a5c7a4 100644 (file)
@@ -651,6 +651,7 @@ class OC_Util {
                        'ini' => [
                                'mbstring.func_overload' => 0,
                                'output_buffering' => false,
+                               'default_charset' => 'UTF-8',
                        ],
                );
                $missingDependencies = array();
@@ -684,6 +685,11 @@ class OC_Util {
                                        $invalidIniSettings[] = [$setting, $expected];
                                }
                        }
+                       if(is_string($expected)) {
+                               if(strtolower($iniWrapper->getString($setting)) !== strtolower($expected)) {
+                                       $invalidIniSettings[] = [$setting, $expected];
+                               }
+                       }
                }
 
                foreach($missingDependencies as $missingDependency) {
@@ -1511,13 +1517,4 @@ class OC_Util {
                }
        }
 
-       /**
-        * Check if PhpCharset config is UTF-8
-        *
-        * @return string
-        */
-       public static function isPhpCharSetUtf8() {
-               return strtoupper(ini_get('default_charset')) === 'UTF-8';
-       }
-
 }
index 9f39936fe7b6b940d039ffe384148eaeb3386852..fc2df77eae166181ae2defb13d87266951853c7d 100644 (file)
@@ -65,7 +65,6 @@ $template->assign('doesLogFileExist', $doesLogFileExist);
 $template->assign('showLog', $showLog);
 $template->assign('readOnlyConfigEnabled', OC_Helper::isReadOnlyConfigEnabled());
 $template->assign('isLocaleWorking', OC_Util::isSetLocaleWorking());
-$template->assign('isPhpCharSetUtf8', OC_Util::isPhpCharSetUtf8());
 $template->assign('isAnnotationsWorking', OC_Util::isAnnotationsWorking());
 $template->assign('has_fileinfo', OC_Util::fileInfoLoaded());
 $template->assign('backgroundjobs_mode', $appConfig->getValue('core', 'backgroundjobs_mode', 'ajax'));
@@ -116,7 +115,7 @@ $forms = OC_App::getForms('admin');
 $l = OC_L10N::get('settings');
 $formsAndMore = array();
 if ($request->getServerProtocol()  !== 'https' || !OC_Util::isAnnotationsWorking() ||
-       $suggestedOverwriteCliUrl || !OC_Util::isSetLocaleWorking() || !OC_Util::isPhpCharSetUtf8() ||
+       $suggestedOverwriteCliUrl || !OC_Util::isSetLocaleWorking()  ||
        !OC_Util::fileInfoLoaded() || $databaseOverload
 ) {
        $formsAndMore[] = array('anchor' => 'security-warning', 'section-name' => $l->t('Security & Setup Warnings'));
index 1f7eacd746baf9eb73862cc5ae251f2a679a51cd..a82d5ee8545a211f4f14fb86b2eaebeccd367f8b 100644 (file)
@@ -175,20 +175,6 @@ if (!$_['has_fileinfo']) {
 <?php
 }
 
-// is PHP charset set to UTF8?
-if (!$_['isPhpCharSetUtf8']) {
-       ?>
-       <div class="section">
-               <h2><?php p($l->t('PHP charset is not set to UTF-8'));?></h2>
-
-               <span class="connectionwarning">
-               <?php p($l->t("PHP charset is not set to UTF-8. This can cause major issues with non-ASCII characters in file names. We highly recommend to change the value of 'default_charset' php.ini to 'UTF-8'.")); ?>
-       </span>
-
-       </div>
-<?php
-}
-
 // is locale working ?
 if (!$_['isLocaleWorking']) {
        ?>