From: Thomas Mueller Date: Fri, 14 Jun 2013 08:06:13 +0000 (+0200) Subject: Merge branch 'master' into move-maint-start X-Git-Tag: v6.0.0alpha2~634^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c8564c07955ead3e85daa67e1871a2c41df3a6d5;p=nextcloud-server.git Merge branch 'master' into move-maint-start Conflicts: lib/util.php --- c8564c07955ead3e85daa67e1871a2c41df3a6d5 diff --cc lib/util.php index a7ed0379294,95af22ed0ee..ddef0c63c55 --- a/lib/util.php +++ b/lib/util.php @@@ -822,24 -832,21 +832,41 @@@ class OC_Util return $theme; } + /** + * Clear the opcode cache if one exists + * This is necessary for writing to the config file + * in case the opcode cache doesn't revalidate files + */ + public static function clearOpcodeCache() { + // APC + if (function_exists('apc_clear_cache')) { + apc_clear_cache(); + } + // Zend Opcache + if (function_exists('accelerator_reset')) { + accelerator_reset(); + } + // XCache + if (function_exists('xcache_clear_cache')) { + xcache_clear_cache(XC_TYPE_VAR, 0); + } + } + + /** + * Normalize a unicode string + * @param string $value a not normalized string + * @return bool|string + */ + public static function normalizeUnicode($value) { + if(class_exists('Patchwork\PHP\Shim\Normalizer')) { + $normalizedValue = \Patchwork\PHP\Shim\Normalizer::normalize($value); + if($normalizedValue === false) { + \OC_Log::write( 'core', 'normalizing failed for "' . $value . '"', \OC_Log::WARN); + } else { + $value = $normalizedValue; + } + } + + return $value; + } }