SlideShare a Scribd company logo
1 of 11
Download to read offline
Drupal Feeds

   Andriy Podanenko aka @podarok
    http://drupal.org/user/116002
    Kyiv Drupal Cafe`


            feeds developer keynotes


     08.09.2011         Kyiv Drupal Cafe`
POI

   FeedsSource extends FeedsConfigurable
    FeedsSource::import

   Plugins (FeedsFetcher, FeedsParser,
    FeedsProcessor)
   Hooks
   Mappings
    hook_feeds_processor_targets_alter()
    hook_feeds_parser_sources_alter()



       08.09.2011               Kyiv Drupal Cafe`
Manual process
startImport()
 $config = $this->importer->getConfig();
  if ($config['process_in_background']) {
    $this->startBackgroundJob('import');
  }
  else {
    $this->startBatchAPIJob(t('Importing'), 'import'); //method
  }
}
 function startBatchAPIJob(){
 $batch = array(
      'title' => $title,
      'operations' => array(
        array('feeds_batch', array($method, $this->id, $this->feed_nid)),
      ),
    );
    batch_set($batch);
  }

     08.09.2011                  Kyiv Drupal Cafe`
Manual process
    feeds_batch()

   function feeds_batch($method, $importer_id, $feed_nid = 0, &$context) {
  $context['finished'] = FEEDS_BATCH_COMPLETE;
  try {
 // main work doing here
    $context['finished'] = feeds_source($importer_id, $feed_nid)->$method();
  }
  catch (Exception $e) {
    drupal_set_message($e->getMessage(), 'error');
  }
}




        08.09.2011               Kyiv Drupal Cafe`
FeedsSource::import
$this->acquireLock();
 try {
     // Fetch.
     if (empty($this->fetcher_result) || FEEDS_BATCH_COMPLETE == $this-
>progressParsing()) {
       $this->fetcher_result = $this->importer->fetcher->fetch($this);
//….
     }

   // Parse.
   $parser_result = $this->importer->parser->parse($this, $this->fetcher_result);
   module_invoke_all('feeds_after_parse', $this, $parser_result);

   // Process.
   $this->importer->processor->process($this, $parser_result);
  }
  catch (Exception $e) {
// ….
  }
  $this->releaseLock();

     08.09.2011                     Kyiv Drupal Cafe`
