Beispiel #1
0
/**
 * This file is part of the BaseProject project.
 * 2015 
 * Copyright (c) RENATER
 */
define('APPLICATION_BASE', realpath(dirname(__FILE__) . '/../../'));
// Include classes autoloader
require_once APPLICATION_BASE . '/classes/core/autoload.php';
// Set default timezone
date_default_timezone_set(Config::get('default_timezone'));
// Set encoding
mb_internal_encoding('UTF-8');
if (php_sapi_name() === 'cli') {
    // Command Line Interface
    include APPLICATION_BASE . '/includes/core/init_cli.php';
    Logger::setProcess(ProcessTypes::CLI);
} else {
    // Default, web server
    include APPLICATION_BASE . '/includes/core/init_web.php';
    Logger::setProcess(ProcessTypes::WEB);
}
// Report all errors
ini_set('display_errors', Config::get('debug') ? '1' : '0');
PluginManager::initialize();
if (file_exists(APPLICATION_BASE . '/includes/init.php')) {
    include APPLICATION_BASE . '/includes/init.php';
}
(new Event('init_done'))->trigger();
if (php_sapi_name() !== 'cli' && Auth::isAuthenticated()) {
    Auth::user()->recordActivity();
}
Beispiel #2
0
<?php

/**
 * This file is part of the BaseProject project.
 * 2015 
 * Copyright (c) RENATER
 */
require_once dirname(__FILE__) . '/../../../includes/core/init.php';
Logger::setProcess(ProcessTypes::CRON);
Logger::info('Cron started');
(new Event('cron_started'))->trigger();
Beispiel #3
0
<?php

/**
 * This file is part of the BaseProject project.
 * 2015 
 * Copyright (c) RENATER
 */
require_once '../includes/core/init.php';
Logger::setProcess(ProcessTypes::REST);
RestServer::process();
Beispiel #4
0
<?php

/*
 * This file is part of the ReferentielSI project.
 * 2014 - Renater
 */
include dirname(__FILE__) . '/../includes/init.php';
Logger::setProcess(ProcessTypes::CLI);
/**
 * Create/upgrade Filesender's database
 */
set_error_handler(function ($no, $str, $file = '', $line = '') {
    if ($no == '2048') {
        return;
    }
    Logger::error('[' . $no . '] ' . $str . ' in ' . $file . ' at line ' . $line);
});
// Get data classes
$classes = array();
foreach (scandir(NOTES_BASE . '/classes/model/component/impl') as $i) {
    if (substr($i, -10) != '.class.php') {
        continue;
    }
    $class = substr($i, 0, -10);
    if ($class == 'DBObject') {
        continue;
    }
    $classes[] = $class;
}
try {
    foreach ($classes as $class) {
Beispiel #5
0
<?php

/**
 * This file is part of the BaseProject project.
 * 2015 
 * Copyright (c) RENATER
 */
include dirname(__FILE__) . '/../../includes/core/init.php';
Logger::setProcess(ProcessTypes::UPGRADE);
/**
 * Create/upgrade application's database
 */
set_error_handler(function ($no, $str, $file = '', $line = '') {
    if ($no == '2048') {
        return;
    }
    Logger::error('[' . $no . '] ' . $str . ' in ' . $file . ' at line ' . $line);
});
try {
    DBUpdater::updateModel();
    echo 'Everything went well' . "\n";
    echo 'Database structure is up to date' . "\n";
} catch (Exception $e) {
    $uid = $e instanceof LoggingException ? $e->getUid() : 'no available uid';
    die('Encountered exception : ' . $e->getMessage() . ', see logs for details (uid: ' . $uid . ') ...');
}
Beispiel #6
0
<?php

/**
 * This file is part of the BaseProject project.
 * 2015 
 * Copyright (c) RENATER
 */
try {
    require_once '../includes/core/init.php';
    Logger::setProcess(ProcessTypes::GUI);
    Template::display('!header');
    try {
        // At that point we can render exceptions using nice html
        if (Config::get('maintenance')) {
            Template::display('maintenance');
        } else {
            Template::display('page');
        }
    } catch (Exception $e) {
        Template::display('exception', array('exception' => $e));
    }
    Template::display('!footer');
} catch (Exception $e) {
    // If all exceptions are catched as expected we should not get there
    die('An exception happened : ' . $e->getMessage());
}