-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathconvert.php
More file actions
69 lines (56 loc) · 1.81 KB
/
convert.php
File metadata and controls
69 lines (56 loc) · 1.81 KB
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
<?php
/**
* @copyright (c) 2019 Patrick Webster
* @license https://opensource.org/licenses/GPL-2.0
*/
define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'includes/common.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/functions_archive.' . $phpEx);
// Purge the cache from any previous runs
$cache->purge();
// Start session management
$user->session_begin();
$auth->acl($user->data);
if (sizeof($style_data))
{
$user->setup(false, $style_data['style_id'], $style_data);
}
else
{
$user->setup(false);
}
// Find guest visible forums if none specified
if (!sizeof($forums))
{
$forums = get_guest_forums();
}
$forum_data = get_forum_data();
if (!set_time_limit(0))
{
echo 'Unable to disable execution time limit. This script may time out.' . LINE_ENDING . LINE_ENDING;
}
$topics = $posts = 0;
echo 'The following forums will be converted to static pages:' . LINE_ENDING;
foreach ($forums as $id)
{
echo $id . ': ' . $forum_data[$id]['name'] . LINE_ENDING;
$topics += $forum_data[$id]['topics'];
$posts += $forum_data[$id]['posts'];
}
echo LINE_ENDING;
echo 'Creating index page... ';
generate_index_page($out_folder);
echo 'Done' . LINE_ENDING . LINE_ENDING;
echo 'Processing forums: ' . $topics . ' topics, ' . $posts . ' posts' . LINE_ENDING;
foreach ($forums as $forum)
{
echo $forum . ': ' . $forum_data[$forum]['name'] . ' (' . $forum_data[$forum]['topics'] . ' topics, ' . $forum_data[$forum]['posts'] . ' posts) ... ';
generate_forum_pages($forum, $out_folder);
generate_topics_pages($forum, $out_folder);
echo 'Done' . LINE_ENDING;
}
echo 'Conversion done.' . LINE_ENDING;