Skip to content

Tinebase_Frontend_Cli

cli server

This class handles all requests from cli scripts

Extend:

Tinebase_Frontend_Cli_Abstract

Methods

Name Description
actionQueueRestoreDeadLetter
addCustomfield add new customfield config
authenticate authentication
cleanAclTables
cleanCustomfields cleanCustomfields
cleanFileObjects
cleanModlog clean timemachine_modlog for records that have been pruned (not deleted!) - accepts optional param date=YYYY-MM-DD to delete all modlogs before this date - accepts optional param instanceseq=NUMBER to delete all modlogs before this instance_seq
cleanNotes cleanNotes: removes notes of records that have been deleted and old avscans
cleanRelations clean relations, set relation to deleted if at least one of the ends has been set to deleted or pruned
clearDeletedFiles clears deleted files from filesystem
clearDeletedFilesFromDatabase clears deleted files from the database, use -- d=false or -- d=0 to turn off dryRun. Default is -- d=true
clearTable clear table as defined in arguments can clear the following tables: - credential_cache - access_log - async_job - temp_files - timemachine_modlog
createAllDemoData creates demo data for all applications accepts same arguments as Tinebase_Frontend_Cli_Abstract::createDemoData and the additional argument "skipAdmin" to force no user/group/role creation
duplicatePersonalContainerCheck Delete duplicate personal container without content.
executeQueueJob process given queue job --jobId the queue job id to execute
export export records
exportGroupListIds
fileSystemCheckIndexing checks if there are not yet indexed file objects and adds them to the index synchronously that means this can be very time consuming
fileSystemCheckPreviews checks if there are files missing previews and creates them synchronously that means this can be very time-consuming also deletes previews of files that no longer exist
fileSystemRecreateAllPreviews recreates all previews
fileSystemSizeRecalculation recalculates the revision sizes and then the folder sizes
forceResync
forceSyncTokenResync forces containers that support sync token to resync via WebDAV sync tokens
generateTranslationLists Generates new js Translation List files for given locale and path If no locales is given all available locales are generated
handle handle request (call -ApplicationName-_Cli.-MethodName- or -ApplicationName-_Cli.getHelp)
import import records
importGroupFromSyncBackend
increaseReplicationMasterId
monitoringActiveUsers nagios monitoring for tine 2.0 active users
monitoringCheckCache nagios monitoring for tine 2.0 cache
monitoringCheckConfig nagios monitoring for tine 2.0 config file
monitoringCheckCron nagios monitoring for tine 2.0 async cronjob run
monitoringCheckDB nagios monitoring for tine 2.0 database connection
monitoringCheckLicense nagios monitoring for tine 2.0 license
monitoringCheckPreviewService nagios monitoring for tine preview service integration
monitoringCheckQueue nagios monitoring for tine 2.0 action queue
monitoringCheckQuota
monitoringCheckSentry nagios monitoring for tine 2.0 sentry integration
monitoringLoginNumber nagios monitoring for successful tine 2.0 logins during the last 5 mins
monitoringMailServers monitoring for mail servers imap/smtp/sieve
monitoringMaintenanceMode nagios monitoring for tine 2.0 maintenance mode
purgeDeletedRecords purge deleted records
reReplicateContainer
readModifictionLogFromMaster
rebuildPaths rebuildPaths
removeAllAvScanNotes
repairContainerOwner
repairFileSystemAclNodes repair acl of nodes (supports -d for dry run)
repairTable repair a table
repairTreeIsDeletedState
reportPreviewStatus
resetSchedulerTasks re-adds all scheduler tasks (if they are missing)
restoreOrDiffEtcFileTreeFromBackupDB utility function to be adjusted for the needs at hand at the time of usage
sanitizeFSMimeTypes
sanitizeGroupListSync default is dryRun, to make changes use "-- dryRun=[0
setCustomfieldAcl set customfield acl
setDefaultGrantsOfPersistentFilters repair function for persistent filters (favorites) without grants: this adds default grants for those filters.
setGroupsListIds
setNodeAcl set node acl
syncFileTreeFromBackupDB
testNotification
transferRelations transfer relations
triggerAsyncEvents trigger async events (for example via cronjob)
undeleteFileNodes recursive undelete of file nodes - needs parent id param (only works if file objects still exist)
undo undo modlog operations (like file delete, ...)
undoDeprecated undo changes to records defined by certain criteria (user, date, fields, ...)
userReport show user report (number of enabled, disabled, ... users)
waitForActionQueueToEmpty

