2022-12-30 21:54:44 +01:00
< ? php
declare ( strict_types = 1 );
2020-01-31 19:29:43 +01:00
2022-07-28 18:04:50 +02:00
if ( PHP_OS_FAMILY === 'Windows' ) {
2022-10-18 14:01:55 +02:00
//echo(PHP_EOL.'========='.PHP_EOL.'WARNING: MadelineProto does not support Windows, please use Linux or another UNIX system (WSLv2 on Windows, Mac OS, BSD, etc).'.PHP_EOL.'========='.PHP_EOL.PHP_EOL);
2022-07-28 18:04:50 +02:00
}
2021-12-15 13:51:01 +01:00
$ampFilePolyfill = 'namespace Amp\\File {' ;
foreach ([
'open' => 'openFile' ,
'stat' => 'getStatus' ,
'lstat' => 'getLinkStatus' ,
'size' => 'getSize' ,
'isdir' => 'isDirectory' ,
'mtime' => 'getModificationTime' ,
'atime' => 'getAccessTime' ,
'ctime' => 'getCreationTime' ,
'symlink' => 'createSymlink' ,
'link' => 'createHardlink' ,
'readlink' => 'resolveSymlink' ,
'rename' => 'move' ,
'unlink' => 'deleteFile' ,
'rmdir' => 'deleteDirectory' ,
'scandir' => 'listFiles' ,
'chmod' => 'changePermissions' ,
'chown' => 'changeOwner' ,
'get' => 'read' ,
'put' => 'write' ,
'mkdir' => 'createDirectory' ,
] as $old => $new ) {
$ampFilePolyfill .= " function $old (... \$ args) { return $new (... \$ args); } " ;
}
$ampFilePolyfill .= " } " ;
eval ( $ampFilePolyfill );
unset ( $ampFilePolyfill );