eZ Publish  [trunk]
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 installations.

Definition at line 22 of file ezsiteinstaller.php.


Member Function Documentation

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 398 of file ezsiteinstaller.php.

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 1174 of file ezsiteinstaller.php.

eZSiteInstaller::addSetting ( name,
value 
)

Add setting with $name and $value.

Definition at line 93 of file ezsiteinstaller.php.

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 1149 of file ezsiteinstaller.php.

Prepare parameters for function executed in step definition.

Definition at line 189 of file ezsiteinstaller.php.

Referenced by execFunction().

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

Definition at line 310 of file ezsiteinstaller.php.

Referenced by addClassAttributes(), and classIDbyIdentifier().

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

Definition at line 291 of file ezsiteinstaller.php.

Referenced by updateClassAttributes().

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 633 of file ezsiteinstaller.php.

Referenced by nodeByName(), and removeContentObject().

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

Definition at line 566 of file ezsiteinstaller.php.

Referenced by updateObjectAttributeFromString().

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

Definition at line 586 of file ezsiteinstaller.php.

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

Definition at line 1284 of file ezsiteinstaller.php.

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

Definition at line 1537 of file ezsiteinstaller.php.

Referenced by createTranslationSiteAccesses().

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 1448 of file ezsiteinstaller.php.

eZSiteInstaller::dbBegin ( params)

Start transaction. Params: no params

Definition at line 262 of file ezsiteinstaller.php.

Commit transaction. Params: no params

Definition at line 273 of file ezsiteinstaller.php.

Default error handler

Definition at line 1705 of file ezsiteinstaller.php.

Referenced by executeSteps().

Execute $function defined in step

Definition at line 175 of file ezsiteinstaller.php.

Referenced by buildFunctionParams(), and executeSteps().

Execute $steps

Definition at line 148 of file ezsiteinstaller.php.

Referenced by postInstall().

Helper function used for extracting hostname from the given

Parameters:
$uri

Definition at line 1426 of file ezsiteinstaller.php.

Referenced by createSiteaccessUrls().

Definition at line 28 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 1680 of file ezsiteinstaller.php.

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

Definition at line 1714 of file ezsiteinstaller.php.

Referenced by executeSteps().

Return TRUE if setting exist, otherwise FALSE.

Definition at line 119 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 46 of file ezsiteinstaller.php.

Referenced by eZSiteInstaller().

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 85 of file ezsiteinstaller.php.

Referenced by eZSiteInstaller().

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

Definition at line 207 of file ezsiteinstaller.php.

Referenced by buildFunctionParams().

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

Definition at line 1416 of file ezsiteinstaller.php.

Referenced by createTranslationSiteAccesses(), and languageNameListFromLocaleList().

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

Definition at line 1403 of file ezsiteinstaller.php.

Get last error code.

Definition at line 227 of file ezsiteinstaller.php.

Referenced by defaultErrorHandler(), and executeSteps().

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 973 of file ezsiteinstaller.php.

Definition at line 953 of file ezsiteinstaller.php.

Referenced by nodeIdByName().

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

Definition at line 918 of file ezsiteinstaller.php.

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

Definition at line 937 of file ezsiteinstaller.php.

Referenced by moveTreeNode(), and swapNodes().

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

Definition at line 899 of file ezsiteinstaller.php.

Return path for package item.

Definition at line 1373 of file ezsiteinstaller.php.

Execute 'post_install' steps

Definition at line 139 of file ezsiteinstaller.php.

Return 'post_install' steps

Definition at line 131 of file ezsiteinstaller.php.

Referenced by postInstall().

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 337 of file ezsiteinstaller.php.

Remove content object. Params: see 'contentObjectByName'

Definition at line 657 of file ezsiteinstaller.php.

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 1221 of file ezsiteinstaller.php.

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

Definition at line 617 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 239 of file ezsiteinstaller.php.

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

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

Definition at line 1259 of file ezsiteinstaller.php.

Referenced by setSection().

Set last error code.

Definition at line 219 of file ezsiteinstaller.php.

Referenced by reportError().

Create rss export.

Definition at line 1331 of file ezsiteinstaller.php.

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 1305 of file ezsiteinstaller.php.

Return value for setting $name.

Definition at line 101 of file ezsiteinstaller.php.

Referenced by packageFileItemPath().

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

Definition at line 1589 of file ezsiteinstaller.php.

Definition at line 1578 of file ezsiteinstaller.php.

Referenced by setVersion().

Definition at line 1572 of file ezsiteinstaller.php.

Referenced by setVersion().

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

Definition at line 987 of file ezsiteinstaller.php.

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 522 of file ezsiteinstaller.php.

Definition at line 742 of file ezsiteinstaller.php.

Definition at line 1601 of file ezsiteinstaller.php.

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 688 of file ezsiteinstaller.php.

Definition at line 1657 of file ezsiteinstaller.php.

Definition at line 1617 of file ezsiteinstaller.php.


Member Data Documentation

eZSiteInstaller::$LastErrorCode

Definition at line 1725 of file ezsiteinstaller.php.

eZSiteInstaller::$Settings

Definition at line 1721 of file ezsiteinstaller.php.

eZSiteInstaller::$Steps

Definition at line 1723 of file ezsiteinstaller.php.

Definition at line 25 of file ezsiteinstaller.php.

Referenced by executeSteps().

Definition at line 26 of file ezsiteinstaller.php.

Referenced by updateContentObjectAttributes().

Definition at line 24 of file ezsiteinstaller.php.

Referenced by executeSteps(), and eZSiteInstaller().


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