Skip to content

Commit de8d455

Browse files
committed
Removed benchmarking code
1 parent 88d115a commit de8d455

File tree

3 files changed

+4
-57
lines changed

3 files changed

+4
-57
lines changed

wiki/src/actions/history.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
function history($path, $action, $title, $content)
44
{
5-
global $benchmark;
6-
$benchmark->start("Viewing History: $path");
75
$Head = '<meta name="robots" content="noindex, nofollow" />';
86
$content['PageNav']->Active("Page History");
97

@@ -29,8 +27,6 @@ function history($path, $action, $title, $content)
2927
$next = mysql_fetch_array($nextQuery);
3028
$previous = mysql_fetch_array($previousQuery);
3129

32-
$benchmark->log('Page Queries');
33-
3430
if(is_numeric($action[1]))
3531
{
3632
$PreviousQuery = mysql_query("Select `Content` from `Wiki_Edits` where `ID` < '$action[1]' and `Archived` = 0 order by `ID` desc limit 1");
@@ -74,11 +70,8 @@ function history($path, $action, $title, $content)
7470
$content['ExtraNav']->Add("Archive This Edit", FormatPath("/$path/")."?archive/$action[1]");
7571
}
7672

77-
$benchmark->log('Before Formatting');
7873
$title[] = FishFormat($PageTitle, "strip");
79-
$benchmark->log('Title Stripped');
8074
$PageContent = FishFormat($PageContent);
81-
$benchmark->log('Body Formatted');
8275

8376
$previousPath = FormatPath("/$path/?history/{$previous['ID']}");
8477
$nextPath = FormatPath("/$path/?history/{$next['ID']}");
@@ -170,14 +163,6 @@ function history($path, $action, $title, $content)
170163
</script>
171164
172165
JavaScript;
173-
174-
175-
$benchmark->save();
176-
177-
if($_SESSION['admin'])
178-
{
179-
$benchmark->display();
180-
}
181166

182167
return array($title, $content);
183168
}

wiki/src/actions/view.php

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,10 @@
22

33
function view($path, $action, $title, $content)
44
{
5-
global $benchmark;
6-
$benchmark->start("Viewing: $path");
75
$content['PageNav']->Active("View Page");
86

97
$PageQuery = mysql_query("SELECT `ID`,`Title`,`Content`,`Edits`,`Views`,`EditTime` FROM `Wiki_Pages` WHERE `Path`='$path'");
108
list($PageID, $PageTitle, $PageContent, $PageEdits, $pageViews, $PageEditTime) = mysql_fetch_array($PageQuery);
11-
12-
$benchmark->log('Page Query');
139

1410
$tagQuery = mysql_query("Select tags.`tag`, stats.`count`
1511
from `Wiki_Tags` as tags,
@@ -18,8 +14,6 @@ function view($path, $action, $title, $content)
1814
where tags.`pageID` = '$PageID'
1915
and stats.`tag` = tags.`tag`");
2016

21-
$benchmark->log('Tag Query');
22-
2317
while(list($tagName, $tagCount) = mysql_fetch_array($tagQuery))
2418
{
2519
$plural = 's';
@@ -38,8 +32,6 @@ function view($path, $action, $title, $content)
3832
$tagLinks = "<hr />Tags: $tagLinks";
3933
}
4034

41-
$benchmark->log('Tags Processed');
42-
4335
$PageTitle = PageTitler($PageTitle);
4436

4537
if(empty($PageContent))
@@ -69,14 +61,10 @@ function view($path, $action, $title, $content)
6961
$content['ExtraNav']->Add("Rename This Page", FormatPath("/$path/")."?rename");
7062
}
7163

72-
$benchmark->log('Before Formatting');
7364
$title[] = FishFormat($PageTitle, "strip");
74-
$benchmark->log('Title Stripped');
7565
$content['Title'] .= FishFormat($PageTitle);
76-
$benchmark->log('Title Formatted');
7766
$content['Body'] .= FishFormat($PageContent);
78-
$benchmark->log('Body Formatted');
79-
67+
8068
if($PageEdits)
8169
{
8270
$EditCount = count(explode(",", $PageEdits));
@@ -93,13 +81,6 @@ function view($path, $action, $title, $content)
9381
$content['Tags'] = $tagLinks;
9482
$content['Footer'] = "<b>".number_format($pageViews)."</b> page view{$viewPlural}. <b>$EditCount</b> edit{$Plural} &ensp;&mdash;&ensp; Last modified <b>$PageEditTime</b>.";
9583
}
96-
97-
$benchmark->save();
98-
99-
if($_SESSION['admin'])
100-
{
101-
$benchmark->display();
102-
}
10384

10485
return array($title, $content);
10586
}

