Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 100 lines (78 sloc) 3.187 kb
a942d8f Jenkins Build Account First commit
wajamjenkins authored
1 <?php
2 /*
3 Cassandra Cluster Admin
4
3dfdd8d Sébastien Giroux UTF8 encoding
authored
5 @author Sébastien Giroux
a942d8f Jenkins Build Account First commit
wajamjenkins authored
6 @copyright All rights reserved - 2011
7 */
8
9 require('include/kernel.inc.php');
11af5a1 Sébastien Giroux Started working on a basic authentification system
authored
10 require('include/verify_login.inc.php');
a942d8f Jenkins Build Account First commit
wajamjenkins authored
11
12 $keyspace_name = '';
13 if (isset($_GET['keyspace_name'])) {
14 $keyspace_name = $_GET['keyspace_name'];
15 }
16
1bff5de Sébastien Giroux Better page titles
authored
17 $current_page_title = 'Cassandra Cluster Admin > Keyspace Details > '.$keyspace_name;
18 echo getHTML('header.php');
19
20 $vw_vars = array();
21
38220be Sébastien Giroux More documentation and random cleanup
authored
22 if (empty($keyspace_name)) {
404acf5 Sébastien Giroux Added url params validation in describe_keyspace and describe_columnfami...
authored
23 echo displayErrorMessage('keyspace_name_must_be_specified');
b07e09b Sébastien Giroux Cleanup describe keyspace controller and view (create sub views)
authored
24 }
9c37406 Sébastien Giroux Better replication factor detection
authored
25 else {
404acf5 Sébastien Giroux Added url params validation in describe_keyspace and describe_columnfami...
authored
26 try {
44fe7da Rob Sort the column families alpha-numericall on index and Keyspace displays
rtconner authored
27 $describe_keyspace = $sys_manager->describe_keyspace($keyspace_name);
28
2587d5e Rob Column family display sorting - code formatting
rtconner authored
29 if (defined('CF_AUTOSORT') && CF_AUTOSORT) {
44fe7da Rob Sort the column families alpha-numericall on index and Keyspace displays
rtconner authored
30 usort($describe_keyspace->cf_defs, array('ColumnFamilyHelper', 'sortCfDefsCallable'));
31 }
9c37406 Sébastien Giroux Better replication factor detection
authored
32
3dfdd8d Sébastien Giroux UTF8 encoding
authored
33 // CF created successfully
34 $vw_vars['added_cf'] = '';
38220be Sébastien Giroux More documentation and random cleanup
authored
35 if (isset($_GET['create_cf'])) {
3dfdd8d Sébastien Giroux UTF8 encoding
authored
36 $columnfamily_name = $_SESSION['message'];
97bdca6 Sébastien Giroux Added query time for action on CF and KS
authored
37 $query_time = $_SESSION['query_time'];
38 $vw_vars['added_cf'] = displaySuccessMessage('create_columnfamily',array('columnfamily_name' => $columnfamily_name,'query_time' => $query_time));
3dfdd8d Sébastien Giroux UTF8 encoding
authored
39 }
40
41 // CF deleted successfully
01ae9d7 Sébastien Giroux Dropping CF now bring to keyspace details when successful
authored
42 $vw_vars['deleted_cf'] = '';
43 if (isset($_GET['deleted_cf']) && $_GET['deleted_cf'] == 1) {
44 $vw_vars['deleted_cf'] = displaySuccessMessage('drop_columnfamily');
45 }
46
9c37406 Sébastien Giroux Better replication factor detection
authored
47 $vw_vars['strategy_class'] = $describe_keyspace->strategy_class;
48
215e0dc Sébastien Giroux Improved JMX stats page
authored
49 $strategy_options = $describe_keyspace->strategy_options;
9c37406 Sébastien Giroux Better replication factor detection
authored
50
51 $replication_factor = $describe_keyspace->replication_factor;
52 if ($replication_factor == '' && isset($strategy_options['replication_factor'])) $replication_factor = $strategy_options['replication_factor'];
53 if ($replication_factor == '') $replication_factor = 1;
54 $vw_vars['replication_factor'] = $replication_factor;
55
215e0dc Sébastien Giroux Improved JMX stats page
authored
56 if (is_array($strategy_options) && isset($strategy_options['replication_factor'])) {
57 unset($strategy_options['replication_factor']);
58 }
59 $vw_vars['strategy_options'] = $strategy_options;
404acf5 Sébastien Giroux Added url params validation in describe_keyspace and describe_columnfami...
authored
60
61 $vw_vars['cluster_name'] = $sys_manager->describe_cluster_name();
62 $vw_vars['keyspace_name'] = $keyspace_name;
63
64 $vw_vars['ring'] = array();
65 $vw_vars['list_column_families'] = '';
66
9183399 Sébastien Giroux Little cleanup
authored
67 $vw_vars['is_read_only_keyspace'] = isReadOnlyKeyspace($keyspace_name);
9b73d1d Sébastien Giroux Added support to specify readonly keyspace (system by default)
authored
68
d7cda01 Sébastien Giroux Message for no CF in KS on describe KS page
authored
69 $nb_cfs = count($describe_keyspace->cf_defs);
70 if ($nb_cfs == 0) {
71 $vw_vars['list_column_families'] = 'There is no column family in this keyspace.';
72 }
73 else {
74 for ($i = 0; $i < $nb_cfs; $i++) {
75 $one_cf = $describe_keyspace->cf_defs[$i];
07131a3 Sébastien Giroux Column family defintion display code cleanup
authored
76
7929e44 More structured interface
FlashySearch authored
77 $vw_vars['cf_def'] = $one_cf;
f6ca651 Sébastien Giroux Dynamically generate CF definition for better support across Cassandra v...
authored
78 $vw_vars['columnfamily_name'] = $one_cf->name;
7929e44 More structured interface
FlashySearch authored
79 $vw_vars['show_edit_link'] = true;
c583fdf Update describe_keyspace.php
FlashySearch authored
80 $vw_vars['list_column_families'] .= getHTML('columnfamily_short_details.php',$vw_vars);
d7cda01 Sébastien Giroux Message for no CF in KS on describe KS page
authored
81 }
404acf5 Sébastien Giroux Added url params validation in describe_keyspace and describe_columnfami...
authored
82 }
83
84 try {
85 $vw_vars['ring'] = $sys_manager->describe_ring($keyspace_name);
86 }
87 catch(Exception $e) {
88 $vw_vars['ring'] = $e->getMessage();
89 }
3dfdd8d Sébastien Giroux UTF8 encoding
authored
90
9c37406 Sébastien Giroux Better replication factor detection
authored
91 echo getHTML('describe_keyspace.php',$vw_vars);
92 }
dec220e Sébastien Giroux Exception catching fixes
authored
93 catch(cassandra\NotFoundException $e) {
9c37406 Sébastien Giroux Better replication factor detection
authored
94 echo displayErrorMessage('keyspace_doesnt_exists',array('keyspace_name' => $keyspace_name));
95 }
a942d8f Jenkins Build Account First commit
wajamjenkins authored
96 }
97
98 echo getHTML('footer.php');
7929e44 More structured interface
FlashySearch authored
99 ?>
Something went wrong with that request. Please try again.