Legend:
- Unmodified
- Added
- Removed
-
plugins/importExport/inc/flat/class.flat.backup.php
r840 r841 17 17 private $line_cols = array(); 18 18 private $line_name; 19 private $line_num; 19 20 20 21 private $replacement = array( … … 29 30 if (file_exists($file) && is_readable($file)) { 30 31 $this->fp = fopen($file,'rb'); 32 $this->line_num = 1; 31 33 } else { 32 34 throw new Exception(__('No file to read.')); … … 43 45 public function getLine() 44 46 { 45 if ( feof($this->fp)) {47 if (($line = $this->nextLine()) === false) { 46 48 return false; 47 49 } 48 49 $line = trim(fgets($this->fp));50 50 51 51 if (substr($line,0,1) == '[') … … 64 64 65 65 if (count($this->line_cols) != count($line)) { 66 throw new Exception( 'Invalid row count');66 throw new Exception(sprintf('Invalid row count at line %s',$this->line_num)); 67 67 } 68 68 … … 74 74 } 75 75 76 return new flatBackupItem($this->line_name,$res );76 return new flatBackupItem($this->line_name,$res,$this->line_num); 77 77 } 78 78 else … … 81 81 } 82 82 } 83 84 private function nextLine() 85 { 86 if (feof($this->fp)) { 87 return false; 88 } 89 $this->line_num++; 90 91 $line = fgets($this->fp); 92 $line = trim($line); 93 94 return empty($line) ? $this->nextLine() : $line; 95 } 83 96 } 84 97 … … 86 99 { 87 100 public $__name; 101 public $__line; 88 102 private $__data = array(); 89 103 90 public function __construct($name,$data )104 public function __construct($name,$data,$line) 91 105 { 92 106 $this->__name = $name; 93 107 $this->__data = $data; 108 $this->__line = $line; 94 109 } 95 110
Note: See TracChangeset
for help on using the changeset viewer.