!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.2.22 (Debian). PHP/5.6.36 

uname -a: Linux h05.hvosting.ua 4.9.110-amd64 #3 SMP Sun Nov 4 16:27:09 UTC 2018 x86_64 

uid=1389(h33678) gid=1099(h33678) groups=1099(h33678),502(mgrsecure) 

Safe-mode: OFF (not secure)

/home/h33678/data/www/it-man.ztu.edu.ua/src/vendor/monolog/monolog/src/Monolog/Handler/   drwxr-xr-x
Free 116.86 GB of 200.55 GB (58.27%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     RotatingFileHandler.php (5.45 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

/*
 * This file is part of the Monolog package.
 *
 * (c) Jordi Boggiano <j.boggiano@seld.be>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Monolog\Handler;

use 
Monolog\Logger;

/**
 * Stores logs to files that are rotated every day and a limited number of files are kept.
 *
 * This rotation is only intended to be used as a workaround. Using logrotate to
 * handle the rotation is strongly encouraged when you can use it.
 *
 * @author Christophe Coevoet <stof@notk.org>
 * @author Jordi Boggiano <j.boggiano@seld.be>
 */
class RotatingFileHandler extends StreamHandler
{
    const 
FILE_PER_DAY 'Y-m-d';
    const 
FILE_PER_MONTH 'Y-m';
    const 
FILE_PER_YEAR 'Y';

    protected 
$filename;
    protected 
$maxFiles;
    protected 
$mustRotate;
    protected 
$nextRotation;
    protected 
$filenameFormat;
    protected 
$dateFormat;

    
/**
     * @param string   $filename
     * @param int      $maxFiles       The maximal amount of files to keep (0 means unlimited)
     * @param int      $level          The minimum logging level at which this handler will be triggered
     * @param Boolean  $bubble         Whether the messages that are handled can bubble up the stack or not
     * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write)
     * @param Boolean  $useLocking     Try to lock log file before doing any writes
     */
    
public function __construct($filename$maxFiles 0$level Logger::DEBUG$bubble true$filePermission null$useLocking false)
    {
        
$this->filename $filename;
        
$this->maxFiles = (int) $maxFiles;
        
$this->nextRotation = new \DateTime('tomorrow');
        
$this->filenameFormat '{filename}-{date}';
        
$this->dateFormat 'Y-m-d';

        
parent::__construct($this->getTimedFilename(), $level$bubble$filePermission$useLocking);
    }

    
/**
     * {@inheritdoc}
     */
    
public function close()
    {
        
parent::close();

        if (
true === $this->mustRotate) {
            
$this->rotate();
        }
    }

    public function 
setFilenameFormat($filenameFormat$dateFormat)
    {
        if (!
in_array($dateFormat, array(self::FILE_PER_DAYself::FILE_PER_MONTHself::FILE_PER_YEAR))) {
            
trigger_error(
                
'Invalid date format - format should be one of '.
                
'RotatingFileHandler::FILE_PER_DAY, RotatingFileHandler::FILE_PER_MONTH '.
                
'or RotatingFileHandler::FILE_PER_YEAR.',
                
E_USER_DEPRECATED
            
);
        }
        if (
substr_count($filenameFormat'{date}') === 0) {
            
trigger_error(
                
'Invalid filename format - format should contain at least `{date}`, because otherwise rotating is impossible.',
                
E_USER_DEPRECATED
            
);
        }
        
$this->filenameFormat $filenameFormat;
        
$this->dateFormat $dateFormat;
        
$this->url $this->getTimedFilename();
        
$this->close();
    }

    
/**
     * {@inheritdoc}
     */
    
protected function write(array $record)
    {
        
// on the first record written, if the log is new, we should rotate (once per day)
        
if (null === $this->mustRotate) {
            
$this->mustRotate = !file_exists($this->url);
        }

        if (
$this->nextRotation $record['datetime']) {
            
$this->mustRotate true;
            
$this->close();
        }

        
parent::write($record);
    }

    
/**
     * Rotates the files.
     */
    
protected function rotate()
    {
        
// update filename
        
$this->url $this->getTimedFilename();
        
$this->nextRotation = new \DateTime('tomorrow');

        
// skip GC of old logs if files are unlimited
        
if (=== $this->maxFiles) {
            return;
        }

        
$logFiles glob($this->getGlobPattern());
        if (
$this->maxFiles >= count($logFiles)) {
            
// no files to remove
            
return;
        }

        
// Sorting the files by name to remove the older ones
        
usort($logFiles, function ($a$b) {
            return 
strcmp($b$a);
        });

        foreach (
array_slice($logFiles$this->maxFiles) as $file) {
            if (
is_writable($file)) {
                
// suppress errors here as unlink() might fail if two processes
                // are cleaning up/rotating at the same time
                
set_error_handler(function ($errno$errstr$errfile$errline) {});
                
unlink($file);
                
restore_error_handler();
            }
        }

        
$this->mustRotate false;
    }

    protected function 
getTimedFilename()
    {
        
$fileInfo pathinfo($this->filename);
        
$timedFilename str_replace(
            array(
'{filename}''{date}'),
            array(
$fileInfo['filename'], date($this->dateFormat)),
            
$fileInfo['dirname'] . '/' $this->filenameFormat
        
);

        if (!empty(
$fileInfo['extension'])) {
            
$timedFilename .= '.'.$fileInfo['extension'];
        }

        return 
$timedFilename;
    }

    protected function 
getGlobPattern()
    {
        
$fileInfo pathinfo($this->filename);
        
$glob str_replace(
            array(
'{filename}''{date}'),
            array(
$fileInfo['filename'], '*'),
            
$fileInfo['dirname'] . '/' $this->filenameFormat
        
);
        if (!empty(
$fileInfo['extension'])) {
            
$glob .= '.'.$fileInfo['extension'];
        }

        return 
$glob;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by PinoyWH1Z | C99Shell Github | Generation time: 0.0397 ]--