wiki/src/markup/fishformat.php

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/*
44
* Fish format!
55
*
6-
* Version 0.1
6+
* Version 0.2
77
*
88
*/
99

@@ -14,16 +14,8 @@
1414
require "view.php";
1515
require "edit.php";
1616

17-
if(!class_exists(Benchmark))
18-
{
19-
include_once(__DIR__ . "/../benchmark.php");
20-
$benchmark = new Benchmark;
21-
}
22-
2317
function FishFormat($text, $action='markup')
2418
{
25-
global $benchmark;
26-
2719
switch($action)
2820
{
2921
case "strip":
@@ -83,40 +75,30 @@ function FishFormat($text, $action='markup')
8375
default:
8476
$output = $text;
8577
$output = str_replace(" ", "&emsp;&emsp;&emsp;", $output);
86-
$benchmark->log('Spaces Replaced');
87-
8878

8979
// Links with custom text
9080
$output = preg_replace_callback('/(?:{{|\[\[)([\w -@\/~]+?)\|([\w -@\/~]+?)(?:\]\]|}})/', "custom_link", $output);
91-
$benchmark->log('Custom Links Replaced');
9281

9382
// Basic links
9483
$output = preg_replace_callback('/(?:{{|\[\[)([\w -@\/~]+?)(?:\]\]|}})(s)?/', "basic_link", $output);
95-
$benchmark->log('Basic Links Replaced');
9684

9785
// Replace semicolon tags with HTML entities (for writing documentation)
9886
$output = str_replace(array(":{", "}:", ':[', ']:'), array("&#123;", "&#125;", "&#91;", "&#93;"), $output);
99-
$benchmark->log('Braces Replaced');
100-
87+
10188
// Allow HTML comments
10289
$output = str_replace(array('&lt;!--', '--&gt;'), array('<!--', '-->'), $output);
103-
$benchmark->log('Comments Replaced');
10490

10591
// Remove HTML comments so they aren't parsed for markup
10692
$output = remove_comments($output);
107-
$benchmark->log('Comments Removed');
10893

10994
// Pasrse content for markup
11095
$parser = new Parser();
11196
$parsed = $parser->parse($output);
112-
$benchmark->log('Markup Parsed');
113-
97+
11498
$output = view_markup($parsed['text'], $parsed['tags']);
115-
$benchmark->log('Markup Formatted');
11699

117100
// Put comments back in
118101
$output = replace_comments($output);
119-
$benchmark->log('Comments Returned');
120102

121103
// Random replacements / emoticon type things
122104
$Search[':Z'] = "<span class='warning'>:Z</span>";
@@ -132,7 +114,6 @@ function FishFormat($text, $action='markup')
132114

133115
// Ordered and unordered lists
134116
$output = preg_replace_callback("/(?:(?:^|\n)\s*(\*|\-|\#)\s+[^\n]+(?:\n|$))+/m", 'replace_lists', $output);
135-
$benchmark->log('Lists Replaced');
136117

137118
// Strip newlines around comments
138119
$output = preg_replace('{\n*(<!--|-->)\n*}', "\\1", $output);

0 commit comments

Comments
 (0)