Feeds hooks
function feeds_hook_info() {
  $hooks = array(
    'feeds_after_parse',
    'feeds_after_import',
    'feeds_after_clear',
    'feeds_processor_targets_alter',
    'feeds_parser_sources_alter',
  );
 08.09.2011    Kyiv Drupal Cafe`
Feeds plugins hook_feeds_plugins()
 function ofeeds_feeds_plugins() {
  $info = array();
  $info['OpenERP_Fetcher'] = array(
    'name' => 'OpenERP Fetcher',
    'description' => 'Fetches OpenERP objects from Models.',
    'help' => 'Fetches OpenERP objects from Models. Additional help will be
in a feature',
    'handler' => array(
      'parent' => 'FeedsFetcher',
      'class' => 'OpenERP_Fetcher',
      'file' => 'OpenERP_Fetcher.inc',
      'path' => drupal_get_path('module', 'ofeeds') . '/fetchers',
// Feeds will look for OpenERP_Fetcher.inc in the ofeeds/fetchers directory.
      ),
    );

    return $info;
}
           08.09.2011                 Kyiv Drupal Cafe`
Feeds plugins
●class FeedsPlugin extends FeedsConfigurable implements
FeedsSourceInterface
 methods: save, sourceForm, configForm, loadMappers...

FeedsFetcher extends FeedsPlugin
●

methods: clear, fetch...

FeedsParser extends FeedsPlugin
●

methods: parse, clear...

●FeedsProcessor extends FeedsPlugin
 methods: process, entityType, newEntity, entityLoad,
entitySave, entityDeleteMultiple


     08.09.2011           Kyiv Drupal Cafe`
Feeds plugins forms
● configForm
 // forms displayed at feeds instance settings tab (admin level)
 FE: OpenERP_Fetcher::configForm($fs) – select model,
setting for limiting count of fetched data etc.
 Exportable as config array !!! (via import export clone)

// configFormSubmit,configFormValidate

● sourceForm
 // forms displayed at /import/$feeds_instance page and at
content type creation forms (user level)
 FE: FeedsFileFetcher::sourceForm($sc) – upload file form,
form for listing already uploaded files etc.

// sourceFormValidate, sourceFormSubmit
      08.09.2011               Kyiv Drupal Cafe`
Feeds tricks
    function ofeeds_ctools_plugin_api($owner, $api) {
      if ($owner == 'feeds' && $api == 'plugins') {
        return array('version' => 1);
      }
    }

    function ofeeds_enable() {
      //clear the cache to display in Feeds as available plugin.
      cache_clear_all('plugins:feeds:plugins', 'cache');
    }

    // Do not use variable_set as instances config !!!



                                       
Thanks

    Andriy Podanenko @podarok

    podarokua@gmail.com
    http://twitter.com/podarok
    http://facebook.com/podarok
    http://drupal.org/user/116002




                          

More Related Content

What's hot

Codeigniter : Custom Routing - Manipulate Uri
Codeigniter : Custom Routing - Manipulate UriCodeigniter : Custom Routing - Manipulate Uri
Codeigniter : Custom Routing - Manipulate UriAbdul Malik Ikhsan
 
The Origin of Lithium
The Origin of LithiumThe Origin of Lithium
The Origin of LithiumNate Abele
 
16.mysql stored procedures in laravel
16.mysql stored procedures in laravel16.mysql stored procedures in laravel
16.mysql stored procedures in laravelRazvan Raducanu, PhD
 
「Code igniter」を読もう。〜ソースコードから知る仕様や拡張方法〜
「Code igniter」を読もう。〜ソースコードから知る仕様や拡張方法〜 「Code igniter」を読もう。〜ソースコードから知る仕様や拡張方法〜
「Code igniter」を読もう。〜ソースコードから知る仕様や拡張方法〜 Makoto Kaga
 
第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 DatasourceKaz Watanabe
 
15. CodeIgniter editarea inregistrarilor
15. CodeIgniter editarea inregistrarilor15. CodeIgniter editarea inregistrarilor
15. CodeIgniter editarea inregistrarilorRazvan Raducanu, PhD
 
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -Yusuke Wada
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applicationselliando dias
 
Twib in Yokoahma.pm 2010/3/5
Twib in Yokoahma.pm 2010/3/5Twib in Yokoahma.pm 2010/3/5
Twib in Yokoahma.pm 2010/3/5Yusuke Wada
 
Looping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsLooping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsMark Baker
 
Introduction to the Pods JSON API
Introduction to the Pods JSON APIIntroduction to the Pods JSON API
Introduction to the Pods JSON APIpodsframework
 
Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)Kris Wallsmith
 
Build your own RESTful API with Laravel
Build your own RESTful API with LaravelBuild your own RESTful API with Laravel
Build your own RESTful API with LaravelFrancisco Carvalho
 

What's hot (20)

Codeigniter : Custom Routing - Manipulate Uri
Codeigniter : Custom Routing - Manipulate UriCodeigniter : Custom Routing - Manipulate Uri
Codeigniter : Custom Routing - Manipulate Uri
 
Add loop shortcode
Add loop shortcodeAdd loop shortcode
Add loop shortcode
 
Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010Symfony2 - WebExpo 2010
Symfony2 - WebExpo 2010
 
Advanced Querying with CakePHP 3
Advanced Querying with CakePHP 3Advanced Querying with CakePHP 3
Advanced Querying with CakePHP 3
 
The Origin of Lithium
The Origin of LithiumThe Origin of Lithium
The Origin of Lithium
 
Lithium Best
Lithium Best Lithium Best
Lithium Best
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
 
16.mysql stored procedures in laravel
16.mysql stored procedures in laravel16.mysql stored procedures in laravel
16.mysql stored procedures in laravel
 
