eZ Publish  [4.2]
eZSiteInstaller Class Reference

A set of functions to do web-site installation from command-line. More...

List of all members.

Public Member Functions

 addClassAttributes ($params)
 addPoliciesForRole ($params)
 addSetting ($name, $value)
 assignUserToRole ($params)
 buildFunctionParams (&$params)
 classByIdentifier ($params)
 classIDbyIdentifier ($params)
 contentObjectByName ($params)
 contentObjectByUrl ($params)
 createContentObject ($params)
 createContentSection ($params)
 createSiteAccess ($params)
 createSiteaccessUrls ($params)
 dbBegin ($params)
 dbCommit ($params)
 defaultErrorHandler ()
 execFunction ($function)
 executeSteps ($steps)
 extractHostname ($uri)
 eZSiteInstaller ($parameters=false)
 handleError ()
 hasSetting ($name)
 initSettings ($parameters)
 initSteps ()
instance ($params)
 isFunctionParam ($param)
 languageNameFromLocale ($locale)
 languageNameListFromLocaleList ($localeList)
 lastErrorCode ()
 moveTreeNode ($params)
 nodeByName ($params)
 nodeByUrl ($params)
 nodeIdByName ($params)
 nodePathStringByURL ($params)
 packageFileItemPath ($params)
 postInstall ()
 postInstallSteps ()
 removeClassAttribute ($params)
 removeContentObject ($params)
 removePoliciesForRole ($params)
 renameContentObject ($params)
 reportError ($text, $caption, $errCode=eZSiteInstaller::ERR_ABORT)
 sectionIDbyName ($params)
 setLastErrorCode ($errCode)
 setRSSExport ($params)
 setSection ($params)
 setting ($name)
 setVersion ($params=false)
 solutionName ()
 solutionVersion ()
 swapNodes ($params)
 updateClassAttributes ($params)
 updateContentObjectAttributes ($params)
 updateINIFiles ($params)
 updateObjectAttributeFromString ($params)
 updatePreferences ($params)
 updateRoles ($params)

Static Public Member Functions

 getParam ($params, $name, $defaultValue=false)

Public Attributes

 $LastErrorCode
 $Settings
 $Steps
const ERR_ABORT = 1
const ERR_CONTINUE = 2
const ERR_OK = 0

Detailed Description

A set of functions to do web-site installation from command-line.

Helps simplify installation process by providing a set of steps which will be executed sequentially. This class contains a common functions which can be reused in particular installtions.

Definition at line 43 of file ezsiteinstaller.php.


Member Function Documentation

eZSiteInstaller::addClassAttributes ( params)

