/** * 初期化.最初に呼び出してください. * * @param array $options */ public static function __init($options = array()) { $propfile = $options[0]; Logger::configure(LIBRARY_PATH . '/etc/' . $propfile); // === MDC (_mapped diagnostic contexts_) 設定 // ※ log4php.appender.{appender_name}.layout.conversionPattern で、'%X{ADDR}' のようにして参照可能 // http://logging.apache.org/log4php/apidocs/class-LoggerMDC.html LoggerMDC::put('ADDR', isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '-'); LoggerMDC::put('HOST', isset($_SERVER['REMOTE_HOST']) ? $_SERVER['REMOTE_HOST'] : '-'); // === ロガー取得 self::$default_logger = Logger::getLogger('DefaultLogger'); self::$initialized = true; }
public function testLoggerMDC() { $logger = new Logger("testLogger"); $layout = new LoggerLayoutSimple(); $this->assertEquals('testLogger [INFO] - test message' . PHP_EOL, $layout->formatMessage($logger, Logger::INFO, "test message")); LoggerMDC::put("foo", "bar"); $this->assertEquals('testLogger [INFO] foo=bar - test message' . PHP_EOL, $layout->formatMessage($logger, Logger::INFO, "test message")); LoggerMDC::put("zip", "tar"); $this->assertEquals('testLogger [INFO] foo=bar zip=tar - test message' . PHP_EOL, $layout->formatMessage($logger, Logger::INFO, "test message")); LoggerMDC::remove("foo"); $this->assertEquals('testLogger [INFO] zip=tar - test message' . PHP_EOL, $layout->formatMessage($logger, Logger::INFO, "test message")); LoggerMDC::remove("zip"); $this->assertEquals('testLogger [INFO] - test message' . PHP_EOL, $layout->formatMessage($logger, Logger::INFO, "test message")); }
public function testMDC() { LoggerMDC::put('foo', 'bar'); LoggerMDC::put('bla', 'tra'); $event = LoggerTestHelper::getErrorEvent("testmessage"); $layout = new LoggerLayoutXml(); $layout->activateOptions(); $actual = $layout->format($event); $thread = $event->getThreadName(); $timestamp = number_format($event->getTimeStamp() * 1000, 0, '', ''); $expected = "<log4php:event logger=\"test\" level=\"ERROR\" thread=\"{$thread}\" timestamp=\"{$timestamp}\">" . PHP_EOL . "<log4php:message><![CDATA[testmessage]]></log4php:message>" . PHP_EOL . "<log4php:properties>" . PHP_EOL . "<log4php:data name=\"foo\" value=\"bar\" />" . PHP_EOL . "<log4php:data name=\"bla\" value=\"tra\" />" . PHP_EOL . "</log4php:properties>" . PHP_EOL . "<log4php:locationInfo class=\"LoggerLoggingEvent\" file=\"NA\" line=\"NA\" " . "method=\"getLocationInformation\" />" . PHP_EOL . "</log4php:event>" . PHP_EOL; self::assertEquals($expected, $actual); LoggerMDC::clear(); }
public function testLoggerMDC() { LoggerMDC::clear(); $layout = new LoggerLayoutPattern('{mdc}'); $message = $layout->formatMessage(new Logger("root"), Logger::INFO, ''); $this->assertEquals('' . PHP_EOL, $message); LoggerMDC::put('foo', 'bar'); $message = $layout->formatMessage(new Logger("root"), Logger::INFO, ''); $this->assertEquals('foo=bar' . PHP_EOL, $message); LoggerMDC::clear(); $layout = new LoggerLayoutPattern('{mdc:foo}'); $message = $layout->formatMessage(new Logger("root"), Logger::INFO, ''); $this->assertEquals('null' . PHP_EOL, $message); LoggerMDC::put('foo', 'bar'); $message = $layout->formatMessage(new Logger("root"), Logger::INFO, ''); $this->assertEquals('bar' . PHP_EOL, $message); }
public function testErrorLayout() { $message = "some-error-message"; $validMDCField = "mdc1"; $invalidMDCField = "%"; LoggerMDC::put($validMDCField, 1); LoggerMDC::put($invalidMDCField, 1); $event = LoggerTestHelper::getErrorEvent($message); $layout = new LoggerLayoutGelf(); $layout->activateOptions(); $layout->setLocationInfo(true); $actual = $layout->format($event); $encodedMessage = json_decode($actual, 1); // Is message a valid json $this->assertNotNull($encodedMessage); // Check basic fields $this->assertNotEmpty($encodedMessage["version"]); $this->assertNotEmpty($encodedMessage["host"]); $this->assertNotEmpty($encodedMessage["short_message"]); $this->assertNotEmpty($encodedMessage["full_message"]); $this->assertNotEmpty($encodedMessage["timestamp"]); $this->assertNotEmpty($encodedMessage["level"]); // Check additional fields $this->assertNotEmpty($encodedMessage["_facility"]); $this->assertNotEmpty($encodedMessage["_thread"]); // Check additional location fields $this->assertNotEmpty($encodedMessage["_file"]); $this->assertNotEmpty($encodedMessage["_line"]); $this->assertNotEmpty($encodedMessage["_class"]); $this->assertNotEmpty($encodedMessage["_method"]); $this->assertInternalType("string", $encodedMessage["version"]); $this->assertInternalType("string", $encodedMessage["host"]); $this->assertInternalType("string", $encodedMessage["short_message"]); $this->assertInternalType("string", $encodedMessage["full_message"]); $this->assertInternalType("float", $encodedMessage["timestamp"]); $this->assertInternalType("integer", $encodedMessage["level"]); $this->assertArrayHasKey("_" . $validMDCField, $encodedMessage); $this->assertArrayNotHasKey("_" . $invalidMDCField, $encodedMessage); LoggerMDC::clear(); }
public function getLogger($payment) { \TPLogger::configure($this->config); if ($this->php_version != null) { \LoggerMDC::put('php_version', $this->php_version); } else { throw new \Exception("Logger Configuracion incompleta"); } if ($this->commerce_version != null) { \LoggerMDC::put('commerce_version', $this->commerce_version); } else { throw new \Exception("Logger Configuracion incompleta"); } if ($this->plugin_version != null) { \LoggerMDC::put('plugin_version', $this->plugin_version); } else { throw new \Exception("Logger Configuracion incompleta"); } if ($payment) { if ($this->end_point != null) { \LoggerMDC::put('end_point', $this->end_point); } else { throw new \Exception("Logger Configuracion incompleta"); } if ($this->customer != null) { \LoggerMDC::put('customer', $this->customer); } else { throw new \Exception("Logger Configuracion incompleta"); } if ($this->order != null) { \LoggerMDC::put('order', $this->order); } else { throw new \Exception("Logger Configuracion incompleta"); } } if ($payment) { return \TPLogger::getLogger("todopagopayment"); } return \TPLogger::getLogger("todopagoadmin"); }
public function testPatterns() { // Create some data to test with LoggerMDC::put('key1', 'valueofkey1'); LoggerMDC::put('key2', 'valueofkey2'); LoggerMDC::put(3, 'valueofkey3'); $expected = array('key1' => 'valueofkey1', 'key2' => 'valueofkey2', 3 => 'valueofkey3'); $actual = LoggerMDC::getMap(); self::assertSame($expected, $actual); $event = LoggerTestHelper::getInfoEvent("Test message"); // Pattern with 1 key $actual = $this->formatEvent($event, $this->pattern1); $expected = "INFO test: valueofkey1 Test message"; self::assertEquals($expected, $actual); // Pattern with 2 keys $actual = $this->formatEvent($event, $this->pattern2); $expected = "INFO test: valueofkey1 valueofkey2 Test message"; self::assertEquals($expected, $actual); // Pattern with 3 keys (one numeric) $actual = $this->formatEvent($event, $this->pattern3); $expected = "INFO test: valueofkey1 valueofkey2 valueofkey3 Test message"; self::assertEquals($expected, $actual); // Pattern with non-existant key $actual = $this->formatEvent($event, $this->pattern4); $expected = "INFO test: Test message"; self::assertEquals($expected, $actual); // Pattern with an empty key $actual = $this->formatEvent($event, $this->pattern5); $expected = "INFO test: key1=valueofkey1, key2=valueofkey2, 3=valueofkey3 Test message"; self::assertEquals($expected, $actual); // Test key removal LoggerMDC::remove('key1'); $value = LoggerMDC::get('key1'); self::assertEquals('', $value); // Pattern with 1 key, now removed $actual = $this->formatEvent($event, $this->pattern1); $expected = "INFO test: Test message"; self::assertEquals($expected, $actual); }
public function testMDC() { LoggerMDC::put('foo', 'bar'); LoggerMDC::put('bla', 'tra'); // Entire context $converter = new LoggerPatternConverterMDC($this->info); $actual = $converter->convert($this->event); $expected = 'foo=bar, bla=tra'; self::assertSame($expected, $actual); // Just foo $converter = new LoggerPatternConverterMDC($this->info, 'foo'); $actual = $converter->convert($this->event); $expected = 'bar'; self::assertSame($expected, $actual); // Non existant key $converter = new LoggerPatternConverterMDC($this->info, 'doesnotexist'); $actual = $converter->convert($this->event); $expected = ''; self::assertSame($expected, $actual); LoggerMDC::clear(); }
/** * Метод создания нового типа услуги * * @author Ермашевский Денис * @return array $data; */ function add_service() { $this->form_validation->set_rules('service_description', 'service_description', 'required|xss_clean'); $this->form_validation->set_rules('marker', 'marker', 'required|xss_clean'); if ($this->form_validation->run() === TRUE) { //check to see if we are creating the user //redirect them back to the admin page $this->session->set_flashdata('message', 'Group Created'); $data['service_description'] = $_POST['service_description']; $data['marker'] = $_POST['marker']; $user = $this->ion_auth->user()->row(); $mdc = new LoggerMDC(); $mdc->put('username', $user->username); $this->log->info('Пользователь создал услугу: ' . $data['service_description']); $this->log->info($data); $this->load->model('services_model'); $this->services_model->add_service($data); redirect('services/getAllServices', 'refresh'); } else { $this->data['message'] = validation_errors() ? validation_errors() : $this->session->flashdata('message'); $this->data['service_description'] = array('name' => 'service_description', 'value' => $this->form_validation->set_value('service_description')); $this->data['marker'] = array('name' => 'marker', 'value' => $this->form_validation->set_value('marker')); } }
function setupLogging() { global $default; $oKTConfig =& KTConfig::getSingleton(); if (!defined('APP_NAME')) { define('APP_NAME', $oKTConfig->get('ui/appName', 'KnowledgeTree')); } define('KT_LOG4PHP_DIR', KT_DIR . '/thirdparty/apache-log4php/src/main/php' . DIRECTORY_SEPARATOR); define('LOG4PHP_CONFIGURATION', KT_DIR . '/config/ktlog.ini'); define('LOG4PHP_DEFAULT_INIT_OVERRIDE', true); require_once KT_LOG4PHP_DIR . 'LoggerManager.php'; require_once KT_LOG4PHP_DIR . 'LoggerPropertyConfigurator.php'; $configurator = new LoggerPropertyConfigurator(); $repository = LoggerManager::getLoggerRepository(); $properties = @parse_ini_file(LOG4PHP_CONFIGURATION); $properties['log4php.appender.default'] = 'LoggerAppenderDailyFile'; $properties['log4php.appender.default.layout'] = 'LoggerPatternLayout'; $properties['log4php.appender.default.layout.conversionPattern'] = '%d{Y-m-d | H:i:s} | %p | %t | %r | %X{userid} | %X{db} | %c | %M | %m%n'; $properties['log4php.appender.default.datePattern'] = 'Y-m-d'; $logDir = $oKTConfig->get('urls/logDirectory'); $properties['log4php.appender.default.file'] = $logDir . '/kt%s.' . KTUtil::running_user() . '.log.txt'; // get the log level set in the configuration settings to override the level set in ktlog.ini // for the default / main logging. Additional logging can be configured through the ini file $logLevel = $oKTConfig->get('KnowledgeTree/logLevel'); $properties['log4php.rootLogger'] = $logLevel . ', default'; session_start(); $configurator->doConfigureProperties($properties, $repository); $userId = isset($_SESSION['userID']) ? $_SESSION['userID'] : 'n/a'; LoggerMDC::put('userid', $userId); LoggerMDC::put('db', $oKTConfig->get('db/dbName')); $default->log = LoggerManager::getLogger('default'); $default->queryLog = LoggerManager::getLogger('sql'); $default->timerLog = LoggerManager::getLogger('timer'); $default->phpErrorLog = LoggerManager::getLogger('php'); }
/** * Метод добавления ЛС клиентам * * @author Ермашевский Денис * @return array $data; */ function add_client_account_item2() { $data['id_client'] = (int) trim($this->input->post('id_client')); $data['client_name'] = trim($this->input->post('client_name')); $data['account'] = trim($this->input->post('client_account')); $data['id_service'] = (int) trim($this->input->post('selected')); $user = $this->ion_auth->user()->row(); $mdc = new LoggerMDC(); $mdc->put('username', $user->username); $this->log->info('Пользователь добавил клиенту ' . $data['client_name'] . ' произвольный ЛС: ' . $data['account']); $this->load->model('clients_model'); $data = $this->clients_model->add_client_account_item2($data); return; }
<?php /** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // START SNIPPET: doxia require_once dirname(__FILE__) . '/../../main/php/Logger.php'; Logger::configure(dirname(__FILE__) . '/../resources/mdc.properties'); LoggerMDC::put('username', 'knut'); $logger = Logger::getRootLogger(); $logger->debug("Testing MDC");
/** * Метод добавления новой номенклатуры * * @author Ермашевский Денис * @return array $data; */ function add_assortment() { $this->data['title'] = 'Создание новой номеклатуры'; if (!$this->ion_auth->logged_in() or !$this->ion_auth->is_admin()) { redirect('auth', 'refresh'); } //validate form input $this->form_validation->set_rules('assortment_name', 'Assortment name', 'required|xss_clean'); $this->form_validation->set_rules('serviceType', 'Service Type', 'required|xss_clean'); $this->form_validation->set_rules('paymentType', 'Payment Type', 'required|xss_clean'); //$this->form_validation->set_rules('name_element', 'Name element', 'required|xss_clean'); $this->form_validation->set_rules('element_form', 'Element form', 'required|xss_clean'); $this->form_validation->set_rules('type_resources', 'Type resources', 'required|xss_clean'); $this->form_validation->set_rules('tariff', 'Tariff', 'required|xss_clean'); if ($this->form_validation->run() === TRUE) { //check to see if we are creating the user //redirect them back to the admin page $this->session->set_flashdata('message', 'Номенклатура добавлена'); $data['assortment_name'] = $_POST['assortment_name']; $data['serviceType'] = $_POST['serviceType']; $data['paymentType'] = $_POST['paymentType']; $data['name_element'] = $_POST['name_element']; $data['element_form'] = $_POST['element_form']; $data['default_element_value'] = $_POST['default_element_value']; $data['datasource'] = $_POST['datasource']; $data['type_resources'] = $_POST['type_resources']; $data['tariff'] = $_POST['tariff']; $user = $this->ion_auth->user()->row(); $mdc = new LoggerMDC(); $mdc->put('username', $user->username); $this->log->info('Пользователь создал номенклатуру: ' . $data['assortment_name']); $this->log->info($data); $this->load->model('services_model'); $this->services_model->create_assortment_item($data); redirect('services/assortmentList', 'refresh'); } else { //display the create user form //set the flash data error message if there is one $this->data['message'] = validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')); $this->data['assortment_name'] = array('name' => 'assortment_name', 'id' => 'assortment_name', 'type' => 'text', 'value' => $this->form_validation->set_value('assortment_name')); $this->data['serviceType'] = array('name' => 'serviceType', 'id' => 'serviceType', 'type' => 'text', 'value' => $this->form_validation->set_value('serviceType')); $this->data['paymentType'] = array('name' => 'paymentType', 'id' => 'paymentType', 'type' => 'text', 'value' => $this->form_validation->set_value('paymentType')); $this->data['tariffList'] = array('name' => 'tariffList', 'id' => 'tariffList', 'type' => 'text', 'value' => $this->form_validation->set_value('tariffList')); $this->data['label_element'] = array('name' => 'label_element', 'id' => 'label_element', 'type' => 'text', 'value' => $this->form_validation->set_value('label_element')); $this->data['name_element'] = array('name' => 'name_element', 'id' => 'name_element', 'type' => 'text', 'value' => $this->form_validation->set_value('name_element')); $this->data['element_form'] = array('name' => 'element_form', 'id' => 'element_form', 'type' => 'text', 'value' => $this->form_validation->set_value('element_form')); $this->data['types_elements'] = array('name' => 'types_elements', 'id' => 'types_elements', 'type' => 'text', 'value' => $this->form_validation->set_value('types_elements')); $this->data['datasource'] = array('name' => 'datasource', 'id' => 'datasource', 'type' => 'text', 'value' => $this->form_validation->set_value('datasource')); $this->data['default_element_value'] = array('name' => 'default_element_value', 'id' => 'default_element_value', 'type' => 'text', 'value' => $this->form_validation->set_value('default_element_value')); $this->data['type_resources'] = array('name' => 'type_resources', 'id' => 'type_resources', 'type' => 'text', 'value' => $this->form_validation->set_value('type_resources')); $this->data['tariff'] = array('name' => 'tariff', 'id' => 'tariff', 'type' => 'text', 'value' => $this->form_validation->set_value('tariff')); $this->load->view('header'); $this->load->view('auth/add_assortment', $this->data); $this->load->view('left_sidebar'); // $this->load->view('auth/footer'); } }
function copyAccount2Account($old_id_account, $id_client, $newCopyAccount, $close_date, $open_date) { $this->db->select('*'); $this->db->from('customer_service'); $this->db->where('id_account', $old_id_account); $date = new DateTime($open_date); $formatted_open_date = $date->format('Y-m-d'); $client = $this->db->get(); $accountList = array(); if (0 < $client->num_rows) { foreach ($client->result() as $info) { $info->id; $new_uniq_id = md5($info->uniq_id); $info->payment_name; $info->resources; $info->identifier; $info->name; $info->tariffs; $info->datepicker1; $info->end_date; $info->period; $data = array('uniq_id' => $new_uniq_id, 'id_account' => $newCopyAccount, 'payment_name' => $info->payment_name, 'resources' => $info->resources, 'identifier' => $info->identifier, 'tariffs' => $info->tariffs, 'datepicker1' => $formatted_open_date, 'period' => 'month'); $this->db->insert('customer_service', $data); $user = $this->ion_auth->user()->row(); $mdc = new LoggerMDC(); $mdc->put('username', $user->username); $this->log->warn('Пользователь скопировал номенклатуру ' . $info->payment_name . ' на лицевой счет с ID=' . $newCopyAccount . ' клиента с id=' . $id_client . ' указав дату начала ' . $open_date); $this->log->warn($data); if ($this->db->affected_rows() == 1) { $date = new DateTime($close_date); $formatted_close_date = $date->format('Y-m-d'); if ($info->end_date == '') { $data = array('end_date' => $formatted_close_date); $this->db->where('id', $info->id); $this->db->where('uniq_id', $info->uniq_id); $this->db->update('customer_service', $data); $this->log->warn('Пользователь при копировании номенклатур указал дату окончания ' . $close_date . ' на номенклатуре ' . $info->payment_name . ' на лицевом счете с ID=' . $old_id_account); } } } } return 'Процесс копирования номенклатур успешно завершен.'; }
/** * Метод поиска номеклатуры в группе IP/SIP * * @author Ермашевский Денис * @return array $data; */ function searchAssortmentIDIP() { $identifier = trim($this->input->post('identifier')); $assortment = trim($this->input->post('assortment')); $amount = trim($this->input->post('amount')); $date = trim($this->input->post('date')); $this->load->model('services_model'); $data = $this->services_model->searchAssortmentIDIP($identifier, $assortment, $amount, $date); $mdc = new LoggerMDC(); // if(isset($data['error'])) // { // echo $data['error']; // }else{ // echo "========>" . $data; // } if (isset($data['error'])) { $mdc->put('username', 'TK_PaymentRobot'); $this->log->fatal($data['error']); } else { echo json_encode($data); } }
function setEndDateForCustomerAssortments() { $id = $this->input->post('id'); $new_date = $this->input->post('new_date'); $uniq_id = $this->input->post('uniq_id'); $id_account = $this->input->post('id_account'); $payment_name = $this->input->post('payment_name'); $resources = $this->input->post('resources'); $identifier = $this->input->post('identifier'); $tariffs = $this->input->post('new_tariff'); $period = $this->input->post('period'); $date = new DateTime($new_date); $date->modify('-1 day'); $modify_end_date = $date->format('Y-m-d'); $user = $this->ion_auth->user()->row(); $mdc = new LoggerMDC(); $mdc->put('username', $user->username); $this->load->model('admin_model'); $this->admin_model->updateEndDateForCustomerAssortments($id, $modify_end_date); $this->log->warn('Пользователь произвел смену тарифа на номеклатуре. Дата окончания действия тарифа ' . $modify_end_date . ' у записи c ID ' . $id); $this->admin_model->insertRow($uniq_id, $id_account, $payment_name, $resources, $identifier, $tariffs, $new_date, $period); $this->log->info('Пользователь установил новый тариф на номеклатуре. Дата начала действия тарифа ' . $new_date . ' на номеклатуре ' . $payment_name . ' ID лицевого счета: ' . $id_account . ' ID нового тарифа:' . $tariffs); }
function addAdjustAmount() { $id_account = trim($this->input->post('id_account')); $date = trim($this->input->post('date')); $amount = trim($this->input->post('amount')); $id_client = trim($this->input->post('id_client')); $comment = $this->input->post('comment'); $user = $this->ion_auth->user()->row(); $mdc = new LoggerMDC(); $mdc->put('username', $user->username); $mdc->put('amount', 'Cумма: ' . $amount); $mdc->put('id_account', 'ID лицевого счета : ' . $id_account); $mdc->put('date', 'Дата оплаты: ' . $date); $this->log->info('Пользователь добавил сумму корректировки на ЛС '); $this->load->model('money_model'); $data = $this->money_model->addAdjustAmount($id_account, $date, $amount, $id_client, $comment); }
if (!defined('ADDRESSES')) { define('ADDRESSES', WORK_DIR . "/addresses"); } if (!defined('PASSWORDS')) { define('PASSWORDS', WORK_DIR . "/passwords"); } if (!defined('TESTS')) { define('TESTS', WORK_DIR . "/tests"); } //////////////////////////////////////////////////////////////////////////////// @(require_once INST_DIR . '/res/backend/lib/utilities.incl.php'); @(require_once INST_DIR . '/res/backend/lib/sessionDestroy.incl.php'); @(require_once INST_DIR . '/res/backend/lib/HttpCodes.incl.php'); include_once INST_DIR . '/res/backend/lib/apache-log4php-2.3.0/Logger.php'; // Passing the configurator as string LoggerMDC::put('sessionid', session_id()); Logger::configure(array('rootLogger' => array('appenders' => array('default')), 'appenders' => array('default' => array('class' => 'LoggerAppenderDailyFile', 'layout' => array('class' => 'LoggerLayoutPattern', 'params' => array('conversionPattern' => '%date{Y-m-d H:i:s,u} [%server{REMOTE_ADDR}] %p %c %x - %m%n')), 'params' => array('datePattern' => 'Y-m-d', 'file' => __DIR__ . '/logs/pdadmin_%s.log'))))); $logger = Logger::getLogger(basename(__FILE__)); $params = @explode("/", @substr(@$_SERVER['PATH_INFO'], 1)); $isDefault = false; if ($params && count($params) > 0 && strlen($params[0]) > 0) { $filename = $params[0]; } else { $filename = 'index'; $isDefault = true; } $incl = sprintf("%s/res/backend/%s.incl.php", __DIR__, $filename); $httpMethod = @constant("HTTP_" . @strtoupper(@$_SERVER['REQUEST_METHOD'])); if (!file_exists($incl)) { $incl = sprintf("%s/views/%s/%s.incl.php", __DIR__, $filename, $filename); if (!file_exists($incl)) {