HEX
Server: Apache/2.4.25
System: Linux ion14 4.9.0-8-amd64 #1 SMP Debian 4.9.144-3.1 (2019-02-19) x86_64
User: (10087)
PHP: 7.4.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,system, exec, shell_exec, passthru, popen, proc_open
Upload Files
File: /home/www/web115/wordpress/wp-content/plugins/digimember/system/model/data/log.php
<?php

class ncore_LogData extends ncore_BaseData
{
    const log_keep_days = 90;

    public function log( $level, $section, $message_templ, $arg1='', $arg2='', $arg3='', $arg4='', $arg5='', $arg6='' )
    {
        $user_id = ncore_userId();

        if (NCORE_DEBUG) {
            $clean = str_replace( '%%', '', $message_templ );
            $count = substr_count( $clean, '%' );
            if ($count>=4) {
                trigger_error( "Too many placeholders in log message:  $message_templ" );

                $message_templ = sprintf( $message_templ, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6, '', '', '', '', '' );
            }
        }

        $message = sprintf( $message_templ, $arg1, $arg2, $arg3, $arg4, $arg5, $arg6 );

        $data = array(
            'level'   => $level,
            'user_id' => $user_id,
            'section' => $section,
            'message' => $message,
        );

        $this->create( $data );
    }

    public function cronDaily()
    {
        $days = self::log_keep_days;

        $db = $this->db();

        $table = $this->sqlTableName();

        $now = ncore_dbDate();

        $query = $db->query("DELETE FROM `$table`
                             WHERE created < '$now' - INTERVAL $days DAY");
    }

    //
    // protected section
    //
    protected function sqlBaseTableName()
    {
        return 'log';
    }

    protected function sqlTableMeta()
    {
       $columns = array(
            'user_id' => 'id',
            'section' => 'string[15]',
            'message' => 'string[255]',
            'level'   => 'string[7]',
       );

       $indexes = array();

       $meta = array(
        'columns' => $columns,
        'indexes' => $indexes,
       );

       return $meta;
    }

    protected function isUniqueInBlog() {

        return true;
    }

    protected function defaultValues()
    {
        $values = parent::defaultValues();

        $values['level'] = 'info';

        return $values;
    }



}