Dotclear


Ignore:
Timestamp:
07/09/12 16:53:05 (13 years ago)
Author:
JcDenis
Branch:
default
Message:

Flat import errors are now more verbose, fixes #888

File:
1 edited

Legend:

Unmodified
Added
Removed
  • plugins/importExport/inc/flat/class.flat.import.php

    r840 r841  
    630630               $this->stack['post_id']++; 
    631631          } else { 
    632                throw new Exception(__('The backup file does not appear to be well formed.')); 
     632               self::throwIdError($post->__name,$post->__line,'category'); 
    633633          } 
    634634     } 
     
    640640               $this->insertMeta($meta); 
    641641          } else { 
    642                throw new Exception(__('The backup file does not appear to be well formed.')); 
     642               self::throwIdError($meta->__name,$meta->__line,'post'); 
    643643          } 
    644644     } 
     
    666666                
    667667               $this->insertPostMedia($post_media); 
    668           } else { 
    669                throw new Exception(__('The backup file does not appear to be well formed.')); 
     668          } elseif (!isset($this->old_ids['media'][(integer) $post_media->media_id])) { 
     669               self::throwIdError($post_media->__name,$post_media->__line,'media'); 
     670          }else { 
     671               self::throwIdError($post_media->__name,$post_media->__line,'post'); 
    670672          } 
    671673     } 
     
    678680               $this->insertPing($ping); 
    679681          } else { 
    680                throw new Exception(__('The backup file does not appear to be well formed.')); 
     682               self::throwIdError($ping->__name,$ping->__line,'post'); 
    681683          } 
    682684     } 
     
    693695               $this->stack['comment_id']++; 
    694696          } else { 
    695                throw new Exception(__('The backup file does not appear to be well formed.')); 
    696           } 
     697               self::throwIdError($comment->__name,$comment->__line,'post'); 
     698          } 
     699     } 
     700      
     701     private static function throwIdError($name,$line,$related) 
     702     { 
     703          throw new Exception(sprintf( 
     704               __('ID of "%3$s" does not match on record "%1$s" at line %2$s of backup file.'), 
     705               html::escapeHTML($name), 
     706               html::escapeHTML($line), 
     707               html::escapeHTML($related) 
     708          )); 
    697709     } 
    698710      
Note: See TracChangeset for help on using the changeset viewer.

Sites map