Commit 43d05f43 authored by Sebastian Kummer's avatar Sebastian Kummer

ZO-28 Rename Syncher into SyncWorker.

parent f444c0c1
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
define('HASHFIELD', 'account'); define('HASHFIELD', 'account');
define('AMOUT_OF_CHUNKS', 10); define('AMOUT_OF_CHUNKS', 10);
// Syncer class to be used // SyncWorker implementation to be used
define('SYNCHER', 'Zarafa'); define('SYNCWORKER', 'Zarafa');
// unique id to find a contact from the GAB (value to be supplied by -u on the command line) // unique id to find a contact from the GAB (value to be supplied by -u on the command line)
// Zarafa supports: 'account' and 'smtpAddress' (email) // Zarafa supports: 'account' and 'smtpAddress' (email)
......
...@@ -29,7 +29,7 @@ include_once(SYNC_CONFIG); ...@@ -29,7 +29,7 @@ include_once(SYNC_CONFIG);
echo GabSyncCLI::UsageInstructions(); echo GabSyncCLI::UsageInstructions();
exit(1); exit(1);
} }
else if (!GabSyncCLI::SetupSyncher()) { else if (!GabSyncCLI::SetupSyncWorker()) {
fwrite(STDERR, GabSyncCLI::GetErrorMessage() . PHP_EOL); fwrite(STDERR, GabSyncCLI::GetErrorMessage() . PHP_EOL);
exit(1); exit(1);
} }
...@@ -52,7 +52,7 @@ class GabSyncCLI { ...@@ -52,7 +52,7 @@ class GabSyncCLI {
const COMMAND_CLEARALL = 4; const COMMAND_CLEARALL = 4;
const COMMAND_DELETEALL = 5; const COMMAND_DELETEALL = 5;
static private $syncher; static private $syncWorker;
static private $command; static private $command;
static private $uniqueId = false; static private $uniqueId = false;
static private $errormessage; static private $errormessage;
...@@ -79,25 +79,25 @@ class GabSyncCLI { ...@@ -79,25 +79,25 @@ class GabSyncCLI {
} }
/** /**
* Setup of the Syncher implementation. * Setup of the SyncWorker implementation.
*/ */
static public function SetupSyncher() { static public function SetupSyncWorker() {
$file = "lib/" .strtolower(SYNCHER).".php"; $file = "lib/" .strtolower(SYNCWORKER).".php";
if (!file_exists($file)) { if (!file_exists($file)) {
self::$errormessage = "Syncher file '".$file."' can not be found. Check your configuration."; self::$errormessage = "SyncWorker file '".$file."' can not be found. Check your configuration.";
return false; return false;
} }
else { else {
include_once($file); include_once($file);
} }
if (!class_exists(SYNCHER)) { if (!class_exists(SYNCWORKER)) {
self::$errormessage = "Syncher file loaded, but class '".SYNCHER."' can not be found. Check your implementation."; self::$errormessage = "SyncWorker file loaded, but class '".SYNCWORKER."' can not be found. Check your implementation.";
} }
else { else {
$s = @constant('SYNCHER'); $s = @constant('SYNCWORKER');
self::$syncher = new $s(); self::$syncWorker = new $s();
return true; return true;
} }
return false; return false;
...@@ -210,22 +210,22 @@ class GabSyncCLI { ...@@ -210,22 +210,22 @@ class GabSyncCLI {
echo PHP_EOL; echo PHP_EOL;
switch(self::$command) { switch(self::$command) {
case self::COMMAND_SIMULATE: case self::COMMAND_SIMULATE:
self::$syncher->Simulate(); self::$syncWorker->Simulate();
break; break;
case self::COMMAND_SYNC: case self::COMMAND_SYNC:
self::$syncher->Sync(); self::$syncWorker->Sync();
break; break;
case self::COMMAND_SYNC_ONE: case self::COMMAND_SYNC_ONE:
self::$syncher->SyncOne(self::$uniqueId); self::$syncWorker->SyncOne(self::$uniqueId);
break; break;
case self::COMMAND_CLEARALL: case self::COMMAND_CLEARALL:
echo "Are you sure you want to remove all chunks and data from the public folder. ALL GAB data will be removed from ALL Outlook instances [y/N]: "; echo "Are you sure you want to remove all chunks and data from the public folder. ALL GAB data will be removed from ALL Outlook instances [y/N]: ";
$confirm = strtolower(trim(fgets(STDIN))); $confirm = strtolower(trim(fgets(STDIN)));
if ( $confirm === 'y' || $confirm === 'yes') if ( $confirm === 'y' || $confirm === 'yes')
self::$syncher->ClearAll(); self::$syncWorker->ClearAll();
else else
echo "Aborted!".PHP_EOL; echo "Aborted!".PHP_EOL;
break; break;
...@@ -234,7 +234,7 @@ class GabSyncCLI { ...@@ -234,7 +234,7 @@ class GabSyncCLI {
echo "Are you sure you want to remove all chunks and data from the public folder and delete it? ALL GAB data will be removed from ALL Outlook instances [y/N]: "; echo "Are you sure you want to remove all chunks and data from the public folder and delete it? ALL GAB data will be removed from ALL Outlook instances [y/N]: ";
$confirm = strtolower(trim(fgets(STDIN))); $confirm = strtolower(trim(fgets(STDIN)));
if ( $confirm === 'y' || $confirm === 'yes') if ( $confirm === 'y' || $confirm === 'yes')
self::$syncher->DeleteAll(); self::$syncWorker->DeleteAll();
else else
echo "Aborted!".PHP_EOL; echo "Aborted!".PHP_EOL;
break; break;
......
<?php <?php
/*********************************************** /***********************************************
* File : syncher.php * File : synchworker.php
* Project : Z-Push - tools - OL GAB sync * Project : Z-Push - tools - OL GAB sync
* Descr : Main synchronization class. * Descr : Main synchronization class.
* *
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
include_once("gabentry.php"); include_once("gabentry.php");
abstract class Syncher { abstract class SyncWorker {
protected $chunkType; protected $chunkType;
private $hashFieldId; private $hashFieldId;
......
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
/*********************************************** /***********************************************
* File : zarafa.php * File : zarafa.php
* Project : Z-Push - tools - OL GAB sync * Project : Z-Push - tools - OL GAB sync
* Descr : Zarafa implementation of Syncher. * Descr : Zarafa implementation of SyncWorker.
* *
* Created : 28.01.2016 * Created : 28.01.2016
* *
* Copyright 2016 Zarafa Deutschland GmbH * Copyright 2016 Zarafa Deutschland GmbH
* ************************************************/ * ************************************************/
include_once("syncher.php"); include_once("syncworker.php");
include_once('mapi/mapi.util.php'); include_once('mapi/mapi.util.php');
include_once('mapi/mapidefs.php'); include_once('mapi/mapidefs.php');
...@@ -19,8 +19,8 @@ include_once('mapi/mapiguid.php'); ...@@ -19,8 +19,8 @@ include_once('mapi/mapiguid.php');
define('PR_EMS_AB_THUMBNAIL_PHOTO', mapi_prop_tag(PT_BINARY, 0x8C9E)); define('PR_EMS_AB_THUMBNAIL_PHOTO', mapi_prop_tag(PT_BINARY, 0x8C9E));
class Zarafa extends Syncher { class Zarafa extends SyncWorker {
const NAME = "Z-Push Zarafa GAB Syncer"; const NAME = "Z-Push Zarafa GAB Sync";
const VERSION = "1.0"; const VERSION = "1.0";
private $session; private $session;
private $store; private $store;
...@@ -51,7 +51,7 @@ class Zarafa extends Syncher { ...@@ -51,7 +51,7 @@ class Zarafa extends Syncher {
} }
/************************************************************************************ /************************************************************************************
* Implementing abstract methods from Syncher * Implementing abstract methods from SyncWorker
*/ */
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment