-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate_package_xml.php
276 lines (235 loc) · 13.6 KB
/
generate_package_xml.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<?php
/**
* package.xml generation script
*
* @package Intraface
* @author Lars Olesen <[email protected]>
* @version @package-version@
*/
error_reporting(0);
if (isset($_SERVER['argv']) && !empty($_SERVER['argv'][2])) {
$version = $_SERVER['argv'][2];
} else {
$version = '2.0.7';
}
$stability = 'stable';
$notes = '
* many changes
';
$web_dir = 'src/intraface.dk';
// @todo make sure that there is not created an intraface.dk/intraface.dk on the server
// @todo make sure that there is not created an install dir on the server.
$ignore = array(
'intraface.dk/config.local.php',
'intraface.dk/config.local.default.php',
'intraface.dk/demo/config.local.php',
'intraface.dk/demo/config.local.example.php',
'intraface.dk/install/',
'intraface.dk/install/reset-staging-server.php',
'.git/',
'.settings/'
);
function getFilelist($dir) {
global $rFiles;
$files = glob($dir.'/*');
foreach ($files as $f) {
if (is_dir($f)) { getFileList($f); continue; }
$rFiles[] = $f;
}
}
getFilelist($web_dir);
$web_files = $rFiles;
require_once 'PEAR/PackageFileManager2.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);
$pfm = new PEAR_PackageFileManager2();
$pfm->setOptions(
array(
'baseinstalldir' => '/',
'filelistgenerator' => 'file',
'packagedirectory' => dirname(__FILE__).'/src',
'packagefile' => 'package.xml',
'ignore' => $ignore,
'dir_roles' => array(
'intraface.dk' => 'www'
),
'exceptions' => array(
'intraface.dk/*.*' => 'www'
),
'simpleoutput' => true,
'addhiddenfiles' => true
)
);
$pfm->setPackage('Intraface');
$pfm->setSummary('Intraface');
$pfm->setDescription('Intraface');
$pfm->setUri('http://localhost/');
$pfm->setLicense('LGPL License', 'http://www.gnu.org/licenses/lgpl.html');
$pfm->addMaintainer('lead', 'lsolesen', 'Lars Olesen', '[email protected]');
$pfm->addMaintainer('lead', 'sune.t.jensen', 'Sune Jensen', '[email protected]');
$pfm->setPackageType('php');
$pfm->setAPIVersion($version);
$pfm->setReleaseVersion($version);
$pfm->setAPIStability($stability);
$pfm->setReleaseStability($stability);
$pfm->setNotes($notes);
$pfm->addRelease();
$pfm->resetUsesRole();
$pfm->addPackageDepWithChannel('required', 'HTTP', 'pear.php.net', '1.4.1');
// $pfm->addGlobalReplacement('package-info', '@package-version@', 'version');
$pfm->addReplacement('intraface.php', 'pear-config', '@php-dir@', 'php_dir');
$pfm->addReplacement('intraface.php', 'pear-config', '@web-dir@', 'www_dir');
$pfm->addReplacement('intraface.php', 'pear-config', '@data-dir@', 'data_dir');
$pfm->clearDeps();
$pfm->setPhpDep('5.2.0');
$pfm->setPearinstallerDep('1.8.1');
// installer
$pfm->addPackageDepWithChannel('required', 'Config', 'pear.php.net', '1.10.12');
$pfm->addPackageDepWithChannel('required', 'Swift', 'pear.swiftmailer.org', '4.0.7', '4.0.7');
// Kernel
$pfm->addPackageDepWithChannel('required', 'MDB2', 'pear.php.net', '2.4.1');
$pfm->addPackageDepWithChannel('required', 'MDB2_Driver_mysql', 'pear.php.net', '1.4.1');
$pfm->addPackageDepWithChannel('required', 'Translation2', 'pear.php.net', '2.0.4');
$pfm->addPackageDepWithChannel('required', 'Translation2_Decorator_LogMissingTranslation', 'public.intraface.dk', '0.1.3');
$pfm->addPackageDepWithChannel('required', 'Log', 'pear.php.net', '1.12.6');
$pfm->addPackageDepWithChannel('required', 'Validate', 'pear.php.net', '0.8.4');
$pfm->addPackageDepWithChannel('required', 'Net_IDNA', 'pear.php.net', '0.8.1');
$pfm->addPackageDepWithChannel('required', 'HTTP_Upload', 'pear.php.net', '0.9.1');
$pfm->addPackageDepWithChannel('required', 'Cache_Lite', 'pear.php.net', '1.7.11');
$pfm->addPackageDepWithChannel('required', 'Image_Transform', 'pear.php.net', '0.9.4');
$pfm->addPackageDepWithChannel('required', 'Ilib_ErrorHandler_Handler', 'public.intraface.dk', '1.0.2');
$pfm->addPackageDepWithChannel('required', 'MDB2_Debug_ExplainQueries', 'public.intraface.dk', '0.1.1');
$pfm->addPackageDepWithChannel('required', 'File', 'pear.php.net', '1.4.0');
$pfm->addPackageDepWithChannel('required', 'Ilib_RandomKeyGenerator', 'public.intraface.dk', '0.3.1');
$pfm->addPackageDepWithChannel('required', 'Ilib_Position', 'public.intraface.dk', '0.4.1');
$pfm->addPackageDepWithChannel('required', 'bucket', 'pearhub.org', '1.1.1');
// Doctrine
$pfm->addPackageDepWithChannel('required', 'Doctrine', 'pear.doctrine-project.org', '1.2.4');
$pfm->addPackageDepWithChannel('required', 'Doctrine_Validator_Nohtml', 'public.intraface.dk', '0.1.3');
$pfm->addPackageDepWithChannel('required', 'Doctrine_Validator_Greaterthan', 'public.intraface.dk', '0.1.3');
$pfm->addPackageDepWithChannel('required', 'Doctrine_Template_Positionable', 'public.intraface.dk', '0.2.2');
// Ilib
$pfm->addPackageDepWithChannel('required', 'Ilib_Category', 'public.intraface.dk', '0.1.5');
$pfm->addPackageDepWithChannel('required', 'Ilib_DBQuery', 'public.intraface.dk', '0.1.10');
$pfm->addPackageDepWithChannel('required', 'Ilib_Error', 'public.intraface.dk', '1.0.1');
$pfm->addPackageDepWithChannel('required', 'Ilib_Redirect', 'public.intraface.dk', '0.2.2');
$pfm->addPackageDepWithChannel('required', 'Ilib_FileImport', 'public.intraface.dk', '0.1.3');
$pfm->addPackageDepWithChannel('required', 'Ilib_Validator', 'public.intraface.dk', '0.0.2');
$pfm->addPackageDepWithChannel('required', 'Ilib_ClassLoader', 'public.intraface.dk', '0.1.2');
$pfm->addPackageDepWithChannel('required', 'Ilib_Variable', 'public.intraface.dk', '1.0.1');
// other intraface 3_Party packages
$pfm->addPackageDepWithChannel('required', 'DB_Sql', 'public.intraface.dk', '0.0.1');
// XMLRPC
$pfm->addPackageDepWithChannel('required', 'XML_RPC2', 'pear.php.net', '1.0.8');
// Bug fix for PEAR XML_RPC2 version 1.0.2
// $pfm->addPackageDepWithChannel('required', 'XML_RPC2', 'public.intraface.dk', '0.0.1');
// Yet another bug fix for PEAR XML_RPC2 version 1.0.2
// $pfm->addPackageDepWithChannel('required', 'XML_RPC2_Backend_Php_ServerFixedEncodingObject', 'public.intraface.dk', '0.0.1');
// filehandler
$pfm->addPackageDepWithChannel('required', 'MIME_Type', 'pear.php.net', '1.2.1');
$pfm->addPackageDepWithChannel('required', 'System_Command', 'pear.php.net', '1.0.7');
$pfm->addPackageDepWithChannel('required', 'Ilib_Filehandler', 'public.intraface.dk', '0.4.0');
$pfm->addPackageDepWithChannel('required', 'Ilib_Keyword', 'public.intraface.dk', '0.4.0');
$pfm->addPackageDepWithChannel('required', 'Ilib_Filehandler_Controller', 'public.intraface.dk', '0.3.0');
$pfm->addPackageDepWithChannel('required', 'Ilib_Keyword_Controller', 'public.intraface.dk', '0.3.0');
$pfm->addPackageDepWithChannel('required', 'Ilib_Date', 'public.intraface.dk', '0.2.1');
// cms
$pfm->addPackageDepWithChannel('required', 'XML_Util', 'pear.php.net', '1.2.0');
$pfm->addPackageDepWithChannel('required', 'XML_Serializer', 'pear.php.net', '0.20.2');
$pfm->addPackageDepWithChannel('required', 'HTMLPurifier', 'htmlpurifier.org', '4.0.3');
$pfm->addPackageDepWithChannel('required', 'Text_Wiki', 'pear.php.net', '1.2.1');
$pfm->addPackageDepWithChannel('required', 'Markdown', 'pear.michelf.com', '1.0.1m');
$pfm->addPackageDepWithChannel('required', 'SmartyPants', 'pear.michelf.com', '1.5.1oo2');
$pfm->addPackageDepWithChannel('required', 'phpFlickr', 'public.intraface.dk', '1.6.1');
$pfm->addPackageDepWithChannel('required', 'IntrafacePublic_CMS_HTML', 'public.intraface.dk', '0.2.0');
// debtor
$pfm->addPackageDepWithChannel('required', 'Document_Cpdf', 'public.intraface.dk', '0.0.2');
$pfm->addPackageDepWithChannel('required', 'Console_Table', 'pear.php.net', '1.1.4');
// contact
$pfm->addPackageDepWithChannel('required', 'Services_Eniro', 'public.intraface.dk', '1.0.0');
$pfm->addPackageDepWithChannel('required', 'Contact_Vcard_Build', 'pear.php.net', '1.1.2');
$pfm->addPackageDepWithChannel('required', 'Date', 'pear.php.net', '1.4.7');
// onlinepayment
$pfm->addPackageDepWithChannel('required', 'Payment_Quickpay', 'public.intraface.dk', '1.18.3');
// $pfm->addPackageDepWithChannel('required', 'Validate_Finance_CreditCard', 'pear.php.net', '0.5.2');
// accounting
$pfm->addPackageDepWithChannel('required', 'OLE', 'pear.php.net', '1.0.0RC1');
$pfm->addPackageDepWithChannel('required', 'Spreadsheet_Excel_Writer', 'pear.php.net', '0.9.2');
// modulepackage
$pfm->addPackageDepWithChannel('required', 'IntrafacePublic_Debtor_XMLRPC', 'public.intraface.dk', '0.1.0');
$pfm->addPackageDepWithChannel('required', 'Ilib_Payment_Authorize_Provider_Testing', 'public.intraface.dk', '1.0.0');
// shop
$pfm->addPackageDepWithChannel('required', 'Ilib_Countries', 'public.intraface.dk', '1.0.0');
// demo
$pfm->addPackageDepWithChannel('required', 'IntrafacePublic_CMS', 'public.intraface.dk', '0.1.7');
$pfm->addPackageDepWithChannel('required', 'IntrafacePublic_CMS_Client_XMLRPC', 'public.intraface.dk', '0.2.0');
$pfm->addPackageDepWithChannel('required', 'IntrafacePublic_CMS_Controller', 'public.intraface.dk', '2.1.1');
$pfm->addPackageDepWithChannel('required', 'IntrafacePublic_Admin_Client_XMLRPC', 'public.intraface.dk', '0.1.0');
$pfm->addPackageDepWithChannel('required', 'IntrafacePublic_OnlinePayment_Client_XMLRPC', 'public.intraface.dk', '1.0.0');
$pfm->addPackageDepWithChannel('required', 'IntrafacePublic_OnlinePayment_Controller', 'public.intraface.dk', '1.0.1');
$pfm->addPackageDepWithChannel('required', 'IntrafacePublic_Shop', 'public.intraface.dk', '1.0.0');
$pfm->addPackageDepWithChannel('required', 'IntrafacePublic_Shop_Client_XMLRPC', 'public.intraface.dk', '1.0.4');
$pfm->addPackageDepWithChannel('required', 'IntrafacePublic_Shop_Controller', 'public.intraface.dk', '1.2.2');
$pfm->addPackageDepWithChannel('required', 'IntrafacePublic_Newsletter_Client_XMLRPC', 'public.intraface.dk', '1.1.1');
$pfm->addPackageDepWithChannel('required', 'IntrafacePublic_Newsletter_Controller', 'public.intraface.dk', '1.0.1');
$pfm->addPackageDepWithChannel('required', 'konstrukt', 'pearhub.org', '2.3.1');
$pfm->addPackageDepWithChannel('required', 'ilib_recursive_array_map', 'public.intraface.dk', '0.1.0');
// tools
// $pfm->addPackageDepWithChannel('required', 'Ilib_SimpleLogin', 'public.intraface.dk', '1.0.0');
// $pfm->addPackageDepWithChannel('required', 'Ilib_ErrorHandler_Observer_File_ErrorList', 'public.intraface.dk', '1.0.3');
// $pfm->addPackageDepWithChannel('required', 'Translation2_Frontend', 'public.intraface.dk', '2.0.0');
$pfm->addPackageDepWithChannel('required', 'Zend', 'zend.googlecode.com/svn', '1.11.7');
foreach ($ignore AS $file) {
// $pfm->addIgnoreToRelease($file);
}
/**
* @todo: path_include_path: what to set it to?
*/
$post_install_script = $pfm->initPostinstallScript('intraface.php');
$post_install_script->addParamGroup('setup',
array($post_install_script->getParam('db_user', 'User', 'string', 'root'),
$post_install_script->getParam('db_pass', 'Password', 'string', ''),
$post_install_script->getParam('db_host', 'Host', 'string', 'localhost'),
$post_install_script->getParam('db_name', 'Database', 'string', 'intraface'),
$post_install_script->getParam('net_scheme', 'Net scheme', 'string', 'http://'),
$post_install_script->getParam('net_host', 'Net host', 'string', 'localhost'),
$post_install_script->getParam('net_directory', 'Net directory', 'string', '/'),
$post_install_script->getParam('path_root', 'Root path', 'string', '/home/intraface/'),
$post_install_script->getParam('path_include_path', 'Include path', 'string', ''),
$post_install_script->getParam('path_upload', 'Upload path', 'string', '/home/intraface/upload/'),
$post_install_script->getParam('path_cache', 'Cache path', 'string', '/home/intraface/cache'),
$post_install_script->getParam('connection_internet', 'Connection to intranet', 'boolean', true),
$post_install_script->getParam('server_status', 'Server status', 'string', 'PRODUCTION'),
$post_install_script->getParam('error_handle_level', 'Error handle error ', 'integer', E_ALL),
$post_install_script->getParam('error_level_continue_script', 'Error level continue script', 'integer' ^ E_NOTICE),
$post_install_script->getParam('error_report_email', 'Error report email', 'string', '[email protected]'),
$post_install_script->getParam('error_log', 'Error log', 'string', 'log/error.log'),
$post_install_script->getParam('timezone', 'Timezone', 'string', 'Europe/Copenhagen'),
$post_install_script->getParam('country_local', 'Country local', 'string', 'da_DK'),
$post_install_script->getParam('intraface_intranetmaintenance_intranet_private_key', 'Private key', 'string', ''),
$post_install_script->getParam('intraface_onlinepayment_provider', 'Online payment provider', 'string', 'Quickpay'),
$post_install_script->getParam('intraface_onlinepayment_merchant', 'Online payment merchant number', 'string', ''),
$post_install_script->getParam('intraface_onlinepayment_md5secret', 'Online payment md5secret', 'string', '')
),
'');
$pfm->addPostInstallTask($post_install_script, 'intraface.php');
foreach ($web_files AS $file) {
$src_file = substr($file, 4);
$formatted_file = substr($file, strlen($web_dir . '/'));
if (in_array($src_file, $ignore)) continue;
$pfm->addInstallAs($src_file, $formatted_file);
}
$pfm->generateContents();
if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) {
$res = $pfm->writePackageFile();
if (PEAR::isError($res)) {
echo $res->toString()."\n";
}
if ($res) {
exit("Package file written\n");
}
} else {
$res = $pfm->debugPackageFile();
if (PEAR::isError($res)) {
echo $res->toString()."\n";
}
}