Browse Source

lots of print statements

pull/40/head
towards_a_new_leftypol 4 years ago
committed by towards-a-new-leftypol
parent
commit
80dc724738
  1. 4
      inc/anti-bot.php
  2. 10
      inc/functions.php
  3. 6
      inc/instance-config.php
  4. 2
      inc/lib/webm/ffmpeg.php
  5. 33
      install.php

4
inc/anti-bot.php

@ -17,6 +17,10 @@ function print_err($s) {
file_put_contents($logfile, $s . "\n", FILE_APPEND);
}
function print_err2($s) {
print_err($s);
}
class AntiBot {
public $salt, $inputs = array(), $index = 0;

10
inc/functions.php

@ -379,21 +379,26 @@ function create_antibot($board, $thread = null) {
function rebuildThemes($action, $boardname = false) {
global $config, $board, $current_locale;
print_err("rebuildThemes");
// Save the global variables
$_config = $config;
$_board = $board;
print_err("list themes");
// List themes
if ($themes = Cache::get("themes")) {
// OK, we already have themes loaded
print_err("themes loaded from cache");
}
else {
print_err("querying db for themes");
$query = query("SELECT `theme` FROM ``theme_settings`` WHERE `name` IS NULL AND `value` IS NULL") or error(db_error());
$themes = array();
while ($theme = $query->fetch(PDO::FETCH_ASSOC)) {
print_err("theme found in db");
$themes[] = $theme;
}
@ -449,6 +454,7 @@ function loadThemeConfig($_theme) {
function rebuildTheme($theme, $action, $board = false) {
global $config, $_theme;
$_theme = $theme;
print_err("rebuildTheme with \$theme as " . $theme);
$theme = loadThemeConfig($_theme);
@ -2293,9 +2299,11 @@ function strip_combining_chars($str) {
function buildThread($id, $return = false, $mod = false) {
global $board, $config, $build_pages;
$id = round($id);
print_err("buildThread start");
if (event('build-thread', $id))
if (event('build-thread', $id)) {
return;
}
if ($config['cache']['enabled'] && !$mod) {
// Clear cache

6
inc/instance-config.php

@ -35,7 +35,7 @@
$config['db']['database'] = 'lainchan';
$config['db']['prefix'] = '';
$config['db']['user'] = 'lainchan';
$config['db']['password'] = 'oijrljqqwjr242kjn';
$config['db']['password'] = '';
$config['cookies']['mod'] = 'mod';
@ -82,7 +82,7 @@
$config['additional_javascript'][] = 'js/expand-video.js';
$config['max_filesize'] = 50 * 1024 * 1024; // 50MB
$config['webm']['allow_audio'] = true;
$config['webm']['max_length'] = 620;
$config['webm']['max_length'] = 1000;
//end test section
@ -92,6 +92,8 @@
$config['allowed_ext_files'][] = 'zip';
$config['allowed_ext_files'][] = 'epub';
$config['api']['enabled'] = false;
/*
* From Config:
// Always regenerate markup. This isn't recommended and should only be used for debugging; by default,

2
inc/lib/webm/ffmpeg.php

@ -3,12 +3,14 @@
* ffmpeg.php
* A barebones ffmpeg based webm implementation for vichan.
*/
function get_webm_info($filename) {
global $board, $config;
$filename = escapeshellarg($filename);
$ffprobe = $config['webm']['ffprobe_path'];
$ffprobe_out = array();
$webminfo = array();
exec("$ffprobe -v quiet -print_format json -show_format -show_streams $filename", $ffprobe_out);
$ffprobe_out = json_decode(implode("\n", $ffprobe_out), 1);
$webminfo['error'] = is_valid_webm($ffprobe_out);

33
install.php

@ -9,6 +9,7 @@ if (fopen('inc/instance-config.php' , 'a') === false) {
}
require 'inc/functions.php';
require_once 'inc/anti-bot.php'; // DELETE ME THIS IS FOR print_err function only!
loadConfig();
@ -23,6 +24,31 @@ $page = array(
// this breaks the display of licenses if enabled
$config['minify_html'] = false;
function checkMd5Exec(bool $can_exec) {
print_err2("checkMd5Exec");
print_err2($can_exec);
$shell_out = shell_exec("pwd");
print_err2("shell out: " . $shell_out);
$shell_out = shell_exec('echo "vichan" | md5sum');
print_err2("shell out: " . $shell_out);
$shell_ok = $shell_out == "141225c362da02b5c359c45b665168de -\n";
print_err2("shell ok: " . strval($shell_ok));
$result = $can_exec && $shell_ok;
print_err2($result);
return $result;
}
function checkGifsicle() {
print_err2("checkGifsicle");
$shell_out = shell_exec('echo $PATH');
print_err2("shell out: " . $shell_out);
$shell_out = shell_exec('gifsicle --help');
print_err2("shell out: " . $shell_out);
$shell_out = shell_exec('which gifsicle');
print_err2("shell out (which gifsicle): " . $shell_out);
return $shell_out;
}
if (file_exists($config['has_installed'])) {
// Check the version number
@ -647,6 +673,7 @@ if ($step == 0) {
echo Element('page.html', $page);
} elseif ($step == 1) {
print_err2("Hello World install.php");
$page['title'] = 'Pre-installation test';
$can_exec = true;
@ -664,6 +691,8 @@ if ($step == 0) {
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
}
print_err2("Can exec: " . strval($can_exec));
// Required extensions
$extensions = array(
'PDO' => array(
@ -770,7 +799,7 @@ if ($step == 0) {
array(
'category' => 'Image processing',
'name' => '`gifsicle` (command-line animted GIF thumbnailing)',
'result' => $can_exec && shell_exec('which gifsicle'),
'result' => $can_exec && checkGifsicle(),
'required' => false,
'message' => '(Optional) `gifsicle` was not found or executable; you may not use `convert+gifsicle` for better animated GIF thumbnailing.',
'effect' => function (&$config) { if ($config['thumb_method'] == 'gm') $config['thumb_method'] = 'gm+gifsicle';
@ -780,7 +809,7 @@ if ($step == 0) {
'category' => 'Image processing',
'name' => '`md5sum` (quick file hashing on GNU/Linux)',
'prereq' => '',
'result' => $can_exec && shell_exec('echo "vichan" | md5sum') == "141225c362da02b5c359c45b665168de -\n",
'result' => checkMd5Exec($can_exec),
'required' => false,
'message' => '(Optional) `md5sum` was not found or executable; file hashing for multiple images will be slower. Ignore if not using Linux.',
'effect' => function (&$config) { $config['gnu_md5'] = true; },

Loading…
Cancel
Save