Kaynağa Gözat

fixed DBG error log

Piotr Labudda 8 yıl önce
ebeveyn
işleme
07ba1bb406
1 değiştirilmiş dosya ile 7 ekleme ve 1 silme
  1. 7 1
      SE/se-lib/DBG.php

+ 7 - 1
SE/se-lib/DBG.php

@@ -361,6 +361,12 @@ class DBG {
 	}
 
 	public static function isLogActiveByAdmin() {
+		static $_isLogActiveByAdmin = null;
+		if (null !== $_isLogActiveByAdmin) return $_isLogActiveByAdmin;
+		$_isLogActiveByAdmin = self::_isLogActiveByAdmin();
+		return $_isLogActiveByAdmin;
+	}
+	public static function _isLogActiveByAdmin() {
 		if (!User::logged()) return false;
 		if (!User::getID()) return false;
 		return self::hasUserDebug(User::getID());
@@ -368,7 +374,7 @@ class DBG {
 	public static function hasUserDebug($idUser, $idAdmin = null) {
 		$prefix = ('production' == V::get('P5_ENV', 'production', $_SERVER)) ? "" : "dev-";
 		if (!$idAdmin) {
-			$output = (int)@shell_exec("ls -1 /tmp/{$prefix}se-user_debug-{$idUser}-by_admin-*.log | wc -l");
+			$output = (int)@shell_exec("ls -1 /tmp/{$prefix}se-user_debug-{$idUser}-by_admin-*.log 2>/dev/null | wc -l");
 			return $output > 0;
 		}
 		return file_exists("/tmp/{$prefix}se-user_debug-{$idUser}-by_admin-{$idAdmin}.log");