예제 #1
0
파일: cron.php 프로젝트: Elwell/concerto
    weekly();
    print "Finished weekly job\n";
}
if (date("Hi") == '0010' || $_REQUEST['nightly']) {
    nightly();
    print "Finished nightly job\n";
}
if (date("i") == '10' || $_REQUEST['hourly']) {
    //In the event screen rotation isn't enabled in the config...
    if (!is_array($screen_rotate)) {
        $screen_rotate = false;
    }
    hourly($screen_rotate);
    print "Finished hourly job";
}
always();
function weekly()
{
    echo "Clearing cache directories.\n";
    clear_cache(IMAGE_DIR . '/cache/');
    clear_cache(TEMPLATE_DIR . '/cache/');
    echo "Cache cleared.\n";
}
function nightly()
{
    //Rollover the feed-content table's statistics
    echo "Rolling over statistics...\n";
    $sql = "UPDATE `feed_content` SET `yesterday_count` = `display_count`";
    sql_command($sql);
    //Rolloever the position table's statistics
    $sql = "UPDATE `position` SET `yesterday_count` = `display_count`";
예제 #2
0
 function testastNestedAst()
 {
     $ts = TokenStream::fromSource('<?php
         interface Foo
         {
             public abstract function foo();
             public abstract static function bar();
             function baz();
         }
     ');
     $modifier = either(token(T_PUBLIC), token(T_STATIC), token(T_PRIVATE));
     $modifiers = optional(either(chain($modifier, $modifier), $modifier));
     $ast = chain(token(T_OPEN_TAG), chain(token(T_INTERFACE), token(T_STRING)->as('name'), token('{'), optional(repeat(chain(optional(either(repeat(either(token(T_PUBLIC)->as('public'), token(T_STATIC)->as('static'), token(T_ABSTRACT)->as('abstract'))), always(new Token(T_PUBLIC, 'public'))->as('public')))->as('is'), token(T_FUNCTION), token(T_STRING)->as('name'), token('('), token(')'), token(';')), token('}')))->as('methods'), token('}'))->as('interface'))->parse($ts);
     $this->assertEquals('Foo', (string) $ast->{'interface name'});
     $this->assertEquals('foo', (string) $ast->{'interface methods 0 name'});
     $this->assertEquals('public', (string) $ast->{'interface methods 0 is public'});
     $this->assertEquals('abstract', (string) $ast->{'interface methods 0 is abstract'});
     $this->assertEmpty($ast->{'interface methods 0 is static'});
     $this->assertEquals('bar', (string) $ast->{'interface methods 1 name'});
     $this->assertEquals('public', (string) $ast->{'interface methods 1 is public'});
     $this->assertEquals('abstract', (string) $ast->{'interface methods 1 is abstract'});
     $this->assertEquals('static', (string) $ast->{'interface methods 1 is static'});
     $this->assertEquals('baz', (string) $ast->{'interface methods 2 name'});
     $this->assertEquals('public', (string) $ast->{'interface methods 2 is public'});
     $this->assertNull($ast->{'interface methods 2 is abstract'});
     $this->assertNull($ast->{'interface methods 2 is static'});
 }