+ // Do a listing comparison if specified
+ if ( $this->hasOption( 'missingonly' ) ) {
+ $relFilesSrc = array();
+ $relFilesDst = array();
+ foreach ( $srcPathsRel as $srcPathRel ) {
+ $relFilesSrc[] = $srcPathRel;
+ }
+ $dstPathsRel = $dst->getFileList( array(
+ 'dir' => $dst->getRootStoragePath() . "/$backendRel" ) );
+ if ( $dstPathsRel === null ) {
+ $this->error( "Could not list files in $container.", 1 ); // die
+ }
+ foreach ( $dstPathsRel as $dstPathRel ) {
+ $relFilesDst[] = $dstPathRel;
+ }
+ // Only copy the missing files over in the next loop
+ $srcPathsRel = array_diff( $relFilesSrc, $relFilesDst );
+ $this->output( count( $srcPathsRel ) . " file(s) need to be copied.\n" );
+ unset( $relFilesSrc );
+ unset( $relFilesDst );
+ }
+