Plugin Directory

Changeset 330937


Ignore:
Timestamp:
01/10/2011 06:56:27 PM (15 years ago)
Author:
lexayo
Message:

bug fix zabojad

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exchange-platform/trunk/includes/version_editor.php

    r330839 r330937  
    6565          a DOMDocument
    6666    */
    67     private function toXML()
     67    public function toXML()
    6868    {
    6969        $versionDoc = new DOMDocument('1.0', 'utf-8');
     
    9090        a SilexTree corresponding to the DOMDocument
    9191    */
    92     private static function fromXML($versionDOMDocument, $fetchVersionOnly = false)
     92    public static function fromXML($versionDOMDocument, $fetchVersionOnly = false)
    9393    {
    9494        $rootElement = $versionDOMDocument->documentElement;
     
    207207class SilexElement
    208208{
    209    
    210     /*
    211         Variable: $version
    212         The label of the version
    213     */
    214     public $version;
     209
    215210
    216211    /*
    217212        Variable: $id
    218213        The id of the element in the Silex exchange platform
     214
     215
    219216    */
    220217    public $id;
     218
     219   
     220    /*
     221        Variable: $version
     222        The label of the element's version
     223
     224
     225    */
     226    public $version;
    221227   
    222228    /*
     
    276282          a DOMDocument
    277283    */
    278     private function toXML()
     284    public function toXML()
    279285    {
    280286        $versionDoc = new DOMDocument('1.0', 'utf-8');
     
    326332        a SilexElement corresponding to the DOMDocument
    327333    */
    328     private static function fromXML($versionDOMDocument, $fetchVersionAndIdOnly = false)
     334    public static function fromXML($versionDOMDocument, $fetchVersionAndIdOnly = false)
    329335    {
    330336        $rootElement = $versionDOMDocument->documentElement;
     
    471477        return $report;
    472478    }
     479   
     480   
     481    /*
     482        Function: compToLocalSignatures
     483        Compare the files signatures of the SilexElement object to the local file ones if the same files (path+name) exist.
     484       
     485        Parameters:
     486           rootpath - the path to the root dir of the local element to compare to (if you want to compare to an installed element, specify the Silex server root dir)
     487       
     488        Returns:
     489        a report in a form of an array containing FileModel objects of this SilexElement that exist in the local path specified in parameter and have a different signature.
     490    */
     491    public function compToLocalSignatures($rootpath)
     492    {
     493        $report = array();
     494        $this->rootFolder->compToLocalSignatures($rootpath, $report);
     495        return $report;
     496    }
    473497}
    474498
     
    621645            if($i == $otherFilesSize)
    622646                $report[] = $file;
     647        }
     648    }
     649   
     650    /*
     651        Function: compToLocalSignatures
     652       
     653       
     654        Parameters:
     655         
     656    */
     657    public function compToLocalSignatures($rootpath, &$report)
     658    {
     659        if( is_dir($rootpath . DIRECTORY_SEPARATOR . $this->path . DIRECTORY_SEPARATOR  . $this->name) )
     660        {
     661            foreach($this->folders as $folder)
     662                $folder->compToLocalSignatures($rootpath, $report);
     663           
     664            foreach($this->files as $file)
     665                $file->compToLocalSignatures($rootpath, $report);
    623666        }
    624667    }
     
    668711                    while ( ( $innerItem = readdir($dh) ) !== false )
    669712                    {
    670                         if ($innerItem === '.' || $innerItem === '..' || $innerItem === '.DS_Store' || $innerItem === 'Thumbs.db' )
     713                        if ($innerItem === '.' || $innerItem === '..' || $innerItem === '.svn' || $innerItem === '.DS_Store' || $innerItem === 'Thumbs.db' )
    671714                            continue;
    672715                       
     
    885928        $fullPathFormatted = formatPath($uri);
    886929        $this->name = basename($fullPathFormatted);
    887         (dirname($fullPathFormatted) != ".") ? $this->path = dirname($fullPathFormatted) : $this->path = "";
     930        (dirname($fullPathFormatted) != ".") ? $this->path = dirname($fullPathFormatted).DIRECTORY_SEPARATOR : $this->path = "";
    888931    }
    889932    /*
     
    10491092    public static function fromFileTree($path, $name, $requirePaths = null, $rootPath=ROOTPATH)
    10501093    {
    1051         if($name === '.DS_Store' || $name === 'Thumbs.db')
     1094        if($name != '.DS_Store' && $name != 'Thumbs.db')
    10521095        {
    10531096            $currentFile = new FileModel($path, $name);
     
    10661109   
    10671110    /*
     1111        Function: compToLocalSignatures
     1112       
     1113       
     1114        Parameters:
     1115         
     1116    */
     1117    public function compToLocalSignatures($rootpath, &$report)
     1118    {
     1119        if( is_file($rootpath . DIRECTORY_SEPARATOR . $this->path . DIRECTORY_SEPARATOR  . $this->name) )
     1120            if( self::getFileSignature($rootpath . DIRECTORY_SEPARATOR . $this->path . DIRECTORY_SEPARATOR  . $this->name) != $this->signature )
     1121                $report[] = $this;
     1122
     1123    }
     1124   
     1125    /*
    10681126        Function: getFileSignature
    10691127        Generate the signature of the desired file
Note: See TracChangeset for help on using the changeset viewer.