Changeset 9727
- Timestamp:
- 06/21/08 16:59:21 (5 years ago)
- Files:
-
- plugins/sfPropelPlanetPlugin/trunk/README (modified) (9 diffs)
- plugins/sfPropelPlanetPlugin/trunk/config/app.yml (modified) (1 diff)
- plugins/sfPropelPlanetPlugin/trunk/config/config.php (modified) (1 diff)
- plugins/sfPropelPlanetPlugin/trunk/lib/model/sfPlanetFeedEntryPeer.php (modified) (2 diffs)
- plugins/sfPropelPlanetPlugin/trunk/lib/routing (added)
- plugins/sfPropelPlanetPlugin/trunk/lib/routing/sfPlanetRouting.class.php (added)
- plugins/sfPropelPlanetPlugin/trunk/lib/task/base/sfPlanetBaseTask.class.php (modified) (2 diffs)
- plugins/sfPropelPlanetPlugin/trunk/lib/task/sfPlanetFeedAddTask.class.php (modified) (1 diff)
- plugins/sfPropelPlanetPlugin/trunk/lib/task/sfPlanetFeedGrabTask.class.php (modified) (1 diff)
- plugins/sfPropelPlanetPlugin/trunk/modules/sfPlanet/actions/actions.class.php (modified) (1 diff)
- plugins/sfPropelPlanetPlugin/trunk/modules/sfPlanet/actions/components.class.php (added)
- plugins/sfPropelPlanetPlugin/trunk/modules/sfPlanet/lib (added)
- plugins/sfPropelPlanetPlugin/trunk/modules/sfPlanet/lib/BasesfPlanetActions.class.php (added)
- plugins/sfPropelPlanetPlugin/trunk/modules/sfPlanet/templates/_listFeeds.php (added)
- plugins/sfPropelPlanetPlugin/trunk/modules/sfPlanet/templates/listSuccess.php (added)
- plugins/sfPropelPlanetPlugin/trunk/modules/sfPlanet/templates/listSuccess.rss.php (added)
- plugins/sfPropelPlanetPlugin/trunk/package.xml (added)
- plugins/sfPropelPlanetPlugin/trunk/package.xml.tpl (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfPropelPlanetPlugin/trunk/README
r9657 r9727 6 6 #!html 7 7 <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 13 9 </div> 14 10 }}} … … 31 27 32 28 == PEAR install == 33 '''Note that the PEAR package of this plugin has not been released yet'''. So34 the following lines do not apply for now.35 36 29 Run the following commands within a bash prompt at the root of your symfony project: 37 30 … … 39 32 $ php symfony plugin-install sfPropelPlanetPlugin 40 33 }}} 34 35 Dependencies will be installed automatically. 41 36 42 37 == After plugin(s) has been installed == … … 58 53 The plugin is bundled with two dedicated task and web modules. 59 54 60 Task can be used with from the command line interface, and you can schedule them61 using the *nix [http://en.wikipedia.org/wiki/Cron CRON] utility.55 Tasks can be used with from the command line interface, and you can schedule 56 them using the *nix [http://en.wikipedia.org/wiki/Cron CRON] utility. 62 57 63 58 Web modules provides quick'n'dirty frontend and backend rough web interfaces to … … 68 63 is a sample call: 69 64 {{{ 70 $ php symfony planet:feed-add <appname>http://feeds.feedburner.com/symfony/blog65 $ php symfony planet:feed-add http://feeds.feedburner.com/symfony/blog 71 66 }}} 72 67 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. 68 Where the url is the feed url you want to add to your planet. This command will 69 fetch its entries, and store them in your database. 76 70 77 71 To get help on available options, just type: 78 72 {{{ 79 73 $ 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-url82 83 Aliases: planet-feed-add84 85 Arguments:86 application The application name87 feed-url The feed url (rss, atom) to grab and add to the planet88 89 Options:90 --non-activate (-i) Do not activate the feed after saving it91 --periodicity (-p) Peremption time in seconds (default: 86400)92 --no-grab (-s) Do not grab and store the feed entries93 --max-entries (-m) Max number of entries to grab and store (default: 0)94 74 }}} 95 75 … … 100 80 To launch the task, just run the following command: 101 81 {{{ 102 $ php symfony planet:feed-grab <appname>82 $ php symfony planet:feed-grab 103 83 }}} 104 84 … … 106 86 {{{ 107 87 $ 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-grab112 113 Arguments:114 application The application name115 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 perempted119 --verbose (-v) Prints verbose messages during grabbing120 88 }}} 121 89 122 90 === Using bundled web modules === 123 The web modules are very rough for now. They will be enhanced later.91 The web modules provides somewhat useful frontend and backend interfaces. 124 92 125 93 ==== The `sfPlanetAdmin` web module ==== 126 The `sfPlanetAdmin` module provides admin features of your feeds entries. To 94 The `sfPlanetAdmin` module provides admin features of your feeds entries. From 95 there you can add, edit, delete and list available feeds in your planet. To 127 96 enable the module for an application, edit its `settings.yml` file as following: 128 97 … … 146 115 147 116 Then 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 119 Pagination is handled automatically, but configurable in the `app.yml` file. 120 121 Note 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 127 An 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 129 at `/planet/home/2.rss`, `/planet/home/3.rss` and so on. 149 130 150 131 == License == … … 154 135 == Credits == 155 136 This plugin has been released by Nicolas Perriault <nperriault -> gmail.com> and 156 uses these other plugins:137 uses these other nice plugins: 157 138 158 139 * [wiki:sfFeed2Plugin sfFeed2Plugin]: handy feed utilities 159 140 * [wiki:sfWebBrowser sfWebBrowser]: handy php web browsing utility 160 141 * [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 1 13 all: 2 14 planet: 15 16 # Planet metadata 3 17 title: My Planet 4 18 homepage: "http://myplanet.foo/" 5 19 description: The planet I live on 6 20 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 9 30 periodicity: 10 31 60: one minute plugins/sfPropelPlanetPlugin/trunk/config/config.php
r9626 r9727 1 1 <?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 6 9 foreach ($dependencies as $pluginName => $className) 7 10 { 8 11 if (!class_exists($className, true)) 9 12 { 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)); 12 15 } 13 16 } 17 18 // Plugin dependencies by helpers 19 try 20 { 21 sfLoader::loadHelpers('PagerNavigation'); 22 } 23 catch (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 29 if (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 9 9 10 10 /** 11 * Retrieves active feed entries, ordered by publication date DESC11 * Generates a Criteria to retrieve active feed(s) entries 12 12 * 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 17 15 */ 18 public static function get List($to = null, $from = 0,sfPlanetFeed $feed = null)16 public static function getActiveListCriteria(sfPlanetFeed $feed = null) 19 17 { 20 18 $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 }31 19 32 20 if (!is_null($feed)) … … 39 27 $c->addDescendingOrderByColumn(self::PUBLISHED_AT); 40 28 41 return self::doSelectJoinsfPlanetFeed($c);29 return $c; 42 30 } 43 31 plugins/sfPropelPlanetPlugin/trunk/lib/task/base/sfPlanetBaseTask.class.php
r9657 r9727 6 6 class sfPlanetBaseTask extends sfBaseTask 7 7 { 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 } 8 18 9 19 /** … … 87 97 88 98 /** 99 * Implemented here because declared abstract in parent class 100 * 89 101 * @see sfTask 90 102 */ plugins/sfPropelPlanetPlugin/trunk/lib/task/sfPlanetFeedAddTask.class.php
r9655 r9727 17 17 $this->name = 'feed-add'; 18 18 $this->briefDescription = 'Adds a new feed to the planet'; 19 $this->detailedDescription = <<<EOF 20 The [planet:feed-add|INFO] allows you to add and grab a new feed to your planet. 21 EOF; 19 22 20 23 $this->addArguments(array( 21 new sfCommandArgument('application', sfCommandArgument::REQUIRED, 'The application name'),22 24 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()), 23 26 )); 24 27 plugins/sfPropelPlanetPlugin/trunk/lib/task/sfPlanetFeedGrabTask.class.php
r9657 r9727 17 17 $this->name = 'feed-grab'; 18 18 $this->briefDescription = 'Grabs last planet feeds entries and store them in the database'; 19 $this->detailedDescription = <<<EOF 20 The [planet:grab-entries|INFO] updates perempted feed entries, ones which the 21 [periodicity|COMMENT] value has been exceeded. 22 EOF; 19 23 20 24 $this->addArguments(array( 21 new sfCommandArgument('application', sfCommandArgument::REQUIRED, 'The application name'),22 25 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()), 23 27 )); 24 28 plugins/sfPropelPlanetPlugin/trunk/modules/sfPlanet/actions/actions.class.php
r9626 r9727 1 1 <?php 2 require_once realpath(dirname(__FILE__).'/../lib/BasesfPlanetActions.class.php'); 3 2 4 /** 3 * sfPlanet module actions 5 * sfPlanet module actions. Feel free to override it in your own frontend app 4 6 * 5 7 */ 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 8 class sfPlanetActions extends BasesfPlanetActions 9 { 25 10 }