Back to index

d-push  2.0
Public Member Functions | Private Attributes
ExportChangesCombined Class Reference

the ExportChangesCombined class is returned from GetExporter for changes. More...

Inheritance diagram for ExportChangesCombined:
Inheritance graph
[legend]
Collaboration diagram for ExportChangesCombined:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ExportChangesCombined (&$backend)
 Config ($syncstate, $flags=0)
 Initializes the state and flags.
 GetChangeCount ()
 Returns the amount of changes to be exported.
 Synchronize ()
 Synchronizes a change to the configured importer.
 GetState ()
 Reads and returns the current state.
 ConfigContentParameters ($contentparameters)
 Configures additional parameters used for content synchronization.
 InitializeExporter (&$importer)
 Sets the importer where the exporter will sent its changes to This exporter should also be ready to accept calls after this.

Private Attributes

 $backend
 $syncstates
 $exporters
 $importer
 $importwraps

Detailed Description

the ExportChangesCombined class is returned from GetExporter for changes.

It combines the changes from all backends and prepends all folderids with the backendid

Definition at line 49 of file exporter.php.


Member Function Documentation

ExportChangesCombined::Config ( syncstate,
flags = 0 
)

Initializes the state and flags.

Parameters:
string$state
int$flagspublic
Returns:
boolean status flag

Implements IChanges.

Definition at line 71 of file exporter.php.

                                                   {
        ZLog::Write(LOGLEVEL_DEBUG, "ExportChangesCombined->Config(...)");
        $this->syncstates = $syncstate;
        if(!is_array($this->syncstates)){
            $this->syncstates = array();
        }

        foreach($this->backend->backends as $i => $b){
            if(isset($this->syncstates[$i])){
                $state = $this->syncstates[$i];
            } else {
                $state = '';
            }

            $this->exporters[$i] = $this->backend->backends[$i]->GetExporter();
            $this->exporters[$i]->Config($state, $flags);
        }
        ZLog::Write(LOGLEVEL_DEBUG, "ExportChangesCombined->Config() success");
    }

Here is the call graph for this function:

Configures additional parameters used for content synchronization.

Parameters:
ContentParameters$contentparameterspublic
Returns:
boolean
Exceptions:
StatusException

Implements IExportChanges.

Definition at line 155 of file exporter.php.

                                                                {
        ZLog::Write(LOGLEVEL_DEBUG, "ExportChangesCombined->ConfigContentParameters()");
        foreach($this->exporters as $i => $e){
            //call the ConfigContentParameters() of each exporter
            $e->ConfigContentParameters($contentparameters);
        }
        ZLog::Write(LOGLEVEL_DEBUG, "ExportChangesCombined->ConfigContentParameters() success");
    }

Here is the call graph for this function:

Definition at line 56 of file exporter.php.

                                                     {
        $this->backend =& $backend;
        $this->exporters = array();
        ZLog::Write(LOGLEVEL_DEBUG, "ExportChangesCombined constructed");
    }

Here is the call graph for this function:

Returns the amount of changes to be exported.

public

Returns:
int

Implements IExportChanges.

Definition at line 97 of file exporter.php.

                                     {
        ZLog::Write(LOGLEVEL_DEBUG, "ExportChangesCombined->GetChangeCount()");
        $c = 0;
        foreach($this->exporters as $i => $e){
            $c += $this->exporters[$i]->GetChangeCount();
        }
        ZLog::Write(LOGLEVEL_DEBUG, "ExportChangesCombined->GetChangeCount() success");
        return $c;
    }

Here is the call graph for this function:

Reads and returns the current state.

public

Returns:
string

Implements IChanges.

Definition at line 137 of file exporter.php.

                               {
        ZLog::Write(LOGLEVEL_DEBUG, "ExportChangesCombined->GetState()");
        foreach($this->exporters as $i => $e){
            $this->syncstates[$i] = $this->exporters[$i]->GetState();
        }
        ZLog::Write(LOGLEVEL_DEBUG, "ExportChangesCombined->GetState() success");
        return $this->syncstates;
    }

Here is the call graph for this function:

Sets the importer where the exporter will sent its changes to This exporter should also be ready to accept calls after this.

Parameters:
object&$importerImplementation of IImportChanges

public

Returns:
boolean

Implements IExportChanges.

Definition at line 173 of file exporter.php.

                                                   {
        ZLog::Write(LOGLEVEL_DEBUG, "ExportChangesCombined->InitializeExporter(...)");
        foreach ($this->exporters as $i => $e) {
            if(!isset($this->_importwraps[$i])){
                $this->importwraps[$i] = new ImportHierarchyChangesCombinedWrap($i, $this->backend, $importer);
            }
            $e->InitializeExporter($this->importwraps[$i]);
        }
        ZLog::Write(LOGLEVEL_DEBUG, "ExportChangesCombined->InitializeExporter(...) success");
    }

Here is the call graph for this function:

Synchronizes a change to the configured importer.

public

Returns:
array with status information

Implements IExportChanges.

Definition at line 113 of file exporter.php.

                                  {
        ZLog::Write(LOGLEVEL_DEBUG, "ExportChangesCombined->Synchronize()");
        foreach($this->exporters as $i => $e){
            if(!empty($this->backend->config['backends'][$i]['subfolder']) && !isset($this->syncstates[$i])){
                // first sync and subfolder backend
                $f = new SyncFolder();
                $f->serverid = $i.$this->backend->config['delimiter'].'0';
                $f->parentid = '0';
                $f->displayname = $this->backend->config['backends'][$i]['subfolder'];
                $f->type = SYNC_FOLDER_TYPE_OTHER;
                $this->importer->ImportFolderChange($f);
            }
            while(is_array($this->exporters[$i]->Synchronize()));
        }
        ZLog::Write(LOGLEVEL_DEBUG, "ExportChangesCombined->Synchronize() success");
        return true;
    }

Here is the call graph for this function:


Member Data Documentation

Definition at line 50 of file exporter.php.

Definition at line 52 of file exporter.php.

Definition at line 53 of file exporter.php.

Definition at line 54 of file exporter.php.

Definition at line 51 of file exporter.php.


The documentation for this class was generated from the following file: