summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAppleman1234 <applemansigloo@gmail.com>2022-09-25 13:30:13 +1000
committerAppleman1234 <applemansigloo@gmail.com>2022-09-25 13:30:13 +1000
commit2c69095a1edf7474073451285238659d0f62ce3f (patch)
tree5dee476605402c66dc2853d0836b29f6aedae62b /tools
parente9a61e2fbbd930eaa80d6a5f33420cedc59d748c (diff)
PHP8.1 fixes from Rector
Diffstat (limited to 'tools')
-rwxr-xr-xtools/benchmark.php10
-rwxr-xr-xtools/delete-stray-images.php11
-rwxr-xr-xtools/i18n_compile.php10
-rwxr-xr-xtools/i18n_extract.php10
-rw-r--r--tools/import_rules.php2
-rw-r--r--tools/inc/cli.php7
-rw-r--r--tools/inc/lib/jsgettext/JSParser.php31
-rw-r--r--tools/inc/lib/jsgettext/PoeditParser.php25
-rw-r--r--tools/inc/lib/jsgettext/PoeditString.php16
-rw-r--r--tools/inc/lib/jsgettext/jsgettext.php18
-rw-r--r--tools/inc/lib/jsgettext/po2json.php16
-rwxr-xr-xtools/rebuild.php8
-rwxr-xr-xtools/rebuild2.php24
-rw-r--r--tools/recount-bumps.php2
-rwxr-xr-xtools/stats.php15
-rwxr-xr-xtools/worker.php8
16 files changed, 90 insertions, 123 deletions
diff --git a/tools/benchmark.php b/tools/benchmark.php
index ed7c200d..0bf38509 100755
--- a/tools/benchmark.php
+++ b/tools/benchmark.php
@@ -5,17 +5,17 @@
*
*/
-require dirname(__FILE__) . '/inc/cli.php';
+require __DIR__ . '/inc/cli.php';
require 'inc/image.php';
// move back to this directory
-chdir(dirname(__FILE__));
+chdir(__DIR__);
-if(count($argv) != 2)
+if((is_countable($argv) ? count($argv) : 0) != 2)
die("Usage: {$argv[0]} [file]\n");
$file = $argv[1];
-$extension = strtolower(substr($file, strrpos($file, '.') + 1));
+$extension = strtolower(substr((string) $file, strrpos((string) $file, '.') + 1));
$out = tempnam($config['tmp'], 'thumb');
$count = 300;
@@ -30,7 +30,7 @@ function benchmark($method) {
for($i = 0; $i < $count; $i++) {
$image = new Image($file, $extension);
$thumb = $image->resize(
- $config['thumb_ext'] ? $config['thumb_ext'] : $extension,
+ $config['thumb_ext'] ?: $extension,
$config['thumb_width'],
$config['thumb_height']
);
diff --git a/tools/delete-stray-images.php b/tools/delete-stray-images.php
index cf94dfe5..06cf513b 100755
--- a/tools/delete-stray-images.php
+++ b/tools/delete-stray-images.php
@@ -9,7 +9,7 @@
*
*/
-require dirname(__FILE__) . '/inc/cli.php';
+require __DIR__ . '/inc/cli.php';
$boards = listBoards();
@@ -19,8 +19,8 @@ foreach ($boards as $board) {
openBoard($board['uri']);
$query = query(sprintf("SELECT `file`, `thumb` FROM ``posts_%s`` WHERE `file` IS NOT NULL", $board['uri']));
- $valid_src = array();
- $valid_thumb = array();
+ $valid_src = [];
+ $valid_thumb = [];
while ($post = $query->fetch(PDO::FETCH_ASSOC)) {
$valid_src[] = $post['file'];
@@ -33,10 +33,7 @@ foreach ($boards as $board) {
$stray_src = array_diff($files_src, $valid_src);
$stray_thumb = array_diff($files_thumb, $valid_thumb);
- $stats = array(
- 'deleted' => 0,
- 'size' => 0
- );
+ $stats = ['deleted' => 0, 'size' => 0];
foreach ($stray_src as $src) {
$stats['deleted']++;
diff --git a/tools/i18n_compile.php b/tools/i18n_compile.php
index ba193767..54827151 100755
--- a/tools/i18n_compile.php
+++ b/tools/i18n_compile.php
@@ -10,15 +10,15 @@
*
*/
-require dirname(__FILE__) . '/inc/cli.php';
+require __DIR__ . '/inc/cli.php';
// parse command line
-$opts = getopt('l:', Array('locale:'));
-$options = Array();
+$opts = getopt('l:', ['locale:']);
+$options = [];
-$options['locale'] = isset($opts['l']) ? $opts['l'] : (isset($opts['locale']) ? $opts['locale'] : false);
+$options['locale'] = $opts['l'] ?? $opts['locale'] ?? false;
-if ($options['locale']) $locales = array($options['locale']);
+if ($options['locale']) $locales = [$options['locale']];
else die("Error: no locales specified; use -l switch, eg. -l pl_PL\n");
foreach ($locales as $loc) {
diff --git a/tools/i18n_extract.php b/tools/i18n_extract.php
index fe501a37..66ccbc74 100755
--- a/tools/i18n_extract.php
+++ b/tools/i18n_extract.php
@@ -10,18 +10,18 @@
*
*/
-require dirname(__FILE__) . '/inc/cli.php';
+require __DIR__ . '/inc/cli.php';
// parse command line
-$opts = getopt('l:', Array('locale:'));
-$options = Array();
+$opts = getopt('l:', ['locale:']);
+$options = [];
-$options['locale'] = isset($opts['l']) ? $opts['l'] : (isset($opts['locale']) ? $opts['locale'] : false);
+$options['locale'] = $opts['l'] ?? $opts['locale'] ?? false;
$locales = glob("inc/locale/*");
$locales = array_map("basename", $locales);
-if ($options['locale']) $locales = array($options['locale']);
+if ($options['locale']) $locales = [$options['locale']];
foreach ($locales as $loc) {
diff --git a/tools/import_rules.php b/tools/import_rules.php
index f583f035..167ecb2c 100644
--- a/tools/import_rules.php
+++ b/tools/import_rules.php
@@ -1,7 +1,7 @@
<?php
// This script imports rules.txt files from the old system into the new ``pages`` table.
-require dirname(__FILE__) . '/inc/cli.php';
+require __DIR__ . '/inc/cli.php';
$boards = listBoards(TRUE);
diff --git a/tools/inc/cli.php b/tools/inc/cli.php
index b04d042a..4b8e3793 100644
--- a/tools/inc/cli.php
+++ b/tools/inc/cli.php
@@ -40,11 +40,6 @@ putenv('TINYBOARD_PATH=' . getcwd());
require 'inc/bootstrap.php';
-$mod = Array(
- 'id' => -1,
- 'type' => ADMIN,
- 'username' => '?',
- 'boards' => Array('*')
-);
+$mod = ['id' => -1, 'type' => ADMIN, 'username' => '?', 'boards' => ['*']];
diff --git a/tools/inc/lib/jsgettext/JSParser.php b/tools/inc/lib/jsgettext/JSParser.php
index adba59bc..739d1195 100644
--- a/tools/inc/lib/jsgettext/JSParser.php
+++ b/tools/inc/lib/jsgettext/JSParser.php
@@ -4,9 +4,9 @@ class JSParser {
protected $content;
protected $keywords;
- protected $regs = array();
+ protected $regs = [];
protected $regsCounter = 0;
- protected $strings = array();
+ protected $strings = [];
protected $stringsCounter = 0;
protected function _extractRegs($match) {
@@ -23,16 +23,12 @@ class JSParser {
}
protected function importRegExps($input) {
$regs = $this->regs;
- return preg_replace_callback("#<<reg(\d+)>>#", function ($match) use($regs) {
- return $regs[$match[1]];
- }, $input);
+ return preg_replace_callback("#<<reg(\d+)>>#", fn($match) => $regs[$match[1]], $input);
}
protected function importStrings($input) {
$strings = $this->strings;
- return preg_replace_callback("#<<s(\d+)>>#", function ($match) use($strings) {
- return $strings[$match[1]];
- }, $input);
+ return preg_replace_callback("#<<s(\d+)>>#", fn($match) => $strings[$match[1]], $input);
}
public function __construct($file, $keywords = '_') {
@@ -46,15 +42,12 @@ class JSParser {
// extract reg exps
$output = preg_replace_callback(
'# ( / (?: (?>[^/\\\\]++) | \\\\\\\\ | (?<!\\\\)\\\\(?!\\\\) | \\\\/ )+ (?<!\\\\)/ ) [a-z]* \b #ix',
- array($this, '_extractRegs'), $output
+ $this->_extractRegs(...), $output
);
// extract strings
$output = preg_replace_callback(
- array(
- '# " ( (?: (?>[^"\\\\]++) | \\\\\\\\ | (?<!\\\\)\\\\(?!\\\\) | \\\\" )* ) (?<!\\\\)" #ix',
- "# ' ( (?: (?>[^'\\\\]++) | \\\\\\\\ | (?<!\\\\)\\\\(?!\\\\) | \\\\' )* ) (?<!\\\\)' #ix"
- ), array($this, '_extractStrings'), $output
+ ['# " ( (?: (?>[^"\\\\]++) | \\\\\\\\ | (?<!\\\\)\\\\(?!\\\\) | \\\\" )* ) (?<!\\\\)" #ix', "# ' ( (?: (?>[^'\\\\]++) | \\\\\\\\ | (?<!\\\\)\\\\(?!\\\\) | \\\\' )* ) (?<!\\\\)' #ix"], $this->_extractStrings(...), $output
);
// delete line comments
@@ -64,13 +57,11 @@ class JSParser {
$output = preg_replace('#/\*(.*?)\*/#is', '', $output);
$strings = $this->strings;
- $output = preg_replace_callback("#<<s(\d+)>>#", function($match) use($strings) {
- return $strings[$match[1]];
- }, $output);
+ $output = preg_replace_callback("#<<s(\d+)>>#", fn($match) => $strings[$match[1]], $output);
$keywords = implode('|', $this->keywords);
- $strings = array();
+ $strings = [];
// extract func calls
preg_match_all(
@@ -78,15 +69,15 @@ class JSParser {
$output, $matches, PREG_SET_ORDER
);
- foreach ($matches as $m) $strings[] = stripslashes($m[1]);
+ foreach ($matches as $m) $strings[] = stripslashes((string) $m[1]);
- $matches = array();
+ $matches = [];
preg_match_all(
"# (?:$keywords) \(\\ *' ( (?: (?>[^'\\\\]++) | \\\\\\\\ | (?<!\\\\)\\\\(?!\\\\) | \\\\' )* ) (?<!\\\\)'\\ *\) #ix",
$output, $matches, PREG_SET_ORDER
);
- foreach ($matches as $m) $strings[] = stripslashes($m[1]);
+ foreach ($matches as $m) $strings[] = stripslashes((string) $m[1]);
return $strings;
}
diff --git a/tools/inc/lib/jsgettext/PoeditParser.php b/tools/inc/lib/jsgettext/PoeditParser.php
index eebd816e..0fbe04e6 100644
--- a/tools/inc/lib/jsgettext/PoeditParser.php
+++ b/tools/inc/lib/jsgettext/PoeditParser.php
@@ -4,17 +4,16 @@ require_once 'PoeditString.php';
class PoeditParser {
- protected $file;
protected $header = '';
- protected $strings = array();
+ protected $strings = [];
protected function _fixQuotes($str) {
- return stripslashes($str);
+ return stripslashes((string) $str);
}
- public function __construct($file) {
- $this->file = $file;
- }
+ public function __construct(protected $file)
+ {
+ }
public function parse() {
$contents = file_get_contents($this->file);
@@ -26,13 +25,13 @@ class PoeditParser {
foreach ($parts as $part) {
// parse comments
- $comments = array();
- preg_match_all('#^\\#: (.*?)$#m', $part, $matches, PREG_SET_ORDER);
+ $comments = [];
+ preg_match_all('#^\\#: (.*?)$#m', (string) $part, $matches, PREG_SET_ORDER);
foreach ($matches as $m) $comments[] = $m[1];
- $isFuzzy = preg_match('#^\\#, fuzzy$#im', $part) ? true : false;
+ $isFuzzy = preg_match('#^\\#, fuzzy$#im', (string) $part) ? true : false;
- preg_match_all('# ^ (msgid|msgstr)\ " ( (?: (?>[^"\\\\]++) | \\\\\\\\ | (?<!\\\\)\\\\(?!\\\\) | \\\\" )* ) (?<!\\\\)" $ #ixm', $part, $matches2, PREG_SET_ORDER);
+ preg_match_all('# ^ (msgid|msgstr)\ " ( (?: (?>[^"\\\\]++) | \\\\\\\\ | (?<!\\\\)\\\\(?!\\\\) | \\\\" )* ) (?<!\\\\)" $ #ixm', (string) $part, $matches2, PREG_SET_ORDER);
$k = $this->_fixQuotes($matches2[0][2]);
$v = !empty($matches2[1][2]) ? $this->_fixQuotes($matches2[1][2]) : '';
@@ -58,11 +57,11 @@ class PoeditParser {
}
public function getJSON() {
- $str = array();
+ $str = [];
foreach ($this->strings as $s) {
if ($s->value) $str[$s->key] = $s->value;
}
- return json_encode($str);
+ return json_encode($str, JSON_THROW_ON_ERROR);
}
public function toJSON($outputFilename, $varName = 'l10n') {
@@ -75,7 +74,7 @@ class PoeditParser {
foreach ($this->strings as $str) {
$data .= $str;
}
- return file_put_contents($filename ? $filename : $this->file, $data) !== false;
+ return file_put_contents($filename ?: $this->file, $data) !== false;
}
}
diff --git a/tools/inc/lib/jsgettext/PoeditString.php b/tools/inc/lib/jsgettext/PoeditString.php
index 3d59d004..5bffeea0 100644
--- a/tools/inc/lib/jsgettext/PoeditString.php
+++ b/tools/inc/lib/jsgettext/PoeditString.php
@@ -1,26 +1,20 @@
<?php
-class PoeditString {
- public $key;
- public $value;
- public $fuzzy;
+class PoeditString implements \Stringable {
public $comments;
- function __construct($key, $value = '', $fuzzy = false, $comments = array()) {
- $this->key = $key;
- $this->value = $value;
- $this->fuzzy = $fuzzy;
+ function __construct(public $key, public $value = '', public $fuzzy = false, $comments = []) {
$this->comments = (array)$comments;
}
- public function __toString() {
+ public function __toString(): string {
$str ='';
foreach ($this->comments as $c) {
$str .= "#: $c\n";
}
if ($this->fuzzy) $str .= "#, fuzzy\n";
- $str .= 'msgid "'.str_replace('"', '\\"', $this->key).'"' . "\n";
- $str .= 'msgstr "'.str_replace('"', '\\"', $this->value).'"' . "\n";
+ $str .= 'msgid "'.str_replace('"', '\\"', (string) $this->key).'"' . "\n";
+ $str .= 'msgstr "'.str_replace('"', '\\"', (string) $this->value).'"' . "\n";
$str .= "\n";
return $str;
}
diff --git a/tools/inc/lib/jsgettext/jsgettext.php b/tools/inc/lib/jsgettext/jsgettext.php
index 6c70f0b4..75ea6566 100644
--- a/tools/inc/lib/jsgettext/jsgettext.php
+++ b/tools/inc/lib/jsgettext/jsgettext.php
@@ -4,16 +4,12 @@
require_once 'PoeditParser.php';
function buildOptions($args) {
- $options = array(
- 'files' => array(),
- '-o' => null,
- '-k' => '_'
- );
- $len = count($args);
+ $options = ['files' => [], '-o' => null, '-k' => '_'];
+ $len = is_countable($args) ? count($args) : 0;
$i = 1;
while ($i < $len) {
- if (preg_match('#^-[a-z]$#i', $args[$i])) {
- $options[$args[$i]] = isset($args[$i+1]) ? trim($args[$i+1]) : true;
+ if (preg_match('#^-[a-z]$#i', (string) $args[$i])) {
+ $options[$args[$i]] = isset($args[$i+1]) ? trim((string) $args[$i+1]) : true;
$i += 2;
}
else {
@@ -43,14 +39,14 @@
$poeditParser = new PoeditParser($options['-o']);
$poeditParser->parse();
- $errors = array();
+ $errors = [];
foreach ($inputFiles as $f) {
- if (!is_readable($f) || !preg_match('#\.js$#', $f)) {
+ if (!is_readable($f) || !preg_match('#\.js$#', (string) $f)) {
$errors[] = ("$f is not a valid javascript file.");
continue;
}
- $jsparser = new JSParser($f, explode(' ', $options['-k']));
+ $jsparser = new JSParser($f, explode(' ', (string) $options['-k']));
$jsStrings = $jsparser->parse();
$poeditParser->merge($jsStrings);
}
diff --git a/tools/inc/lib/jsgettext/po2json.php b/tools/inc/lib/jsgettext/po2json.php
index 847b0899..8fb6f69f 100644
--- a/tools/inc/lib/jsgettext/po2json.php
+++ b/tools/inc/lib/jsgettext/po2json.php
@@ -3,16 +3,12 @@
require_once 'PoeditParser.php';
function buildOptions($args) {
- $options = array(
- '-o' => null,
- '-i' => null,
- '-n' => 'l10n'
- );
- $len = count($args);
+ $options = ['-o' => null, '-i' => null, '-n' => 'l10n'];
+ $len = is_countable($args) ? count($args) : 0;
$i = 0;
while ($i < $len) {
- if (preg_match('#^-[a-z]$#i', $args[$i])) {
- $options[$args[$i]] = isset($args[$i+1]) ? trim($args[$i+1]) : true;
+ if (preg_match('#^-[a-z]$#i', (string) $args[$i])) {
+ $options[$args[$i]] = isset($args[$i+1]) ? trim((string) $args[$i+1]) : true;
$i += 2;
}
else {
@@ -33,8 +29,8 @@
$poeditParser->parse();
if ($poeditParser->toJSON($options['-o'], $options['-n'])) {
- $strings = count($poeditParser->getStrings());
- echo "Successfully exported " . count($strings) . " strings.\n";
+ $strings = is_countable($poeditParser->getStrings()) ? count($poeditParser->getStrings()) : 0;
+ echo "Successfully exported " . (is_countable($strings) ? count($strings) : 0) . " strings.\n";
}
else {
echo "Cannor write to file '{$options['-o']}'.\n";
diff --git a/tools/rebuild.php b/tools/rebuild.php
index 289523a1..9adb183b 100755
--- a/tools/rebuild.php
+++ b/tools/rebuild.php
@@ -19,18 +19,18 @@
*
*/
-require dirname(__FILE__) . '/inc/cli.php';
+require __DIR__ . '/inc/cli.php';
require_once("inc/bans.php");
$start = microtime(true);
// parse command line
-$opts = getopt('qfb:', Array('board:', 'quick', 'full', 'quiet'));
-$options = Array();
+$opts = getopt('qfb:', ['board:', 'quick', 'full', 'quiet']);
+$options = [];
$global_locale = $config['locale'];
-$options['board'] = isset($opts['board']) ? $opts['board'] : (isset($opts['b']) ? $opts['b'] : false);
+$options['board'] = $opts['board'] ?? $opts['b'] ?? false;
$options['quiet'] = isset($opts['q']) || isset($opts['quiet']);
$options['quick'] = isset($opts['quick']);
$options['full'] = isset($opts['full']) || isset($opts['f']);
diff --git a/tools/rebuild2.php b/tools/rebuild2.php
index 2945460c..82d0fef2 100755
--- a/tools/rebuild2.php
+++ b/tools/rebuild2.php
@@ -11,17 +11,17 @@
* I removed the quiet option, it's useless. Just use output redirection.
*/
-require dirname(__FILE__) . '/inc/cli.php';
+require __DIR__ . '/inc/cli.php';
$start = microtime(true);
// parse command line
-$opts = getopt('', Array('board:', 'themes', 'js', 'indexes', 'threads', 'processes:', 'cache', 'postmarkup', 'api'));
-$options = Array();
+$opts = getopt('', ['board:', 'themes', 'js', 'indexes', 'threads', 'processes:', 'cache', 'postmarkup', 'api']);
+$options = [];
$global_locale = $config['locale'];
// Do only one board?
-$options['board'] = isset($opts['board']) ? $opts['board'] : (isset($opts['b']) ? $opts['b'] : false);
+$options['board'] = $opts['board'] ?? $opts['b'] ?? false;
// Clear the cache?
$options['cache'] = isset($opts['cache']);
// Rebuild themes (catalogs)?
@@ -37,7 +37,7 @@ $options['postmarkup'] = isset($opts['postmarkup']);
// Rebuild API pages? (e.g. /b/res/1.json')
$options['api'] = isset($opts['api']);
// How many processes?
-$options['processes'] = isset($opts['processes']) ? $opts['processes'] : 1;
+$options['processes'] = $opts['processes'] ?? 1;
echo "== Tinyboard + vichan {$config['version']} ==\n";
@@ -71,22 +71,22 @@ function doboard($board) {
echo "Opening board /{$board['uri']}/...\n";
// Reset locale to global locale
$config['locale'] = $global_locale;
- init_locale($config['locale'], 'error');
+ init_locale($config['locale']);
openBoard($board['uri']);
$config['try_smarter'] = false;
-
+
if($config['file_script'] != $main_js && $options['js']) {
// different javascript file
echo "(/{$board['uri']}/) Generating Javascript file...\n";
buildJavascript();
}
-
-
+
+
if ($options['indexes']) {
echo "(/{$board['uri']}/) Creating index pages...\n";
buildIndex();
}
-
+
if($options['postmarkup']) {
$query = query(sprintf("SELECT `id` FROM ``posts_%s``", $board['uri'])) or error(db_error());
while($post = $query->fetch()) {
@@ -94,7 +94,7 @@ function doboard($board) {
rebuildPost($post['id']);
}
}
-
+
if ($options['threads']) {
$query = query(sprintf("SELECT `id` FROM ``posts_%s`` WHERE `thread` IS NULL", $board['uri'])) or error(db_error());
while($post = $query->fetch()) {
@@ -104,7 +104,7 @@ function doboard($board) {
}
}
-$children = array();
+$children = [];
foreach ($boards_m as $i => $bb) {
$pid = pcntl_fork();
diff --git a/tools/recount-bumps.php b/tools/recount-bumps.php
index 06e8ca9f..5d1053ab 100644
--- a/tools/recount-bumps.php
+++ b/tools/recount-bumps.php
@@ -2,7 +2,7 @@
// A script to recount bumps to recover from a last-page-bump attack
// or to be run after the KusabaX Migration.
-require dirname(__FILE__) . '/inc/cli.php';
+require __DIR__ . '/inc/cli.php';
if (!isset ($argv[1])) {
die("Usage: tools/recount-bumps.php board_uri\n");
diff --git a/tools/stats.php b/tools/stats.php
index 00214842..0729418f 100755
--- a/tools/stats.php
+++ b/tools/stats.php
@@ -1,14 +1,13 @@
#!/usr/bin/php
<?php
mb_internal_encoding('utf-8');
-require dirname(__FILE__) . '/inc/cli.php';
+require __DIR__ . '/inc/cli.php';
-$variants = array(array("hour", 3600), array("day", 3600*24), array("3 days", 3600*24*3),
- array("week", 3600*24*7), array("month", 3600*24*7*30));
+$variants = [["hour", 3600], ["day", 3600*24], ["3 days", 3600*24*3], ["week", 3600*24*7], ["month", 3600*24*7*30]];
printf(" || ");
foreach ($variants as $iter) {
- list($term, $time) = $iter;
+ [$term, $time] = $iter;
printf("%8s | ", $term);
}
print("\n");
@@ -18,12 +17,12 @@ print("\n");
function mb_str_pad ($input, $pad_length, $pad_string, $pad_type, $encoding="UTF-8") {
if (!$encoding) {
- $diff = strlen($input) - mb_strlen($input);
+ $diff = strlen((string) $input) - mb_strlen((string) $input);
}
else {
- $diff = strlen($input) - mb_strlen($input, $encoding);
+ $diff = strlen((string) $input) - mb_strlen((string) $input, $encoding);
}
- return str_pad($input, $pad_length + $diff, $pad_string, $pad_type);
+ return str_pad((string) $input, $pad_length + $diff, $pad_string, $pad_type);
}
@@ -33,7 +32,7 @@ while ($f = $q->fetch()) {
$str = mb_str_pad($str,10," ", STR_PAD_LEFT, "UTF-8");
printf("%s || ", $str);
foreach ($variants as $iter) {
- list($term, $time) = $iter;
+ [$term, $time] = $iter;
$qq = query(sprintf("SELECT COUNT(*) as count FROM ``posts_%s`` WHERE time > %d", $f['uri'], time()-$time));
$c = $qq->fetch()['count'];
diff --git a/tools/worker.php b/tools/worker.php
index e19fe1c6..d0623eb4 100755
--- a/tools/worker.php
+++ b/tools/worker.php
@@ -2,15 +2,15 @@
<?php
/* worker.php - part of advanced build vichan feature */
-require dirname(__FILE__) . '/inc/cli.php';
+require __DIR__ . '/inc/cli.php';
require_once 'inc/controller.php';
$config['smart_build'] = false; // Let's disable it, so we can build the page for real
-$config['generation_strategies'] = array('strategy_immediate');
+$config['generation_strategies'] = ['strategy_immediate'];
function after_open_board() { global $config;
$config['smart_build'] = false;
- $config['generation_strategies'] = array('strategy_immediate');
+ $config['generation_strategies'] = ['strategy_immediate'];
};
echo "Hello world!\n";
@@ -20,7 +20,7 @@ $queue = get_queue('generate');
while (true) {
$q = $queue->pop(2);
foreach ($q as $v) {
- list($__, $func, $ary, $action) = unserialize($v);
+ [$__, $func, $ary, $action] = unserialize($v);
echo "Starting to generate $func ".implode(" ", $ary)."... ";
call_user_func_array($func, $ary);