コード例 #1
0
ファイル: feedpoll.php プロジェクト: bashrc/gnusocial-debian
 public static function enqueueNewFeeds(array $args = array())
 {
     if (!isset($args['interval']) || !is_int($args['interval']) || $args['interval'] <= 0) {
         $args['interval'] = self::DEFAULT_INTERVAL;
     }
     $args['interval'] *= 60;
     // minutes to seconds
     $feedsub = new FeedSub();
     $feedsub->sub_state = 'nohub';
     // Find feeds that haven't been polled within the desired interval,
     // though perhaps we're abusing the "last_update" field here?
     $feedsub->whereAdd(sprintf('last_update < "%s"', common_sql_date(time() - $args['interval'])));
     $feedsub->find();
     $qm = QueueManager::get();
     while ($feedsub->fetch()) {
         $orig = clone $feedsub;
         $item = array('id' => $feedsub->id);
         $qm->enqueue($item, self::QUEUE_CHECK);
         $feedsub->last_update = common_sql_now();
         $feedsub->update($orig);
     }
 }
コード例 #2
0
ファイル: gcfeeds.php プロジェクト: bashrc/gnusocial-debian
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
$longoptions = array('delete-inactive');
$shortoptions = 'd';
$helptext = <<<END_OF_HELP
gcfeeds.php [options]
Clean up feeds that no longer have subscribers.

    -d --delete-inactive    Delete inactive feeds from feedsub table.

END_OF_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
$delete_inactive = have_option('d', 'delete-inactive');
$delcount = 0;
$feedsub = new FeedSub();
$feedsub->find();
while ($feedsub->fetch()) {
    try {
        echo $feedsub->getUri() . " ({$feedsub->sub_state})";
        if ($feedsub->garbageCollect()) {
            if ($delete_inactive) {
                $delcount++;
                $feedsub->delete();
                echo " DELETED";
            }
            echo " INACTIVE\n";
        } else {
            echo " ACTIVE\n";
        }
    } catch (NoProfileException $e) {
        echo " DELETED (no profile)\n";
        $feedsub->delete();