Apply fixes from StyleCI

This commit is contained in:
Daniil Gentili 2018-02-20 11:25:25 +00:00 committed by StyleCI Bot
parent 38e5b6151a
commit e58e99a37a
4 changed files with 15 additions and 8 deletions

View File

@ -12,17 +12,18 @@ If not, see <http://www.gnu.org/licenses/>.
*/
require 'vendor/autoload.php';
use \Spatie\Php7to5\DirectoryConverter;
use Spatie\Php7to5\DirectoryConverter;
function rimraf($dir) {
function rimraf($dir)
{
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (is_dir($dir."/".$object)) {
rimraf($dir."/".$object);
if ($object != '.' && $object != '..') {
if (is_dir($dir.'/'.$object)) {
rimraf($dir.'/'.$object);
} else {
unlink($dir."/".$object);
unlink($dir.'/'.$object);
}
}
}

View File

@ -34,6 +34,7 @@ class API extends APIFactory
$realpaths['lockfile'] = fopen($realpaths['lockfile'], 'r');
\danog\MadelineProto\Logger::log(['Waiting for shared lock of serialization lockfile...']);
flock($realpaths['lockfile'], LOCK_SH);
try {
$unserialized = file_get_contents($realpaths['file']);
} finally {

View File

@ -161,7 +161,9 @@ class Connection
if ($this->parsed['host'][0] === '[') {
$this->parsed['host'] = substr($this->parsed['host'], 1, -1);
}
if ($this->protocol === 'https' && $proxy === '\Socket') $proxy = '\FSocket';
if ($this->protocol === 'https' && $proxy === '\Socket') {
$proxy = '\FSocket';
}
$this->sock = new $proxy($ipv6 ? \AF_INET6 : \AF_INET, \SOCK_STREAM, $this->protocol === 'https' ? PHP_INT_MAX : getprotobyname('tcp'));
if ($has_proxy && $this->extra !== []) {
$this->sock->setExtra($this->extra);

View File

@ -31,10 +31,12 @@ class Serialization
}
}
public static function realpaths($file) {
public static function realpaths($file)
{
if ($file[0] !== '/') {
$file = getcwd().'/'.$file;
}
return ['file' => $file, 'lockfile' => $file.'.lock', 'tempfile' => $file.'.temp.session'];
}
@ -95,6 +97,7 @@ class Serialization
\danog\MadelineProto\Logger::log(['Waiting for shared lock of serialization lockfile...']);
flock($realpaths['lockfile'], LOCK_SH);
try {
$unserialized = file_get_contents($realpaths['file']);
} finally {