「Code igniter」を読もう。〜ソースコードから知る仕様や拡張方法〜
「Code igniter」を読もう。〜ソースコードから知る仕様や拡張方法〜 「Code igniter」を読もう。〜ソースコードから知る仕様や拡張方法〜
「Code igniter」を読もう。〜ソースコードから知る仕様や拡張方法〜
 
Perl5i
Perl5iPerl5i
Perl5i
 
第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource第49回Php勉強会@関東 Datasource
第49回Php勉強会@関東 Datasource
 
15. CodeIgniter editarea inregistrarilor
15. CodeIgniter editarea inregistrarilor15. CodeIgniter editarea inregistrarilor
15. CodeIgniter editarea inregistrarilor
 
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
エロサイト管理者の憂鬱3 - Hokkaiodo.pm#4 -
 
PHP and Rich Internet Applications
PHP and Rich Internet ApplicationsPHP and Rich Internet Applications
PHP and Rich Internet Applications
 
Twib in Yokoahma.pm 2010/3/5
Twib in Yokoahma.pm 2010/3/5Twib in Yokoahma.pm 2010/3/5
Twib in Yokoahma.pm 2010/3/5
 
PHP pod mikroskopom
PHP pod mikroskopomPHP pod mikroskopom
PHP pod mikroskopom
 
Looping the Loop with SPL Iterators
Looping the Loop with SPL IteratorsLooping the Loop with SPL Iterators
Looping the Loop with SPL Iterators
 
Introduction to the Pods JSON API
Introduction to the Pods JSON APIIntroduction to the Pods JSON API
Introduction to the Pods JSON API
 
Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)Doctrine MongoDB ODM (PDXPHP)
Doctrine MongoDB ODM (PDXPHP)
 
Build your own RESTful API with Laravel
Build your own RESTful API with LaravelBuild your own RESTful API with Laravel
Build your own RESTful API with Laravel
 

Viewers also liked

Ubercart7 views catalog ru
Ubercart7 views catalog ruUbercart7 views catalog ru
Ubercart7 views catalog ruAndrii Podanenko
 
Drupal 8 configuration development flow
Drupal 8 configuration development flowDrupal 8 configuration development flow
Drupal 8 configuration development flowAndrii Podanenko
 
Docker SQL Continuous Integration Flow
Docker SQL Continuous Integration FlowDocker SQL Continuous Integration Flow
Docker SQL Continuous Integration FlowAndrii Podanenko
 
Drupal codesprint kyiv drupal cafe 07.02.2013
Drupal codesprint   kyiv drupal cafe 07.02.2013Drupal codesprint   kyiv drupal cafe 07.02.2013
Drupal codesprint kyiv drupal cafe 07.02.2013Andrii Podanenko
 
Do + ldo for developers(full)
Do + ldo for developers(full)Do + ldo for developers(full)
Do + ldo for developers(full)Andrii Podanenko
 
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011camp_drupal_ua
 
Live deployment, ci, drupal
Live deployment, ci, drupalLive deployment, ci, drupal
Live deployment, ci, drupalAndrii Podanenko
 
Drupal contrib module maintaining
Drupal contrib module maintainingDrupal contrib module maintaining
Drupal contrib module maintainingAndrii Podanenko
 
Drupal Continuous Integration Workflow
Drupal Continuous Integration WorkflowDrupal Continuous Integration Workflow
Drupal Continuous Integration WorkflowAndrii Podanenko
 
природна і економна дорожня карта для переходу команди розробки на тест центр...
природна і економна дорожня карта для переходу команди розробки на тест центр...природна і економна дорожня карта для переходу команди розробки на тест центр...
природна і економна дорожня карта для переходу команди розробки на тест центр...Andrii Podanenko
 
MoldCamp - multidimentional testing workflow. CIBox.
MoldCamp  - multidimentional testing workflow. CIBox.MoldCamp  - multidimentional testing workflow. CIBox.
MoldCamp - multidimentional testing workflow. CIBox.Andrii Podanenko
 

