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

6
inc/instance-config.php

@ -35,7 +35,7 @@
$config['db']['database'] = 'lainchan'; $config['db']['database'] = 'lainchan';
$config['db']['prefix'] = ''; $config['db']['prefix'] = '';
$config['db']['user'] = 'lainchan'; $config['db']['user'] = 'lainchan';
$config['db']['password'] = 'oijrljqqwjr242kjn'; $config['db']['password'] = '';
$config['cookies']['mod'] = 'mod'; $config['cookies']['mod'] = 'mod';
@ -82,7 +82,7 @@
$config['additional_javascript'][] = 'js/expand-video.js'; $config['additional_javascript'][] = 'js/expand-video.js';
$config['max_filesize'] = 50 * 1024 * 1024; // 50MB $config['max_filesize'] = 50 * 1024 * 1024; // 50MB
$config['webm']['allow_audio'] = true; $config['webm']['allow_audio'] = true;
$config['webm']['max_length'] = 620; $config['webm']['max_length'] = 1000;
//end test section //end test section
@ -92,6 +92,8 @@
$config['allowed_ext_files'][] = 'zip'; $config['allowed_ext_files'][] = 'zip';
$config['allowed_ext_files'][] = 'epub'; $config['allowed_ext_files'][] = 'epub';
$config['api']['enabled'] = false;
/* /*
* From Config: * From Config:
// Always regenerate markup. This isn't recommended and should only be used for debugging; by default, // 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 * ffmpeg.php
* A barebones ffmpeg based webm implementation for vichan. * A barebones ffmpeg based webm implementation for vichan.
*/ */
function get_webm_info($filename) { function get_webm_info($filename) {
global $board, $config; global $board, $config;
$filename = escapeshellarg($filename); $filename = escapeshellarg($filename);
$ffprobe = $config['webm']['ffprobe_path']; $ffprobe = $config['webm']['ffprobe_path'];
$ffprobe_out = array(); $ffprobe_out = array();
$webminfo = array(); $webminfo = array();
exec("$ffprobe -v quiet -print_format json -show_format -show_streams $filename", $ffprobe_out); exec("$ffprobe -v quiet -print_format json -show_format -show_streams $filename", $ffprobe_out);
$ffprobe_out = json_decode(implode("\n", $ffprobe_out), 1); $ffprobe_out = json_decode(implode("\n", $ffprobe_out), 1);
$webminfo['error'] = is_valid_webm($ffprobe_out); $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 'inc/functions.php';
require_once 'inc/anti-bot.php'; // DELETE ME THIS IS FOR print_err function only!
loadConfig(); loadConfig();
@ -23,6 +24,31 @@ $page = array(
// this breaks the display of licenses if enabled // this breaks the display of licenses if enabled
$config['minify_html'] = false; $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'])) { if (file_exists($config['has_installed'])) {
// Check the version number // Check the version number
@ -647,6 +673,7 @@ if ($step == 0) {
echo Element('page.html', $page); echo Element('page.html', $page);
} elseif ($step == 1) { } elseif ($step == 1) {
print_err2("Hello World install.php");
$page['title'] = 'Pre-installation test'; $page['title'] = 'Pre-installation test';
$can_exec = true; $can_exec = true;
@ -663,6 +690,8 @@ if ($step == 0) {
$version = explode('.', PHP_VERSION); $version = explode('.', PHP_VERSION);
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
} }
print_err2("Can exec: " . strval($can_exec));
// Required extensions // Required extensions
$extensions = array( $extensions = array(
@ -770,7 +799,7 @@ if ($step == 0) {
array( array(
'category' => 'Image processing', 'category' => 'Image processing',
'name' => '`gifsicle` (command-line animted GIF thumbnailing)', 'name' => '`gifsicle` (command-line animted GIF thumbnailing)',
'result' => $can_exec && shell_exec('which gifsicle'), 'result' => $can_exec && checkGifsicle(),
'required' => false, 'required' => false,
'message' => '(Optional) `gifsicle` was not found or executable; you may not use `convert+gifsicle` for better animated GIF thumbnailing.', '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'; 'effect' => function (&$config) { if ($config['thumb_method'] == 'gm') $config['thumb_method'] = 'gm+gifsicle';
@ -780,7 +809,7 @@ if ($step == 0) {
'category' => 'Image processing', 'category' => 'Image processing',
'name' => '`md5sum` (quick file hashing on GNU/Linux)', 'name' => '`md5sum` (quick file hashing on GNU/Linux)',
'prereq' => '', 'prereq' => '',
'result' => $can_exec && shell_exec('echo "vichan" | md5sum') == "141225c362da02b5c359c45b665168de -\n", 'result' => checkMd5Exec($can_exec),
'required' => false, 'required' => false,
'message' => '(Optional) `md5sum` was not found or executable; file hashing for multiple images will be slower. Ignore if not using Linux.', '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; }, 'effect' => function (&$config) { $config['gnu_md5'] = true; },

Loading…
Cancel
Save