![]() |
Xataface 2.0
Xataface Application Framework
|
00001 <?php 00002 00003 class dataface_actions_manage_build_index { 00004 function handle(&$params){ 00005 session_write_close(); 00006 set_time_limit(0); 00007 import('Dataface/Index.php'); 00008 $index = new Dataface_Index(); 00009 if ( @$_POST['--build-index'] ){ 00010 00011 00012 if ( is_array($_POST['--tables']) ){ 00013 $tables = $_POST['--tables']; 00014 } else if ( !empty($_POST['--tables']) ){ 00015 $tables = array($_POST['--tables']); 00016 } else { 00017 $tables = null; 00018 } 00019 00020 if ( @$_POST['--clear'] ){ 00021 $clear = true; 00022 } else { 00023 $clear = false; 00024 } 00025 00026 00027 00028 $index->buildIndex($tables, '*', $clear); 00029 $app =& Dataface_Application::getInstance(); 00030 $this->redirect($app->url('').'&--msg='.urlencode('Successfully indexed database')); 00031 00032 } 00033 00034 $tables = array_keys(Dataface_Table::getTableModificationTimes()); 00035 $count = 0; 00036 00037 $indexable = array(); 00038 foreach ( $tables as $key=>$table ){ 00039 if ( preg_match('/^dataface__/', $table) ){ 00040 continue; 00041 } 00042 if ( preg_match('/^_/', $table) ){ 00043 continue; 00044 } 00045 00046 if ( $index->isTableIndexable($table) ){ 00047 $indexable[] = $table; 00048 //unset($tables[$key]); 00049 } 00050 00051 } 00052 00053 $tables = $indexable; 00054 00055 df_display(array('tables'=>$tables), 'manage_build_index.html'); 00056 00057 } 00058 }