Changeset 1053 for trunk/htdocs/coverager/coverager.php
- Timestamp:
- 07/27/2012 09:17:42 AM (10 months ago)
- Files:
-
- 1 modified
-
trunk/htdocs/coverager/coverager.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/htdocs/coverager/coverager.php
r531 r1053 2 2 3 3 include("./common.php"); 4 5 class Cycle6 {7 var $values;8 var $i;9 var $count;10 11 function Cycle($v)12 {13 $this->values = func_get_args();14 $this->i = -1;15 $this->count = count($this->values);16 }17 18 function next()19 {20 $this->i = ($this->i + 1) % $this->count;21 return $this->values[$this->i];22 }23 24 function cur()25 {26 return $this->values[$this->i];27 }28 29 function reset()30 {31 $this->i = -1;32 }33 }34 4 35 5 class XcacheCoverageViewer 36 6 { 37 var $syntax higlight = true;38 var $use cache = false;7 var $syntax_higlight = true; 8 var $use_cache = false; 39 9 var $include_paths = array(); 40 10 var $exclude_paths = array(); … … 50 20 $this->datadir = ini_get('xcache.coveragedump_directory'); 51 21 52 // copy config53 foreach (array('charset', 'include_paths', 'exclude_paths', 'syntax higlight', 'usecache', 'datadir', 'lang') as $k) {54 if (isset($ GLOBALS[$k])) {55 $this->{$k} = $ GLOBALS[$k];22 global $config; 23 foreach (array('charset', 'include_paths', 'exclude_paths', 'syntax_higlight', 'use_cache', 'datadir', 'lang') as $k) { 24 if (isset($config[$k])) { 25 $this->{$k} = $config[$k]; 56 26 } 57 27 } … … 79 49 $prefix_len = strlen($path) + 1; 80 50 $dirinfo = $this->loadDir($this->outpath); 81 if (!$this->use cache) {51 if (!$this->use_cache) { 82 52 ksort($dirinfo['subdirs']); 83 53 ksort($dirinfo['files']); … … 104 74 } 105 75 } 106 if ($this->syntax higlight) {76 if ($this->syntax_higlight) { 107 77 $source = implode('', $lines); 108 78 ob_start(); … … 130 100 else if (!$this->datadir) { 131 101 $action = 'error'; 132 $error = 'require ` ini:xcache.coveragedump_directory` or `config:$datadir`to be set';102 $error = 'require `xcache.coveragedump_directory` in ini or `$datadir` in config to be set'; 133 103 } 134 104 else { … … 137 107 } 138 108 139 $xcache_version = defined('XCACHE_VERSION') ? XCACHE_VERSION : '';109 global $config; 140 110 include("coverager.tpl.php"); 141 111 } … … 143 113 function loadDir($outdir, $addtodo = null) 144 114 { 145 if ($this->use cache) {115 if ($this->use_cache) { 146 116 $cachefile = $outdir . "/.pcovcache"; 147 117 if (file_exists($cachefile)) { … … 210 180 } 211 181 212 if ($this->use cache) {182 if ($this->use_cache) { 213 183 ksort($subdirs); 214 184 ksort($files); … … 223 193 ); 224 194 225 if ($this->use cache) {195 if ($this->use_cache) { 226 196 $fp = fopen($cachefile, "wb"); 227 197 fwrite($fp, serialize($info)); … … 233 203 function loadFile($file) 234 204 { 235 if ($this->use cache) {205 if ($this->use_cache) { 236 206 $cachefile = $file . "cache"; 237 207 if (file_exists($cachefile)) { … … 243 213 unset($info['cov']); 244 214 245 if ($this->use cache) {215 if ($this->use_cache) { 246 216 $fp = fopen($cachefile, "wb"); 247 217 fwrite($fp, serialize($info));

