[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/kernel/classes/ -> ezpackagehandler.php (source)

   1  <?php
   2  //
   3  // Definition of eZPackageHandler class
   4  //
   5  // Created on: <01-Aug-2003 17:11:07 amos>
   6  //
   7  // SOFTWARE NAME: eZ publish
   8  // SOFTWARE RELEASE: 3.9.0
   9  // BUILD VERSION: 17785
  10  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
  11  // SOFTWARE LICENSE: GNU General Public License v2.0
  12  // NOTICE: >
  13  //   This program is free software; you can redistribute it and/or
  14  //   modify it under the terms of version 2.0  of the GNU General
  15  //   Public License as published by the Free Software Foundation.
  16  //
  17  //   This program is distributed in the hope that it will be useful,
  18  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  19  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20  //   GNU General Public License for more details.
  21  //
  22  //   You should have received a copy of version 2.0 of the GNU General
  23  //   Public License along with this program; if not, write to the Free
  24  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  25  //   MA 02110-1301, USA.
  26  //
  27  //
  28  
  29  /*! \file ezpackagehandler.php
  30  */
  31  
  32  /*!
  33    \class eZPackageHandler ezpackagehandler.php
  34    \brief The class eZPackageHandler does
  35  
  36  */
  37  
  38  class eZPackageHandler
  39  {
  40      /*!
  41       Constructor
  42      */
  43      function eZPackageHandler( $handlerType, $parameters = array() )
  44      {
  45          $parameters = array_merge( array( 'extract-install-content' => false ),
  46                                     $parameters );
  47          $this->ExtractInstallContent = $parameters['extract-install-content'];
  48          $this->HandlerType = $handlerType;
  49      }
  50  
  51      /*!
  52       \virtual
  53       \return true if the content of the install item should be extracted
  54               from disk before the install() function is called.
  55      */
  56      function extractInstallContent()
  57      {
  58          return $this->ExtractInstallContent;
  59      }
  60  
  61      /*!
  62       \pure
  63       Installs the package item
  64      */
  65      function install( &$package, $installType, $parameters,
  66                        $name, $os, $filename, $subdirectory,
  67                        &$content, &$installParameters, &$installData )
  68      {
  69      }
  70  
  71      /*!
  72       \pure
  73       Uninstalls the package item
  74      */
  75      function uninstall( &$package, $installType, $parameters,
  76                          $name, $os, $filename, $subdirectory,
  77                          $installParameters, &$installData )
  78      {
  79      }
  80  
  81      /*!
  82       \return the name of the type this handler works for.
  83      */
  84      function handlerType()
  85      {
  86          return $this->HandlerType;
  87      }
  88  
  89      /*!
  90       \virtual
  91       Resets all data in the handler so that it's ready to handle a new package.
  92      */
  93      function reset()
  94      {
  95      }
  96  
  97      /*!
  98       \pure
  99       Returns an explanation (human readable) for the install item \a $installItem.
 100       The explanation is an array with the following items.
 101       - description - Textual description of what will be installed
 102  
 103       \note This must be implemented for package handlers.
 104      */
 105      function explainInstallItem( &$package, $installItem )
 106      {
 107      }
 108  
 109      /*!
 110       \pure
 111       Adds items defined in \a $parameters to the package \a $package.
 112      */
 113      function add( $packageType, &$package, $parameters )
 114      {
 115      }
 116  
 117      /*!
 118       \pure
 119       Called when command line parameters must be handled by the package handler.
 120       This function must return an array with values which can easily be used in the add() function.
 121       \param $packageType The type that was specified when using the add command,
 122                           which is either the name of this handler or an alias for it.
 123       \param $package     The package object.
 124       \param $cli         Command line interface object, can be used to output errors etc.
 125       \param $arguments   An array with string values taken from the command line after the add command.
 126      */
 127      function handleAddParameters( $packageType, &$package, &$cli, $arguments )
 128      {
 129      }
 130  
 131  //     /*!
 132  //      \pure
 133  //      Inteprets the parameters defined in \a $parameters and adds items to \a $package.
 134  //     */
 135  //     function handle( &$package, $parameters )
 136  //     {
 137  //     }
 138  
 139      /*!
 140       \pure
 141       Fills in extra information on the dependency node \a $dependencyNode which is
 142       specific to the current handler.
 143       \param $package The current package.
 144       \param $dependencyItem Contains all variables for the dependency
 145       \param $dependencySection The section for the dependency, can be \c 'provide', \c 'require', \c 'obsolete' or \c 'conflict'
 146      */
 147      function createDependencyNode( &$package, &$dependencyNode, $dependencyItem, $dependencySection )
 148      {
 149      }
 150  
 151      /*!
 152       \pure
 153       Parses the XML node \c $dependencyNode and fills in extra information not handled
 154       by the package parser.
 155       \param $package The current package.
 156       \param $dependencyParameters Reference to an array with must be filled with specific data for the current handler.
 157       \param $dependencySection The section for the dependency, can be \c 'provide', \c 'require', \c 'obsolete' or \c 'conflict'
 158      */
 159      function parseDependencyNode( &$package, &$dependencyNode, &$dependencyParameters, $dependencySection )
 160      {
 161      }
 162  
 163      /*!
 164       \virtual
 165       Creates a text specific for the dependency item \a $dependencyItem and returns it.
 166       \param $package The current package.
 167       \param $dependencyItem Associative array with dependency values.
 168       \param $dependencySection The section for the dependency, can be \c 'provide', \c 'require', \c 'obsolete' or \c 'conflict'
 169       \return \c false if no special text is required.
 170      */
 171      function createDependencyText( &$package, $dependencyItem, $dependencySection )
 172      {
 173      }
 174  
 175      /*!
 176       \pure
 177       Fills in extra information on the install node \a $installNode which is
 178       specific to the current handler.
 179       \param $package The current package.
 180       \param $installItem Contains all variables for the install
 181       \param $installType The type of install, can be \c 'install' or \c 'uninstall'
 182      */
 183      function createInstallNode( &$package, &$installNode, $installItem, $installType )
 184      {
 185      }
 186  
 187      /*!
 188       \pure
 189       Parses the XML node \c $installNode and fills in extra information not handled
 190       by the package parser.
 191       \param $package The current package.
 192       \param $installParameters Reference to an array which must be filled with specific data for the current handler.
 193       \param $isInstall Is \c true if this is an install node, \c false if it is an uninstall node
 194      */
 195      function parseInstallNode( &$package, &$installNode, &$installParameters, $isInstall )
 196      {
 197      }
 198  
 199      /*!
 200          Helper function to process install errors.
 201          Decides to skip current element or not when cycling thru elements
 202          Also skips element where error has occured if action is not choosen
 203      */
 204  
 205      function isErrorElement( $elementID, &$installParameters )
 206      {
 207          if ( $elementID == $installParameters['error']['element_id'] )
 208          {
 209              // If action not set - skip this element
 210              if ( !isset( $installParameters['error']['choosen_action'] ) )
 211              {
 212                   $installParameters['error'] = array();
 213                   return false;
 214              }
 215              return true;
 216          }
 217          return false;
 218  
 219      }
 220  
 221      /*!
 222          Helper function to process install errors.
 223          \return choosen action code.
 224          If $resetError is false, array should be manually reset in handler.
 225      */
 226  
 227      function errorChoosenAction( $errorCode, &$installParameters, $description = false, $handlerType = false, $resetError = true )
 228      {
 229          if ( isset( $installParameters['non-interactive'] ) && $installParameters['non-interactive'] )
 230          {
 231              if ( $description )
 232              {
 233                  eZDebug::writeNotice( $description, 'Package installation conflict' );
 234              }
 235              return EZ_PACKAGE_NON_INTERACTIVE;
 236          }
 237  
 238          if ( !$handlerType )
 239              $handlerType = $this->HandlerType;
 240  
 241          if ( isset( $installParameters['error_default_actions'][$handlerType][$errorCode] ) )
 242          {
 243              if ( $resetError && count( $installParameters['error'] ) )
 244                  $installParameters['error'] = array();
 245              return $installParameters['error_default_actions'][$handlerType][$errorCode];
 246          }
 247  
 248          if ( isset( $installParameters['error']['error_code'] ) &&
 249               $installParameters['error']['error_code'] == $errorCode )
 250          {
 251              if ( isset( $installParameters['error']['choosen_action'] ) )
 252              {
 253                  $choosenAction = $installParameters['error']['choosen_action'];
 254                  if ( $resetError )
 255                      $installParameters['error'] = array();
 256                  return $choosenAction;
 257              }
 258          }
 259          return false;
 260      }
 261  
 262  }
 263  
 264  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7