Viewers also liked (13)

Ubercart7 views catalog ru
Ubercart7 views catalog ruUbercart7 views catalog ru
Ubercart7 views catalog ru
 
Drupal Optimization
Drupal OptimizationDrupal Optimization
Drupal Optimization
 
Drupal 8 configuration development flow
Drupal 8 configuration development flowDrupal 8 configuration development flow
Drupal 8 configuration development flow
 
Docker SQL Continuous Integration Flow
Docker SQL Continuous Integration FlowDocker SQL Continuous Integration Flow
Docker SQL Continuous Integration Flow
 
Drupal codesprint kyiv drupal cafe 07.02.2013
Drupal codesprint   kyiv drupal cafe 07.02.2013Drupal codesprint   kyiv drupal cafe 07.02.2013
Drupal codesprint kyiv drupal cafe 07.02.2013
 
Do + ldo for developers(full)
Do + ldo for developers(full)Do + ldo for developers(full)
Do + ldo for developers(full)
 
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
Andriy Podanenko.Drupal database api.DrupalCamp Kyiv 2011
 
Live deployment, ci, drupal
Live deployment, ci, drupalLive deployment, ci, drupal
Live deployment, ci, drupal
 
Drupal contrib module maintaining
Drupal contrib module maintainingDrupal contrib module maintaining
Drupal contrib module maintaining
 
Start using vagrant now!
Start using vagrant now!Start using vagrant now!
Start using vagrant now!
 
Drupal Continuous Integration Workflow
Drupal Continuous Integration WorkflowDrupal Continuous Integration Workflow
Drupal Continuous Integration Workflow
 
природна і економна дорожня карта для переходу команди розробки на тест центр...
природна і економна дорожня карта для переходу команди розробки на тест центр...природна і економна дорожня карта для переходу команди розробки на тест центр...
природна і економна дорожня карта для переходу команди розробки на тест центр...
 
MoldCamp - multidimentional testing workflow. CIBox.
MoldCamp  - multidimentional testing workflow. CIBox.MoldCamp  - multidimentional testing workflow. CIBox.
MoldCamp - multidimentional testing workflow. CIBox.
 

Similar to Feeds drupal cafe

Aura Project for PHP
Aura Project for PHPAura Project for PHP
Aura Project for PHPHari K T
 
Symfony internals [english]
Symfony internals [english]Symfony internals [english]
Symfony internals [english]Raul Fraile
 
Drupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionDrupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionPhilip Norton
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
SPL: The Missing Link in Development
SPL: The Missing Link in DevelopmentSPL: The Missing Link in Development
SPL: The Missing Link in Developmentjsmith92
 
Apostrophe
ApostropheApostrophe
Apostrophetompunk
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Michelangelo van Dam
 
Puppet Modules for Fun and Profit
Puppet Modules for Fun and ProfitPuppet Modules for Fun and Profit
Puppet Modules for Fun and ProfitPuppet
 
Using and reusing CakePHP plugins
Using and reusing CakePHP pluginsUsing and reusing CakePHP plugins
Using and reusing CakePHP pluginsPierre MARTIN
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Elena Kolevska
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium AppsNate Abele
 
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)arcware
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For BeginnersJonathan Wage
 
Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)Fabien Potencier
 
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsPhpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsMichael Peacock
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony TechniquesKris Wallsmith
 
PHP 5.3 Overview
PHP 5.3 OverviewPHP 5.3 Overview
PHP 5.3 Overviewjsmith92
 

Similar to Feeds drupal cafe (20)

Aura Project for PHP
Aura Project for PHPAura Project for PHP
Aura Project for PHP
 
Symfony internals [english]
Symfony internals [english]Symfony internals [english]
Symfony internals [english]
 
Drupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency InjectionDrupal 8 Services And Dependency Injection
Drupal 8 Services And Dependency Injection
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
SPL: The Missing Link in Development
SPL: The Missing Link in DevelopmentSPL: The Missing Link in Development
SPL: The Missing Link in Development
 
