forked from Mosasauroidea/GazellePW
-
Notifications
You must be signed in to change notification settings - Fork 0
/
boris
executable file
·64 lines (59 loc) · 1.65 KB
/
boris
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env php
<?php
/* Ensure that the following functions are removed from the `disable_functions`
* directive in cli/php.ini
*
* pcntl_fork
* pcntl_signal
* pcntl_signal_dispatch
* pcntl_waitpid
*
* boris won't function unless these functions are enabled in the PHP interpreter.
*
* The following variables are defined:
*
* $db - database connection
* $cache - memcache connection
* $bonus - \Gazelle\Bonus instance
* $stylesheet - \Gazelle\Stylesheet instance
*
* More can be added when implemented.
*/
define('BORIS', 1);
require(__DIR__ . 'classes/includes.php');
require_once(__DIR__ . '/vendor/d11wtq/boris/lib/autoload.php');
$b = new \Boris\Boris(CONFIG['SITE_NAME'] . '> ');
$preload = [
'cache' => $Cache,
'db' => $DB,
'fileTorrent' => new \Gazelle\File\Torrent,
'stylesheet' => new \Gazelle\Stylesheet,
'tagMan' => new \Gazelle\Manager\Tag,
'twig' => new Twig\Environment(
new Twig\Loader\FilesystemLoader('templates'),
['debug' => true, 'cache' => __DIR__ . '/cache/twig']
),
];
printf("** preloaded objects:\n** %s\n", implode(', ', array_keys($preload)));
$b->setLocal($preload);
$b->start();
/*
* Sample usage:
*
vagrant@contrib-jessie:/var/www$ ./boris
[1] ops> $db->query('select count(*) from torrents');
// object(mysqli_result)(
// 'current_field' => NULL,
// 'field_count' => NULL,
// 'lengths' => NULL,
// 'num_rows' => NULL,
// 'type' => NULL
// )
[2] ops> $db->to_array();
// array(
// 0 => array(
// 0 => '14',
// 'count(*)' => '14'
// )
// )
*/