Files
Gazelle-Porn/boris
2022-12-18 20:03:35 +00:00

65 lines
1.7 KiB
PHP
Executable File

#!/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'
// )
// )
*/