Changeset 330937
- Timestamp:
- 01/10/2011 06:56:27 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
exchange-platform/trunk/includes/version_editor.php
r330839 r330937 65 65 a DOMDocument 66 66 */ 67 p rivatefunction toXML()67 public function toXML() 68 68 { 69 69 $versionDoc = new DOMDocument('1.0', 'utf-8'); … … 90 90 a SilexTree corresponding to the DOMDocument 91 91 */ 92 p rivatestatic function fromXML($versionDOMDocument, $fetchVersionOnly = false)92 public static function fromXML($versionDOMDocument, $fetchVersionOnly = false) 93 93 { 94 94 $rootElement = $versionDOMDocument->documentElement; … … 207 207 class SilexElement 208 208 { 209 210 /* 211 Variable: $version 212 The label of the version 213 */ 214 public $version; 209 215 210 216 211 /* 217 212 Variable: $id 218 213 The id of the element in the Silex exchange platform 214 215 219 216 */ 220 217 public $id; 218 219 220 /* 221 Variable: $version 222 The label of the element's version 223 224 225 */ 226 public $version; 221 227 222 228 /* … … 276 282 a DOMDocument 277 283 */ 278 p rivatefunction toXML()284 public function toXML() 279 285 { 280 286 $versionDoc = new DOMDocument('1.0', 'utf-8'); … … 326 332 a SilexElement corresponding to the DOMDocument 327 333 */ 328 p rivatestatic function fromXML($versionDOMDocument, $fetchVersionAndIdOnly = false)334 public static function fromXML($versionDOMDocument, $fetchVersionAndIdOnly = false) 329 335 { 330 336 $rootElement = $versionDOMDocument->documentElement; … … 471 477 return $report; 472 478 } 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 } 473 497 } 474 498 … … 621 645 if($i == $otherFilesSize) 622 646 $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); 623 666 } 624 667 } … … 668 711 while ( ( $innerItem = readdir($dh) ) !== false ) 669 712 { 670 if ($innerItem === '.' || $innerItem === '..' || $innerItem === '. DS_Store' || $innerItem === 'Thumbs.db' )713 if ($innerItem === '.' || $innerItem === '..' || $innerItem === '.svn' || $innerItem === '.DS_Store' || $innerItem === 'Thumbs.db' ) 671 714 continue; 672 715 … … 885 928 $fullPathFormatted = formatPath($uri); 886 929 $this->name = basename($fullPathFormatted); 887 (dirname($fullPathFormatted) != ".") ? $this->path = dirname($fullPathFormatted) : $this->path = "";930 (dirname($fullPathFormatted) != ".") ? $this->path = dirname($fullPathFormatted).DIRECTORY_SEPARATOR : $this->path = ""; 888 931 } 889 932 /* … … 1049 1092 public static function fromFileTree($path, $name, $requirePaths = null, $rootPath=ROOTPATH) 1050 1093 { 1051 if($name === '.DS_Store' || $name === 'Thumbs.db')1094 if($name != '.DS_Store' && $name != 'Thumbs.db') 1052 1095 { 1053 1096 $currentFile = new FileModel($path, $name); … … 1066 1109 1067 1110 /* 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 /* 1068 1126 Function: getFileSignature 1069 1127 Generate the signature of the desired file
Note: See TracChangeset
for help on using the changeset viewer.