Apostrophe
ApostropheApostrophe
Apostrophe
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8
 
Puppet modules for Fun and Profit
Puppet modules for Fun and ProfitPuppet modules for Fun and Profit
Puppet modules for Fun and Profit
 
Puppet Modules for Fun and Profit
Puppet Modules for Fun and ProfitPuppet Modules for Fun and Profit
Puppet Modules for Fun and Profit
 
Using and reusing CakePHP plugins
Using and reusing CakePHP pluginsUsing and reusing CakePHP plugins
Using and reusing CakePHP plugins
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5
 
Building Lithium Apps
Building Lithium AppsBuilding Lithium Apps
Building Lithium Apps
 
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
10 Things Every Plugin Developer Should Know (WordCamp Atlanta 2013)
 
Doctrine For Beginners
Doctrine For BeginnersDoctrine For Beginners
Doctrine For Beginners
 
Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)Be RESTful (Symfony Camp 2008)
Be RESTful (Symfony Camp 2008)
 
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsPhpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friends
 
Advanced symfony Techniques
Advanced symfony TechniquesAdvanced symfony Techniques
Advanced symfony Techniques
 
Unittests für Dummies
Unittests für DummiesUnittests für Dummies
Unittests für Dummies
 
PHP 5.3 Overview
PHP 5.3 OverviewPHP 5.3 Overview
PHP 5.3 Overview
 

More from Andrii Podanenko

Глобальні навчальні дні друпал
Глобальні навчальні дні друпалГлобальні навчальні дні друпал
Глобальні навчальні дні друпалAndrii Podanenko
 
Головні Принципи Автоматизації
Головні Принципи АвтоматизаціїГоловні Принципи Автоматизації
Головні Принципи АвтоматизаціїAndrii Podanenko
 
Drupal 8 DevOps . Profile and SQL flows.
Drupal 8 DevOps . Profile and SQL flows.Drupal 8 DevOps . Profile and SQL flows.
Drupal 8 DevOps . Profile and SQL flows.Andrii Podanenko
 
CIbox - OpenSource solution for making your #devops better
CIbox - OpenSource solution for making your #devops betterCIbox - OpenSource solution for making your #devops better
CIbox - OpenSource solution for making your #devops betterAndrii Podanenko
 
DrupalCon Los Angeles - Continuous Integration Toolbox
DrupalCon Los Angeles - Continuous Integration ToolboxDrupalCon Los Angeles - Continuous Integration Toolbox
DrupalCon Los Angeles - Continuous Integration ToolboxAndrii Podanenko
 
Сейчас самое время...ЖИТЬ!
Сейчас самое время...ЖИТЬ!Сейчас самое время...ЖИТЬ!
Сейчас самое время...ЖИТЬ!Andrii Podanenko
 
Drupal 8 what to wait from
Drupal 8   what to wait fromDrupal 8   what to wait from
Drupal 8 what to wait fromAndrii Podanenko
 
Диалоговый интенсив 2012 карпаты
Диалоговый интенсив 2012 карпатыДиалоговый интенсив 2012 карпаты
Диалоговый интенсив 2012 карпатыAndrii Podanenko
 
психолог в социальных медиа
психолог в социальных медиапсихолог в социальных медиа
психолог в социальных медиаAndrii Podanenko
 
Ubercart7 Dynamic properties ru
Ubercart7 Dynamic properties ruUbercart7 Dynamic properties ru
Ubercart7 Dynamic properties ruAndrii Podanenko
 
Yaremchuk - Drupal CodeLobster
Yaremchuk - Drupal CodeLobsterYaremchuk - Drupal CodeLobster
Yaremchuk - Drupal CodeLobsterAndrii Podanenko
 
Yaremchuk - Корпоративные сайты
Yaremchuk - Корпоративные сайтыYaremchuk - Корпоративные сайты
Yaremchuk - Корпоративные сайтыAndrii Podanenko
 
