Merge lp:~edb/quam-plures/smarter_installer_plugins into lp:quam-plures
- smarter_installer_plugins
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 7611 |
Proposed branch: | lp:~edb/quam-plures/smarter_installer_plugins |
Merge into: | lp:quam-plures |
Diff against target: |
624 lines (+94/-152) 3 files modified
qp_install/_functions_create.php (+33/-61) qp_install/_functions_install.php (+61/-73) qp_plugins/basic_antispam_plugin/_basic_antispam.plugin.php (+0/-18) |
To merge this branch: | bzr merge lp:~edb/quam-plures/smarter_installer_plugins |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tilman Blumenbach (community) | merge | Approve | |
EdB | Needs Resubmitting | ||
Review via email: mp+65876@code.launchpad.net |
Commit message
Description of the change
Installs plugins that are present instead of core installing a list (which may not be present in each installation). Also "tidies up" what we see when we do an installation.
I'll get #2 and #3 done as soon as (and assuming) I can get bazaar to not be stupid again.
On adding punctuation to translatable bits, we decided a long time ago to not do that because it tends to cause multiple "the same but different" strings. Think templates is mostly where, but the problem is scattered throughout core. Pretty much one way or the other is where I'm at. If we want to do "include punctuation" we can, but then we need/ought to go back and put all the punctuations back into everything that it was removed from.
Tilman Blumenbach (tblue) wrote : | # |
> On adding punctuation to translatable bits, we decided a long time ago to not do that because it tends to cause multiple "the same but different" strings. Think templates is mostly where, but the problem is scattered throughout core. Pretty much one way or the other is where I'm at. If we want to do "include punctuation" we can, but then we need/ought to go back and put all the punctuations back into everything that it was removed from.
Oooh, really? I must have missed/forgotten that. Well, I guess it's okay then.
BUT RTL followed by ... will look like crap. As will stuff like "by:" and "date:".
Back then another piece of the puzzle for minimizing translatables was removal of leading and trailing empty spaces. Perhaps that is where it should have stopped?
Anyway we need to revisit this topic. For this I can go ahead and put the ellipses in, but we really need to have a "core wide" answer for this type of thing.
Tilman Blumenbach (tblue) wrote : | # |
Agreed. Maybe write some guidelines regarding localization?
Fixed items #2 and #3 and tested without issue :)
Tilman Blumenbach (tblue) wrote : | # |
Looks good now!
Preview Diff
1 | === modified file 'qp_install/_functions_create.php' |
2 | --- qp_install/_functions_create.php 2011-01-29 22:04:06 +0000 |
3 | +++ qp_install/_functions_create.php 2011-07-13 16:26:30 +0000 |
4 | @@ -56,7 +56,7 @@ |
5 | load_funcs('_core/model/db/_upgrade.funcs.php'); |
6 | |
7 | // Alter DB to match DB schema: |
8 | - install_make_db_schema_current( true ); |
9 | + install_make_db_schema_current( false ); |
10 | } |
11 | |
12 | |
13 | @@ -73,7 +73,7 @@ |
14 | global $Plugins; |
15 | $Plugins = new Plugins_admin_no_DB(); // COPY |
16 | |
17 | - echo 'Creating default blacklist entries... '; |
18 | + echo T_('Creating default blacklist entries').' ... '; |
19 | $query = "INSERT INTO T_antispam(aspm_string) VALUES ". |
20 | "('online-casino'), ('penis-enlargement'), ". |
21 | "('order-viagra'), ('order-phentermine'), ('order-xenical'), ". |
22 | @@ -82,11 +82,10 @@ |
23 | "('order-cheap-pills'), ('buy-xenadrine'), ('xxx'), ". |
24 | "('paris-hilton'), ('parishilton'), ('camgirls'), ('adult-models')"; |
25 | $DB->query( $query ); |
26 | - echo "OK.<br />\n"; |
27 | - |
28 | + task_end(); |
29 | |
30 | // highest order of permissions for group #1 |
31 | - echo 'Creating default groups... '; |
32 | + echo T_('Creating default groups').' ... '; |
33 | $Group_Admins = new Group(); // COPY ! |
34 | $Group_Admins->set( 'name', 'Administrators' ); |
35 | $Group_Admins->set( 'perm_admin', 'visible' ); |
36 | @@ -99,8 +98,6 @@ |
37 | $Group_Admins->set( 'perm_templates', 1 ); |
38 | $Group_Admins->set( 'perm_files', 'all' ); |
39 | $Group_Admins->dbinsert(); |
40 | - |
41 | - |
42 | // permissions generally one step down from group #1 |
43 | $Group_Special = new Group(); |
44 | $Group_Special->set( 'name', 'Special Bloggers' ); |
45 | @@ -114,8 +111,6 @@ |
46 | $Group_Special->set( 'perm_templates', 0 ); |
47 | $Group_Special->set( 'perm_files', 'edit' ); |
48 | $Group_Special->dbinsert(); |
49 | - |
50 | - |
51 | // permissions generally one step down from group #2 |
52 | $Group_Bloggers = new Group(); |
53 | $Group_Bloggers->set( 'name', 'Bloggers' ); |
54 | @@ -128,8 +123,6 @@ |
55 | $Group_Bloggers->set( 'perm_templates', 0 ); |
56 | $Group_Bloggers->set( 'perm_files', 'add' ); |
57 | $Group_Bloggers->dbinsert(); |
58 | - |
59 | - |
60 | // permissions generally one step down from group #3 |
61 | $Group_Users = new Group(); |
62 | $Group_Users->set( 'name', 'Basic Users' ); |
63 | @@ -142,9 +135,9 @@ |
64 | $Group_Users->set( 'perm_templates', 0 ); |
65 | $Group_Users->set( 'perm_files', 'view' ); |
66 | $Group_Users->dbinsert(); |
67 | - echo "OK.<br />\n"; |
68 | + task_end(); |
69 | |
70 | - echo 'Creating user field definitions... '; |
71 | + echo T_('Creating user field definitions').' ... '; |
72 | $DB->query( " |
73 | INSERT INTO T_plugin_sharedfields (psf_fieldname, psf_label, psf_type, psf_note, psf_validate) |
74 | VALUES ( 'address_1', 'Address 1', 'text', 'note', 'none' ), |
75 | @@ -175,12 +168,11 @@ |
76 | ( 'msn_im', 'MSN IM', 'text', 'note', 'none' ), |
77 | ( 'skype', 'Skype ID', 'text', 'note', 'none' ), |
78 | ( 'yahoo_im', 'Yahoo IM', 'text', 'note', 'none' );" ); |
79 | - echo "OK.<br />\n"; |
80 | - |
81 | - |
82 | - task_begin('Creating default users (one per group)...'); |
83 | + task_end(); |
84 | + |
85 | + echo T_('Creating default users').' ... '; |
86 | global $timestamp, $default_locale; |
87 | - |
88 | + // user in group #1 |
89 | $User_Admin = new User(); |
90 | $User_Admin->set( 'login', param('conf_admin_login', 'string' ) ); |
91 | $User_Admin->set( 'pass', md5(param('conf_admin_pass', 'string' )) ); |
92 | @@ -194,7 +186,7 @@ |
93 | $User_Admin->set_datecreated( installer_timestamp() ); |
94 | $User_Admin->set_Group( $Group_Admins ); |
95 | $User_Admin->dbinsert(); |
96 | - |
97 | + // user in group #2 |
98 | $User_Special = new User(); |
99 | $User_Special->set( 'login', 'demospecial' ); |
100 | $User_Special->set( 'pass', md5(param('conf_admin_pass', 'string' )) ); |
101 | @@ -208,7 +200,7 @@ |
102 | $User_Special->set_datecreated( installer_timestamp() ); |
103 | $User_Special->set_Group( $Group_Special ); |
104 | $User_Special->dbinsert(); |
105 | - |
106 | + // user in group #3 |
107 | $User_Bloggers = new User(); |
108 | $User_Bloggers->set( 'login', 'demoblogger' ); |
109 | $User_Bloggers->set( 'pass', md5(param('conf_admin_pass', 'string' )) ); |
110 | @@ -222,7 +214,7 @@ |
111 | $User_Bloggers->set_datecreated( installer_timestamp() ); |
112 | $User_Bloggers->set_Group( $Group_Bloggers ); |
113 | $User_Bloggers->dbinsert(); |
114 | - |
115 | + // user in group #4 |
116 | $User_Demo = new User(); |
117 | $User_Demo->set( 'login', 'demouser' ); |
118 | $User_Demo->set( 'pass', md5(param('conf_admin_pass', 'string' )) ); |
119 | @@ -236,11 +228,9 @@ |
120 | $User_Demo->set_datecreated( installer_timestamp() ); |
121 | $User_Demo->set_Group( $Group_Users ); |
122 | $User_Demo->dbinsert(); |
123 | - |
124 | task_end(); |
125 | |
126 | - // added in Phoenix-Alpha |
127 | - echo 'Creating default Post Types... '; |
128 | + echo T_('Creating default Post Types').' ... '; |
129 | $DB->query( " |
130 | INSERT INTO T_items__type ( ptyp_ID, ptyp_name ) |
131 | VALUES ( 1, 'Post' ), |
132 | @@ -254,11 +244,9 @@ |
133 | ( 3000, 'Sidebar link' ), |
134 | ( 4000, 'Reserved' ), |
135 | ( 5000, 'Reserved' ) " ); |
136 | - echo "OK.<br />\n"; |
137 | - |
138 | - |
139 | - // added in Phoenix-Beta |
140 | - echo 'Creating default file types... '; |
141 | + task_end(); |
142 | + |
143 | + echo T_('Creating default file types').' ... '; |
144 | // Contribs: feel free to add more types here... |
145 | // TODO: dh> shouldn't they get localized to the app's default locale? fp> ftyp_name, yes |
146 | $DB->query( "INSERT INTO T_filetypes |
147 | @@ -282,11 +270,11 @@ |
148 | (16, 'mp4', 'MPEG video', 'video/mp4', 'mp4.png', 'browser', 1), |
149 | (17, 'mov', 'Quicktime video', 'video/quicktime', 'mov.png', 'browser', 1) |
150 | " ); |
151 | - echo "OK.<br />\n"; |
152 | + task_end(); |
153 | |
154 | if( ! empty( $current_locale ) ) |
155 | { // Make sure the user sees his new system localized. |
156 | - echo 'Activating selected default locale... '; |
157 | + echo T_('Activating selected default locale').' ... '; |
158 | $DB->query( 'INSERT INTO T_locales ' |
159 | .'( loc_locale, loc_charset, loc_datefmt, loc_timefmt, ' |
160 | .'loc_startofweek, loc_name, loc_messages, loc_priority, ' |
161 | @@ -300,7 +288,7 @@ |
162 | .$DB->quote( $locales[$current_locale]['messages'] ).', ' |
163 | .$DB->quote( $locales[$current_locale]['priority'] ).', ' |
164 | .' 1)' ); |
165 | - echo 'OK.<br />', "\n"; |
166 | + task_end(); |
167 | } |
168 | |
169 | create_default_settings(); |
170 | @@ -458,8 +446,7 @@ |
171 | |
172 | $default_blog_longdesc = T_("This is the long description for the blog named '%s'. %s"); |
173 | |
174 | - echo "Creating default blogs... "; |
175 | - |
176 | + echo T_('Creating default blogs').' ... '; |
177 | $blog_shortname = 'Blog A'; |
178 | $blog_a_long = sprintf( T_('%s Title'), $blog_shortname ); |
179 | $blog_stub = 'a'; |
180 | @@ -506,19 +493,15 @@ |
181 | T_('This blog shows photos...'), |
182 | sprintf( $default_blog_longdesc, $blog_shortname, $blog_more_longdesc ), |
183 | 4, 'photo', 1 ); // template ID, type, num_posts |
184 | - |
185 | - echo "OK.<br />\n"; |
186 | - |
187 | + task_end(); |
188 | |
189 | global $query, $timestamp; |
190 | |
191 | - echo 'Creating sample categories... '; |
192 | - |
193 | + echo T_('Creating sample categories').' ... '; |
194 | // Create categories for blog A |
195 | $cat_welcome = cat_create( 'Welcome', 'NULL', $blog_a_ID ); |
196 | $cat_news = cat_create( 'News', 'NULL', $blog_a_ID ); |
197 | $cat_post_features = cat_create( 'Post features', 'NULL', $blog_a_ID ); |
198 | - |
199 | // Create categories for blog B |
200 | $cat_ann_b = cat_create( 'Announcements', 'NULL', $blog_b_ID ); |
201 | $cat_appname = cat_create( sprintf( '%s Tips', $app_name ), 'NULL', $blog_b_ID ); |
202 | @@ -534,21 +517,15 @@ |
203 | $cat_renderers = cat_create( 'Text Renderers', $cat_sidebar, $blog_b_ID ); |
204 | $cat_comments = cat_create( 'Comments', $cat_sidebar, $blog_b_ID ); |
205 | $cat_toolbars = cat_create( 'Toolbars', $cat_writepage, $blog_b_ID ); |
206 | - |
207 | // Create categories for linkblog |
208 | $cat_linkblog_b2evo = cat_create( $app_name, 'NULL', $blog_linkblog_ID ); |
209 | $cat_linkblog_contrib = cat_create( 'Contributors', 'NULL', $blog_linkblog_ID ); |
210 | - |
211 | // Create categories for photoblog |
212 | $cat_photo_album = cat_create( 'Owen Michael', 'NULL', $blog_photoblog_ID ); |
213 | - |
214 | - echo "OK.<br />\n"; |
215 | - |
216 | - |
217 | - echo 'Creating sample posts and comments... '; |
218 | - |
219 | + task_end(); |
220 | + |
221 | + echo T_('Creating sample posts and comments').' ... '; |
222 | global $app_baseurl; |
223 | - |
224 | // sets up inserting tags without knowing what tags are used by which post IDs |
225 | $tag_id_counter = 0; |
226 | |
227 | @@ -1051,10 +1028,6 @@ |
228 | $DB->query( $query ); |
229 | |
230 | |
231 | - |
232 | - |
233 | - |
234 | - |
235 | // Insert a post into blog #1: |
236 | $now = date('Y-m-d H:i:s',installer_timestamp()); |
237 | $edited_Item = new Item(); |
238 | @@ -1080,7 +1053,6 @@ |
239 | $DB->query( $query ); |
240 | |
241 | |
242 | - |
243 | // Insert a post into blog #1: |
244 | $now = date('Y-m-d H:i:s',installer_timestamp()); |
245 | $edited_Item = new Item(); |
246 | @@ -1164,10 +1136,10 @@ |
247 | $edit_File = new File( 'collection', 1, 'qp-logo_337x76.jpg' ); |
248 | $edit_File->link_to_Item( $edited_Item ); |
249 | |
250 | - echo "OK.<br />\n"; |
251 | - |
252 | - |
253 | - echo 'Creating default group/blog permissions... '; |
254 | + task_end(); |
255 | + |
256 | + |
257 | + echo T_('Creating default group/blog permissions').' ... '; |
258 | // Admin for blog A: |
259 | $query = " |
260 | INSERT INTO T_coll_group_perms( bloggroup_blog_ID, bloggroup_group_ID, bloggroup_ismember, |
261 | @@ -1188,11 +1160,11 @@ |
262 | ( $blog_linkblog_ID, ".$Group_Bloggers->ID.", 1, 'published,deprecated,protected,private,draft', 0, 0, 0, 0, 1, 1, 0 ), |
263 | ( $blog_linkblog_ID, ".$Group_Users->ID.", 1, '', 0, 0, 0, 0, 0, 0, 0 )"; |
264 | $DB->query( $query ); |
265 | - echo "OK.<br />\n"; |
266 | + task_end(); |
267 | |
268 | /* |
269 | // Note: we don't really need this any longer, but we might use it for a better default setup later... |
270 | - echo 'Creating default user/blog permissions... '; |
271 | + echo T_('Creating default user/blog permissions').' ... '; |
272 | // Admin for blog A: |
273 | $query = "INSERT INTO T_coll_user_perms( bloguser_blog_ID, bloguser_user_ID, bloguser_ismember, |
274 | bloguser_perm_poststatuses, bloguser_perm_delpost, bloguser_perm_comments, |
275 | @@ -1202,7 +1174,7 @@ |
276 | ( $blog_a_ID, ".$User_Demo->ID.", 1, |
277 | 'published,deprecated,protected,private,draft', 1, 1, 0, 0, 1, 1, 1 )"; |
278 | $DB->query( $query ); |
279 | - echo "OK.<br />\n"; |
280 | + task_end(); |
281 | */ |
282 | |
283 | install_basic_widgets(); |
284 | |
285 | === modified file 'qp_install/_functions_install.php' |
286 | --- qp_install/_functions_install.php 2010-12-31 12:12:03 +0000 |
287 | +++ qp_install/_functions_install.php 2011-07-13 16:26:30 +0000 |
288 | @@ -147,12 +147,10 @@ |
289 | } |
290 | |
291 | echo '<h2>'; |
292 | - printf( T_('Creating %s tables...'), $app_name ); |
293 | + printf( T_('Installing %s ...'), $app_name ); |
294 | echo '</h2>'; |
295 | flush(); |
296 | create_tables(); |
297 | - |
298 | - echo '<h2>'.T_('Creating minimum default data...').'</h2>'; |
299 | flush(); |
300 | create_default_data(); |
301 | |
302 | @@ -160,20 +158,13 @@ |
303 | { |
304 | global $Settings; |
305 | |
306 | - echo '<h2>'.T_('Installing sample contents...').'</h2>'; |
307 | flush(); |
308 | |
309 | // We're gonna need some environment in order to create the demo contents... |
310 | load_class( 'settings/model/_generalsettings.class.php' ); |
311 | load_class( 'users/model/_usersettings.class.php' ); |
312 | - /** |
313 | - * @var GeneralSettings |
314 | - */ |
315 | $Settings = new GeneralSettings(); |
316 | |
317 | - /** |
318 | - * @var UserCache |
319 | - */ |
320 | $UserCache = & get_Cache( 'UserCache' ); |
321 | // Create $current_User object. |
322 | // (Assigning by reference does not work with "global" keyword (PHP 5.2.8)) |
323 | @@ -212,7 +203,7 @@ |
324 | */ |
325 | function task_end() |
326 | { |
327 | - echo "OK.<br />\n"; |
328 | + echo /* TRANS: "okay", or "good" */ T_('OK.')."<br />\n"; |
329 | flush(); |
330 | } |
331 | |
332 | @@ -274,7 +265,7 @@ |
333 | { |
334 | global $DB; |
335 | |
336 | - echo "Checking for extra quote escaping in comments... "; |
337 | + echo T_('Checking for extra quote escaping in comments').' ... '; |
338 | $query = "SELECT comment_ID, comment_content |
339 | FROM T_comments |
340 | WHERE comment_content LIKE '%\\\\\\\\\'%' |
341 | @@ -283,7 +274,7 @@ |
342 | $rows = $DB->get_results( $query, ARRAY_A ); |
343 | if( $DB->num_rows ) |
344 | { |
345 | - echo 'Updating '.$DB->num_rows.' comments... '; |
346 | + echo sprintf( T_('Updating %d comments ... '), $DB->num_rows ); |
347 | foreach( $rows as $row ) |
348 | { |
349 | $query = "UPDATE T_comments |
350 | @@ -292,7 +283,7 @@ |
351 | $DB->query( $query ); |
352 | } |
353 | } |
354 | - echo "OK.<br />\n"; |
355 | + task_end(); |
356 | |
357 | } |
358 | |
359 | @@ -344,12 +335,11 @@ |
360 | $insertvalues[] = '('.$DB->quote($name).', '.$DB->quote($defaults[$name]).')'; |
361 | } |
362 | } |
363 | - |
364 | - echo 'Creating default settings'.( count($override) ? ' (with '.count($override).' existing values)' : '' ).'... '; |
365 | + echo T_('Creating default settings').( count( $override ) ? ' '.sprintf( T_('(with %d existing values)'), count( $override ) ) : '' ).' ... '; |
366 | $DB->query( |
367 | "INSERT INTO T_settings (set_name, set_value) |
368 | VALUES ".implode( ', ', $insertvalues ) ); |
369 | - echo "OK.<br />\n"; |
370 | + task_end(); |
371 | } |
372 | |
373 | |
374 | @@ -360,7 +350,7 @@ |
375 | { |
376 | load_funcs( 'templates/_template.funcs.php' ); |
377 | |
378 | - echo 'Installing default templates... '; |
379 | + echo T_('Installing templates').' ... '; |
380 | |
381 | // Note: Template #1 will we used by Blog A |
382 | template_install( 'evopress' ); |
383 | @@ -387,30 +377,21 @@ |
384 | template_install( 'vastitude' ); |
385 | template_install( '_atom' ); |
386 | template_install( '_rss2' ); |
387 | - |
388 | - echo "OK.<br />\n"; |
389 | + task_end(); |
390 | } |
391 | |
392 | |
393 | /** |
394 | * Install basic plugins. |
395 | * |
396 | - * This gets called separately on fresh installs. |
397 | - * |
398 | - * {@internal |
399 | - * NOTE: this won't call the "AfterInstall" method on the plugin nor install its DB schema. |
400 | - * This get done in the plugins controller, on manually installing a plugin. |
401 | - * |
402 | - * If you change the number of plugins here, please also adjust {@link InstallUnitTestCase::nr_of_basic_plugins}. |
403 | - * }} |
404 | + * This gets called separately on fresh installs and installs all plugins found |
405 | + * in the qp_plugins folder EXCEPT 'test_plugin' and 'generic_ping_plugin'. |
406 | + * |
407 | * |
408 | * @param integer Old DB version, so that only new plugins gets installed |
409 | */ |
410 | function install_basic_plugins( $old_db_version = 0 ) |
411 | { |
412 | - /** |
413 | - * @var Plugins_admin |
414 | - */ |
415 | global $Plugins_admin; |
416 | |
417 | $Plugins_admin = & get_Cache('Plugins_admin'); |
418 | @@ -422,28 +403,46 @@ |
419 | |
420 | if( $old_db_version < 0001 ) |
421 | { |
422 | - install_plugin( 'adsense_plugin' ); // 'toolbars' |
423 | - install_plugin( 'archives_plugin' ); // 'widgets' - one day this turns into a widget :) |
424 | - install_plugin( 'auto_p_plugin' ); // 'renderers' |
425 | - install_plugin( 'autolinks_plugin' ); // 'renderers' |
426 | - install_plugin( 'basic_antispam_plugin' ); // 'antispam' |
427 | - install_plugin( 'bbcode_plugin' ); // 'renderers' |
428 | - install_plugin( 'calendar_plugin' ); // 'widgets' - one day this turns into a widget :) |
429 | - install_plugin( 'captcha_img_plugin' ); // 'antispam' |
430 | - install_plugin( 'code_highlight_plugin' ); // 'toolbars' |
431 | - install_plugin( 'comment_gravatars_plugin' ); // 'comments' |
432 | - install_plugin( 'commenttags_plugin' ); // 'comments' |
433 | - install_plugin( 'gmcode_plugin' ); // 'renderers' |
434 | - install_plugin( 'ping_pingomatic_plugin' ); // 'pingers' |
435 | - install_plugin( 'quicktags_plugin' ); // 'toolbars' |
436 | - install_plugin( 'smilies_plugin' ); // 'toolbars' |
437 | - install_plugin( 'texturize_plugin' ); // 'renderers' |
438 | - install_plugin( 'tinymce_plugin' ); // 'other' |
439 | - install_plugin( 'turingtest_plugin' ); // 'antispam' |
440 | - install_plugin( 'twitter_plugin' ); // 'pingers' |
441 | - install_plugin( 'video_plugin' ); // 'toolbars' |
442 | - install_plugin( 'whosonline_plugin' ); // 'widgets' - one day this turns into a widget :) |
443 | - install_plugin( 'wikilinks_plugin' ); // 'renderers' |
444 | + global $plugins_path; |
445 | + // thanks to http://www.the-art-of-web.com/php/dirlist/ for the basis of the following code |
446 | + // array to hold return value |
447 | + $plugins = array(); |
448 | + // open pointer to directory and read list of folders/files |
449 | + $d = dir( $plugins_path ) or die( sprintf( T_('Failed opening directory %s for reading'), $plugins_path ) ); |
450 | + while( false !== ( $entry = $d->read() ) ) |
451 | + { |
452 | + // skip hidden folders |
453 | + if( $entry[0] == '.' ) |
454 | + { |
455 | + continue; |
456 | + } |
457 | + // save directory names |
458 | + $plugins_path_entry = $plugins_path.$entry; |
459 | + if( is_dir( $plugins_path_entry ) ) |
460 | + { |
461 | + if( substr( $entry, -7 ) == '_plugin' && $entry != 'generic_ping_plugin' && $entry != 'test_plugin' ) |
462 | + { |
463 | + $plugins[] = $entry; |
464 | + } |
465 | + } |
466 | + } |
467 | + $d->close(); |
468 | + |
469 | + // install all plugins alphabetically |
470 | + echo T_('Installing plugins ... '); |
471 | + sort( $plugins ); |
472 | + foreach( $plugins as $a_plugin ) |
473 | + { |
474 | + install_plugin( $a_plugin ); |
475 | + } |
476 | + task_end(); |
477 | + } |
478 | + |
479 | + // perform AfterInstall() tasks |
480 | + $Plugins_admin->restart(); |
481 | + while( $a_plugin = & $Plugins_admin->get_next() ) |
482 | + { |
483 | + $Plugins_admin->call_method( $a_plugin->ID, 'AfterInstall', $params = array() ); |
484 | } |
485 | |
486 | } |
487 | @@ -454,14 +453,11 @@ |
488 | */ |
489 | function uninstall_plugin( $plugin ) |
490 | { |
491 | - /** |
492 | - * @var Plugins_admin |
493 | - */ |
494 | global $Plugins_admin; |
495 | |
496 | if( $edit_Plugin = & $Plugins_admin->get_by_classname( $plugin ) ) |
497 | { // plugin is installed |
498 | - echo 'Uninstalling plugin: '.$plugin.'... '; |
499 | + echo T_('Uninstalling plugin: ').$plugin.' ... '; |
500 | $Plugins_admin->uninstall( $edit_Plugin->ID ); |
501 | } |
502 | } |
503 | @@ -472,24 +468,18 @@ |
504 | */ |
505 | function install_plugin( $plugin ) |
506 | { |
507 | - /** |
508 | - * @var Plugins_admin |
509 | - */ |
510 | global $Plugins_admin; |
511 | global $DB; |
512 | |
513 | - echo 'Installing plugin: '.$plugin.'... '; |
514 | $edit_Plugin = & $Plugins_admin->install( $plugin, 'broken' ); // "broken" by default, gets adjusted later |
515 | if( ! is_a( $edit_Plugin, 'Plugin' ) ) |
516 | { |
517 | - echo $edit_Plugin."<br />\n"; |
518 | return false; |
519 | } |
520 | |
521 | - // install tables if required |
522 | + // perform GetDbLayout() |
523 | if( $db_layout = $edit_Plugin->GetDbLayout() ) |
524 | { |
525 | - echo 'creating table(s)... '; |
526 | foreach( $db_layout as $a_table ) |
527 | { |
528 | $DB->query( $a_table ); |
529 | @@ -501,14 +491,12 @@ |
530 | if( $enable_return !== true ) |
531 | { |
532 | $Plugins_admin->set_Plugin_status( $edit_Plugin, 'disabled' ); // does not unregister it |
533 | - echo $enable_return."<br />\n"; |
534 | return false; |
535 | } |
536 | |
537 | $Plugins_admin->set_Plugin_status( $edit_Plugin, 'enabled' ); |
538 | - |
539 | - echo "OK.<br />\n"; |
540 | return true; |
541 | + |
542 | } |
543 | |
544 | |
545 | @@ -519,8 +507,7 @@ |
546 | { |
547 | global $DB; |
548 | |
549 | - echo 'Installing default widgets... '; |
550 | - |
551 | + echo T_('Installing default widgets').' ... '; |
552 | // Add blog list to all blog Page Tops: |
553 | $DB->query( 'INSERT INTO T_widget( wi_coll_ID, wi_sco_name, wi_order, wi_type, wi_code, wi_params ) |
554 | SELECT blog_ID, "Page Top", 1, "widget", "bloglist", \'a:5:{s:14:"coll_list_type";s:6:"public";s:11:"widget_name";s:9:"Blog List";}\' |
555 | @@ -621,7 +608,7 @@ |
556 | SELECT blog_ID, "Sidebar 2", 4, "widget", "free_html", \'a:5:{s:5:"title";s:9:"Sidebar 2";s:7:"content";s:162:"This is the "Sidebar 2" container. You can place any widget you like in here. In the evo toolbar at the top of this page, select "Customize", then "Blog Widgets".";s:11:"widget_name";s:9:"Free HTML";s:16:"widget_css_class";s:0:"";s:9:"widget_ID";s:0:"";}\' |
557 | FROM T_blogs' ); |
558 | |
559 | - echo "OK.<br />\n"; |
560 | + task_end(); |
561 | } |
562 | |
563 | |
564 | @@ -646,7 +633,7 @@ |
565 | { |
566 | global $DB; |
567 | |
568 | - echo 'Creating relations... '; |
569 | + echo T_('Creating relations').' ... '; |
570 | |
571 | $DB->query( 'alter table T_coll_user_perms |
572 | add constraint FK_bloguser_blog_ID |
573 | @@ -810,7 +797,7 @@ |
574 | on delete restrict |
575 | on update restrict' ); |
576 | |
577 | - echo "OK.<br />\n"; |
578 | + task_end(); |
579 | } |
580 | |
581 | |
582 | @@ -834,11 +821,12 @@ |
583 | } |
584 | |
585 | // Load modules: |
586 | + echo T_('Loading modules').' ... '; |
587 | foreach( $modules as $module ) |
588 | { |
589 | - echo 'Loading: '.$module.'/model/_'.$module.'.install.php<br />'; |
590 | require_once $inc_path.$module.'/model/_'.$module.'.install.php'; |
591 | } |
592 | + task_end(); |
593 | |
594 | } |
595 | ?> |
596 | |
597 | === modified file 'qp_plugins/basic_antispam_plugin/_basic_antispam.plugin.php' |
598 | --- qp_plugins/basic_antispam_plugin/_basic_antispam.plugin.php 2011-03-01 19:59:37 +0000 |
599 | +++ qp_plugins/basic_antispam_plugin/_basic_antispam.plugin.php 2011-07-13 16:26:30 +0000 |
600 | @@ -293,24 +293,6 @@ |
601 | |
602 | |
603 | /** |
604 | - * @see Plugin::AfterInstall() |
605 | - */ |
606 | - function AfterInstall() |
607 | - { |
608 | - global $Settings; |
609 | - |
610 | - if( $Settings->get('hit_doublecheck_referer') ) |
611 | - { // old general settings, "transform it" |
612 | - $this->Settings->set( 'check_url_referers', '1' ); |
613 | - $this->Settings->dbupdate(); |
614 | - } |
615 | - |
616 | - $Settings->delete('hit_doublecheck_referer'); |
617 | - $Settings->dbupdate(); |
618 | - } |
619 | - |
620 | - |
621 | - /** |
622 | * @see Plugin::AppendHitLog() |
623 | */ |
624 | function AppendHitLog( & $params ) |
Here are some things I'd fix (but I can't since I have no push access to the branch -- wrong owner):
1.) There are multiple occurrences of partly localized strings, like this:
echo T_('Installing templates').' ... ';
I think you should include the ellipsis in the string that's passed to T_(). Think of languages written from right to left: It looks weird if there's an ellipsis in front of the status output...
2.) echo T_('Creating default settings').( count($override) ? ' (with '.count( $override) .' existing values)' : '' ).' ... ';
I'd make the rest of the output ("with %d existing values") localizable, too.
3.) Nitpicking: if( strpos( $entry, '_plugin' ) && $entry != 'generic_ ping_plugin' && $entry != 'test_plugin' )
Just to be completely sure it's a valid plugin folder, I'd use this: ping_plugin' && $entry != 'test_plugin' )
if( substr( $entry, -7 ) == '_plugin' && $entry != 'generic_