Add attribute to the content class Params: array( 'class' => array( 'identifier' => optional, string: identifire of content class; see 'id'; 'id' => optional, ID of content class. if set it's used instead of 'class_identifier' to speed up things. you must supply either 'class_identifier' or 'class_id'; ), 'attributes' => array( array( 'identifier' => attibute identifier, 'name' => attribute name, 'data_type_string' => attribute datatype, 'default_value' => optional, attribute default value, default is 'false' 'can_translate' => optional, default '1' 'is_required' => optional, default '0' 'is_searchable' => optional, default '0' 'content' => optional, attribute content ), ... );

Definition at line 419 of file ezsiteinstaller.php.

eZSiteInstaller::addPoliciesForRole ( params)

Add policies from role Params: role_name - name of role; policies - array of policies to remove. Each item is an array of policy definition: array( 'module' => 'function' => ['limitation'] => ); create_role - boolean, optional. If TRUE - will create new role if it doesn't exist. Default is TRUE.

Definition at line 1195 of file ezsiteinstaller.php.

eZSiteInstaller::addSetting ( name,
value 
)

Add setting with $name and $value.

Definition at line 114 of file ezsiteinstaller.php.

eZSiteInstaller::assignUserToRole ( params)

Assign user to role. Params: location - path to user node where user object is located; role_name - name of role to assign;

Definition at line 1170 of file ezsiteinstaller.php.

eZSiteInstaller::buildFunctionParams ( &$  params)

Prepare parameters for function executed in step definition.

Definition at line 210 of file ezsiteinstaller.php.

Referenced by execFunction().

eZSiteInstaller::classByIdentifier ( params)

Return content class. Params: 'identifier' - identifier of the class.

Definition at line 331 of file ezsiteinstaller.php.

Referenced by addClassAttributes(), and classIDbyIdentifier().

eZSiteInstaller::classIDbyIdentifier ( params)

Return ID of the content class. Params: 'identifier' - identifier of the class.

Definition at line 312 of file ezsiteinstaller.php.

Referenced by updateClassAttributes().

eZSiteInstaller::contentObjectByName ( params)

Return content object. The first object is returned in case if several objects have the same name. Params: 'name' - object's name to look up; 'class_id' - optional, ID of content class;

Definition at line 654 of file ezsiteinstaller.php.

Referenced by nodeByName(), and removeContentObject().

eZSiteInstaller::contentObjectByUrl ( params)

Return content object by path identification string of its node. Params: 'location' - path_identification_string of the node.

Definition at line 587 of file ezsiteinstaller.php.

Referenced by updateObjectAttributeFromString().

eZSiteInstaller::createContentObject ( params)

Create content object. Params: class_identifier - identifier of class; location - path identification string of parent node; attributes - array with object attributes;

Definition at line 607 of file ezsiteinstaller.php.

eZSiteInstaller::createContentSection ( params)

Create new content section. Params: 'name' - string: section name; 'navigation_part_identifier' - string: identifier of navigation part;

Definition at line 1305 of file ezsiteinstaller.php.

eZSiteInstaller::createSiteAccess ( params)

Create localized siteaccess: copy general setting form 'source' siteaccess, apply new custom settings(locale, others...).

Definition at line 1554 of file ezsiteinstaller.php.

Referenced by createTranslationSiteAccesses().

eZSiteInstaller::createSiteaccessUrls ( params)

Create siteaccess urls for additional user siteacceses using info about access type(host, post, uri) Params: 'siteaccess_list' - list of siteaccess names to build urls; 'access_type' - access type: port, hostname, url; 'access_type_value' - access type value provided by setup wizard 'exclude_port_list' - optional, ports to skip. used if 'access_type' is 'port'; 'host' - host name 'host_prepend_siteaccess' - optional, boolean which instructs to prepend the site access name or not to the value of 'host', by default true

Definition at line 1465 of file ezsiteinstaller.php.

eZSiteInstaller::dbBegin ( params)

Start transaction. Params: no params

Definition at line 283 of file ezsiteinstaller.php.

eZSiteInstaller::dbCommit ( params)

Commit transaction. Params: no params

Definition at line 294 of file ezsiteinstaller.php.

eZSiteInstaller::defaultErrorHandler ( )

Default error handler

Definition at line 1720 of file ezsiteinstaller.php.

Referenced by executeSteps().

eZSiteInstaller::execFunction ( function)

Execute $function defined in step

Definition at line 196 of file ezsiteinstaller.php.

Referenced by buildFunctionParams(), and executeSteps().

eZSiteInstaller::executeSteps ( steps)

Execute $steps

Definition at line 169 of file ezsiteinstaller.php.

Referenced by postInstall().

eZSiteInstaller::extractHostname ( uri)

Helper function used for extracting hostname from the given

Parameters:
$uri

Definition at line 1443 of file ezsiteinstaller.php.

Referenced by createSiteaccessUrls().

eZSiteInstaller::eZSiteInstaller ( parameters = false)

Definition at line 49 of file ezsiteinstaller.php.

eZSiteInstaller::getParam ( params,
name,
defaultValue = false 
) [static]

Return a value from $params hash. Return $defaultValue is value is not set. $name - a key in $params hash. $name can point to 2-dimensional array. example: $name = 'foo' will return $params['foo']; $name = 'foo/boo' will return $params['foo']['boo']

Definition at line 1695 of file ezsiteinstaller.php.

eZSiteInstaller::handleError ( )

Virtual function to re-implement in derived classes to handle error. Default error handler will be called if returns FALSE.

Definition at line 1729 of file ezsiteinstaller.php.

Referenced by executeSteps().

eZSiteInstaller::hasSetting ( name)

Return TRUE if setting exist, otherwise FALSE.

Definition at line 140 of file ezsiteinstaller.php.

Referenced by setting().

eZSiteInstaller::initSettings ( parameters)

Initialize $Settings member with custom values which can be used in install steps.

Definition at line 67 of file ezsiteinstaller.php.

Referenced by eZSiteInstaller().

eZSiteInstaller::initSteps ( )

Define install steps Step definition: array( '_function' => <function_name>, '_params' => array( <param_list> ) ) where '_function' defines function name(which should be implemented within installer class) which will be called, '_params' is an array of parameters which will be passed to function <function_name>. Note that items of <param_list> can be defined in the form as <step definition>=""> and this rule can be applied recursively.

Each function used in step definition should be defined as: function someFunction( $params ) { ... you code goes here ...

optionally you can set $LastErrorCode to 'eZSiteInstaller::ERR_ABORT' if you want to break installation if some step is failed. $this->setLastErrorCode( eZSiteInstaller::ERR_ABORT ); }

Example: array( '_function' => 'step_1', '_params' => array( 'param_a' => 'foo', 'param_b' => array( '_function' => 'helper_function_for_b', '_params' => array( 'param_b_a' => 'goo', 'param_b_b' => array( '_function' => 'helper_functin_for_b_b', '_params' => array( 'param_b_b_a' => 'b_b_a' ) ) ) ) ) ); Execution flow:

  • $b_b = helper_function_b_b( array( 'param_b_b_a' => 'b_b_a' ) );
  • $b = helper_function_for_b( array( 'param_b_a' => 'goo', 'param_b_b' => $b_b ) );
  • $result = step_1( array( 'param_a' => 'foo', 'param_b' => $b ) );

Definition at line 106 of file ezsiteinstaller.php.

Referenced by eZSiteInstaller().

& eZSiteInstaller::instance ( params)
eZSiteInstaller::isFunctionParam ( param)

Return TRUE is custom function should be called to prepare params, otherwise FALSE( $param is constant).

Definition at line 228 of file ezsiteinstaller.php.

Referenced by buildFunctionParams().

eZSiteInstaller::languageNameFromLocale ( locale)

Return language name from locale string. Example: 'rus' from 'rus-RU'

Definition at line 1433 of file ezsiteinstaller.php.

Referenced by createTranslationSiteAccesses(), and languageNameListFromLocaleList().

eZSiteInstaller::languageNameListFromLocaleList ( localeList)

Build array of language names from locale list. Example: array( 'eng-GB', 'rus-RU' ) => array( 'eng', 'rus' )

Definition at line 1420 of file ezsiteinstaller.php.

eZSiteInstaller::lastErrorCode ( )

Get last error code.

Definition at line 248 of file ezsiteinstaller.php.

Referenced by defaultErrorHandler(), and executeSteps().

eZSiteInstaller::moveTreeNode ( params)

Move node. Params: 'node' - array( 'name' => object's name to move, 'class_id' => optional, object's content class ID );

'parent_node' - array( 'name' => parent object's name to move; 'class_id' => optional, parent object's content class ID );

Definition at line 994 of file ezsiteinstaller.php.

eZSiteInstaller::nodeByName ( params)

Definition at line 974 of file ezsiteinstaller.php.

Referenced by nodeIdByName().

eZSiteInstaller::nodeByUrl ( params)

Return node. Params: 'location' - path_identification_string of the node.

Definition at line 939 of file ezsiteinstaller.php.

Referenced by assignUserToRole(), contentObjectByUrl(), createContentObject(), nodePathStringByURL(), and setSection().

eZSiteInstaller::nodeIdByName ( params)

Definition at line 958 of file ezsiteinstaller.php.

Referenced by moveTreeNode(), and swapNodes().

eZSiteInstaller::nodePathStringByURL ( params)

Return 'path_string' attribute of the node. Params: 'location' - path_identification_string of the node.

Definition at line 920 of file ezsiteinstaller.php.

eZSiteInstaller::packageFileItemPath ( params)

Return path for package item.

Definition at line 1390 of file ezsiteinstaller.php.

eZSiteInstaller::postInstall ( )

Execute 'post_install' steps

Definition at line 160 of file ezsiteinstaller.php.

eZSiteInstaller::postInstallSteps ( )

Return 'post_install' steps

Definition at line 152 of file ezsiteinstaller.php.

Referenced by postInstall().

eZSiteInstaller::removeClassAttribute ( params)

Remove attribute from the content class Params: 'class_id' - ID of content class to remove attribute from; 'attribute_identifier' - attibute identifier to remove;

Definition at line 358 of file ezsiteinstaller.php.

eZSiteInstaller::removeContentObject ( params)

Remove content object. Params: see 'contentObjectByName'

Definition at line 678 of file ezsiteinstaller.php.

eZSiteInstaller::removePoliciesForRole ( params)

Remove policies from role Params: role_name - name of role; policies - array of policies to remove. Each item is an array of policy definition: array( 'module' => , 'function' => ); remove_role - boolean, optional. If TRUE - empty(without policies) role will be removed. Default is TRUE.

Definition at line 1242 of file ezsiteinstaller.php.

eZSiteInstaller::renameContentObject ( params)

Change name of content object. Params: contentobject_id - ID of object; name - new object name;

Definition at line 638 of file ezsiteinstaller.php.

eZSiteInstaller::reportError ( text,
caption,
errCode = eZSiteInstaller::ERR_ABORT 
)

Set last error code and write error message to debug output Params: $text - error message text; $caption - error message caption; $errCode - error code to set;

Definition at line 260 of file ezsiteinstaller.php.

Referenced by addClassAttributes(), addPoliciesForRole(), executeSteps(), nodeByUrl(), removeClassAttribute(), removePoliciesForRole(), swapNodes(), updateContentObjectAttributes(), and updateObjectAttributeFromString().

eZSiteInstaller::sectionIDbyName ( params)

Return ID of the section. Params: 'section_name' - name of the section

Definition at line 1280 of file ezsiteinstaller.php.

Referenced by setSection().

eZSiteInstaller::setLastErrorCode ( errCode)

Set last error code.

Definition at line 240 of file ezsiteinstaller.php.

Referenced by reportError().

eZSiteInstaller::setRSSExport ( params)

Create rss export.

Definition at line 1352 of file ezsiteinstaller.php.

eZSiteInstaller::setSection ( params)

Assign section to subtree. Params: 'section_name' - string: section name; 'location' - string: path_identification_string of the node(root node of subtree);

Definition at line 1326 of file ezsiteinstaller.php.

eZSiteInstaller::setting ( name)

Return value for setting $name.

Definition at line 122 of file ezsiteinstaller.php.

Referenced by packageFileItemPath().

eZSiteInstaller::setVersion ( params = false)

Set solution name and version into db. Params: not used

Definition at line 1604 of file ezsiteinstaller.php.

eZSiteInstaller::solutionName ( )

Definition at line 1594 of file ezsiteinstaller.php.

Referenced by setVersion().

eZSiteInstaller::solutionVersion ( )

Definition at line 1589 of file ezsiteinstaller.php.

Referenced by setVersion().

eZSiteInstaller::swapNodes ( params)

Swap two nodes. It's a copy/paste from kernel/content/action.php

Definition at line 1008 of file ezsiteinstaller.php.

eZSiteInstaller::updateClassAttributes ( params)

Update class attribute data. Currently only attribute 'name' is supported. Params: 'class' - array( 'identifier' - identifire of content class ); 'attributes - array( array( 'identifier' - attibute identifier to update; 'new_name' - new attribute name ), ... );

Definition at line 543 of file ezsiteinstaller.php.

eZSiteInstaller::updateContentObjectAttributes ( params)

Definition at line 763 of file ezsiteinstaller.php.

eZSiteInstaller::updateINIFiles ( params)

Definition at line 1616 of file ezsiteinstaller.php.

eZSiteInstaller::updateObjectAttributeFromString ( params)

Update contentObjectAttribute with value specified in string. The object can be specified either by ID or by path identification string of its node. Params: object_id - optional, ID of object to update; location - optional, path to node with object; class_attribute_identifier - an identifier of attribute to update; string - new attribute value;

Definition at line 709 of file ezsiteinstaller.php.

eZSiteInstaller::updatePreferences ( params)

Definition at line 1672 of file ezsiteinstaller.php.

eZSiteInstaller::updateRoles ( params)

Definition at line 1632 of file ezsiteinstaller.php.


Member Data Documentation

eZSiteInstaller::$LastErrorCode

Definition at line 1740 of file ezsiteinstaller.php.

eZSiteInstaller::$Settings

Definition at line 1736 of file ezsiteinstaller.php.

eZSiteInstaller::$Steps

Definition at line 1738 of file ezsiteinstaller.php.

Definition at line 46 of file ezsiteinstaller.php.

Referenced by executeSteps().

Definition at line 47 of file ezsiteinstaller.php.

Referenced by updateContentObjectAttributes().

Definition at line 45 of file ezsiteinstaller.php.

Referenced by executeSteps(), and eZSiteInstaller().


The documentation for this class was generated from the following file: