Development

Changeset 9727

You must first sign up to be able to contribute.

Changeset 9727

Show
Ignore:
Timestamp:
06/21/08 16:59:21 (5 years ago)
Author:
nicolas
Message:

released sfPropelPlanetPlugin v 0.6:

  • removed the mandatory application name argument in tasks
  • enhanced web modules, more configuration parameters available, added component to list available feeds
  • hooked bundled routes
  • created package.xml and PEAR package is available
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfPropelPlanetPlugin/trunk/README

    r9657 r9727  
    66#!html 
    77<div style="border:solid 3px #ff8;padding:8px;background-color:#ffe;margin:5px 15%"> 
    8   <strong>Notes:</strong> 
    9   <ol> 
    10     <li>this plugin is <strong>not</strong> compatible with symfony 1.0</li> 
    11     <li>this plugin is <strong>in a very alpha state</strong> and should be used with caution</li> 
    12   </ol> 
     8  This plugin is <strong>not</strong> compatible with symfony 1.0 
    139</div> 
    1410}}} 
     
    3127 
    3228== PEAR install == 
    33 '''Note that the PEAR package of this plugin has not been released yet'''. So 
    34 the following lines do not apply for now.  
    35  
    3629Run the following commands within a bash prompt at the root of your symfony project: 
    3730 
     
    3932$ php symfony plugin-install sfPropelPlanetPlugin 
    4033}}} 
     34 
     35Dependencies will be installed automatically. 
    4136 
    4237== After plugin(s) has been installed == 
     
    5853The plugin is bundled with two dedicated task and web modules.  
    5954 
    60 Task can be used with from the command line interface, and you can schedule them 
    61 using the *nix [http://en.wikipedia.org/wiki/Cron CRON] utility. 
     55Tasks can be used with from the command line interface, and you can schedule  
     56them using the *nix [http://en.wikipedia.org/wiki/Cron CRON] utility. 
    6257 
    6358Web modules provides quick'n'dirty frontend and backend rough web interfaces to 
     
    6863is a sample call: 
    6964{{{ 
    70 $ php symfony planet:feed-add <appname> http://feeds.feedburner.com/symfony/blog 
     65$ php symfony planet:feed-add http://feeds.feedburner.com/symfony/blog 
    7166}}} 
    7267 
    73 Where `<appname>` is the name of one of your apps, and the following url is the  
    74 feed url you want to add to your planet. This command will fetch its entries,  
    75 and store them in your database. 
     68Where the url is the feed url you want to add to your planet. This command will  
     69fetch its entries, and store them in your database. 
    7670 
    7771To get help on available options, just type: 
    7872{{{ 
    7973$ php symfony help planet:feed-add 
    80 Usage: 
    81  symfony planet:feed-add [--non-activate|-i] [--periodicity|-p[="..."]] [--no-grab|-s] [--max-entries|-m[="..."]] application feed-url 
    82  
    83 Aliases: planet-feed-add 
    84  
    85 Arguments: 
    86  application     The application name 
    87  feed-url        The feed url (rss, atom) to grab and add to the planet 
    88  
    89 Options: 
    90  --non-activate  (-i) Do not activate the feed after saving it 
    91  --periodicity   (-p) Peremption time in seconds (default: 86400) 
    92  --no-grab       (-s) Do not grab and store the feed entries 
    93  --max-entries   (-m) Max number of entries to grab and store (default: 0) 
    9474}}} 
    9575 
     
    10080To launch the task, just run the following command: 
    10181{{{ 
    102 $ php symfony planet:feed-grab <appname> 
     82$ php symfony planet:feed-grab 
    10383}}} 
    10484 
     
    10686{{{ 
    10787$ php symfony help planet:feed-grab 
    108 Usage: 
    109  symfony planet:feed-grab [--force-refresh|-f] [--verbose|-v] application [feed-slug] 
    110  
    111 Aliases: planet-feed-grab 
    112  
    113 Arguments: 
    114  application      The application name 
    115  feed-slug        The feed slug (if not provided, all active feeds entries will be grabbed) 
    116  
    117 Options: 
    118  --force-refresh  (-f) Forces to grab and update all feeds, including those which are not perempted 
    119  --verbose        (-v) Prints verbose messages during grabbing 
    12088}}} 
    12189 
    12290=== Using bundled web modules === 
    123 The web modules are very rough for now. They will be enhanced later
     91The web modules provides somewhat useful frontend and backend interfaces
    12492 
    12593==== The `sfPlanetAdmin` web module ==== 
    126 The `sfPlanetAdmin` module provides admin features of your feeds entries. To  
     94The `sfPlanetAdmin` module provides admin features of your feeds entries. From 
     95there you can add, edit, delete and list available feeds in your planet. To  
    12796enable the module for an application, edit its `settings.yml` file as following: 
    12897 
     
    146115 
    147116Then purge your application config cache with `php symfony cc` and browse to  
    148 `/sfPlanet/list`. 
     117`/planet/home/1.html` after having added some feeds to your planet. 
     118 
     119Pagination is handled automatically, but configurable in the `app.yml` file. 
     120 
     121Note that the plugin provided bundled symfony routes: 
     122 * `sf_planet_home`: The home of the planet, listing entries from all active  
     123   feeds 
     124 * `sf_planet_feed_home`: The list of all entries for a given feed, passing its  
     125   mandatory `slug` parameter 
     126 
     127An RSS feed for the planet is also available. Just point your browser at  
     128`/planet/home/1.rss` and enjoy. You can even paginate yout planet feed browsing 
     129at `/planet/home/2.rss`, `/planet/home/3.rss` and so on. 
    149130 
    150131== License == 
     
    154135== Credits == 
    155136This plugin has been released by Nicolas Perriault <nperriault -> gmail.com> and 
    156 uses these other plugins: 
     137uses these other nice plugins: 
    157138  
    158139 * [wiki:sfFeed2Plugin sfFeed2Plugin]: handy feed utilities 
    159140 * [wiki:sfWebBrowser sfWebBrowser]: handy php web browsing utility 
    160141 * [wiki:sfPropelActAsSluggableBehaviorPlugin sfPropelActAsSluggableBehaviorPlugin]: handy slug generation utility 
     142 * [wiki:sfPagerNavigationPlugin sfPagerNavigationPlugin]: pagination helper 
  • plugins/sfPropelPlanetPlugin/trunk/config/app.yml

    r9626 r9727  
     1# sfPropelPlanetPlugin configuration 
     2# This file will be parsed and the values below will be set. If you want to  
     3# override them, just edit your own application/project app.yml file setting 
     4# the properties you want to override, eg. 
     5#  
     6#    // file apps/frontend/config/app.yml 
     7#    all: 
     8#      planet: 
     9#        title:       Les flux de mes amis 
     10#        homepage:    http://monblog.net/planet 
     11#        description: Ils sont tous sympathiques 
     12#        language:    fr 
    113all: 
    214  planet: 
     15 
     16    # Planet metadata 
    317    title:            My Planet 
    418    homepage:         "http://myplanet.foo/" 
    519    description:      The planet I live on 
    620    language:         en-us 
    7     editor_email:     me@myplanet.foo 
    8     webmaster_email:  webmaster@myplanet.foo 
     21    editor_email:     ~     
     22    webmaster_email:  ~ 
     23     
     24    # Advanced configuration 
     25    display_feeds_list: true   # display the list of the active feeds on every page 
     26    max_per_page:       10     # max entries per page 
     27    routes_register:    true   # provides native routes for the sfPlanet web module 
     28 
     29    # Available periodicities, in seconds 
    930    periodicity: 
    1031      60:    one minute 
  • plugins/sfPropelPlanetPlugin/trunk/config/config.php

    r9626 r9727  
    11<?php 
    2 // Plugin dependencies check 
    3 $dependencies = array('sfPropelActAsSluggableBehaviorPlugin' => 'sfPropelActAsSluggableBehavior', 
    4                       'sfWebBrowser' => 'sfWebBrowser', 
    5                       'sfFeed2Plugin' => 'sfFeed'); 
     2// Plugin dependencies check by classes 
     3$dependencies = array( 
     4  'sfPropelActAsSluggableBehaviorPlugin' => 'sfPropelActAsSluggableBehavior', 
     5  'sfWebBrowser' => 'sfWebBrowser', 
     6  'sfFeed2Plugin' => 'sfFeed' 
     7); 
     8 
    69foreach ($dependencies as $pluginName => $className) 
    710{ 
    811  if (!class_exists($className, true)) 
    912  { 
    10     throw new sfConfigurationException(sprintf('Plugin %s is required (class %s not found)', 
    11                                                  $pluginName, $className)); 
     13    throw new sfConfigurationException(sprintf('sfPropelPlanetPlugin: plugin %s is required (class %s not found). If you\'ve just installed it, did you clear your cache?', 
     14                                               $pluginName, $className)); 
    1215  } 
    1316} 
     17 
     18// Plugin dependencies by helpers 
     19try 
     20{ 
     21  sfLoader::loadHelpers('PagerNavigation'); 
     22} 
     23catch (Exception $e) 
     24{ 
     25  throw new sfConfigurationException('sfPropelPlanetPlugin: Plugin sfPagerNavigationPlugin is required. If you\'ve just installed it, did you clear your cache?'); 
     26} 
     27 
     28// Routing hook 
     29if (sfConfig::get('app_planet_routes_register', true) && in_array('sfPlanet', sfConfig::get('sf_enabled_modules', array()))) 
     30{ 
     31  $this->dispatcher->connect('routing.load_configuration', array('sfPlanetRouting', 'listenToRoutingLoadConfigurationEvent')); 
     32} 
  • plugins/sfPropelPlanetPlugin/trunk/lib/model/sfPlanetFeedEntryPeer.php

    r9626 r9727  
    99   
    1010  /** 
    11    * Retrieves active feed entries, ordered by publication date DESC 
     11   * Generates a Criteria to retrieve active feed(s) entries 
    1212   * 
    13    * @param  int          $to    limit (optional) 
    14    * @param  int          $from  start (optional) 
    15    * @param  sfPlanetFeed $feed  feed  (optional) 
    16    * @return array 
     13   * @param  sfPlanetFeed  $feed  The feed instance (optional) 
     14   * @return Criteria 
    1715   */ 
    18   public static function getList($to = null, $from = 0, sfPlanetFeed $feed = null) 
     16  public static function getActiveListCriteria(sfPlanetFeed $feed = null) 
    1917  { 
    2018    $c = new Criteria(); 
    21      
    22     if (!is_null($to) && $to > 0) 
    23     { 
    24       $c->setLimit($to); 
    25     } 
    26      
    27     if (!is_null($from) && $from > 0) 
    28     { 
    29       $c->setOffset($from); 
    30     } 
    3119     
    3220    if (!is_null($feed)) 
     
    3927    $c->addDescendingOrderByColumn(self::PUBLISHED_AT); 
    4028     
    41     return self::doSelectJoinsfPlanetFeed($c)
     29    return $c
    4230  } 
    4331   
  • plugins/sfPropelPlanetPlugin/trunk/lib/task/base/sfPlanetBaseTask.class.php

    r9657 r9727  
    66class sfPlanetBaseTask extends sfBaseTask 
    77{ 
     8   
     9  /** 
     10   * Retrieves an available application name 
     11   * 
     12   * @return string 
     13   */ 
     14  protected static function getDefaultAppName() 
     15  { 
     16    return array_pop(scandir(sfConfig::get('sf_apps_dir'))); 
     17  } 
    818   
    919  /** 
     
    8797   
    8898  /** 
     99   * Implemented here because declared abstract in parent class 
     100   *  
    89101   * @see sfTask 
    90102   */ 
  • plugins/sfPropelPlanetPlugin/trunk/lib/task/sfPlanetFeedAddTask.class.php

    r9655 r9727  
    1717    $this->name             = 'feed-add'; 
    1818    $this->briefDescription = 'Adds a new feed to the planet'; 
     19    $this->detailedDescription = <<<EOF 
     20The [planet:feed-add|INFO] allows you to add and grab a new feed to your planet.  
     21EOF; 
    1922     
    2023    $this->addArguments(array( 
    21       new sfCommandArgument('application', sfCommandArgument::REQUIRED, 'The application name'), 
    2224      new sfCommandArgument('feed-url', sfCommandArgument::REQUIRED, 'The feed url (rss, atom) to grab and add to the planet'), 
     25      new sfCommandArgument('application', sfCommandArgument::OPTIONAL, 'The application name', self::getDefaultAppName()), 
    2326    )); 
    2427     
  • plugins/sfPropelPlanetPlugin/trunk/lib/task/sfPlanetFeedGrabTask.class.php

    r9657 r9727  
    1717    $this->name             = 'feed-grab'; 
    1818    $this->briefDescription = 'Grabs last planet feeds entries and store them in the database'; 
     19    $this->detailedDescription = <<<EOF 
     20The [planet:grab-entries|INFO] updates perempted feed entries, ones which the  
     21[periodicity|COMMENT] value has been exceeded. 
     22EOF; 
    1923     
    2024    $this->addArguments(array( 
    21       new sfCommandArgument('application', sfCommandArgument::REQUIRED, 'The application name'), 
    2225      new sfCommandArgument('feed-slug', sfCommandArgument::OPTIONAL, 'The feed slug (if not provided, all active feeds entries will be grabbed)'), 
     26      new sfCommandArgument('application', sfCommandArgument::OPTIONAL, 'The application name', self::getDefaultAppName()), 
    2327    )); 
    2428     
  • plugins/sfPropelPlanetPlugin/trunk/modules/sfPlanet/actions/actions.class.php

    r9626 r9727  
    11<?php 
     2require_once realpath(dirname(__FILE__).'/../lib/BasesfPlanetActions.class.php'); 
     3 
    24/** 
    3  * sfPlanet module actions 
     5 * sfPlanet module actions. Feel free to override it in your own frontend app 
    46 * 
    57 */ 
    6 class sfPlanetActions extends sfActions 
    7 
    8    
    9   /** 
    10    * Lists last entries 
    11    * 
    12    * @param sfWebRequest $request 
    13    */ 
    14   public function executeList(sfWebRequest $request) 
    15   { 
    16     $this->entries = sfPlanetFeedEntryPeer::getList($to = null, $from = null, $feed = null); 
    17     if ('rss' === $request->getParameter('sf_format')) 
    18     { 
    19       $this->setLayout(false); 
    20       sfConfig::set('sf_web_debug', false); 
    21       $this->getResponse()->setHttpHeader('content-type', 'text/xml;charset=utf-8'); 
    22     } 
    23   } 
    24    
     8class sfPlanetActions extends BasesfPlanetActions 
     9{   
    2510}