Forráskód Böngészése

Change PHP min version

Visman 5 éve
szülő
commit
9a8cc16b5c
4 módosított fájl, 5 hozzáadás és 35 törlés
  1. 2 32
      app/Core/Secury.php
  2. 1 1
      app/Models/Pages/Install.php
  3. 1 1
      composer.json
  4. 1 1
      readme.md

+ 2 - 32
app/Core/Secury.php

@@ -63,36 +63,6 @@ class Secury
         return \hash_hmac($this->hmac['algo'], $data, $key . $this->hmac['salt']);
     }
 
-    /**
-     * Возвращает случайный набор байтов заданной длины
-     *
-     * @param int $len
-     *
-     * @throws RuntimeException
-     *
-     * @return string
-     */
-    public function randomKey(int $len): string
-    {
-        $key = '';
-        if (\function_exists('\\random_bytes')) {
-            $key .= (string) \random_bytes($len);
-        }
-        if (\strlen($key) < $len && \function_exists('\\mcrypt_create_iv')) {
-            $key .= (string) \mcrypt_create_iv($len, \MCRYPT_DEV_URANDOM);
-        }
-        if (\strlen($key) < $len && \function_exists('\\openssl_random_pseudo_bytes')) {
-            $tmp = (string) \openssl_random_pseudo_bytes($len, $strong);
-            if ($strong) {
-                $key .= $tmp;
-            }
-        }
-        if (\strlen($key) < $len) {
-            throw new RuntimeException('Could not gather sufficient random data');
-        }
-        return $key;
-    }
-
     /**
      * Возвращает случайную строку заданной длины состоящую из символов 0-9 и a-f
      *
@@ -102,7 +72,7 @@ class Secury
      */
     public function randomHash(int $len): string
     {
-        return \substr(\bin2hex($this->randomKey($len)), 0, $len);
+        return \substr(\bin2hex(\random_bytes($len)), 0, $len);
     }
 
     /**
@@ -115,7 +85,7 @@ class Secury
      */
     public function randomPass(int $len): string
     {
-        $key = $this->randomKey($len);
+        $key = \random_bytes($len);
         $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
         $result = '';
         for ($i = 0; $i < $len; ++$i) {

+ 1 - 1
app/Models/Pages/Install.php

@@ -10,7 +10,7 @@ use RuntimeException;
 
 class Install extends Page
 {
-    const PHP_MIN = '5.6.12';
+    const PHP_MIN = '7.2.0';
 
     /**
      * Для MySQL

+ 1 - 1
composer.json

@@ -24,7 +24,7 @@
         }
     ],
     "require": {
-        "php": ">=5.6.12",
+        "php": ">=7.2.0",
         "ext-gd": "*",
         "ext-mbstring": "*",
         "artoodetoo/dirk": "dev-visman",

+ 1 - 1
readme.md

@@ -12,7 +12,7 @@ No: moderator functions, private messages, voting, subscriptions, rss, plugins/e
 
 ## Requirements
 
-* PHP 5.6.12+ or 7.x.x
+* PHP 7.2+
 * A database such as MySQL 5.5.3 or later (_Drivers for other databases are not realized now_)
 
 ## Install