Skip to content

Commit

Permalink
Merge branch 'master' of github.com:TechEmpower/FrameworkBenchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
pfalls-techempower committed Apr 29, 2013
2 parents a413814 + 5e038e2 commit 2bd4ede
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 1 deletion.
25 changes: 25 additions & 0 deletions php-codeigniter/application/controllers/bench.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,29 @@ public function db($queries = 1) {
->set_content_type('application/json')
->set_output(json_encode($worlds));
}

public function fortunes() {
$fortunes = $this->db
->query('SELECT * FROM Fortune')
->result_array();

$fortunes[] = array(
'id' => 0,
'message' => 'Additional fortune added at request time.'
);

usort($fortunes, function($left, $right) {
if ($left['message'] === $right['message']) {
return 0;
} else if ($left['message'] > $right['message']) {
return 1;
} else {
return -1;
}
});

$this->load->view('fortunes', [
'fortunes' => $fortunes
]);
}
}
25 changes: 25 additions & 0 deletions php-codeigniter/application/views/fortunes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome to CodeIgniter</title>
</head>
<body>

<table>
<tr>
<th>id</th>
<th>message</th>
</tr>

<?php foreach($fortunes as $fortune): ?>
<tr>
<td><?php echo $fortune['id']; ?></td>
<td><?php echo htmlspecialchars($fortune['message'], ENT_QUOTES, "UTF-8", false); ?></td>
</tr>
<?php endforeach; ?>

</table>

</body>
</html>
1 change: 1 addition & 0 deletions php-codeigniter/benchmark_config
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"setup_file": "setup",
"db_url": "/index.php/bench/db",
"query_url": "/index.php/bench/db/",
"fortune_url": "/index.php/bench/fortunes",
"port": 8080,
"sort": 63
}
Expand Down
2 changes: 1 addition & 1 deletion php-codeigniter/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* NOTE: If you change these, also change the error_reporting() code below
*
*/
define('ENVIRONMENT', 'development');
define('ENVIRONMENT', 'production');
/*
*---------------------------------------------------------------
* ERROR REPORTING
Expand Down

0 comments on commit 2bd4ede

Please sign in to comment.