<?php use PicoFarad\Router; use PicoFarad\Response; use PicoFarad\Request; use PicoFarad\Session; use PicoFarad\Template; // Refresh all feeds, used when Javascript is disabled Router\get_action('refresh-all', function () { Model\Feed\refresh_all(); Session\flash(t('Your subscriptions are updated')); Response\redirect('?action=unread'); }); // Edit feed form Router\get_action('edit-feed', function () { $id = Request\int_param('feed_id'); $values = Model\Feed\get($id); $values += array('feed_group_ids' => Model\Group\get_feed_group_ids($id)); Response\html(Template\layout('edit_feed', array('values' => $values, 'errors' => array(), 'nb_unread_items' => Model\Item\count_by_status('unread'), 'groups' => Model\Group\get_all(), 'menu' => 'feeds', 'title' => t('Edit subscription')))); }); // Submit edit feed form Router\post_action('edit-feed', function () { $values = Request\values(); $values += array('enabled' => 0, 'download_content' => 0, 'rtl' => 0, 'cloak_referrer' => 0, 'feed_group_ids' => array(), 'create_group' => ''); list($valid, $errors) = Model\Feed\validate_modification($values); if ($valid) { if (Model\Feed\update($values)) { Session\flash(t('Your subscription has been updated.')); Response\redirect('?action=feeds'); } else { Session\flash_error(t('Unable to edit your subscription.'));
<?php require __DIR__ . '/common.php'; if (php_sapi_name() === 'cli') { $options = getopt('', array('limit::', 'call-interval::', 'update-interval::', 'database::')); } else { $options = $_GET; } if (!empty($options['database'])) { if (!Model\Database\select($options['database'])) { die("Database " . $options['database'] . " not found\r\n"); } } $limit = !empty($options['limit']) && ctype_digit($options['limit']) ? (int) $options['limit'] : Model\Feed\LIMIT_ALL; $update_interval = !empty($options['update-interval']) && ctype_digit($options['update-interval']) ? (int) $options['update-interval'] : null; $call_interval = !empty($options['call-interval']) && ctype_digit($options['call-interval']) ? (int) $options['call-interval'] : null; if ($update_interval !== null && $call_interval !== null && $limit === Model\Feed\LIMIT_ALL && $update_interval >= $call_interval) { $feeds_count = PicoDb\Database::getInstance('db')->table('feeds')->count(); $limit = ceil($feeds_count / ($update_interval / $call_interval)); } Model\Feed\refresh_all($limit); Model\Item\autoflush_read(); Model\Item\autoflush_unread(); Model\Config\write_debug();