Beispiel #1
2
 public function testBasic()
 {
     $r = $w = false;
     $this->assertCount(0, $this->ticker);
     $file = fopen(__FILE__, "r");
     stream_set_blocking($file, false);
     $this->ticker->read($file, function ($file) use(&$r) {
         fread($file, fstat($file)["size"]);
     });
     $this->assertCount(1, $this->ticker);
     $this->ticker->write($file, function ($file) use(&$w) {
         return $w;
     });
     $this->assertCount(2, $this->ticker);
     $this->assertSame(2, $this->ticker->wait());
     $this->assertSame(0, $this->ticker->wait());
 }
function activitycheck_init()
{
    global $mybb, $db;
    $activitycheck = new Ticker($db, 1, $mybb->settings['rpgsuite_activitycheck_freq']);
    if ($mybb->settings['rpgsuite_activitycheck'] && $activitycheck->needs_run()) {
        run_activitycheck();
        $activitycheck->increment();
    }
}
Beispiel #3
0
function grouppoints_init()
{
    global $mybb, $db;
    $grouppoints = new Ticker($db, 2, $mybb->settings['rpgsuite_grouppoints_freq']);
    if ($mybb->settings['rpgsuite_grouppoints'] && $grouppoints->needs_run()) {
        run_grouppoints();
        $grouppoints->update();
    }
}
Beispiel #4
0
 function testIO()
 {
     $gzip = new IO\Process("gzip -1");
     $base = new IO\Process("base64");
     $func = new IO\Filter(function ($f, $data, $eof) {
         return strrev($data);
     });
     fwrite($gzip->getInput(), "Hello World!\n");
     fclose($gzip->getInput());
     $ticker = new Ticker();
     $ticker->pipe($gzip, $base, $func, "fpassthru");
     ob_start();
     while ($ticker(1)) {
     }
     $this->assertStringMatchesFormat("\nAAAAN0HFd3NACQeUJp8LPjwVJnczIN/AEI%sAIs4H", ob_get_contents());
 }
Beispiel #5
0
 public function testSequence()
 {
     $ticker = new Ticker(['0', '1', '2', '3']);
     $this->assertEquals('0', $ticker->__toString());
     $this->assertEquals('1', $ticker->__toString());
     $this->assertEquals('2', $ticker->__toString());
     $this->assertEquals('3', $ticker->__toString());
     $this->assertEquals('0', $ticker->__toString());
 }
Beispiel #6
0
<?php

/**
 * TickerRunner
 */
namespace ticker;

include_once '../app/autoloader.php';
$ticker = new Ticker();
$ticker->getData();
Beispiel #7
0
$page->add_breadcrumb_item('Manage Packs');
$page->output_header('Pack Management');
$table = new Table();
$table->construct_header('Job');
$table->construct_header('Next Run');
$table->construct_cell('<strong>Activity Check</strong>');
if ($mybb->settings['rpgsuite_activitycheck']) {
    $activitycheck = new Ticker($db, 1, $mybb->settings['rpgsuite_activitycheck_freq']);
    $table->construct_cell(date("D, jS M Y @ g:ia", $activitycheck->next_run()));
} else {
    $table->construct_cell('<i>Disabled</i>');
}
$table->construct_row();
$table->construct_cell('<strong>Group Rewards/Penalties</strong>');
if ($mybb->settings['rpgsuite_grouppoints']) {
    $grouppoints = new Ticker($db, 2, $mybb->settings['rpgsuite_grouppoints_freq']);
    $table->construct_cell(date("D, jS M Y @ g:ia", $grouppoints->next_run()));
} else {
    $table->construct_cell('<i>Disabled</i>');
}
$table->construct_row();
$table->output("Management Jobs");
// Generate list of IC Groups for editing
$rpgsuite = new RPGSuite($mybb, $db, $cache);
$table = new Table();
foreach ($rpgsuite->get_icgroups() as $usergroup) {
    $group = $usergroup->get_info();
    $table->construct_cell("<strong>" . $group['title'] . "</strong>");
    $table->construct_cell("<a href='index.php?module=rpgsuite-group&action=settings&gid=" . $group['gid'] . "'>Manage Pack</a>");
    $table->construct_cell("<a target='_blank' href='" . $mybb->settings['bburl'] . "/modcp.php?action=managegroup&gid=" . $group['gid'] . "'>Mod CP</a>");
    $table->construct_row();