Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezinstallscriptpackagehandler.php
Go to the documentation of this file.
1 <?php
18 class eZInstallScriptPackageHandler extends eZPackageHandler
19 {
20 public function __construct()
21 {
22 parent::__construct( 'ezinstallscript', array( 'extract-install-content' => false ) );
23 }
24
28 function explainInstallItem( $package, $installItem, $requestedInfo = array() )
29 {
30 $itemPath = $package->path() . '/' . $installItem['sub-directory'];
31 $xmlPath = $itemPath . '/' . $installItem['filename'] . '.xml';
32
33 $dom = $package->fetchDOMFromFile( $xmlPath );
34 if ( !$dom )
35 return false;
36
37 $mainNode =& $dom->documentElement;
38
39 $description = $mainNode->getAttribute( 'description' );
40 if ( !$description )
41 return false;
42
43 return array( 'description' => ezpI18n::tr( 'kernel/package', 'Install script: %description', false,
44 array( '%description' => $description ) ) );
45 }
46
50 function uninstall( $package, $installType, $parameters,
51 $name, $os, $filename, $subdirectory,
52 $content, &$installParameters,
53 &$installData )
54 {
55 return true;
56 }
57
61 function install( $package, $installType, $parameters,
62 $name, $os, $filename, $subdirectory,
63 $content, &$installParameters,
64 &$installData )
65 {
66 return true;
67 }
68
69 function add( $packageType, $package, $cli, $parameters )
70 {
71 $siteINI = eZINI::instance();
72 $extensionDir = $siteINI->variable( 'ExtensionSettings', 'ExtensionDirectory' );
73
74 //$cli->output( var_export( $parameters, true ) );
75 foreach ( $parameters as $scriptItem )
76 {
77 $cli->output( 'adding install script ' . $cli->style( 'dir' ) . $scriptItem['filename'] . $cli->style( 'dir-end' ) );
78
79 $sourceDir = $scriptItem['source-directory'];
80 $targetDir = $package->path() . '/' . $scriptItem['sub-directory'];
81
82 eZDir::mkdir( $targetDir, false, true );
83 eZDir::copy( $sourceDir, $targetDir, false );
84
85 $package->appendInstall( 'ezinstallscript', false, false, true,
86 $scriptItem['filename'], $scriptItem['sub-directory'],
87 array( 'content' => false ) );
88 }
89 }
90
91 function handleAddParameters( $packageType, $package, $cli, $arguments )
92 {
93 $scriptArgumentList = array_chunk( $arguments, 3 );
94 $params = array();
95
96 foreach ( $scriptArgumentList as $scriptArguments )
97 {
98 if ( count( $scriptArguments ) < 3 )
99 {
100 break;
101 }
102
103 $script = array(
104 'sub-directory' => $scriptArguments[0],
105 'filename' => $scriptArguments[1],
106 'source-directory' => $scriptArguments[2]
107 );
108
109 if ( !file_exists( $script['source-directory'] ) )
110 {
111 $cli->error( 'install script source directory ' . $cli->style( 'dir' ) . $script['source-directory'] . $cli->style( 'dir-end' ) . 'does not exist' );
112 return false;
113 }
114
115 $installFile = $script['source-directory'] . '/' . $script['filename'] . '.xml';
116 if ( !file_exists( $installFile ) )
117 {
118 $cli->error( 'install script ' . $cli->style( 'dir' ) . $script['filename'] . '.xml' . $cli->style( 'dir-end' ) . 'does not exist in source dir' );
119 return false;
120 }
121
122 $params[] = $script;
123 }
124
125 return $params;
126 }
127 }
128
129 ?>
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
eZInstallScriptPackageHandler
Empty handler to support package custom install scripts.
Definition: ezinstallscriptpackagehandler.php:19
eZInstallScriptPackageHandler\__construct
__construct()
Definition: ezinstallscriptpackagehandler.php:20
eZInstallScriptPackageHandler\handleAddParameters
handleAddParameters( $packageType, $package, $cli, $arguments)
Definition: ezinstallscriptpackagehandler.php:91
eZInstallScriptPackageHandler\install
install( $package, $installType, $parameters, $name, $os, $filename, $subdirectory, $content, &$installParameters, &$installData)
Definition: ezinstallscriptpackagehandler.php:61
eZInstallScriptPackageHandler\explainInstallItem
explainInstallItem( $package, $installItem, $requestedInfo=array())
Definition: ezinstallscriptpackagehandler.php:28
eZInstallScriptPackageHandler\add
add( $packageType, $package, $cli, $parameters)
Definition: ezinstallscriptpackagehandler.php:69
eZInstallScriptPackageHandler\uninstall
uninstall( $package, $installType, $parameters, $name, $os, $filename, $subdirectory, $content, &$installParameters, &$installData)
Definition: ezinstallscriptpackagehandler.php:50
eZPackageHandler
The class eZPackageHandler does.
Definition: ezpackagehandler.php:18
ezpI18n\tr
static tr( $context, $source, $comment=null, $arguments=null)
Definition: ezpi18n.php:86
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.