управление проектами отношение к клиенту
управление проектами   отношение к клиентууправление проектами   отношение к клиенту
управление проектами отношение к клиентуAndrii Podanenko
 
Друпал - стандартні модулі
Друпал - стандартні модуліДрупал - стандартні модулі
Друпал - стандартні модуліAndrii Podanenko
 

More from Andrii Podanenko (18)

Глобальні навчальні дні друпал
Глобальні навчальні дні друпалГлобальні навчальні дні друпал
Глобальні навчальні дні друпал
 
Головні Принципи Автоматизації
Головні Принципи АвтоматизаціїГоловні Принципи Автоматизації
Головні Принципи Автоматизації
 
Drupal 8 DevOps . Profile and SQL flows.
Drupal 8 DevOps . Profile and SQL flows.Drupal 8 DevOps . Profile and SQL flows.
Drupal 8 DevOps . Profile and SQL flows.
 
CIbox - OpenSource solution for making your #devops better
CIbox - OpenSource solution for making your #devops betterCIbox - OpenSource solution for making your #devops better
CIbox - OpenSource solution for making your #devops better
 
DrupalCon Los Angeles - Continuous Integration Toolbox
DrupalCon Los Angeles - Continuous Integration ToolboxDrupalCon Los Angeles - Continuous Integration Toolbox
DrupalCon Los Angeles - Continuous Integration Toolbox
 
Сейчас самое время...ЖИТЬ!
Сейчас самое время...ЖИТЬ!Сейчас самое время...ЖИТЬ!
Сейчас самое время...ЖИТЬ!
 
Drupal 8 what to wait from
Drupal 8   what to wait fromDrupal 8   what to wait from
Drupal 8 what to wait from
 
Диалоговый интенсив 2012 карпаты
Диалоговый интенсив 2012 карпатыДиалоговый интенсив 2012 карпаты
Диалоговый интенсив 2012 карпаты
 
психолог в социальных медиа
психолог в социальных медиапсихолог в социальных медиа
психолог в социальных медиа
 
Ubercart7 Dynamic properties ru
Ubercart7 Dynamic properties ruUbercart7 Dynamic properties ru
Ubercart7 Dynamic properties ru
 
Ubercart 7 ru
Ubercart 7 ruUbercart 7 ru
Ubercart 7 ru
 
Drupal 7 database api
Drupal 7 database api Drupal 7 database api
Drupal 7 database api
 
Yaremchuk - Drupal CodeLobster
Yaremchuk - Drupal CodeLobsterYaremchuk - Drupal CodeLobster
Yaremchuk - Drupal CodeLobster
 
Yaremchuk - Корпоративные сайты
Yaremchuk - Корпоративные сайтыYaremchuk - Корпоративные сайты
Yaremchuk - Корпоративные сайты
 
управление проектами отношение к клиенту
управление проектами   отношение к клиентууправление проектами   отношение к клиенту
управление проектами отношение к клиенту
 
Друпал - стандартні модулі
Друпал - стандартні модуліДрупал - стандартні модулі
Друпал - стандартні модулі
 
Друпал Drush
Друпал DrushДрупал Drush
Друпал Drush
 
Drupal Migrate
Drupal MigrateDrupal Migrate
Drupal Migrate
 

Recently uploaded

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Recently uploaded (20)

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

