/
admin_rebuild_search.php
624 lines (520 loc) Β· 19.8 KB
/
admin_rebuild_search.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
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
<?php
if (!empty($setmodules))
{
if (IS_SUPER_ADMIN) $module['GENERAL']['REBUILD_SEARCH_INDEX'] = basename(__FILE__);
return;
}
require('./pagestart.php');
if (!IS_SUPER_ADMIN) bb_die($lang['NOT_ADMIN']);
require(INC_DIR .'bbcode.php');
define('REBUILD_SEARCH_ABORTED', 0); // when the user aborted the processing
define('REBUILD_SEARCH_PROCESSED', 1); // when a batch of posts has been processed
define('REBUILD_SEARCH_COMPLETED', 2); // when all the db posts have been processed
//
// Define initial vars
//
$def_post_limit = 50;
$def_refresh_rate = 3;
$def_time_limit = ($sys_time_limit = @ini_get('max_execution_time')) ? $sys_time_limit : 30;
$last_session_data = get_rebuild_session_details('last', 'all');
$last_session_id = (int) $last_session_data['rebuild_session_id'];
$max_post_id = get_latest_post_id();
$start_time = TIMENOW;
$mode = (string) @$_REQUEST['mode'];
// check if the user has choosen to stop processing
if (isset($_REQUEST['cancel_button']))
{
// update the rebuild_status
if ($last_session_id)
{
DB()->query("
UPDATE ". BB_SEARCH_REBUILD ." SET
rebuild_session_status = ". REBUILD_SEARCH_ABORTED ."
WHERE rebuild_session_id = $last_session_id
");
}
bb_die(sprintf($lang['REBUILD_SEARCH_ABORTED'], $last_session_data['end_post_id']) .'<br /><br />'. sprintf($lang['CLICK_RETURN_REBUILD_SEARCH'], '<a href="admin_rebuild_search.php">', '</a>'));
}
// from which post to start processing
$start = abs(intval(@$_REQUEST['start']));
// get the total number of posts in the db
$total_posts = get_total_posts();
// clear the search tables and clear mode (delete or truncate)
$clear_search = isset($_REQUEST['clear_search']) ? (int) $_REQUEST['clear_search'] : 0;
// get the number of total/session posts already processed
$total_posts_processed = ( $start != 0 ) ? get_total_posts('before', $last_session_data['end_post_id']) : 0;
$session_posts_processed = ( $mode == 'refresh' ) ? get_processed_posts('session') : 0;
// find how many posts aren't processed
$total_posts_processing = $total_posts - $total_posts_processed;
// how many posts to process in this session
if ($session_posts_processing = @intval($_REQUEST['session_posts_processing']))
{
if ($mode == 'submit')
{
// check if we passed over total_posts just after submitting
if ($session_posts_processing + $total_posts_processed > $total_posts)
{
$session_posts_processing = $total_posts - $total_posts_processed;
}
}
// correct it when posts are deleted during processing
$session_posts_processing = ($session_posts_processing > $total_posts) ? $total_posts : $session_posts_processing;
}
else
{
// if we have finished, get all the posts, else only the remaining
$session_posts_processing = (!$total_posts_processing) ? $total_posts : $total_posts_processing;
}
// how many posts to process per cycle
$post_limit = isset($_REQUEST['post_limit']) ? (int) $_REQUEST['post_limit'] : $def_post_limit;
// correct the post_limit when we pass over it
if ( $session_posts_processed + $post_limit > $session_posts_processing )
{
$post_limit = $session_posts_processing - $session_posts_processed;
}
// how much time to wait per cycle
if (isset($_REQUEST['time_limit']))
{
$time_limit = (int) $_REQUEST['time_limit'];
}
else
{
$time_limit = $def_time_limit;
$time_limit_explain = $lang['TIME_LIMIT_EXPLAIN'];
// check for safe mode timeout
if ( ini_get('safe_mode') )
{
// get execution time
$max_execution_time = ini_get('max_execution_time');
$time_limit_explain .= '<br />' . sprintf($lang['TIME_LIMIT_EXPLAIN_SAFE'], $max_execution_time);
if ( $time_limit > $max_execution_time )
{
$time_limit = $max_execution_time;
}
}
// check for webserver timeout (IE returns null)
if ( isset($_SERVER["HTTP_KEEP_ALIVE"]) )
{
// get webserver timeout
$webserver_timeout = intval($_SERVER["HTTP_KEEP_ALIVE"]);
$time_limit_explain .= '<br />' . sprintf($lang['TIME_LIMIT_EXPLAIN_WEBSERVER'], $webserver_timeout);
if ( $time_limit > $webserver_timeout )
{
$time_limit = $webserver_timeout;
}
}
}
// how much time to wait between page refreshes
$refresh_rate = isset($_REQUEST['refresh_rate']) ? (int) $_REQUEST['refresh_rate'] : $def_refresh_rate;
// check if the user gave wrong input
if ($mode == 'submit')
{
if (($session_posts_processing || $post_limit || $refresh_rate || $time_limit) <= 0)
{
bb_die($lang['WRONG_INPUT'] .'<br /><br />'. sprintf($lang['CLICK_RETURN_REBUILD_SEARCH'], '<a href="admin_rebuild_search.php">', '</a>'));
}
}
// Increase maximum execution time in case of a lot of posts, but don't complain about it if it isn't allowed.
@set_time_limit($time_limit + 20);
// check if we are should start processing
if ($mode == 'submit' || $mode == 'refresh')
{
// check if we are in the beginning of processing
if ($start == 0)
{
$last_session_data = get_empty_last_session_data();
clear_search_tables($clear_search);
}
// get the db sizes
list($search_data_size, $search_index_size, $search_tables_size) = get_db_sizes();
// get the post subject/text of each post
$result = DB()->query("
SELECT
pt.post_id, pt.post_text,
IF(p.post_id = t.topic_first_post_id, t.topic_title, '') AS post_subject
FROM
". BB_POSTS_TEXT ." pt,
". BB_POSTS ." p,
". BB_TOPICS ." t
WHERE p.post_id = pt.post_id
AND t.topic_id = p.topic_id
AND p.poster_id NOT IN(". BOT_UID .")
AND pt.post_id >= $start
ORDER BY pt.post_id ASC
LIMIT $post_limit
");
$expire_time = $start_time + $time_limit - 5;
$start_post_id = $end_post_id = $num_rows = 0;
$timer_expired = false;
$words_sql = array();
while ($row = DB()->fetch_next($result) AND !$timer_expired)
{
@set_time_limit(600);
$start_post_id = ($num_rows == 0) ? $row['post_id'] : $start_post_id;
$end_post_id = $row['post_id'];
// Get search words
$s_post_text = str_replace('\n', "\n", $row['post_text']);
$s_post_subject = str_replace('\n', "\n", $row['post_subject']);
$words_sql[] = array(
'post_id' => (int) $row['post_id'],
'search_words' => add_search_words($row['post_id'], stripslashes($s_post_text), stripslashes($s_post_subject), true),
);
$timer_expired = (TIMENOW > $expire_time);
$num_rows++;
}
// Store search words
if ($words_sql)
{
DB()->query("REPLACE INTO ". BB_POSTS_SEARCH . DB()->build_array('MULTI_INSERT', $words_sql));
}
// find how much time the last cycle took
$last_cycle_time = intval(TIMENOW - $start_time);
// check if we had any data
if ($num_rows != 0)
{
if ($mode == 'submit')
{
// insert a new session entry
$args = DB()->build_array('INSERT', array(
'end_post_id' => (int) $end_post_id,
'end_time' => (int) TIMENOW,
'last_cycle_time' => (int) $last_cycle_time,
'session_time' => (int) $last_cycle_time,
'session_posts' => (int) $num_rows,
'session_cycles' => (int) 1,
'start_post_id' => (int) $start_post_id,
'start_time' => (int) $start_time,
'search_size' => (int) $search_tables_size,
'rebuild_session_status' => REBUILD_SEARCH_PROCESSED,
));
DB()->query("REPLACE INTO ". BB_SEARCH_REBUILD . $args);
}
else // refresh
{
// update the last session entry
DB()->query("
UPDATE ". BB_SEARCH_REBUILD ." SET
end_post_id = $end_post_id,
end_time = ". TIMENOW .",
last_cycle_time = $last_cycle_time,
session_time = session_time + $last_cycle_time,
session_posts = session_posts + $num_rows,
session_cycles = session_cycles + 1,
rebuild_session_status = ". REBUILD_SEARCH_PROCESSED ."
WHERE rebuild_session_id = $last_session_id
");
}
}
$last_session_data = get_rebuild_session_details('last', 'all');
$template->assign_vars(array('TPL_REBUILD_SEARCH_PROGRESS' => true));
$processing_messages = '';
$processing_messages .= ($timer_expired) ? sprintf($lang['TIMER_EXPIRED'], TIMENOW - $start_time) : '';
$processing_messages .= ($start == 0 && $clear_search) ? $lang['CLEARED_SEARCH_TABLES'] : '';
// check if we have reached the end of our post processing
$session_posts_processed = get_processed_posts('session');
$total_posts_processed = get_total_posts('before', $last_session_data['end_post_id']);
$total_posts = get_total_posts();
if ( $session_posts_processed < $session_posts_processing && $total_posts_processed < $total_posts )
{
$form_parameters = '&start='.($end_post_id+1);
$form_parameters .= '&session_posts_processing='.$session_posts_processing;
$form_parameters .= '&post_limit='.$post_limit;
$form_parameters .= '&time_limit='.$time_limit;
$form_parameters .= '&refresh_rate='.$refresh_rate;
$form_action = 'admin_rebuild_search.php'.'?mode=refresh'.$form_parameters;
$next_button = $lang['NEXT'];
$progress_bar_img = $images['progress_bar'];
$processing_messages .= sprintf($lang['PROCESSING_NEXT_POSTS'], $post_limit);
meta_refresh($form_action, $refresh_rate);
// create the meta tag for refresh
$template->assign_vars(array(
'CANCEL_BUTTON' => true,
));
}
else // end of processing
{
$form_action = "admin_rebuild_search.php";
$next_button = $lang['FINISHED'];
$progress_bar_img = $images['progress_bar_full'];
$processing_messages .= ( $session_posts_processed < $session_posts_processing ) ? sprintf($lang['DELETED_POSTS'], $session_posts_processing - $session_posts_processed) : '';
$processing_messages .= ( $total_posts_processed == $total_posts ) ? $lang['ALL_POSTS_PROCESSED'] : $lang['ALL_SESSION_POSTS_PROCESSED'];
// if we have processed all the db posts we need to update the rebuild_status
DB()->query("UPDATE ". BB_SEARCH_REBUILD ." SET
rebuild_session_status = ". REBUILD_SEARCH_COMPLETED ."
WHERE rebuild_session_id = $last_session_id
AND end_post_id = $max_post_id
");
// optimize all search tables when finished
$table_ary = array(BB_POSTS_SEARCH);
foreach ($table_ary as $table)
{
DB()->query("ANALYZE TABLE $table");
DB()->query("OPTIMIZE TABLE $table");
}
$processing_messages .= '<br />' . $lang['ALL_TABLES_OPTIMIZED'];
}
// calculate the percent
$session_percent = ($session_posts_processed / $session_posts_processing) * 100;
$total_percent = ($total_posts_processed / $total_posts) * 100;
// get the db sizes
list($search_data_size, $search_index_size, $search_tables_size) = get_db_sizes();
// calculate the final (estimated) values
$final_search_tables_size = '';
if ($search_tables_size)
{
$start_search_tables_size = $last_session_data['search_size'];
$final_search_tables_size = $start_search_tables_size + round(($search_tables_size - $start_search_tables_size) * (100 / $session_percent));
}
// calculate various times
$session_time = $last_session_data['session_time'];
$session_average_cycle_time = round($session_time / $last_session_data['session_cycles']);
$session_estimated_time = round($session_time * (100 / $session_percent)) - $session_time;
// create the percent boxes
create_percent_box('session', create_percent_color($session_percent), $session_percent);
create_percent_box('total', create_percent_color($total_percent), $total_percent);
$template->assign_vars(array(
'L_NEXT' => $next_button,
'L_TIME_LAST_POSTS_ADMIN' => sprintf($lang['TIME_LAST_POSTS'], $num_rows),
'PROCESSING_POSTS' => sprintf($lang['PROCESSED_POST_IDS'], $start_post_id, $end_post_id),
'PROCESSING_MESSAGES' => $processing_messages,
'PROGRESS_BAR_IMG' => $progress_bar_img,
'SESSION_DETAILS' => sprintf($lang['PROCESS_DETAILS'], $session_posts_processed - $num_rows + 1, $session_posts_processed, $session_posts_processing),
'SESSION_PERCENT' => sprintf($lang['PERCENT_COMPLETED'], round($session_percent, 2)),
'TOTAL_DETAILS' => sprintf($lang['PROCESS_DETAILS'], $total_posts_processed - $num_rows + 1, $total_posts_processed, $total_posts),
'TOTAL_PERCENT' => sprintf($lang['PERCENT_COMPLETED'], round($total_percent, 2)),
'LAST_CYCLE_TIME' => delta_time(TIMENOW),
'SESSION_TIME' => delta_time($last_session_data['start_time']),
'SESSION_AVERAGE_CYCLE_TIME'=> delta_time($session_average_cycle_time, 0),
'SESSION_ESTIMATED_TIME' => delta_time($session_estimated_time, 0),
'SEARCH_TABLES_SIZE' => humn_size($search_tables_size),
'FINAL_SEARCH_TABLES_SIZE' => humn_size($final_search_tables_size),
'SEARCH_DATA_SIZE' => humn_size($search_data_size),
'SEARCH_INDEX_SIZE' => humn_size($search_index_size),
'START_POST' => $last_session_data['start_post_id'],
'POST_LIMIT' => $num_rows,
'TIME_LIMIT' => $time_limit,
'REFRESH_RATE' => $refresh_rate,
'S_REBUILD_SEARCH_ACTION' => $form_action,
));
}
else // show the input page
{
// create the page
// used only with the select input
$post_limit_hidden = ( $def_post_limit > $total_posts ) ? $total_posts : $def_post_limit;
$s_hidden_fields = '<input type="hidden" name="post_limit_stored" value="'.$post_limit_hidden.'" />';
$s_hidden_fields .= '<input type="hidden" name="total_posts_stored" value="'.$total_posts.'" />';
$next_start_post_id = 0;
$last_saved_processing = '';
$clear_search_disabled = '';
if ($last_session_data['rebuild_session_id'])
{
$last_saved_post_id = $last_session_data['end_post_id'];
$next_start_post_id = $last_saved_post_id + 1;
$last_saved_date = bb_date($last_session_data['end_time']);
// check our last status
if ( $last_session_data['rebuild_session_status'] == REBUILD_SEARCH_PROCESSED )
{
$last_saved_processing = sprintf($lang['INFO_PROCESSING_STOPPED'], $last_saved_post_id, $total_posts_processed, $last_saved_date);
$clear_search_disabled = 'disabled="disabled"';
$template->assign_block_vars("start_select_input", array());
}
elseif ( $last_session_data['rebuild_session_status'] == REBUILD_SEARCH_ABORTED )
{
$last_saved_processing = sprintf($lang['INFO_PROCESSING_ABORTED'], $last_saved_post_id, $total_posts_processed, $last_saved_date);
// check if the interrupted cycle has finished
if ( TIMENOW - $last_session_data['end_time'] < $last_session_data['last_cycle_time'] )
{
$last_saved_processing .= '<br />'.$lang['INFO_PROCESSING_ABORTED_SOON'];
}
$clear_search_disabled = 'disabled="disabled"';
$template->assign_block_vars("start_select_input", array());
}
else // when finished
{
if ( $last_session_data['end_post_id'] < $max_post_id )
{
$last_saved_processing = sprintf($lang['INFO_PROCESSING_FINISHED_NEW'], $last_saved_post_id, $total_posts_processed, $last_saved_date, ($total_posts - $total_posts_processed));
$clear_search_disabled = 'disabled="disabled"';
$template->assign_block_vars("start_select_input", array());
}
else
{
$last_saved_processing = sprintf($lang['INFO_PROCESSING_FINISHED'], $total_posts, $last_saved_date);
$template->assign_block_vars("start_text_input", array());
}
}
$template->assign_block_vars("last_saved_info", array());
}
else
{
$template->assign_block_vars("start_text_input", array());
}
// create the output of page
$template->assign_vars(array(
'TPL_REBUILD_SEARCH_MAIN' => true,
'L_TIME_LIMIT_EXPLAIN' => $time_limit_explain,
'NEXT_START_POST_ID' => $next_start_post_id,
'CLEAR_SEARCH_DISABLED' => $clear_search_disabled,
'SESSION_POSTS_PROCESSING' => $session_posts_processing,
'POST_LIMIT' => $post_limit,
'REFRESH_RATE' => $refresh_rate,
'TIME_LIMIT' => $time_limit,
'LAST_SAVED_PROCESSING' => $last_saved_processing,
'SESSION_ID' => $userdata['session_id'],
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_REBUILD_SEARCH_ACTION' => "admin_rebuild_search.php?mode=submit",
));
}
print_page('admin_rebuild_search.tpl', 'admin');
//
// Functions
//
function get_db_sizes ()
{
$search_data_size = $search_index_size = 0;
$search_table_like = DB()->escape(BB_POSTS_SEARCH);
$sql = "SHOW TABLE STATUS FROM `". DB()->selected_db ."` LIKE '$search_table_like'";
foreach (DB()->fetch_rowset($sql) as $row)
{
$search_data_size += $row['Data_length'];
$search_index_size += $row['Index_length'];
}
return array($search_data_size, $search_index_size, $search_data_size+$search_index_size);
}
// get the latest post_id in the forum
function get_latest_post_id ()
{
$row = DB()->fetch_row("SELECT MAX(post_id) as post_id FROM ". BB_POSTS_TEXT);
return (int) $row['post_id'];
}
function get_empty_last_session_data ()
{
return array(
'rebuild_session_id' => 0,
'start_post_id' => 0,
'end_post_id' => 0,
'start_time' => 0,
'end_time' => 0,
'last_cycle_time' => 0,
'session_time' => 0,
'session_posts' => 0,
'session_cycles' => 0,
'search_size' => 0,
'rebuild_session_status' => REBUILD_SEARCH_COMPLETED,
);
}
// get some or all of the rebuild details of a specific session or of the last session
// $id is the id or the 'last' id
// $details is one of the fields or 'all' of them
function get_rebuild_session_details ($id, $details = 'all')
{
$session_details = get_empty_last_session_data();
if ($id != 'last')
{
$sql = "SELECT * FROM ". BB_SEARCH_REBUILD ." WHERE rebuild_session_id = $id";
}
else
{
$sql = "SELECT * FROM ". BB_SEARCH_REBUILD ." ORDER BY rebuild_session_id DESC LIMIT 1";
}
if ($row = DB()->fetch_row($sql))
{
$session_details = ($details == 'all') ? $row : $row[$details];
}
return $session_details;
}
// get the number of processed posts in the last session or in all sessions
// 'total' to get the sum of posts of all sessions
// 'session' to get the posts of the last session
function get_processed_posts ($mode = 'session')
{
global $last_session_data;
if ($mode == 'total')
{
$sql = "SELECT SUM(session_posts) as posts FROM ". BB_SEARCH_REBUILD;
$row = DB()->fetch_row($sql);
}
else
{
$row['posts'] = $last_session_data['session_posts'];
}
return (int) $row['posts'];
}
// how many posts are in the db before or after a specific post_id
// after/before require and the post_id
function get_total_posts ($mode = 'after', $post_id = 0)
{
if ($post_id)
{
$sql = "SELECT COUNT(post_id) as total_posts FROM " . BB_POSTS_TEXT . "
WHERE post_id " . (($mode == 'after') ? '>= ' : '<= ' ) . (int) $post_id;
}
else
{
$sql = "SELECT COUNT(*) as total_posts FROM " . BB_POSTS_TEXT;
}
$row = DB()->fetch_row($sql);
return (int) $row['total_posts'];
}
function clear_search_tables ($mode = '')
{
DB()->query("DELETE FROM ". BB_SEARCH_REBUILD);
if ($mode)
{
$table_ary = array(BB_POSTS_SEARCH);
foreach ($table_ary as $table)
{
$sql = (($mode == 1) ? "DELETE FROM " : "TRUNCATE TABLE ") . $table;
DB()->query($sql);
}
}
}
// Create the percent color
// We use an array with the color percent limits.
// One color stays constantly at FF when the percent is between its limits
// and we adjust the other 2 accordingly to percent, from 200 to 0.
// We limit the result to 200, in order to avoid white (255).
function create_percent_color($percent)
{
$percent_ary = array(
'r' => array(86, 100),
'g' => array(0, 50),
'b' => array(51, 85),
);
foreach ($percent_ary as $key => $value)
{
if ( $percent <= $value[1] )
{
$percent_color = create_color($key, round(200-($percent-$value[0])*(200/($value[1]-$value[0]))));
break;
}
}
return $percent_color;
}
// create the hex representation of color
function create_color($mode, $code)
{
return (($mode == 'r') ? 'FF': sprintf("%02X", $code)) . (($mode == 'g') ? 'FF': sprintf("%02X", $code)) . (($mode == 'b') ? 'FF': sprintf("%02X", $code));
}
// create the percent bar & box
function create_percent_box($box, $percent_color, $percent_width)
{
global $template;
if ($box == 'session')
{
$template->assign_vars(array(
'SESSION_PERCENT_BOX' => true,
'SESSION_PERCENT_COLOR' => $percent_color,
'SESSION_PERCENT_WIDTH' => round($percent_width),
));
}
else
{
$template->assign_vars(array(
'TOTAL_PERCENT_BOX' => true,
'TOTAL_PERCENT_COLOR' => $percent_color,
'TOTAL_PERCENT_WIDTH' => round($percent_width),
));
}
}