From dffa922c0b3c84394b955caeabac004381e604ac Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Sat, 13 Jan 2018 19:41:34 +0100 Subject: [PATCH] Remove deprecated functions for OCP\Util Signed-off-by: Roeland Jago Douma --- apps/files_external/lib/config.php | 2 +- apps/user_ldap/tests/Group_LDAPTest.php | 2 +- lib/public/Util.php | 26 ------------------------- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index 13960dde68457..ae04daf4f3158 100644 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -361,7 +361,7 @@ public static function decryptPasswords($options) { */ private static function encryptPassword($password) { $cipher = self::getCipher(); - $iv = \OCP\Util::generateRandomBytes(16); + $iv = \OC::$server->getSecureRandom()->generate(16); $cipher->setIV($iv); return base64_encode($iv . $cipher->encrypt($password)); } diff --git a/apps/user_ldap/tests/Group_LDAPTest.php b/apps/user_ldap/tests/Group_LDAPTest.php index e758bc9bd02c4..03fd73f261fc3 100644 --- a/apps/user_ldap/tests/Group_LDAPTest.php +++ b/apps/user_ldap/tests/Group_LDAPTest.php @@ -150,7 +150,7 @@ public function testCountWithSearchString() { $access->expects($this->any()) ->method('dn2username') ->will($this->returnCallback(function() { - return 'foobar' . \OCP\Util::generateRandomBytes(7); + return 'foobar' . \OC::$server->getSecureRandom()->generate(7); })); $groupBackend = new GroupLDAP($access,$pluginManager); diff --git a/lib/public/Util.php b/lib/public/Util.php index 5127beaf50509..2fb6bdf491dfd 100644 --- a/lib/public/Util.php +++ b/lib/public/Util.php @@ -244,21 +244,6 @@ public static function addHeader($tag, $attributes, $text=null) { \OC_Util::addHeader($tag, $attributes, $text); } - /** - * formats a timestamp in the "right" way - * @param int $timestamp $timestamp - * @param bool $dateOnly option to omit time from the result - * @param DateTimeZone|string $timeZone where the given timestamp shall be converted to - * @return string timestamp - * - * @deprecated 8.0.0 Use \OC::$server->query('DateTimeFormatter') instead - * @since 4.0.0 - * @suppress PhanDeprecatedFunction - */ - public static function formatDate($timestamp, $dateOnly=false, $timeZone = null) { - return \OC_Util::formatDate($timestamp, $dateOnly, $timeZone); - } - /** * check if some encrypted files are stored * @return bool @@ -656,17 +641,6 @@ public static function isValidFileName($file) { return \OC_Util::isValidFileName($file); } - /** - * Generates a cryptographic secure pseudo-random string - * @param int $length of the random string - * @return string - * @deprecated 8.0.0 Use \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate($length); instead - * @since 7.0.0 - */ - public static function generateRandomBytes($length = 30) { - return \OC::$server->getSecureRandom()->generate($length, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); - } - /** * Compare two strings to provide a natural sort * @param string $a first string to compare