Feeds drupal cafe

  • 1. Drupal Feeds  Andriy Podanenko aka @podarok http://drupal.org/user/116002 Kyiv Drupal Cafe` feeds developer keynotes 08.09.2011 Kyiv Drupal Cafe`
  • 2. POI  FeedsSource extends FeedsConfigurable FeedsSource::import  Plugins (FeedsFetcher, FeedsParser, FeedsProcessor)  Hooks  Mappings hook_feeds_processor_targets_alter() hook_feeds_parser_sources_alter() 08.09.2011 Kyiv Drupal Cafe`
  • 3. Manual process startImport() $config = $this->importer->getConfig(); if ($config['process_in_background']) { $this->startBackgroundJob('import'); } else { $this->startBatchAPIJob(t('Importing'), 'import'); //method } } function startBatchAPIJob(){ $batch = array( 'title' => $title, 'operations' => array( array('feeds_batch', array($method, $this->id, $this->feed_nid)), ), ); batch_set($batch); } 08.09.2011 Kyiv Drupal Cafe`
  • 4. Manual process feeds_batch() function feeds_batch($method, $importer_id, $feed_nid = 0, &$context) { $context['finished'] = FEEDS_BATCH_COMPLETE; try { // main work doing here $context['finished'] = feeds_source($importer_id, $feed_nid)->$method(); } catch (Exception $e) { drupal_set_message($e->getMessage(), 'error'); } } 08.09.2011 Kyiv Drupal Cafe`
  • 5. FeedsSource::import $this->acquireLock(); try { // Fetch. if (empty($this->fetcher_result) || FEEDS_BATCH_COMPLETE == $this- >progressParsing()) { $this->fetcher_result = $this->importer->fetcher->fetch($this); //…. } // Parse. $parser_result = $this->importer->parser->parse($this, $this->fetcher_result); module_invoke_all('feeds_after_parse', $this, $parser_result); // Process. $this->importer->processor->process($this, $parser_result); } catch (Exception $e) { // …. } $this->releaseLock(); 08.09.2011 Kyiv Drupal Cafe`
  • 6. Feeds hooks function feeds_hook_info() { $hooks = array( 'feeds_after_parse', 'feeds_after_import', 'feeds_after_clear', 'feeds_processor_targets_alter', 'feeds_parser_sources_alter', ); 08.09.2011 Kyiv Drupal Cafe`
  • 7. Feeds plugins hook_feeds_plugins() function ofeeds_feeds_plugins() { $info = array(); $info['OpenERP_Fetcher'] = array( 'name' => 'OpenERP Fetcher', 'description' => 'Fetches OpenERP objects from Models.', 'help' => 'Fetches OpenERP objects from Models. Additional help will be in a feature', 'handler' => array( 'parent' => 'FeedsFetcher', 'class' => 'OpenERP_Fetcher', 'file' => 'OpenERP_Fetcher.inc', 'path' => drupal_get_path('module', 'ofeeds') . '/fetchers', // Feeds will look for OpenERP_Fetcher.inc in the ofeeds/fetchers directory. ), ); return $info; } 08.09.2011 Kyiv Drupal Cafe`
  • 8. Feeds plugins ●class FeedsPlugin extends FeedsConfigurable implements FeedsSourceInterface methods: save, sourceForm, configForm, loadMappers... FeedsFetcher extends FeedsPlugin ● methods: clear, fetch... FeedsParser extends FeedsPlugin ● methods: parse, clear... ●FeedsProcessor extends FeedsPlugin methods: process, entityType, newEntity, entityLoad, entitySave, entityDeleteMultiple 08.09.2011 Kyiv Drupal Cafe`
  • 9. Feeds plugins forms ● configForm // forms displayed at feeds instance settings tab (admin level) FE: OpenERP_Fetcher::configForm($fs) – select model, setting for limiting count of fetched data etc. Exportable as config array !!! (via import export clone) // configFormSubmit,configFormValidate ● sourceForm // forms displayed at /import/$feeds_instance page and at content type creation forms (user level) FE: FeedsFileFetcher::sourceForm($sc) – upload file form, form for listing already uploaded files etc. // sourceFormValidate, sourceFormSubmit 08.09.2011 Kyiv Drupal Cafe`
  • 10. Feeds tricks function ofeeds_ctools_plugin_api($owner, $api) { if ($owner == 'feeds' && $api == 'plugins') { return array('version' => 1); } } function ofeeds_enable() { //clear the cache to display in Feeds as available plugin. cache_clear_all('plugins:feeds:plugins', 'cache'); } // Do not use variable_set as instances config !!!    
  • 11. Thanks Andriy Podanenko @podarok podarokua@gmail.com http://twitter.com/podarok http://facebook.com/podarok http://drupal.org/user/116002