Inherited methods

Name Description
createContainer add container
createDemoData create demo data
getHelp echos usage information
importegw14 import from egroupware
setContainerGrants set container grants
setContainerGrantsHelper set containers grants helper
setContainerGrantsReadOnly setContainerGrantsReadOnly
updateImportExportDefinition update or create import/export definition

Tinebase_Frontend_Cli::actionQueueRestoreDeadLetter

Description

 actionQueueRestoreDeadLetter (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::addCustomfield

Description

public addCustomfield ( $_opts)

add new customfield config

example:
$ php tine20.php --method=Tinebase.addCustomfield -- \
application="Addressbook" model="Addressbook_Model_Contact" name="datefield" \
definition='{"label":"Date","type":"datetime", "uiconfig": {"group":"Dates", "order": 30}}'

Parameters

  • () $_opts

Return Values

bool

success


Tinebase_Frontend_Cli::authenticate

Description

public authenticate (string $_username, string $_password)

authentication

Parameters

  • (string) $_username
  • (string) $_password

Return Values

void


Tinebase_Frontend_Cli::cleanAclTables

Description

 cleanAclTables (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::cleanCustomfields

Description

public cleanCustomfields (void)

cleanCustomfields

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::cleanFileObjects

Description

 cleanFileObjects (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::cleanModlog

Description

public cleanModlog (\Zend_Console_Getopt|null $_opts)

clean timemachine_modlog for records that have been pruned (not deleted!) - accepts optional param date=YYYY-MM-DD to delete all modlogs before this date - accepts optional param instanceseq=NUMBER to delete all modlogs before this instance_seq

Parameters

  • (\Zend_Console_Getopt|null) $_opts

Return Values

int

Throws Exceptions

\Tinebase_Exception_AccessDenied

\Tinebase_Exception_InvalidArgument


Tinebase_Frontend_Cli::cleanNotes

Description

public cleanNotes (void)

cleanNotes: removes notes of records that have been deleted and old avscans

-- purge=1 param also removes redundant notes (empty updates + create notes)
supports dry run (-d)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::cleanRelations

Description

public cleanRelations (void)

clean relations, set relation to deleted if at least one of the ends has been set to deleted or pruned

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::clearDeletedFiles

Description

public clearDeletedFiles (void)

clears deleted files from filesystem

Parameters

This function has no parameters.

Return Values

int


Tinebase_Frontend_Cli::clearDeletedFilesFromDatabase

Description

public clearDeletedFilesFromDatabase (\Zend_Console_Getopt $opts)

clears deleted files from the database, use -- d=false or -- d=0 to turn off dryRun. Default is -- d=true

Parameters

  • (\Zend_Console_Getopt) $opts

Return Values

int


Tinebase_Frontend_Cli::clearTable

Description

public clearTable ( $_opts)

clear table as defined in arguments can clear the following tables: - credential_cache - access_log - async_job - temp_files - timemachine_modlog

if param date is given (date=2010-09-17), all records before this date are deleted (if the table has a date field)

Parameters

  • () $_opts

Return Values

bool

success


Tinebase_Frontend_Cli::createAllDemoData

Description

public createAllDemoData (\Zend_Console_Getopt $_opts)

creates demo data for all applications accepts same arguments as Tinebase_Frontend_Cli_Abstract::createDemoData and the additional argument "skipAdmin" to force no user/group/role creation

Parameters

  • (\Zend_Console_Getopt) $_opts

Return Values

void


Tinebase_Frontend_Cli::duplicatePersonalContainerCheck

Description

public duplicatePersonalContainerCheck (\Zend_Console_Getopt $opts)

Delete duplicate personal container without content.

e.g. php tine20.php --method=Tinebase.duplicatePersonalContainerCheck app=Addressbook [-d]

Parameters

  • (\Zend_Console_Getopt) $opts

Return Values

void

Throws Exceptions

\Tinebase_Exception_AccessDenied

\Tinebase_Exception_InvalidArgument

\Tinebase_Exception_NotFound

\Tinebase_Exception_Record_SystemContainer


Tinebase_Frontend_Cli::executeQueueJob

Description

public executeQueueJob (\Zend_Console_Getopt $_opts)

process given queue job --jobId the queue job id to execute

  • respects maintenance mode

Parameters

  • (\Zend_Console_Getopt) $_opts

Return Values

bool

success

Throws Exceptions

\Tinebase_Exception_AccessDenied

\Tinebase_Exception_InvalidArgument

\Tinebase_Exception_NotFound

\Zend_Db_Statement_Exception


Tinebase_Frontend_Cli::export

Description

public export (\Zend_Console_Getopt $_opts)

export records

usage: method=Tinebase.export -- definition=DEFINITION_NAME

Parameters

  • (\Zend_Console_Getopt) $_opts

Return Values

int


Tinebase_Frontend_Cli::exportGroupListIds

Description

 exportGroupListIds (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::fileSystemCheckIndexing

Description

public fileSystemCheckIndexing (void)

checks if there are not yet indexed file objects and adds them to the index synchronously that means this can be very time consuming

Parameters

This function has no parameters.

Return Values

int


Tinebase_Frontend_Cli::fileSystemCheckPreviews

Description

public fileSystemCheckPreviews (\Zend_Console_Getopt $opts)

checks if there are files missing previews and creates them synchronously that means this can be very time-consuming also deletes previews of files that no longer exist

accepts (node) ids=XXXX,YYYY as param

Parameters

  • (\Zend_Console_Getopt) $opts

Return Values

int

Throws Exceptions

\Zend_Db_Statement_Exception

\Tinebase_Exception_InvalidArgument


Tinebase_Frontend_Cli::fileSystemRecreateAllPreviews

Description

public fileSystemRecreateAllPreviews (void)

recreates all previews

Parameters

This function has no parameters.

Return Values

int


Tinebase_Frontend_Cli::fileSystemSizeRecalculation

Description

public fileSystemSizeRecalculation (void)

recalculates the revision sizes and then the folder sizes

Parameters

This function has no parameters.

Return Values

int


Tinebase_Frontend_Cli::forceResync

Description

 forceResync (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::forceSyncTokenResync

Description

public forceSyncTokenResync (\Zend_Console_Getopt $_opts)

forces containers that support sync token to resync via WebDAV sync tokens

this will DELETE the complete content history for the affected containers
this will increate the sequence for all records in all affected containers
this will increate the sequence of all affected containers

this will cause 2 BadRequest responses to sync token requests
the first one as soon as the client notices that something changed and sends a sync token request
eventually the client receives a false sync token (as we increased content sequence, but we dont have a content history entry)
eventually not (if something really changed in the calendar in the meantime)

in case the client got a fake sync token, the clients next sync token request (once something really changed) will fail again
after something really changed valid sync tokens will be handed out again

Parameters

  • (\Zend_Console_Getopt) $_opts

Return Values

void


Tinebase_Frontend_Cli::generateTranslationLists

Description

public generateTranslationLists (\Zend_Console_Getopt $opts)

Generates new js Translation List files for given locale and path If no locales is given all available locales are generated

Parameters

  • (\Zend_Console_Getopt) $opts

Return Values

int

Throws Exceptions

\Tinebase_Exception_InvalidArgument


Tinebase_Frontend_Cli::handle

Description

public handle (\Zend_Console_Getopt $_opts)

handle request (call -ApplicationName-_Cli.-MethodName- or -ApplicationName-_Cli.getHelp)

Parameters

  • (\Zend_Console_Getopt) $_opts

Return Values

bool|int

success


Tinebase_Frontend_Cli::import

Description

public import (\Zend_Console_Getopt $_opts)

import records

Parameters

  • (\Zend_Console_Getopt) $_opts

Return Values

int


Tinebase_Frontend_Cli::importGroupFromSyncBackend

Description

 importGroupFromSyncBackend (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::increaseReplicationMasterId

Description

 increaseReplicationMasterId (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::monitoringActiveUsers

Description

public monitoringActiveUsers (void)

nagios monitoring for tine 2.0 active users

Parameters

This function has no parameters.

Return Values

\number


Tinebase_Frontend_Cli::monitoringCheckCache

Description

public monitoringCheckCache (void)

nagios monitoring for tine 2.0 cache

Parameters

This function has no parameters.

Return Values

int


Tinebase_Frontend_Cli::monitoringCheckConfig

Description

public monitoringCheckConfig (void)

nagios monitoring for tine 2.0 config file

Parameters

This function has no parameters.

Return Values

int


Tinebase_Frontend_Cli::monitoringCheckCron

Description

public monitoringCheckCron (void)

nagios monitoring for tine 2.0 async cronjob run

Parameters

This function has no parameters.

Return Values

int


Tinebase_Frontend_Cli::monitoringCheckDB

Description

public monitoringCheckDB (void)

nagios monitoring for tine 2.0 database connection

Parameters

This function has no parameters.

Return Values

int


Tinebase_Frontend_Cli::monitoringCheckLicense

Description

public monitoringCheckLicense (void)

nagios monitoring for tine 2.0 license

Parameters

This function has no parameters.

Return Values

int


Tinebase_Frontend_Cli::monitoringCheckPreviewService

Description

public monitoringCheckPreviewService (void)

nagios monitoring for tine preview service integration

Parameters

This function has no parameters.

Return Values

int

TODO also display on status page
TODO use tine logic to test docservice?
TODO catch output


Tinebase_Frontend_Cli::monitoringCheckQueue

Description

public monitoringCheckQueue (void)

nagios monitoring for tine 2.0 action queue

Parameters

This function has no parameters.

Return Values

int


Tinebase_Frontend_Cli::monitoringCheckQuota

Description

 monitoringCheckQuota (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::monitoringCheckSentry

Description

public monitoringCheckSentry (void)

nagios monitoring for tine 2.0 sentry integration

Parameters

This function has no parameters.

Return Values

int


Tinebase_Frontend_Cli::monitoringLoginNumber

Description

public monitoringLoginNumber (void)

nagios monitoring for successful tine 2.0 logins during the last 5 mins

Parameters

This function has no parameters.

Return Values

\number


Tinebase_Frontend_Cli::monitoringMailServers

Description

public monitoringMailServers (void)

monitoring for mail servers imap/smtp/sieve

Parameters

This function has no parameters.

Return Values

int


Tinebase_Frontend_Cli::monitoringMaintenanceMode

Description

public monitoringMaintenanceMode (void)

nagios monitoring for tine 2.0 maintenance mode

Parameters

This function has no parameters.

Return Values

int


Tinebase_Frontend_Cli::purgeDeletedRecords

Description

public purgeDeletedRecords (\Zend_Console_Getopt $_opts)

purge deleted records

If param date is given (for example: date=2010-09-17), all records before this date are deleted
(if the table has a date field). If table names are given, purge only records from these tables.
We also remove all modification log records before the given date (with param modlog=purge)!
- modlog can be skipped with skip=modlog

Parameters

  • (\Zend_Console_Getopt) $_opts

Return Values

int

Throws Exceptions

\Tinebase_Exception_InvalidArgument


Tinebase_Frontend_Cli::reReplicateContainer

Description

 reReplicateContainer (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::readModifictionLogFromMaster

Description

 readModifictionLogFromMaster (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::rebuildPaths

Description

public rebuildPaths (\Zend_Console_Getopt $opts)

rebuildPaths

Parameters

  • (\Zend_Console_Getopt) $opts

Return Values

int

success


Tinebase_Frontend_Cli::removeAllAvScanNotes

Description

 removeAllAvScanNotes (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::repairContainerOwner

Description

 repairContainerOwner (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::repairFileSystemAclNodes

Description

public repairFileSystemAclNodes (\Zend_Console_Getopt $opts)

repair acl of nodes (supports -d for dry run)

Parameters

  • (\Zend_Console_Getopt) $opts

Return Values

int

Throws Exceptions

\Tinebase_Exception_InvalidArgument

\Tinebase_Exception_NotFound

\Tinebase_Exception_Record_Validation

\Zend_Db_Statement_Exception


Tinebase_Frontend_Cli::repairTable

Description

public repairTable (\Zend_Console_Getopt $opts)

repair a table

Parameters

  • (\Zend_Console_Getopt) $opts

Return Values

void


Tinebase_Frontend_Cli::repairTreeIsDeletedState

Description

 repairTreeIsDeletedState (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::reportPreviewStatus

Description

 reportPreviewStatus (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::resetSchedulerTasks

Description

public resetSchedulerTasks (\Zend_Console_Getopt $opts)

re-adds all scheduler tasks (if they are missing)

Parameters

  • (\Zend_Console_Getopt) $opts

Return Values

int


Tinebase_Frontend_Cli::restoreOrDiffEtcFileTreeFromBackupDB

Description

public restoreOrDiffEtcFileTreeFromBackupDB (void)

utility function to be adjusted for the needs at hand at the time of usage

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::sanitizeFSMimeTypes

Description

 sanitizeFSMimeTypes (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::sanitizeGroupListSync

Description

public sanitizeGroupListSync (\Zend_Console_Getopt $opts)

default is dryRun, to make changes use "-- dryRun=[0|false]

Parameters

  • (\Zend_Console_Getopt) $opts

Return Values

int


Tinebase_Frontend_Cli::setCustomfieldAcl

Description

public setCustomfieldAcl ( $_opts)

set customfield acl

example:
$ php tine20.php --method Tinebase.setCustomfieldAcl -- application=Addressbook \
model=Addressbook_Model_Contact name=$CFNAME \
grants='[{"account":"$USERNAME","account_type":"user","readGrant":1,"writeGrant":1},{"account_type":"anyone","readGrant":1}]'

Parameters

  • () $_opts

Return Values

int

Throws Exceptions

\Tinebase_Exception_InvalidArgument


Tinebase_Frontend_Cli::setDefaultGrantsOfPersistentFilters

Description

public setDefaultGrantsOfPersistentFilters (void)

repair function for persistent filters (favorites) without grants: this adds default grants for those filters.

Parameters

This function has no parameters.

Return Values

int


Tinebase_Frontend_Cli::setGroupsListIds

Description

 setGroupsListIds (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::setNodeAcl

Description

public setNodeAcl ( $_opts)

set node acl

example:
$ php tine20.php --method Tinebase.setNodeAcl [-d] -- id=NODEID \
grants='[{"account":"$USERNAME","account_type":"user","readGrant":1,"writeGrant":1},{"account":"$GROUPNAME","account_type":"group","readGrant":1}]'

Parameters

  • () $_opts

Return Values

int


Tinebase_Frontend_Cli::syncFileTreeFromBackupDB

Description

 syncFileTreeFromBackupDB (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::testNotification

Description

 testNotification (void)

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::transferRelations

Description

public transferRelations (\Zend_Console_Getopt $opts)

transfer relations

Parameters

  • (\Zend_Console_Getopt) $opts

Return Values

void


Tinebase_Frontend_Cli::triggerAsyncEvents

Description

public triggerAsyncEvents (\Zend_Console_Getopt $_opts)

trigger async events (for example via cronjob)

  • respects maintenance mode
  • can be deactivated via Tinebase_Config::CRON_DISABLED

Parameters

  • (\Zend_Console_Getopt) $_opts

Return Values

int

Throws Exceptions

\Tinebase_Exception_InvalidArgument

\Zend_Db_Statement_Exception


Tinebase_Frontend_Cli::undeleteFileNodes

Description

public undeleteFileNodes (\Zend_Console_Getopt $_opts)

recursive undelete of file nodes - needs parent id param (only works if file objects still exist)

Parameters

  • (\Zend_Console_Getopt) $_opts

Return Values

int


Tinebase_Frontend_Cli::undo

Description

public undo (\Zend_Console_Getopt $opts)

undo modlog operations (like file delete, ...)

usage:

--method=Tinebase.undo [-d] -- iseqfrom=INSTANCESEQ1 iseqto=INSTANCESEQ2 accountid=IDFROMUSERTABLE models=MODELS

params:

  • iseqfrom: starting instance_seq
  • iseqto: ending instance_seq
  • accountid: user account whose actions should be undeleted (field in modlog: modification_account)
  • models: the models for undelete, "fs" means Filesystem (undo all filesystem operations)
    comma separated string, example: Addressbook_Model_Contact,Addressbook_Model_List
    (field in modlog: record_type)

=> all param information can be fetched from timemachine_modlog table

example:

--method Tinebase.undo -- iseqfrom=1932 iseqto=1934 accountid=81db314e75f5c5e8eab8d2b3a7a5a566b0b98d5d models=fs

Parameters

  • (\Zend_Console_Getopt) $opts

Return Values

int

Throws Exceptions

\Tinebase_Exception_InvalidArgument

\Tinebase_Exception_Record_DefinitionFailure

\Tinebase_Exception_Record_Validation


Tinebase_Frontend_Cli::undoDeprecated

Description

public undoDeprecated (\Zend_Console_Getopt $opts)

undo changes to records defined by certain criteria (user, date, fields, ...)

example: $ php tine20.php --username pschuele --method Tinebase.undoDeprecated -d
-- record_type=Addressbook_Model_Contact modification_time=2013-05-08 modification_account=3263

Parameters

  • (\Zend_Console_Getopt) $opts

Return Values

int


Tinebase_Frontend_Cli::userReport

Description

public userReport (void)

show user report (number of enabled, disabled, ... users)

TODO add system user count
TODO use twig?

Parameters

This function has no parameters.

Return Values

void


Tinebase_Frontend_Cli::waitForActionQueueToEmpty

Description

 waitForActionQueueToEmpty (void)

Parameters

This function has no parameters.

Return Values

void