123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234 |
- <?php
- //----------------------------------------------------------------------------------------------------
- // ZERONEED PHP WEB FRAMEWORK
- //----------------------------------------------------------------------------------------------------
- //
- // Author : Ozan UYKUN <ozanbote@windowslive.com> | <ozanbote@gmail.com>
- // Site : www.znframework.com
- // License : The MIT License
- // Copyright : Copyright (c) 2012-2016, ZN Framework
- //
- //----------------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------------
- // REAL_BASE_DIR
- //----------------------------------------------------------------------------------------------------
- define('REAL_BASE_DIR', realpath(__DIR__).DIRECTORY_SEPARATOR);
- //----------------------------------------------------------------------------------------------------
- // INTERNAL_DIR
- //----------------------------------------------------------------------------------------------------
- //
- // @return Internal/
- //
- //----------------------------------------------------------------------------------------------------
- define('INTERNAL_DIR', 'Internal/');
- //----------------------------------------------------------------------------------------------------
- // CORE_DIR
- //----------------------------------------------------------------------------------------------------
- //
- // @return Internal/Core/
- //
- //----------------------------------------------------------------------------------------------------
- define('CORE_DIR', INTERNAL_DIR.'Core/');
- //----------------------------------------------------------------------------------------------------
- // EXTERNAL_DIR
- //----------------------------------------------------------------------------------------------------
- //
- // @return External/
- //
- //----------------------------------------------------------------------------------------------------
- define('EXTERNAL_DIR', 'External/');
- //----------------------------------------------------------------------------------------------------
- // EXTERNAL_CONFIG_DIR
- //----------------------------------------------------------------------------------------------------
- //
- // @return External/Config/
- //
- //----------------------------------------------------------------------------------------------------
- define('EXTERNAL_CONFIG_DIR', EXTERNAL_DIR.'Config/');
- //----------------------------------------------------------------------------------------------------
- // INTERNAL_CONFIG_DIR
- //----------------------------------------------------------------------------------------------------
- //
- // @return Internal/Config/
- //
- //----------------------------------------------------------------------------------------------------
- define('INTERNAL_CONFIG_DIR', INTERNAL_DIR.'Config/');
- //----------------------------------------------------------------------------------------------------
- // Dahili Uygulama Ayarları
- //----------------------------------------------------------------------------------------------------
- require_once INTERNAL_CONFIG_DIR . 'Application.php';
- //----------------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------------
- // Global Application Variable
- //----------------------------------------------------------------------------------------------------
- global $config;
- $application = $config['Application'];
- //----------------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------------
- // Directory Index
- //----------------------------------------------------------------------------------------------------
- define('DIRECTORY_INDEX', $application['directoryIndex']);
- //----------------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------------
- // Uygulama Türü
- //----------------------------------------------------------------------------------------------------
- define('APPMODE', strtolower($application['mode']));
- //----------------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------------
- // Kullanılabilir Uygulama Seçenekleri
- //----------------------------------------------------------------------------------------------------
- switch( APPMODE )
- {
- //------------------------------------------------------------------------------------------------
- // Publication Yayın Modu
- // Tüm hatalar kapalıdır.
- // Projenin tamamlanmasından sonra bu modun kullanılması önerilir.
- //------------------------------------------------------------------------------------------------
- case 'publication' :
- error_reporting(0);
- break;
- //------------------------------------------------------------------------------------------------
- //------------------------------------------------------------------------------------------------
- // Restoration Onarım Modu
- // Hataların görünümü görecelidir.
- //------------------------------------------------------------------------------------------------
- case 'restoration' :
- //------------------------------------------------------------------------------------------------
- // Development Geliştirme Modu
- // Tüm hatalar açıktır.
- //------------------------------------------------------------------------------------------------
- case 'development' :
- error_reporting(-1);
- break;
- //------------------------------------------------------------------------------------------------
- //------------------------------------------------------------------------------------------------
- // Farklı bir kullanım hatası
- //------------------------------------------------------------------------------------------------
- default: exit('Invalid Application Mode! Available Options: development, restoration or publication');
- //------------------------------------------------------------------------------------------------
- }
- //----------------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------------
- // Ön Yüklenenler
- //----------------------------------------------------------------------------------------------------
- require_once CORE_DIR . 'Preloading.php';
- //----------------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------------
- // Uygulama Dizini
- //----------------------------------------------------------------------------------------------------
- $appdir = $application['directory']['others'];
- if( is_array($appdir) && ! empty($appdir[host()]) )
- {
- $appdir = $appdir[host()];
- }
- elseif( defined('URIAPPDIR') )
- {
- $appdir = URIAPPDIR;
- }
- elseif( is_array($appdir) )
- {
- $appdir = $application['directory']['default'];
- }
- //----------------------------------------------------------------------------------------------------
- // Applications & Restorasyons Directories
- //----------------------------------------------------------------------------------------------------
- define('APPDIR', suffix(APPLICATIONS_DIR.$appdir));
- define('RESDIR', suffix(RESTORATIONS_DIR.$appdir));
- //----------------------------------------------------------------------------------------------------
- if( ! is_dir(APPDIR) )
- {
- exit('"'.$appdir.'" Application Directory Not Found!');
- }
- //----------------------------------------------------------------------------------------------------
- // Benchmarking Test
- //----------------------------------------------------------------------------------------------------
- $benchmark = $application['benchmark'];
- //----------------------------------------------------------------------------------------------------
- if( $benchmark === true )
- {
- //------------------------------------------------------------------------------------------------
- // Sisteminin Açılış Zamanını Hesaplamayı Başlat
- //------------------------------------------------------------------------------------------------
- $start = microtime();
- //------------------------------------------------------------------------------------------------
- }
- //----------------------------------------------------------------------------------------------------
- // Internal Hierarchy -- Internal/Core/Hierarchy.php
- //----------------------------------------------------------------------------------------------------
- require_once HIERARCHY_DIR;
- //----------------------------------------------------------------------------------------------------
- if( $benchmark === true )
- {
- //------------------------------------------------------------------------------------------------
- // Sistemin Açılış Zamanını Hesaplamayı Bitir
- //------------------------------------------------------------------------------------------------
- $finish = microtime();
- //------------------------------------------------------------------------------------------------
- //------------------------------------------------------------------------------------------------
- // System Elapsed Time Calculating
- //------------------------------------------------------------------------------------------------
- $elapsedTime = $finish - $start;
- //------------------------------------------------------------------------------------------------
- //------------------------------------------------------------------------------------------------
- // Sistemin Bellek Kullanımını Hesapla
- //------------------------------------------------------------------------------------------------
- $memoryUsage = memory_get_usage();
- //------------------------------------------------------------------------------------------------
- //------------------------------------------------------------------------------------------------
- // Sistemin Maksimum Bellek Kullanımını Hesapla
- //------------------------------------------------------------------------------------------------
- $maxMemoryUsage = memory_get_peak_usage();
- //------------------------------------------------------------------------------------------------
- //------------------------------------------------------------------------------------------------
- // Benchmark Performans Sonuç Tablosu
- //------------------------------------------------------------------------------------------------
- $benchmarkData =
- [
- 'elapsedTime' => $elapsedTime,
- 'memoryUsage' => $memoryUsage,
- 'maxMemoryUsage' => $maxMemoryUsage
- ];
- $benchResult = Import::template('BenchmarkTable', $benchmarkData, true);
- //------------------------------------------------------------------------------------------------
- //------------------------------------------------------------------------------------------------
- // Benchmark Performans Sonuç Tablosu Yazdırılıyor
- //------------------------------------------------------------------------------------------------
- echo $benchResult;
- //------------------------------------------------------------------------------------------------
- //------------------------------------------------------------------------------------------------
- // Sistem benchmark performans test sonuçlarını raporla.
- //------------------------------------------------------------------------------------------------
- report('Benchmarking Test Result', $benchResult, 'BenchmarkTestResults');
- //------------------------------------------------------------------------------------------------
- }
|