daily pastebin goal
64%
SHARE
TWEET

SQLIImport - Interface for import handlers

a guest Aug 17th, 2010 387 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3.  * Interface for import handlers
  4.  * Must be implemented by all import handlers
  5.  * @copyright Copyright (C) 2010 - SQLi Agency. All rights reserved
  6.  * @licence http://www.gnu.org/licenses/gpl-2.0.txt GNU GPLv2
  7.  * @author Jerome Vieilledent
  8.  * @package sqliimport
  9.  * @subpackage sourcehandlers
  10.  */
  11. interface ISQLIImportHandler
  12. {
  13.     /**
  14.      * Constructor
  15.      */
  16.     public function __construct( SQLIImportHandlerOptions $options = null );
  17.    
  18.     /**
  19.      * Main method called to configure/initialize handler.
  20.      * Here you may read your data to import
  21.      */
  22.     public function initialize();
  23.    
  24.     /**
  25.      * Get the number of iterations needed to complete the process.
  26.      * For example, if you have 150 XML nodes to process, you may return 150.
  27.      * This is needed to display import progression in admin interface
  28.      * @return int
  29.      */
  30.     public function getProcessLength();
  31.    
  32.     /**
  33.      * Must return next row to process.
  34.      * In an iteration over several XML nodes, you'll return the current node (like current() function for arrays)
  35.      */
  36.     public function getNextRow();
  37.    
  38.     /**
  39.      * Main method to process current row returned by getNextRow() method.
  40.      * You may throw an exception if something goes wrong. It will be logged but won't break the import process
  41.      * @param mixed $row Depending on your data format, can be DOMNode, SimpleXMLIterator, SimpleXMLElement, CSV row...
  42.      */
  43.     public function process( $row );
  44.    
  45.     /**
  46.      * Final method called at the end of the handler process.
  47.      */
  48.     public function cleanup();
  49.    
  50.     /**
  51.      * Returns full handler name
  52.      */
  53.     public function getHandlerName();
  54.    
  55.     /**
  56.      * Returns handler identifier, as in sqliimport.ini
  57.      */
  58.     public function getHandlerIdentifier();
  59.    
  60.     /**
  61.      * Returns notes for import progression. Can be any string (an ID, a reference...)
  62.      * Can be for example ID of row your import handler has just processed
  63.      * @return string
  64.      */
  65.     public function getProgressionNotes();
  66. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top