chore: Removed trailing spaces and cleaned up code

This commit is contained in:
Aerex 2021-07-05 16:41:38 -05:00
parent 39feb2edb9
commit 0755b84fdd
4 changed files with 33 additions and 33 deletions

View File

@ -47,11 +47,12 @@ class Plugin extends ServerPlugin {
function __construct($configFile){ function __construct($configFile){
$this->rawConfigs = $this->buildConfigurations($configFile); $this->rawConfigs = $this->buildConfigurations($configFile);
$this->storageManager = new StorageManager($this->rawConfigs); $this->storageManager = new StorageManager($this->rawConfigs);
$this->logger = new Logger($this->rawConfigs, 'BaikalStorage');
$this->initializeStorages($this->rawConfigs); $this->initializeStorages($this->rawConfigs);
} }
private function getDisplayName($path) { private function getDisplayName($path) {
// Remove filepath (e.g Remove xxxx.ics from calendars/collection_name/xxxx.ics) // Remove filepath
$urlParts = explode('/', $path); $urlParts = explode('/', $path);
$calendarUrl = implode('/', array_slice($urlParts, 0, sizeof($urlParts)-1)); $calendarUrl = implode('/', array_slice($urlParts, 0, sizeof($urlParts)-1));
@ -307,4 +308,3 @@ class Plugin extends ServerPlugin {
} }
} }

View File

@ -22,6 +22,10 @@ class StorageManager {
$this->configs = $configs; $this->configs = $configs;
} }
public function getStorages() {
return $this->storages;
}
public function fromStorageSource(Calendar $calendar) { public function fromStorageSource(Calendar $calendar) {
if (!isset($this->configs)) { if (!isset($this->configs)) {
throw new \Exception('StorageManager was not initialize or configs are not defined'); throw new \Exception('StorageManager was not initialize or configs are not defined');
@ -34,9 +38,6 @@ class StorageManager {
return false; return false;
} }
public function getStorages() {
return $this->storages;
}
public function getConfigs() { public function getConfigs() {
return $this->configs; return $this->configs;
@ -72,4 +73,3 @@ class StorageManager {
} }
} }
} }

View File

@ -11,4 +11,3 @@ interface IStorage {
public function getConfigBrowser(); public function getConfigBrowser();
public function updateConfigs($postData); public function updateConfigs($postData);
} }

View File

@ -179,6 +179,7 @@ class Taskwarrior implements IStorage {
if (!isset($c->VTODO)){ if (!isset($c->VTODO)){
throw new \Exception('Calendar event does not contain VTODO'); throw new \Exception('Calendar event does not contain VTODO');
} }
$this->logger->info(sprintf('Executing on calendar %s', $displayname));
$this->logger->info(json_encode($c->jsonSerialize())); $this->logger->info(json_encode($c->jsonSerialize()));
$this->refresh(); $this->refresh();
$task = $this->vObjectToTask($c->VTODO, $displayname); $task = $this->vObjectToTask($c->VTODO, $displayname);
@ -206,6 +207,7 @@ class Taskwarrior implements IStorage {
} }
$task = $this->tasks[(string)$uid]; $task = $this->tasks[(string)$uid];
if (isset($task) && $task['status'] !== 'deleted') { if (isset($task) && $task['status'] !== 'deleted') {
$this->logger->info(sprintf('Deleting iCal %s from taskwarrior', $uid));
$uuid = $task['uuid']; $uuid = $task['uuid'];
$this->logger->info( $this->logger->info(
sprintf('Executing TASKRC = %s TASKDATA = %s task delete %s', $this->configs['taskrc'], $this->configs['taskdata'], $uuid) sprintf('Executing TASKRC = %s TASKDATA = %s task delete %s', $this->configs['taskrc'], $this->configs['taskdata'], $uuid)
@ -225,6 +227,5 @@ class Taskwarrior implements IStorage {
$this->logger->error($e->getTraceAsString()); $this->logger->error($e->getTraceAsString());
throw $e; throw $e;
} }
} }
} }