summaryrefslogtreecommitdiff
path: root/tools/worker.php
diff options
context:
space:
mode:
authorAppleman1234 <applemansigloo@gmail.com>2016-12-15 18:25:42 +0900
committerGitHub <noreply@github.com>2016-12-15 18:25:42 +0900
commitcae526e65a20f3da2d8884c4d8e8978c54120000 (patch)
tree2954153dd49f616f5018490058ff4bfbd17300d3 /tools/worker.php
parentb58fab98147a92c8e6d22f15d23684508b6bb811 (diff)
parent5feae402cb55d49963bfd2c6f5a33d10690ecbc1 (diff)
Merge pull request #79 from lainchan/clean_prod_vichan_update
Merge vichan changes from upstream and changes directly applied to the site.
Diffstat (limited to 'tools/worker.php')
-rwxr-xr-xtools/worker.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/tools/worker.php b/tools/worker.php
new file mode 100755
index 00000000..e19fe1c6
--- /dev/null
+++ b/tools/worker.php
@@ -0,0 +1,31 @@
+#!/usr/bin/php
+<?php
+/* worker.php - part of advanced build vichan feature */
+
+require dirname(__FILE__) . '/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');
+
+function after_open_board() { global $config;
+ $config['smart_build'] = false;
+ $config['generation_strategies'] = array('strategy_immediate');
+};
+
+echo "Hello world!\n";
+
+$queue = get_queue('generate');
+
+while (true) {
+ $q = $queue->pop(2);
+ foreach ($q as $v) {
+ list($__, $func, $ary, $action) = unserialize($v);
+ echo "Starting to generate $func ".implode(" ", $ary)."... ";
+
+ call_user_func_array($func, $ary);
+
+ echo "done!\n";
+ }
+ if (!$q) usleep(20000); // 0.02s
+}