Xataface  2.0alpha2
Xataface Application Framework
 All Data Structures Namespaces Files Functions Variables Groups Pages
manage_build_index.php
Go to the documentation of this file.
1 <?php
2 
4  function handle(&$params){
5  session_write_close();
6  set_time_limit(0);
7  import('Dataface/Index.php');
8  $index = new Dataface_Index();
9  if ( @$_POST['--build-index'] ){
10 
11 
12  if ( is_array($_POST['--tables']) ){
13  $tables = $_POST['--tables'];
14  } else if ( !empty($_POST['--tables']) ){
15  $tables = array($_POST['--tables']);
16  } else {
17  $tables = null;
18  }
19 
20  if ( @$_POST['--clear'] ){
21  $clear = true;
22  } else {
23  $clear = false;
24  }
25 
26 
27 
28  $index->buildIndex($tables, '*', $clear);
30  $this->redirect($app->url('').'&--msg='.urlencode('Successfully indexed database'));
31 
32  }
33 
34  $tables = array_keys(Dataface_Table::getTableModificationTimes());
35  $count = 0;
36 
37  $indexable = array();
38  foreach ( $tables as $key=>$table ){
39  if ( preg_match('/^dataface__/', $table) ){
40  continue;
41  }
42  if ( preg_match('/^_/', $table) ){
43  continue;
44  }
45 
46  if ( $index->isTableIndexable($table) ){
47  $indexable[] = $table;
48  //unset($tables[$key]);
49  }
50 
51  }
52 
53  $tables = $indexable;
54 
55  df_display(array('tables'=>$tables), 'manage_build_index.html');
56 
57  }
58 }