Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezsiteinstaller.php
Go to the documentation of this file.
1 <?php
22 class eZSiteInstaller
23 {
24 const ERR_OK = 0;
25 const ERR_ABORT = 1;
26 const ERR_CONTINUE = 2;
27
28 public function __construct( $parameters = false )
29 {
30 $this->initSettings( $parameters );
31 $this->initSteps();
32
33 $this->LastErrorCode = eZSiteInstaller::ERR_OK;
34 }
35
40 function eZSiteInstaller( $parameters = false )
41 {
42 self::__construct( $parameters );
43 }
44
45 function &instance( $params )
46 {
47 eZDebug::writeWarning( "Your installer doesn't implement 'instance' function", __METHOD__ );
48 return false;
49 }
50
55 function initSettings( $parameters )
56 {
57 eZDebug::writeWarning( "Your installer doesn't implement 'initSettings' function", __METHOD__ );
58 }
59
94 function initSteps()
95 {
96 eZDebug::writeWarning( "Your installer doesn't implement 'initSteps' function", __METHOD__ );
97 }
98
102 function addSetting( $name, $value )
103 {
104 $this->Settings[$name] = $value;
105 }
106
110 function setting( $name )
111 {
112 $value = false;
113 if( $this->hasSetting( $name ) )
114 {
115 $value = $this->Settings[$name];
116 }
117 else
118 {
119 eZDebug::writeWarning( "Setting '$name' doesn't exist", __METHOD__ );
120 }
121
122 return $value;
123 }
124
128 function hasSetting( $name )
129 {
130 $hasSetting = false;
131 if( isset( $this->Settings[$name] ) )
132 $hasSetting = true;
133
134 return $hasSetting;
135 }
136
140 function postInstallSteps()
141 {
142 return $this->Steps['post_install'];
143 }
144
148 function postInstall()
149 {
150 $steps = $this->postInstallSteps();
151 $this->executeSteps( $steps );
152 }
153
157 function executeSteps( $steps )
158 {
159 $stepNum = 1;
160 foreach( $steps as $step )
161 {
162 $this->execFunction( $step );
163
164 if( $this->lastErrorCode() !== eZSiteInstaller::ERR_OK )
165 {
166 $res = $this->handleError();
167 if( $res === false )
168 $res = $this->defaultErrorHandler();
169
170 if( $res === eZSiteInstaller::ERR_ABORT )
171 {
172 $this->reportError( "Aborting execution on step number $stepNum: '". $step['_function'] ."'", 'eZSiteInstaller::postInstall' );
173 break;
174 }
175 }
176
177 ++$stepNum;
178 }
179 }
180
184 function execFunction( $function )
185 {
186 $functionName = $function['_function'];
187
188 $this->buildFunctionParams( $function['_params'] );
189
190 $result = $this->$functionName( $function['_params'] );
191
192 return $result;
193 }
194
198 function buildFunctionParams( &$params )
199 {
200 foreach( array_keys( $params ) as $paramKey )
201 {
202 if( $this->isFunctionParam( $params[$paramKey] ) )
203 {
204 $params[$paramKey] = $this->execFunction( $params[$paramKey] );
205 }
206 else if( is_array( $params[$paramKey] ) )
207 {
208 $this->buildFunctionParams( $params[$paramKey] );
209 }
210 }
211 }
212
216 function isFunctionParam( $param )
217 {
218 $isFunction = false;
219 if( is_array( $param) && isset( $param['_function'] ) )
220 $isFunction = true;
221
222 return $isFunction;
223 }
224
228 function setLastErrorCode( $errCode )
229 {
230 $this->LastErrorCode = $errCode;
231 }
232
236 function lastErrorCode()
237 {
238 return $this->LastErrorCode;
239 }
240
248 function reportError( $text, $caption, $errCode = eZSiteInstaller::ERR_ABORT )
249 {
250 eZDebug::writeError( $text, $caption );
251
252 $this->setLastErrorCode( $errCode );
253 }
254
255
256 //
257 // Function groups for common use in install steps.
258 //
259
261 // DB:
262 // dbBegin
263 // dbCommit
265
271 function dbBegin( $params )
272 {
273 $db = eZDB::instance();
274 $db->begin();
275 }
276
282 function dbCommit( $params )
283 {
284 $db = eZDB::instance();
285 $db->commit();
286 }
287
288
290 // Content class:
291 // classIDbyIdentifier
292 // classByIdentifier
294
300 function classIDbyIdentifier( $params )
301 {
302 $classID = false;
303
304 $contentClass = $this->classByIdentifier( $params );
305
306 if( is_object( $contentClass ) )
307 {
308 $classID = $contentClass->attribute( 'id' );
309 }
310
311 return $classID;
312 }
313
319 function classByIdentifier( $params )
320 {
321 $classIdentifier = $params['identifier'];
322
323 $contentClass = eZContentClass::fetchByIdentifier( $classIdentifier );
324 if( !is_object( $contentClass ) )
325 {
326 eZDebug::writeWarning( "Content class with identifier '$classIdentifier' doesn't exist.", __METHOD__ );
327 }
328
329 return $contentClass;
330 }
331
332
334 // Content class attributes:
335 // removeClassAttribute
336 // addClassAttributes
337 // updateClassAttributes
339
346 function removeClassAttribute( $params )
347 {
348 $contentClassID = $params['class_id'];
349 $classAttributeIdentifier = $params['attribute_identifier'];
350
351 // get attributes of 'temporary' version as well
352 $classAttributeList = eZContentClassAttribute::fetchFilteredList( array( 'contentclass_id' => $contentClassID,
353 'identifier' => $classAttributeIdentifier ),
354 true );
355
356 $validation = array();
357 foreach( $classAttributeList as $classAttribute )
358 {
359 $dataType = $classAttribute->dataType();
360 if( $dataType->isClassAttributeRemovable( $classAttribute ) )
361 {
362 $objectAttributes = eZContentObjectAttribute::fetchSameClassAttributeIDList( $classAttribute->attribute( 'id' ) );
363 foreach( $objectAttributes as $objectAttribute )
364 {
365 $objectAttributeID = $objectAttribute->attribute( 'id' );
366 $objectAttribute->removeThis( $objectAttributeID );
367 }
368
369 $classAttribute->removeThis();
370 }
371 else
372 {
373 $removeInfo = $dataType->classAttributeRemovableInformation( $classAttribute );
374 if( $removeInfo === false )
375 $removeInfo = "Unknow reason";
376
377 $validation[] = array( 'id' => $classAttribute->attribute( 'id' ),
378 'identifier' => $classAttribute->attribute( 'identifier' ),
379 'reason' => $removeInfo );
380 }
381 }
382
383 if( count( $validation ) > 0 )
384 {
385 $this->reportError( $validation, 'eZSiteInstaller::removeClassAttribute: Unable to remove eZClassAttribute(s)' );
386 }
387
388 }
389
407 function addClassAttributes( $params )
408 {
409 $classInfo = $params['class'];
410 $attributesInfo = $params['attributes'];
411
412 $classID = isset( $classInfo['id'] ) ? $classInfo['id'] : false;
413 if( $classID )
414 {
415 $class = eZContentClass::fetch( $classID );
416 }
417 else
418 {
419 if( isset( $classInfo['identifier'] ) )
420 {
421 $class = eZSiteInstaller::classByIdentifier( $classInfo );
422 }
423 else
424 {
425 $this->reportError( "neither 'id' nor 'identifier' is set for content class" ,
426 'eZSiteInstaller::addClassAttribute' );
427 }
428 }
429
430 if( !is_object( $class ) )
431 {
432 $this->reportError( "Can't fetch content class" ,
433 'eZSiteInstaller::addClassAttribute' );
434 return;
435 }
436
437 $classID = $class->attribute( 'id' );
438
439 foreach( $attributesInfo as $attributeInfo )
440 {
441 $classAttributeIdentifier = $attributeInfo['identifier'];
442 $classAttributeName = $attributeInfo['name'];
443 $datatype = $attributeInfo['data_type_string'];
444 $defaultValue = isset( $attributeInfo['default_value'] ) ? $attributeInfo['default_value'] : false;
445 $canTranslate = isset( $attributeInfo['can_translate'] ) ? $attributeInfo['can_translate'] : 1;
446 $isRequired = isset( $attributeInfo['is_required'] ) ? $attributeInfo['is_required'] : 0;
447 $isSearchable = isset( $attributeInfo['is_searchable'] ) ? $attributeInfo['is_searchable'] : 0;
448 $attrContent = isset( $attributeInfo['content'] ) ? $attributeInfo['content'] : false;
449
450 $attrCreateInfo = array( 'identifier' => $classAttributeIdentifier,
451 'name' => $classAttributeName,
452 'can_translate' => $canTranslate,
453 'is_required' => $isRequired,
454 'is_searchable' => $isSearchable );
455 $newAttribute = eZContentClassAttribute::create( $classID, $datatype, $attrCreateInfo );
456
457 $dataType = $newAttribute->dataType();
458 $dataType->initializeClassAttribute( $newAttribute );
459
460 // not all datatype can have 'default_value'. do check here.
461 if( $defaultValue !== false )
462 {
463 switch( $datatype )
464 {
465 case 'ezboolean':
466 {
467 $newAttribute->setAttribute( 'data_int3', $defaultValue );
468 }
469 break;
470
471 default:
472 break;
473 }
474 }
475
476 if( $attrContent )
477 $newAttribute->setContent( $attrContent );
478
479 // store attribute, update placement, etc...
480 $attributes = $class->fetchAttributes();
481 $attributes[] = $newAttribute;
482
483 // remove temporary version
484 if ( $newAttribute->attribute( 'id' ) !== null )
485 {
486 $newAttribute->remove();
487 }
488
489 $newAttribute->setAttribute( 'version', eZContentClass::VERSION_STATUS_DEFINED );
490 $newAttribute->setAttribute( 'placement', count( $attributes ) );
491
492 $class->adjustAttributePlacements( $attributes );
493 foreach( $attributes as $attribute )
494 {
495 $attribute->storeDefined();
496 }
497
498 // update objects
499 $classAttributeID = $newAttribute->attribute( 'id' );
500 $objects = eZContentObject::fetchSameClassList( $classID );
501 foreach( $objects as $object )
502 {
503 $contentobjectID = $object->attribute( 'id' );
504 $objectVersions = $object->versions();
505 foreach( $objectVersions as $objectVersion )
506 {
507 $translations = $objectVersion->translations( false );
508 $version = $objectVersion->attribute( 'version' );
509 foreach( $translations as $translation )
510 {
511 $objectAttribute = eZContentObjectAttribute::create( $classAttributeID, $contentobjectID, $version );
512 $objectAttribute->setAttribute( 'language_code', $translation );
513 $objectAttribute->initialize();
514 $objectAttribute->store();
515 $objectAttribute->postInitialize();
516 }
517 }
518 }
519 }
520 }
521
531 function updateClassAttributes( $params )
532 {
533 $classInfo = $params['class'];
534 $attributesInfo = $params['attributes'];
535
536 $contentClassID = eZSiteInstaller::classIDbyIdentifier( $classInfo );
537 if( $contentClassID )
538 {
539 foreach( $attributesInfo as $attributeInfo )
540 {
541 $attributeIdentifier = $attributeInfo['identifier'];
542 $name = isset( $attributeInfo['new_name'] ) ? $attributeInfo['new_name'] : false;
543
544 $classAttributeList = eZContentClassAttribute::fetchFilteredList( array( 'contentclass_id' => $contentClassID,
545 'identifier' => $attributeIdentifier ),
546 true );
547 foreach( $classAttributeList as $attribute )
548 {
549 if( $name !== false )
550 {
551 $attribute->setName( $name );
552 }
553
554 $attribute->store();
555 }
556 }
557 }
558 }
559
560
562 // Content object:
563 // contentObjectByUrl
564 // contentObjectByName
565 // createContentObject
566 // removeContentObject
567 // renameContentObject
569
575 function contentObjectByUrl( $params )
576 {
577 $object = false;
578
579 $node = $this->nodeByUrl( $params );
580 if( is_object( $node ) )
581 {
582 $object = $node->object();
583 }
584
585 return $object;
586 }
587
595 function createContentObject( $params )
596 {
597 $objectID = false;
598
599 $classIdentifier = $params['class_identifier'];
600 $location = $params['location'];
601 $attributesData = $params['attributes'];
602
603 $parentNode = $this->nodeByUrl( $params );
604 if( is_object( $parentNode ) )
605 {
606 $parentNodeID = $parentNode->attribute( 'node_id' );
607 $object = eZContentFunctions::createAndPublishObject( array( 'parent_node_id' => $parentNodeID,
608 'class_identifier' => $classIdentifier,
609 'attributes' => $attributesData ) );
610
611 if( is_object( $object ) )
612 {
613 $objectID = $object->attribute( 'id' );
614 }
615 }
616
617 return $objectID;
618 }
619
626 function renameContentObject( $params )
627 {
628 $contentObjectID = $params['contentobject_id'];
629 $newName = $params['name'];
630 $object = eZContentObject::fetch( $contentObjectID );
631 if( !is_object( $object ) )
632 return false;
633 $object->rename( $newName );
634 }
635
642 function contentObjectByName( $params )
643 {
644 $objectName = $params['name'];
645 $classID = isset( $params['class_id'] ) ? $params['class_id'] : false;
646
647 //build up the conditions
648 $conditions = array( 'name' => $objectName );
649
650 if( $classID )
651 array_merge( $conditions, array( 'contentclass_id' => $classID ) );
652
653 $objectList = eZContentObject::fetchList( true, $conditions, 0, 1 );
654
655 $object = false;
656 if( count( $objectList ) > 0 )
657 $object = $objectList[0];
658
659 return $object;
660 }
661
666 function removeContentObject( $params )
667 {
668 $object = $this->contentObjectByName( $params );
669 if( is_object( $object ) )
670 {
671 $object->purge();
672 }
673 else
674 {
675 eZDebug::writeWarning( "Object with name '" . $params['name'] . "' doesn't exist", __METHOD__ );
676 }
677 }
678
679
680
682 // Content object attributes:
683 // updateObjectAttributeFromString
684 // updateContentObjectAttributes
686
697 function updateObjectAttributeFromString( $params )
698 {
699 $objectID = isset( $params['object_id'] ) ? $params['object_id'] : false;
700 $location = isset( $params['location'] ) ? $params['location'] : false;
701 $classAttrIdentifier = $params['class_attribute_identifier'];
702 $stringParam = $params['string'];
703
704 $contentObject = false;
705 if( $objectID )
706 {
707 $contentObject = eZContentObject::fetch( $objectID );
708 if( !is_object( $contentObject ) )
709 {
710 $this->reportError( "Content object with id '$objectID' doesn't exist." , 'eZSiteInstaller::updateObjectAttributeFromString' );
711 }
712 }
713 else if( $location )
714 {
715 $contentObject = $this->contentObjectByUrl( array( 'location' => $location ) );
716 }
717
718 if( is_object( $contentObject ) )
719 {
720 $attributes = $contentObject->contentObjectAttributes();
721 if( count( $attributes ) > 0 )
722 {
723 $objectAttribute = false;
724 foreach( $attributes as $attribute )
725 {
726 if( $attribute->attribute( 'contentclass_attribute_identifier' ) == $classAttrIdentifier )
727 {
728 $objectAttribute = $attribute;
729 break;
730 }
731 }
732
733 if( is_object( $objectAttribute ) )
734 {
735 $objectAttribute->fromString( $stringParam );
736 $objectAttribute->store();
737 }
738 else
739 {
740 $this->reportError( "Content object with id '$objectID' doesn't have attribute with contentClassAttribute identifier '$classAttrIdentifier'." , 'eZSiteInstaller::updateObjectAttributeFromString' );
741 }
742 }
743 else
744 {
745 $this->reportError( "Content object with id '$objectID' doesn't have attributes." , 'eZSiteInstaller::updateObjectAttributeFromString' );
746 }
747 }
748 }
749
750
751 function updateContentObjectAttributes( $params )
752 {
753 $objectID = $params['object_id'];
754 $attributesData = $params['attributes_data'];
755
756 $contentObject = eZContentObject::fetch( $objectID );
757 if( !is_object( $contentObject ) )
758 {
759 $this->reportError( "Content object with id '$objectID' doesn't exist." , 'eZSiteInstaller::updateContentObjectAttributes' );
760 return;
761 }
762
763 $dataMap = $contentObject->dataMap();
764 foreach( $attributesData as $attrIdentifier => $attrData )
765 {
766 $attribute = $dataMap[$attrIdentifier];
767 if( !is_object( $attribute ) )
768 {
769 $this->reportError( "Warning: could not acquire attribute with identifier '$attrIdentifier'.",
770 'eZSiteInstaller::updateContentObjectAttributes',
771 eZSiteInstaller::ERR_CONTINUE );
772 continue;
773 }
774
775 //get datatype name
776 $datatypeString = $attribute->attribute( 'data_type_string' );
777
778 switch( $datatypeString )
779 {
780 case 'ezstring':
781 {
782 $attribute->setAttribute( "data_text", $attrData['DataText']);
783 } break;
784
785 case 'ezxmltext':
786 {
787 $xml = '<?xml version="1.0" encoding="utf-8"?>'."\n".
788 '<section xmlns:image="http://ez.no/namespaces/ezpublish3/image/"'."\n".
789 ' xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/"'."\n".
790 ' xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">'."\n".
791 ' <section>'."\n";
792 {
793 $xml .= ' <paragraph>';
794 $numSentences = mt_rand( ( int ) $attributeParameters['min_sentences'], ( int ) $attributeParameters['max_sentences'] );
795 for( $sentence = 0; $sentence < $numSentences; $sentence++ )
796 {
797 if( $sentence != 0 )
798 {
799 $xml .= ' ';
800 }
801 }
802 $xml .= "</paragraph>\n";
803 }
804 $xml .= " </section>\n</section>\n";
805
806 $attribute->setAttribute( 'data_text', $xml );
807 } break;
808
809 case 'eztext':
810 {
811 $attribute->setAttribute( 'data_text', $attrData['DataText'] );
812 } break;
813
814 case 'ezmatrix':
815 {
816 $columnsCount = count( $attrData["MatrixDefinition"]->attribute( 'columns' ) );
817 if( $columnsCount > 0 )
818 {
819 $rowsCount = count( $attrData["MatrixCells"] ) / $columnsCount;
820
821 $tempMatrix = new eZMatrix( $attrData["MatrixTitle"], $rowsCount, $attrData["MatrixDefinition"] );
822 $tempMatrix->Cells = $attrData["MatrixCells"];
823
824 $attribute->setAttribute( 'data_text', $tempMatrix->xmlString() );
825 $tempMatrix->decodeXML( $attribute->attribute( 'data_text' ) );
826
827 $attribute->setContent( $tempMatrix );
828 }
829 else
830 {
831 $this->reportError( "Number of columns in 'ezmatrix' should be greater then zero",
832 'eZSiteInstaller::updateContentObjectAttributes',
833 eZSiteInstaller::ERR_CONTINUE );
834 }
835
836 } break;
837
838 case 'ezboolean':
839 {
840 $attribute->setAttribute( 'data_int', $attrData['DataInt'] );
841 } break;
842
843 case 'ezinteger':
844 {
845 $attribute->setAttribute( 'data_int', $attrData['DataInt'] );
846 } break;
847
848 case 'ezfloat':
849 {
850 $power = 100;
851 $float = mt_rand( $power * ( int ) $attrData['Min'], $power * ( int ) $attrData['Max'] );
852 $float = $float / $power;
853 $attribute->setAttribute( 'data_float', $float );
854 } break;
855
856 case 'ezprice':
857 {
858 $power = 10;
859 $price = mt_rand( $power * ( int ) $attrData['Min'], $power * ( int ) $attrData['Max'] );
860 $price = $price / $power;
861 $attribute->setAttribute( 'data_float', $price );
862 } break;
863
864 case 'ezurl':
865 {
866 $attribute->setContent( $attrData['Content'] );
867 $attribute->setAttribute( "data_text", $attrData['DataText']);
868 } break;
869
870 case 'ezuser':
871 {
872 $user = $attribute->content();
873 if( $user === null )
874 {
875 $user = eZUser::create( $objectID );
876 }
877
878 $user->setInformation( $objectID,
879 md5( time() . '-' . mt_rand() ),
880 md5( time() . '-' . mt_rand() ) . '@ez.no',
881 'publish',
882 'publish' );
883 $user->store();
884 } break;
885 }
886 $attribute->store();
887 }
888
889 $contentObject->store();
890 }
891
892
894 // Content object tree node:
895 // nodeByUrl
896 // nodeByName
897 // nodeIdByName
898 // nodePathStringByURL
899 // moveTreeNode
900 // swapNodes
902
908 function nodePathStringByURL( $params )
909 {
910 $pathString = '';
911
912 $node = $this->nodeByUrl( $params );
913
914 if( is_object( $node ) )
915 {
916 $pathString = $node->attribute( 'path_string' );
917 }
918
919 return $pathString;
920 }
921
927 function nodeByUrl( $params )
928 {
929 $path_identification_string = $params['location'];
930
931 $node = eZContentObjectTreeNode::fetchByURLPath( $path_identification_string );
932
933 if( !is_object( $node ) )
934 {
935 $this->reportError( "The node '$path_identification_string' doesn't exist", 'eZSiteInstaller::nodeByUrl' );
936 }
937
938 return $node;
939 }
940
941 /*
942 Return 'main' node ID of object which has specifued name. For more info see 'contentObjectByName'
943 Params:
944 See 'contentObjectByName'
945 */
946 function nodeIdByName( $params )
947 {
948 $node = $this->nodeByName( $params );
949
950 $id = false;
951 if( is_object( $node ) )
952 $id = $node->attribute( 'node_id' );
953
954 return $id;
955 }
956
957 /*
958 Return 'main' node of object which has specifued name. For more info see 'contentObjectByName'
959 Params:
960 See 'contentObjectByName'
961 */
962 function nodeByName( $params )
963 {
964 $node = false;
965
966 $contentObject = $this->contentObjectByName( $params );
967 if( is_object( $contentObject ) )
968 $node = $contentObject->attribute( 'main_node' );
969
970 return $node;
971 }
972
982 function moveTreeNode( $params )
983 {
984 $nodeID = $this->nodeIdByName( $params['node'] );
985 $parentNodeID = $this->nodeIdByName( $params['parent_node'] );
986
987 $result = eZContentObjectTreeNodeOperations::move( $nodeID, $parentNodeID );
988
989 return $result;
990 }
991
996 function swapNodes( $params )
997 {
998 $nodeInfo1 = $params['src_node'];
999 $nodeInfo2 = $params['dst_node'];
1000
1001 //init vars
1002 $node1 = $this->nodeIdByName( $nodeInfo1 );
1003 $node2 = $this->nodeIdByName( $nodeInfo2 );
1004
1005 $nodeID = $node1;
1006 $node = eZContentObjectTreeNode::fetch( $nodeID );
1007
1008 if( !is_object( $node ) )
1009 {
1010 $this->reportError( "Can't fetch node '$nodeID'", 'eZSiteInstaller::swapNodes' );
1011 return false;
1012 }
1013
1014 if( !$node->canSwap() )
1015 {
1016 $this->reportError( "Cannot swap node '$nodeID' (no edit permission)", 'eZSiteInstaller::swapNodes' );
1017 return false;
1018 }
1019
1020 $nodeParentNodeID = $node->attribute( 'parent_node_id' );
1021
1022 $object = $node->object();
1023 if( !is_object( $object ) )
1024 {
1025 $this->reportError( "Cannot fetch object for node '$nodeID'", 'eZSiteInstaller::swapNodes' );
1026 return false;
1027 }
1028
1029 $objectID = $object->attribute( 'id' );
1030 $objectVersion = $object->attribute( 'current_version' );
1031 $class = $object->contentClass();
1032 $classID = $class->attribute( 'id' );
1033
1034 $selectedNodeID = $node2;
1035
1036 $selectedNode = eZContentObjectTreeNode::fetch( $selectedNodeID );
1037
1038 if( !is_object( $selectedNode ) )
1039 {
1040 $this->reportError( "Cannot fetch node '$selectedNodeID'", 'eZSiteInstaller::swapNodes' );
1041 return false;
1042 }
1043
1044 if( !$selectedNode->canSwap() )
1045 {
1046 $this->reportError( "Cannot use node $selectedNodeID as the exchanging node for $nodeID, the current user does not have edit permission for it",
1047 'eZSiteInstaller::swapNodes' );
1048 return false;
1049 }
1050
1051 // verify one of the nodes contains children and the other is not a container.
1052 if ( !$node->classIsContainer() && $selectedNode->childrenCount() > 0 )
1053 {
1054 $this->reportError( "Cannot use node $selectedNodeID as the exchanging node for $nodeID, as it contains sub items (node is not container)",
1055 'eZSiteInstaller::swapNodes' );
1056 return false;
1057 }
1058 if ( !$selectedNode->classIsContainer() && $node->childrenCount() > 0 )
1059 {
1060 $this->reportError( "Cannot use node $selectedNodeID as the exchanging node for $nodeID, as it is not container (node contains sub items)",
1061 'eZSiteInstaller::swapNodes' );
1062 return false;
1063 }
1064
1065 // clear cache.
1066 eZContentCacheManager::clearContentCacheIfNeeded( $objectID );
1067
1068 $selectedObject = $selectedNode->object();
1069 $selectedObjectID = $selectedObject->attribute( 'id' );
1070 $selectedObjectVersion = $selectedObject->attribute( 'current_version' );
1071 $selectedNodeParentNodeID = $selectedNode->attribute( 'parent_node_id' );
1072
1073
1074 /* In order to swap node1 and node2 a user should have the following permissions:
1075 * 1. move_from: move node1
1076 * 2. move_from: move node2
1077 * 3. move_to: move an object of the same class as node2 under parent of node1
1078 * 4. move_to: move an object of the same class as node1 under parent of node2
1079 *
1080 * The First two has already been checked. Let's check the rest.
1081 */
1082 $nodeParent = $node->attribute( 'parent' );
1083 $selectedNodeParent = $selectedNode->attribute( 'parent' );
1084 $objectClassID = $object->attribute( 'contentclass_id' );
1085 $selectedObjectClassID = $selectedObject->attribute( 'contentclass_id' );
1086
1087 if( !$nodeParent || !$selectedNodeParent )
1088 {
1089 $this->reportError( "No $nodeParent or no !$selectedNodeParent received.",
1090 'eZSiteInstaller::swapNodes' );
1091 return false;
1092 }
1093
1094 if( !$nodeParent->canMoveTo( $selectedObjectClassID ) )
1095 {
1096 $this->reportError( "Cannot move an object of class $selectedObjectClassID to node $nodeParentNodeID (no create permission)",
1097 'eZSiteInstaller::swapNodes' );
1098 return false;
1099 }
1100
1101 if( !$selectedNodeParent->canMoveTo( $objectClassID ) )
1102 {
1103 $this->reportError( "Cannot move an object of class $objectClassID to node $selectedNodeParentNodeID (no create permission)",
1104 'eZSiteInstaller::swapNodes' );
1105 return false;
1106 }
1107
1108 // exchange contentobject ids and versions.
1109 $node->setAttribute( 'contentobject_id', $selectedObjectID );
1110 $node->setAttribute( 'contentobject_version', $selectedObjectVersion );
1111
1112 $db = eZDB::instance();
1113 $db->begin();
1114 $node->store();
1115 $selectedNode->setAttribute( 'contentobject_id', $objectID );
1116 $selectedNode->setAttribute( 'contentobject_version', $objectVersion );
1117 $selectedNode->store();
1118
1119 // modify path string
1120 $changedOriginalNode = eZContentObjectTreeNode::fetch( $nodeID );
1121 $changedOriginalNode->updateSubTreePath();
1122 $changedTargetNode = eZContentObjectTreeNode::fetch( $selectedNodeID );
1123 $changedTargetNode->updateSubTreePath();
1124
1125 // modify section
1126 if( $changedOriginalNode->attribute( 'main_node_id' ) == $changedOriginalNode->attribute( 'node_id' ) )
1127 {
1128 $changedOriginalObject = $changedOriginalNode->object();
1129 $parentObject = $nodeParent->object();
1130 if( $changedOriginalObject->attribute( 'section_id' ) != $parentObject->attribute( 'section_id' ) )
1131 {
1132
1133 eZContentObjectTreeNode::assignSectionToSubTree( $changedOriginalNode->attribute( 'main_node_id' ),
1134 $parentObject->attribute( 'section_id' ),
1135 $changedOriginalObject->attribute( 'section_id' ) );
1136 }
1137 }
1138 if( $changedTargetNode->attribute( 'main_node_id' ) == $changedTargetNode->attribute( 'node_id' ) )
1139 {
1140 $changedTargetObject = $changedTargetNode->object();
1141 $selectedParentObject = $selectedNodeParent->object();
1142 if( $changedTargetObject->attribute( 'section_id' ) != $selectedParentObject->attribute( 'section_id' ) )
1143 {
1144
1145 eZContentObjectTreeNode::assignSectionToSubTree( $changedTargetNode->attribute( 'main_node_id' ),
1146 $selectedParentObject->attribute( 'section_id' ),
1147 $changedTargetObject->attribute( 'section_id' ) );
1148 }
1149 }
1150
1151 $db->commit();
1152
1153 // clear cache for new placement.
1154 eZContentCacheManager::clearContentCacheIfNeeded( $objectID );
1155
1156 return true;
1157 }
1158
1160 // Roles and policies:
1161 // assignUserToRole
1162 // addPoliciesForRole
1163 // removePoliciesForRole
1165
1172 function assignUserToRole( $params )
1173 {
1174 $location = $params['location'];
1175 $roleName = $params['role_name'];
1176
1177 $node = $this->nodeByUrl( $params );
1178 if( is_object( $node ) )
1179 {
1180 $role = eZRole::fetchByName( $roleName );
1181 if( is_object( $role ) )
1182 $role->assignToUser( $node->attribute( 'contentobject_id' ) );
1183 }
1184 }
1185
1197 function addPoliciesForRole( $params )
1198 {
1199 $roleName = $params['role_name'];
1200 $policiesDefinition = $params['policies'];
1201 $createRoleIfNotExists = isset( $params['create_role'] ) ? $params['create_role'] : true;
1202
1203 $role = eZRole::fetchByName( $roleName );
1204 if( is_object( $role ) || $createRoleIfNotExists )
1205 {
1206 if( !is_object( $role ) )
1207 {
1208 $role = eZRole::create( $roleName );
1209 $role->store();
1210 }
1211
1212 $roleID = $role->attribute( 'id' );
1213 if( count( $policiesDefinition ) > 0 )
1214 {
1215 foreach( $policiesDefinition as $policyDefinition )
1216 {
1217 if( isset( $policyDefinition['limitation'] ) )
1218 {
1219 $role->appendPolicy( $policyDefinition['module'], $policyDefinition['function'], $policyDefinition['limitation'] );
1220 }
1221 else
1222 {
1223 $role->appendPolicy( $policyDefinition['module'], $policyDefinition['function'] );
1224 }
1225 }
1226 }
1227 }
1228 else
1229 {
1230 $this->reportError( "Role '$roleName' doesn't exist." , 'eZSiteInstaller::addPoliciesToRole' );
1231 }
1232 }
1233
1244 function removePoliciesForRole( $params )
1245 {
1246 $roleName = $params['role_name'];
1247 $policiesDefinition = $params['policies'];
1248 $removeRoleIfEmpty = isset( $params['remove_role'] ) ? $params['remove_role'] : true;
1249
1250 $role = eZRole::fetchByName( $roleName );
1251 if( is_object( $role ) )
1252 {
1253 foreach( $policiesDefinition as $policyDefinition )
1254 {
1255 $role->removePolicy( $policyDefinition['module'], $policyDefinition['function'] );
1256 }
1257
1258 if( $removeRoleIfEmpty && count( $role->policyList() ) == 0 )
1259 {
1260 $role->removeThis();
1261 }
1262 }
1263 else
1264 {
1265 $this->reportError( "Role '$roleName' doesn't exist." , 'eZSiteInstaller::removePoliciesForRole' );
1266 }
1267 }
1268
1269
1271 // Section:
1272 // sectionIDbyName
1273 // createContentSection
1274 // setSection
1276
1282 function sectionIDbyName( $params )
1283 {
1284 $sectionID = false;
1285 $sectionName = $params['section_name'];
1286
1287 $sectionList = eZSection::fetchFilteredList( array( 'name' => $sectionName ), false, false, true );
1288
1289 if( is_array( $sectionList ) && count( $sectionList ) > 0 )
1290 {
1291 $section = $sectionList[0];
1292 if( is_object( $section ) )
1293 {
1294 $sectionID = $section->attribute( 'id' );
1295 }
1296 }
1297
1298 return $sectionID;
1299 }
1300
1307 function createContentSection( $params )
1308 {
1309 $section = false;
1310
1311 $sectionName = $params['name'];
1312 $navigationPart = $params['navigation_part_identifier'];
1313
1314 $section = new eZSection( array() );
1315 $section->setAttribute( 'name', $sectionName );
1316 $section->setAttribute( 'navigation_part_identifier', $navigationPart );
1317 $section->store();
1318
1319 return $section;
1320 }
1321
1328 function setSection( $params )
1329 {
1330 $location = $params['location'];
1331 $sectionName = $params['section_name'];
1332
1333 $sectionID = $this->sectionIDbyName( $params );
1334 if( $sectionID )
1335 {
1336 $rootNode = $this->nodeByUrl( $params );
1337 if( is_object( $rootNode ) )
1338 {
1339 eZContentObjectTreeNode::assignSectionToSubTree( $rootNode->attribute( 'node_id' ), $sectionID );
1340 }
1341 }
1342
1343 }
1344
1345
1347 // RSS:
1348 // setRSSExport
1350
1354 function setRSSExport( $params )
1355 {
1356
1357
1358 // Create default rssExport object to use
1359 $rssExport = eZRSSExport::create( $params['creator'] );
1360 $rssExport->setAttribute( 'access_url', $params['access_url'] );
1361 $rssExport->setAttribute( 'main_node_only', $params['main_node_only'] );
1362 $rssExport->setAttribute( 'number_of_objects', $params['number_of_objects'] );
1363 $rssExport->setAttribute( 'rss_version', $params['rss_version'] );
1364 $rssExport->setAttribute( 'status', $params['status'] );
1365 $rssExport->setAttribute( 'title', $params['title'] );
1366 $rssExport->store();
1367
1368 $rssExportID = $rssExport->attribute( 'id' );
1369
1370 foreach( $params['rss_export_itmes'] as $item )
1371 {
1372 // Create One empty export item
1373 $rssExportItem = eZRSSExportItem::create( $rssExportID );
1374 $rssExportItem->setAttribute( 'class_id', $item['class_id'] );
1375 $rssExportItem->setAttribute( 'description', $item['description'] );
1376 $rssExportItem->setAttribute( 'source_node_id', $item['source_node_id'] );
1377 $rssExportItem->setAttribute( 'status', $item['status'] );
1378 $rssExportItem->setAttribute( 'title', $item['title'] );
1379 if ( isset( $item['enclosure'] ) )
1380 {
1381 $rssExportItem->setAttribute( 'enclosure', $item['enclosure'] );
1382 }
1383 $rssExportItem->store();
1384 }
1385 }
1386
1387
1389 // Package:
1390 // packageFileItemPath
1392
1396 function packageFileItemPath( $params )
1397 {
1398 $collection = $params['collection'];
1399 $fileItem = $params['file_item'];
1400
1401 $filePath = $fileItem['name'];
1402
1403 $package = $this->setting( 'package_object' );
1404 if( is_object( $package ) )
1405 {
1406 $filePath = $package->fileItemPath( $fileItem, $collection );
1407 }
1408 else
1409 {
1410 eZDebug::writeWarning( "'Package' object is not set", __METHOD__ );
1411 }
1412
1413 return $filePath;
1414 }
1415
1417 // Languages and Locales:
1418 // languageNameListFromLocaleList
1419 // languageNameFromLocale
1421
1426 function languageNameListFromLocaleList( $localeList )
1427 {
1428 $languageList = array();
1429 foreach( $localeList as $locale )
1430 $languageList[] = $this->languageNameFromLocale( $locale );
1431
1432 return $languageList;
1433 }
1434
1439 function languageNameFromLocale( $locale )
1440 {
1441 $pos = strpos( $locale , "-");
1442 $languageName = substr( $locale , 0, $pos );
1443 return $languageName;
1444 }
1445
1449 public function extractHostname( $uri )
1450 {
1451 $hostname = false;
1452
1453 $parts = parse_url( $uri );
1454
1455 if ( isset( $parts['host'] ) )
1456 $hostname = $parts['host'];
1457
1458 return $hostname;
1459 }
1460
1471 function createSiteaccessUrls( $params )
1472 {
1473 $urlList = array();
1474
1475 $siteaccessList = $params['siteaccess_list'];
1476 $accessType = $params['access_type'];
1477 $accessTypeValue = $params['access_type_value'];
1478
1479 $excludePortList = isset( $params['exclude_port_list'] ) ? $params['exclude_port_list'] : array();
1480
1481 $hostname = false;
1482
1483 if ( isset( $params['host'] ) && $params['host'] !== '' )
1484 $hostname = $this->extractHostname( $params['host'] );
1485
1486 if ( !$hostname )
1487 $hostname = eZSys::hostname();
1488
1489 $indexFile = eZSys::wwwDir() . eZSys::indexFileName();
1490
1491 switch( $accessType )
1492 {
1493 case 'port':
1494 {
1495 $port = $accessTypeValue;
1496
1497 // build urls
1498 foreach( $siteaccessList as $siteaccess )
1499 {
1500 // skip ports which are already in use
1501 while( in_array( $port, $excludePortList ) )
1502 ++$port;
1503
1504 $urlList[$siteaccess]['url'] = "$hostname:$port" . $indexFile;
1505 $urlList[$siteaccess]['port'] = $port;
1506 ++$port;
1507 }
1508 }
1509 break;
1510 case 'host':
1511 case 'hostname':
1512 {
1513 $prependSiteAccess = isset( $params['host_prepend_siteaccess'] ) && is_bool( $params['host_prepend_siteaccess'] ) ? $params['host_prepend_siteaccess'] : true;
1514
1515 $hostname = $this->extractHostname( $accessTypeValue );
1516
1517 if ( !$hostname )
1518 $hostname = $accessTypeValue;
1519
1520 foreach( $siteaccessList as $siteaccess )
1521 {
1522 if ( $prependSiteAccess )
1523 {
1524 // replace undescores with dashes( '_' -> '-' );
1525 $hostPrefix = preg_replace( '/(_)/', '-', $siteaccess);
1526
1527 // create url and host
1528 $urlList[$siteaccess]['url'] = $hostPrefix . '.' . $hostname . $indexFile;
1529 $urlList[$siteaccess]['host'] = $hostPrefix . '.' . $hostname;
1530 }
1531 else
1532 {
1533 // create url and host
1534 $urlList[$siteaccess]['url'] = $hostname . $indexFile;
1535 $urlList[$siteaccess]['host'] = $hostname;
1536 }
1537 }
1538 }
1539 break;
1540 case 'url':
1541 case 'uri':
1542 {
1543 foreach( $siteaccessList as $siteaccess )
1544 {
1545 $urlList[$siteaccess]['url'] = $hostname . $indexFile . '/' . $siteaccess;
1546 }
1547 }
1548 break;
1549
1550 default:
1551 break;
1552 }
1553
1554 return $urlList;
1555 }
1556
1560 function createSiteAccess( $params )
1561 {
1562 $srcSiteaccess = $params['src']['siteaccess'];
1563 $dstSiteaccess = $params['dst']['siteaccess'];
1564 $dstSettings = isset( $params['dst']['settings'] ) ? $params['dst']['settings'] : array();
1565
1566 // Create the siteaccess directory
1567 $srcSiteaccessDir = "settings/siteaccess/" . $srcSiteaccess;
1568 $dstSiteaccessDir = "settings/siteaccess/" . $dstSiteaccess;
1569 eZDir::mkdir( $dstSiteaccessDir, false, true );
1570 eZDir::copy( $srcSiteaccessDir, $dstSiteaccessDir, false, true );
1571
1572 // Update settings
1573 foreach ( $dstSettings as $iniFile => $settingGroups )
1574 {
1575 $ini = eZINI::instance( $iniFile . ".append.php", $dstSiteaccessDir, null, false, null, true );
1576
1577 foreach ( $settingGroups as $settingGroup => $settings )
1578 {
1579 foreach ( $settings as $name => $value )
1580 {
1581 $ini->setVariable( $settingGroup, $name, $value );
1582 }
1583 }
1584
1585 $ini->save( false, false, false, false, true, true );
1586 unset( $ini );
1587 }
1588
1589 // Create roles
1590 $role = eZRole::fetchByName( "Anonymous" );
1591 $role->appendPolicy( "user", "login", array( "SiteAccess" => array( eZSys::ezcrc32( $dstSiteaccess ) ) ) );
1592 $role->store();
1593 }
1594
1595 function solutionVersion()
1596 {
1597 eZDebug::writeWarning( "Your installer doesn't implement 'solutionVersion' function", __METHOD__ );
1598 return false;
1599 }
1600
1601 function solutionName()
1602 {
1603 eZDebug::writeWarning( "Your installer doesn't implement 'solutionName' function", __METHOD__ );
1604 return false;
1605 }
1606
1612 function setVersion( $params = false )
1613 {
1614 $db = eZDB::instance();
1615
1616 $name = strtolower( $this->solutionName() );
1617 $version = $this->solutionVersion();
1618
1619 $result = $db->query( "INSERT INTO ezsite_data VALUES( '$name', '$version' )" );
1620
1621 return $result;
1622 }
1623
1624 function updateINIFiles( $params )
1625 {
1626 foreach( $params['groups'] as $settingsData )
1627 {
1628 $iniFilename = $settingsData['name'] . '.append.php';
1629 $ini = eZINI::instance( $iniFilename, $params['settings_dir'] );
1630 if( isset( $settingsData['discard_old_values'] ) && $settingsData['discard_old_values'] )
1631 $ini->reset();
1632
1633 // Ignore site.ini[eZINISettings].ReadonlySettingList[] settings when saving ini variables.
1634 $ini->setReadOnlySettingsCheck( false );
1635 $ini->setVariables( $settingsData['settings'] );
1636 $ini->save();
1637 }
1638 }
1639
1640 function updateRoles( $params )
1641 {
1642 foreach( $params['roles'] as $roleData )
1643 {
1644 $roleName = $roleData['name'];
1645 $role = eZRole::fetchByName( $roleName );
1646 if( !is_object( $role ) )
1647 {
1648 $role = eZRole::create( $roleName );
1649 $role->store();
1650 }
1651
1652 $roleID = $role->attribute( 'id' );
1653 if( isset( $roleData['policies'] ) )
1654 {
1655 $policies = $roleData['policies'];
1656 foreach( $policies as $policy )
1657 {
1658 $role->appendPolicy( $policy['module'], $policy['function'], isset( $policy['limitation'] ) ? $policy['limitation'] : array() );
1659 }
1660 }
1661
1662 if( isset( $roleData['assignments'] ) )
1663 {
1664 $roleAssignments = $roleData['assignments'];
1665 foreach( $roleAssignments as $roleAssignment )
1666 {
1667 $assignmentIdentifier = false;
1668 $assignmentValue = false;
1669 if( isset( $roleAssignment['limitation'] ) )
1670 {
1671 $assignmentIdentifier = $roleAssignment['limitation']['identifier'];
1672 $assignmentValue = $roleAssignment['limitation']['value'];
1673 }
1674 $role->assignToUser( $roleAssignment['user_id'], $assignmentIdentifier, $assignmentValue );
1675 }
1676 }
1677 }
1678 }
1679
1680 function updatePreferences( $params )
1681 {
1682 foreach( $params['prefs'] as $prefEntry )
1683 {
1684 $prefUserID = $prefEntry['user_id'];
1685 foreach( $prefEntry['preferences'] as $pref )
1686 {
1687 $prefName = $pref['name'];
1688 $prefValue = $pref['value'];
1689 eZPreferences::setValue( $prefName, $prefValue, $prefUserID );
1690 }
1691 }
1692 }
1693
1703 function getParam( $params, $name, $defaultValue = false )
1704 {
1705 $value = $defaultValue;
1706
1707 $pos = strpos( $name, '/' );
1708 if( $pos !== false )
1709 {
1710 $dim1 = substr( $name, 0, $pos );
1711 $dim2 = substr( $name, $pos + 1 );
1712 if( isset( $params[$dim1][$dim2] ) )
1713 {
1714 $value = $params[$dim1][$dim2];
1715 }
1716 }
1717 else if( isset( $params[$name] ) )
1718 {
1719 $value = $params[$name];
1720 }
1721
1722 return $value;
1723 }
1724
1728 function defaultErrorHandler()
1729 {
1730 return $this->lastErrorCode();
1731 }
1732
1737 function handleError()
1738 {
1739 // call default error handler
1740 return false;
1741 }
1742
1743 // store data to use in your steps.
1744 public $Settings;
1745 // define an order of functions to execute.
1746 public $Steps;
1747 // hold an error code of last executed step.
1748 public $LastErrorCode;
1749 }
1750
1751 ?>
eZContentCacheManager\clearContentCacheIfNeeded
static clearContentCacheIfNeeded( $objectID, $versionNum=true, $additionalNodeList=false)
Definition: ezcontentcachemanager.php:1062
eZContentClassAttribute\create
static create( $class_id, $data_type_string, $optionalValues=array(), $languageLocale=false)
Definition: ezcontentclassattribute.php:221
eZContentClassAttribute\fetchFilteredList
static fetchFilteredList( $cond, $asObject=true)
Definition: ezcontentclassattribute.php:481
eZContentClass\fetchByIdentifier
static fetchByIdentifier( $identifier, $asObject=true, $version=eZContentClass::VERSION_STATUS_DEFINED, $user_id=false, $parent_id=null)
Definition: ezcontentclass.php:1203
eZContentClass\fetch
static fetch( $id, $asObject=true, $version=eZContentClass::VERSION_STATUS_DEFINED, $user_id=false, $parent_id=null)
Definition: ezcontentclass.php:1116
eZContentClass\VERSION_STATUS_DEFINED
const VERSION_STATUS_DEFINED
Definition: ezcontentclass.php:22
eZContentFunctions\createAndPublishObject
static createAndPublishObject( $params)
Definition: ezcontentfunctions.php:88
eZContentObjectAttribute\create
static create( $contentclassAttributeID, $contentobjectID, $version=1, $languageCode=false)
Definition: ezcontentobjectattribute.php:254
eZContentObjectAttribute\fetchSameClassAttributeIDList
static fetchSameClassAttributeIDList( $contentClassAttributeID, $asObject=true, $version=false, $contentObjectID=false, $limit=null)
Definition: ezcontentobjectattribute.php:205
eZContentObjectTreeNodeOperations\move
static move( $nodeID, $newParentNodeID)
Definition: ezcontentobjecttreenodeoperations.php:38
eZContentObjectTreeNode\assignSectionToSubTree
static assignSectionToSubTree( $nodeID, $sectionID, $oldSectionID=false, $updateSearchIndexes=true)
Definition: ezcontentobjecttreenode.php:2828
eZContentObjectTreeNode\fetch
static fetch( $nodeID=false, $lang=false, $asObject=true, $conditions=false)
Definition: ezcontentobjecttreenode.php:3058
eZContentObjectTreeNode\fetchByURLPath
static fetchByURLPath( $pathString, $asObject=true)
Definition: ezcontentobjecttreenode.php:2943
eZContentObject\fetch
static fetch( $id, $asObject=true)
Definition: ezcontentobject.php:885
eZContentObject\fetchList
static fetchList( $asObject=true, $conditions=null, $offset=false, $limit=false)
Definition: ezcontentobject.php:1185
eZContentObject\fetchSameClassList
static fetchSameClassList( $contentClassID, $asObject=true, $offset=false, $limit=false)
Definition: ezcontentobject.php:1247
eZDB\instance
static instance( $databaseImplementation=false, $databaseParameters=false, $forceNewInstance=false)
Definition: ezdb.php:117
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:545
eZDebug\writeWarning
static writeWarning( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:502
eZDir\mkdir
static mkdir( $dir, $perm=false, $recursive=false)
Definition: ezdir.php:73
eZDir\copy
static copy( $sourceDirectory, &$destinationDirectory, $asChild=true, $recursive=true, $includeHidden=false, $excludeItems=false)
Definition: ezdir.php:577
eZMatrix
The class eZMatrix does.
Definition: ezmatrix.php:19
eZPreferences\setValue
static setValue( $name, $value, $storeUserID=false)
Definition: ezpreferences.php:38
eZRSSExportItem\create
static create( $rssexport_id)
Definition: ezrssexportitem.php:88
eZRSSExport\create
static create( $user_id)
Definition: ezrssexport.php:132
eZRole\create
static create( $roleName, $version=0)
Definition: ezrole.php:167
eZRole\fetchByName
static fetchByName( $roleName, $version=0)
Definition: ezrole.php:881
eZSection
eZSection handles grouping of content in eZ Publish
Definition: ezsection.php:18
eZSection\fetchFilteredList
static fetchFilteredList( $conditions=null, $offset=false, $limit=false, $asObject=true)
Definition: ezsection.php:127
eZSiteInstaller
A set of functions to do web-site installation from command-line.
Definition: ezsiteinstaller.php:23
eZSiteInstaller\assignUserToRole
assignUserToRole( $params)
Definition: ezsiteinstaller.php:1172
eZSiteInstaller\dbBegin
dbBegin( $params)
Definition: ezsiteinstaller.php:271
eZSiteInstaller\lastErrorCode
lastErrorCode()
Definition: ezsiteinstaller.php:236
eZSiteInstaller\handleError
handleError()
Definition: ezsiteinstaller.php:1737
eZSiteInstaller\createSiteaccessUrls
createSiteaccessUrls( $params)
Definition: ezsiteinstaller.php:1471
eZSiteInstaller\setLastErrorCode
setLastErrorCode( $errCode)
Definition: ezsiteinstaller.php:228
eZSiteInstaller\classIDbyIdentifier
classIDbyIdentifier( $params)
Definition: ezsiteinstaller.php:300
eZSiteInstaller\createSiteAccess
createSiteAccess( $params)
Definition: ezsiteinstaller.php:1560
eZSiteInstaller\swapNodes
swapNodes( $params)
Definition: ezsiteinstaller.php:996
eZSiteInstaller\defaultErrorHandler
defaultErrorHandler()
Definition: ezsiteinstaller.php:1728
eZSiteInstaller\packageFileItemPath
packageFileItemPath( $params)
Definition: ezsiteinstaller.php:1396
eZSiteInstaller\buildFunctionParams
buildFunctionParams(&$params)
Definition: ezsiteinstaller.php:198
eZSiteInstaller\addSetting
addSetting( $name, $value)
Definition: ezsiteinstaller.php:102
eZSiteInstaller\setRSSExport
setRSSExport( $params)
Definition: ezsiteinstaller.php:1354
eZSiteInstaller\isFunctionParam
isFunctionParam( $param)
Definition: ezsiteinstaller.php:216
eZSiteInstaller\removePoliciesForRole
removePoliciesForRole( $params)
Definition: ezsiteinstaller.php:1244
eZSiteInstaller\contentObjectByName
contentObjectByName( $params)
Definition: ezsiteinstaller.php:642
eZSiteInstaller\$Settings
$Settings
Definition: ezsiteinstaller.php:1744
eZSiteInstaller\ERR_OK
const ERR_OK
Definition: ezsiteinstaller.php:24
eZSiteInstaller\instance
& instance( $params)
Definition: ezsiteinstaller.php:45
eZSiteInstaller\removeContentObject
removeContentObject( $params)
Definition: ezsiteinstaller.php:666
eZSiteInstaller\createContentSection
createContentSection( $params)
Definition: ezsiteinstaller.php:1307
eZSiteInstaller\postInstall
postInstall()
Definition: ezsiteinstaller.php:148
eZSiteInstaller\executeSteps
executeSteps( $steps)
Definition: ezsiteinstaller.php:157
eZSiteInstaller\dbCommit
dbCommit( $params)
Definition: ezsiteinstaller.php:282
eZSiteInstaller\$Steps
$Steps
Definition: ezsiteinstaller.php:1746
eZSiteInstaller\ERR_CONTINUE
const ERR_CONTINUE
Definition: ezsiteinstaller.php:26
eZSiteInstaller\languageNameListFromLocaleList
languageNameListFromLocaleList( $localeList)
Definition: ezsiteinstaller.php:1426
eZSiteInstaller\addClassAttributes
addClassAttributes( $params)
Definition: ezsiteinstaller.php:407
eZSiteInstaller\renameContentObject
renameContentObject( $params)
Definition: ezsiteinstaller.php:626
eZSiteInstaller\reportError
reportError( $text, $caption, $errCode=eZSiteInstaller::ERR_ABORT)
Definition: ezsiteinstaller.php:248
eZSiteInstaller\updateRoles
updateRoles( $params)
Definition: ezsiteinstaller.php:1640
eZSiteInstaller\classByIdentifier
classByIdentifier( $params)
Definition: ezsiteinstaller.php:319
eZSiteInstaller\contentObjectByUrl
contentObjectByUrl( $params)
Definition: ezsiteinstaller.php:575
eZSiteInstaller\getParam
getParam( $params, $name, $defaultValue=false)
Definition: ezsiteinstaller.php:1703
eZSiteInstaller\solutionVersion
solutionVersion()
Definition: ezsiteinstaller.php:1595
eZSiteInstaller\updatePreferences
updatePreferences( $params)
Definition: ezsiteinstaller.php:1680
eZSiteInstaller\sectionIDbyName
sectionIDbyName( $params)
Definition: ezsiteinstaller.php:1282
eZSiteInstaller\updateINIFiles
updateINIFiles( $params)
Definition: ezsiteinstaller.php:1624
eZSiteInstaller\updateClassAttributes
updateClassAttributes( $params)
Definition: ezsiteinstaller.php:531
eZSiteInstaller\execFunction
execFunction( $function)
Definition: ezsiteinstaller.php:184
eZSiteInstaller\removeClassAttribute
removeClassAttribute( $params)
Definition: ezsiteinstaller.php:346
eZSiteInstaller\nodeByName
nodeByName( $params)
Definition: ezsiteinstaller.php:962
eZSiteInstaller\extractHostname
extractHostname( $uri)
Definition: ezsiteinstaller.php:1449
eZSiteInstaller\$LastErrorCode
$LastErrorCode
Definition: ezsiteinstaller.php:1748
eZSiteInstaller\ERR_ABORT
const ERR_ABORT
Definition: ezsiteinstaller.php:25
eZSiteInstaller\languageNameFromLocale
languageNameFromLocale( $locale)
Definition: ezsiteinstaller.php:1439
eZSiteInstaller\nodeIdByName
nodeIdByName( $params)
Definition: ezsiteinstaller.php:946
eZSiteInstaller\nodeByUrl
nodeByUrl( $params)
Definition: ezsiteinstaller.php:927
eZSiteInstaller\updateObjectAttributeFromString
updateObjectAttributeFromString( $params)
Definition: ezsiteinstaller.php:697
eZSiteInstaller\setSection
setSection( $params)
Definition: ezsiteinstaller.php:1328
eZSiteInstaller\setVersion
setVersion( $params=false)
Definition: ezsiteinstaller.php:1612
eZSiteInstaller\moveTreeNode
moveTreeNode( $params)
Definition: ezsiteinstaller.php:982
eZSiteInstaller\setting
setting( $name)
Definition: ezsiteinstaller.php:110
eZSiteInstaller\postInstallSteps
postInstallSteps()
Definition: ezsiteinstaller.php:140
eZSiteInstaller\addPoliciesForRole
addPoliciesForRole( $params)
Definition: ezsiteinstaller.php:1197
eZSiteInstaller\solutionName
solutionName()
Definition: ezsiteinstaller.php:1601
eZSiteInstaller\__construct
__construct( $parameters=false)
Definition: ezsiteinstaller.php:28
eZSiteInstaller\createContentObject
createContentObject( $params)
Definition: ezsiteinstaller.php:595
eZSiteInstaller\initSteps
initSteps()
Definition: ezsiteinstaller.php:94
eZSiteInstaller\hasSetting
hasSetting( $name)
Definition: ezsiteinstaller.php:128
eZSiteInstaller\updateContentObjectAttributes
updateContentObjectAttributes( $params)
Definition: ezsiteinstaller.php:751
eZSiteInstaller\initSettings
initSettings( $parameters)
Definition: ezsiteinstaller.php:55
eZSiteInstaller\eZSiteInstaller
eZSiteInstaller( $parameters=false)
Definition: ezsiteinstaller.php:40
eZSiteInstaller\nodePathStringByURL
nodePathStringByURL( $params)
Definition: ezsiteinstaller.php:908
eZSys\indexFileName
static indexFileName()
Definition: ezsys.php:663
eZSys\hostname
static hostname()
Definition: ezsys.php:676
eZSys\wwwDir
static wwwDir()
Definition: ezsys.php:582
eZSys\ezcrc32
static ezcrc32( $string)
Definition: ezsys.php:1297
eZUser\create
static create( $contentObjectID)
Definition: ezuser.php:237
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.