Changeset 1168
- Timestamp:
- 11/18/07 03:13:52 (10 months ago)
- Location:
- trunk/system
- Files:
-
- 4 added
- 8 modified
-
config/profiler.php (added)
-
core/Benchmark.php (modified) (1 diff)
-
core/Kohana.php (modified) (6 diffs)
-
helpers/text.php (modified) (2 diffs)
-
libraries/Database.php (modified) (3 diffs)
-
libraries/Loader.php (modified) (2 diffs)
-
libraries/Profiler.php (modified) (1 diff)
-
libraries/drivers/Database_Mysql.php (modified) (2 diffs)
-
models (added)
-
models/form.php (added)
-
views/kohana_form.php (added)
-
views/kohana_profiler.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/core/Benchmark.php
r939 r1168 1 1 <?php defined('SYSPATH') or die('No direct script access.'); 2 /* 3 * Class: Benchmark 4 * Simple benchmarking. 2 /** 3 * Simple benchmarking. 5 4 * 6 5 * Kohana Source Code: -
trunk/system/core/Kohana.php
r1121 r1168 1 1 <?php defined('SYSPATH') or die('No direct script access.'); 2 /* 2 /** 3 3 * Class: Kohana 4 4 * Provides Kohana-specific helper functions. This is where the magic happens! … … 420 420 } 421 421 422 /* 422 /** 423 423 * Method: show_error 424 424 * Show a custom error message … … 437 437 } 438 438 439 /* 439 /** 440 440 * Method: auto_load 441 441 * Provides class auto-loading … … 500 500 } 501 501 502 /* 502 /** 503 503 * Method: find_file 504 504 * Find a resource file in a given directory … … 563 563 } 564 564 565 /* 565 /** 566 566 * Method: list_files 567 567 * Lists all files and directories in a resource path … … 570 570 * directory - directory to search 571 571 * recursive - list all files to the maximum depth? 572 * path - full path to search (used for recursion, *never* set this manually)572 * path - full path to search (used for recursion, *never* set this manually) 573 573 */ 574 574 public static function list_files($directory, $recursive = FALSE, $path = FALSE) -
trunk/system/helpers/text.php
r936 r1168 104 104 * 105 105 * Default Types: 106 * unique - a 32character unique hash106 * unique - 40 character unique hash 107 107 * alnum - alpha-numeric characters 108 108 * alpha - alphabetical characters … … 118 118 { 119 119 case 'unique': 120 return md5(uniqid(mt_rand())); 121 case '': 120 return sha1(uniqid(NULL, TRUE)); 122 121 case 'alnum': 123 122 $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; -
trunk/system/libraries/Database.php
r1166 r1168 728 728 $table = $this->from[0]; 729 729 } 730 $sql = $this->driver->update($this->config['table_prefix'].$table, $this->set, $this->where); 730 731 $table = $this->driver->escape_table($this->config['table_prefix'].$table); 732 733 $sql = $this->driver->update($table, $this->set, $this->where); 731 734 732 735 $this->reset_write(); … … 862 865 public function list_tables() 863 866 { 864 $this->link OR $this->driver->connect();867 $this->link or $this->connect(); 865 868 866 869 $this->reset_select(); … … 928 931 public function field_data($table ='') 929 932 { 933 $this->link or $this->connect(); 934 930 935 return $this->driver->field_data($table); 936 } 937 938 /* 939 * Method: list_fields 940 * Get the field data for a database table, along with the field's attributes. 941 * 942 * Parameters: 943 * table - table name 944 * 945 * Returns: 946 * Array containing the field data 947 */ 948 public function list_fields($table ='') 949 { 950 $this->link or $this->connect(); 951 952 return $this->driver->list_fields($table); 931 953 } 932 954 -
trunk/system/libraries/Loader.php
r1015 r1168 109 109 public function helper($name) 110 110 { 111 // Allow recursive loading 112 if (is_array($name)) 113 { 114 $helpers = $name; 115 116 foreach($helpers as $name) 117 { 118 $this->helper($name); 119 } 120 } 121 else 122 { 123 include Kohana::find_file('helpers', $name, TRUE); 124 } 111 // Just don't do this... there's no point. 112 Log::add('debug', 'Using $this->load->helper() is deprecated. See Kohana::auto_load().'); 125 113 } 126 114 … … 158 146 $model = new $class(); 159 147 148 // Return the model 160 149 if ($alias === TRUE) 161 150 return $model; -
trunk/system/libraries/Profiler.php
r1123 r1168 52 52 public function render($return = FALSE) 53 53 { 54 $data = array 55 ( 56 'benchmarks' => array(), 57 'queries' => FALSE 58 ); 54 if (Config::item('profiler.benchmarks')) 55 { 56 // Clean unique id from system benchmark names 57 foreach (Benchmark::get(TRUE) as $name => $time) 58 { 59 $data['benchmarks'][str_replace(SYSTEM_BENCHMARK.'_', '', $name)] = $time; 60 } 61 } 59 62 60 63 // Load database benchmarks, if Database has been loaded 61 if ( class_exists('Database', FALSE))64 if (Config::item('profiler.database') AND class_exists('Database', FALSE)) 62 65 { 63 66 $data['queries'] = Database::$benchmarks; 64 67 } 65 68 66 // Clean unique id from system benchmark names67 foreach (Benchmark::get(TRUE) as $name => $time)69 // Load POST data 70 if (Config::item('profiler.post')) 68 71 { 69 $data['benchmarks'][str_replace(SYSTEM_BENCHMARK.'_', '', $name)] = $time; 72 $data['post'] = TRUE; 73 } 74 75 if (Config::item('profiler.session')) 76 { 77 $data['session'] = TRUE; 70 78 } 71 79 -
trunk/system/libraries/drivers/Database_Mysql.php
r1166 r1168 82 82 public function escape_table($table) 83 83 { 84 return str_replace('.', '`.`', $table);84 return '`'.str_replace('.', '`.`', $table).'`'; 85 85 } 86 86 … … 316 316 } 317 317 318 public function list_fields($table) 319 { 320 $query = mysql_query('DESCRIBE '.$this->escape_table($table), $this->link); 321 322 $fields = array(); 323 while ($row = mysql_fetch_object($query)) 324 { 325 $fields[] = $row->Field; 326 } 327 return $fields; 328 } 329 318 330 public function field_data($table) 319 331 { -
trunk/system/views/kohana_profiler.php
r1114 r1168 82 82 <div id="kohana-profiler"> 83 83 84 <?php if (isset($benchmarks)): ?> 84 85 <table id="kp-benchmarks"> 85 86 <tr> … … 109 110 ?> 110 111 </table> 111 112 <?php endif; ?> 113 114 <?php if (isset($queries)): ?> 112 115 <table id="kp-queries"> 113 116 <tr> … … 150 153 ?> 151 154 </table> 152 155 <?php endif; ?> 156 157 <?php if (isset($post)): ?> 153 158 <table id="kp-postdata"> 154 159 <tr> … … 181 186 ?> 182 187 </table> 183 188 <?php endif; ?> 189 190 <?php if (isset($session)): ?> 184 191 <table id="kp-sessiondata"> 185 192 <tr> … … 212 219 ?> 213 220 </table> 221 <?php endif; ?> 214 222 215 223 </div>
