forked from mirzaev/deeproots_bot
read database util and file cleanup
This commit is contained in:
parent
d867d640a4
commit
ced4e3241c
|
@ -79,7 +79,7 @@ final class telegram extends core
|
|||
*
|
||||
* @param model $telegram The telegram account
|
||||
*
|
||||
* @throws exception_runtime if update the telegram account record in the database by the telegram account values
|
||||
* @throws exception_runtime if failed to update the telegram account record in the database by the telegram account values
|
||||
* @throws exception_runtime if failed to find the created telegram account
|
||||
* @throws exception_runtime if failed to create the telegram account
|
||||
*
|
||||
|
|
|
@ -10,8 +10,8 @@ use mirzaev\minimal\core,
|
|||
|
||||
// Enabling debugging
|
||||
/* ini_set('error_reporting', E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1); */
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1); */
|
||||
|
||||
// Initializing path to the public directory
|
||||
define('INDEX', __DIR__);
|
||||
|
@ -43,7 +43,7 @@ $core = new core(namespace: __NAMESPACE__);
|
|||
// Initializing routes
|
||||
$core->router
|
||||
->write('/', new route('index', 'index'), 'GET')
|
||||
;
|
||||
;
|
||||
|
||||
// Handling request
|
||||
$core->start();
|
||||
|
|
|
@ -20,8 +20,8 @@ use Zanzara\Zanzara as zanzara,
|
|||
|
||||
// Enabling debugging
|
||||
/* ini_set('error_reporting', E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1); */
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1); */
|
||||
|
||||
// Initializing path to the public directory
|
||||
define('INDEX', __DIR__);
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
use mirzaev\baza\database,
|
||||
mirzaev\baza\column,
|
||||
mirzaev\baza\record,
|
||||
mirzaev\baza\enumerations\encoding,
|
||||
mirzaev\baza\enumerations\type;
|
||||
|
||||
// Initializing path constants
|
||||
define('INDEX', __DIR__);
|
||||
define('ROOT', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR);
|
||||
define('SETTINGS', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'settings');
|
||||
define('DATABASES', INDEX . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'databases');
|
||||
|
||||
// Initializing dependencies and system settings
|
||||
require ROOT . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||
require SETTINGS . DIRECTORY_SEPARATOR . 'system.php';
|
||||
|
||||
// Initializing a path to the Baza database binary file
|
||||
$file = DATABASES . DIRECTORY_SEPARATOR . 'telegram.baza';
|
||||
|
||||
// Instanciating new database class we want to read
|
||||
$database = new database()
|
||||
->encoding(encoding::utf8)
|
||||
->columns(
|
||||
new column('identifier', type::integer_unsigned),
|
||||
new column('domain', type::string, ['length' => 32]),
|
||||
new column('name_first', type::string, ['length' => 64]),
|
||||
new column('name_second', type::string, ['length' => 64]),
|
||||
new column('language', type::string, ['length' => 2]),
|
||||
new column('robot', type::char),
|
||||
new column('updated', type::integer_unsigned),
|
||||
new column('created', type::integer_unsigned)
|
||||
)
|
||||
->connect($file);
|
||||
|
||||
// Reading the whole database array
|
||||
$read = $database->read();
|
||||
print_r($read);
|
Loading…
Reference in New Issue