CLI Functions

From Tine 2.0 - Wiki

This page covers the available CLI functions.

not yet documented:

- Timetracker.allBillable
- Timetracker.searchDuplicateTimeaccounts
- more Setup CLI functions
- Calendar.importegw14
- Tinebase.processQueue


Contents

Setup

create_admin

description

Creates a new admin user or activates an existing admin user. Allows to reset the admin password, too.

usage example

php setup.php --create_admin


setconfig

description

Allows to change config values for all applications. If "app" param is omitted, config is set for Tinebase.

usage example

php setup.php --setconfig -- configkey=sample3 configvalue=value3 app=Addressbook


update

description

Update the database for all activated tine20 components. Can be invoked after upgrading instead of opening the setup-module in the browser.

usage example

setup.php --update


sync accounts (LDAP/AD)

description

Synchronize user accounts and groups from LDAP/AD.

usage example

setup.php --sync_accounts_from_ldap


backup

description

Backup data, config and files. You may choose what to backup and to include or exclude a Timestamp to the output file names.

usage example

setup.php --backup -- config=1 db=1 files=1 backupDir=/backup/tine20 noTimestamp=1


restore

description

Restore data, config and files from a backup.

usage example

setup.php --restore -- config=1 db=1 files=1 backupDir=/backup/tine20


updateAllImportExportDefinitions

description

Update Import and Export definitions for all applications.

usage example

setup.php --updateAllImportExportDefinitions

Tinebase

Tinebase.triggerAsyncEvents

description

Used to trigger asynchronus events like sending of alarm notifications. Can be called by a cronjob and does not need a username (it checks the cronuserid config).

usage example

php tine20.php --method Tinebase.triggerAsyncEvents

params

(--username user [optional])


Tinebase.clearTable

description

Used to clear obsolete data from tables.

the following tables are supported atm:

- credential_cache
- access_log
- async_job

usage example

php tine20.php --username tine20admin --method Tinebase.clearTable credential_cache access_log -- date=2010-09-17

One can setup a cron job with dynamically created date by using linux 'date' command and providing a password. Mind the usage of quotes as provided in the example below. This allows the usage of special characters like '@' in username and/or password.

usage example (keep last 30 days)

php tine20.php --username "tine20admin" --password "tine20password" --method Tinebase.clearTable access_log -- date=$(date -d -30days +%Y-%m-%d)

params

(tablenames)
(date, only useful if table = access_log [optional])


Tinebase.purgeDeletedRecords

description

Used to purge deleted records from tables (is_deleted == 1).

you can call it with specific tables or without tables to purge records from all installed application tables.

if date param is given, all records that were deleted before the given date (deleted_time) are purged.

usage example

php tine20.php --username tine20admin --method Tinebase.purgeDeletedRecords -- date=2010-09-17

One can setup a cron job with dynamically created date by using linux 'date' command and providing a password. Mind the usage of quotes as provided in the example below. This allows the usage of special characters like '@' in username and/or password.

usage example (keep last 30 days)

php tine20.php --username "tine20admin" --password "tine20password" --method Tinebase.purgeDeletedRecords -- date=$(date -d -30days +%Y-%m-%d)

params

(tablenames [optional])
(date [optional])


Tinebase.cleanModlog

description

Clean timemachine_modlog for records that have been pruned (not deleted!).

usage example

php tine20.php --username tine20admin --method Tinebase.cleanModlog


Tinebase.cleanRelations

description

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

usage example

php tine20.php --username tine20admin --method Tinebase.cleanRelations


Tinebase.addCustomfield

description

Used to add new customfields with acl for anyone by default.

usage examples >= Joey (2011/11)

php --username unittest --method Tinebase.addCustomfield -- application="Addressbook" \ 
 model="Addressbook_Model_Contact"  name="datefield" \ 
 definition='{"label":"Date","type":"Date","uiconfig":{"xtype":"datefield"}}'

php  --username unittest --method Tinebase.addCustomfield -- application="Addressbook" \
 model="Addressbook_Model_Contact" name="definedkeyfield" \
 definition='{"label":"definedkeyfield","type":"keyField", "keyFieldConfig": {"value": {"records": [{"id": "LOW", "value": "Low"}, {"id": "MID", "value": "Mid"}, {"id": "HIGH", "value": "High"}], "default": "MID"}}}'

params >= Joey (2011/11)

- application (the application of the cf)
- model (the model which contains the cf, for example Addressbook_Model_Contact)
- name (internal name of the cf)
- definition (json encoded definition of the cf)
-- label (label in the cf panel)
-- type (string|int|DateTime|keyField|...)
-- value_search (if this is 1, the cf becomes a combobox with a list of all values that are saved in the db for this cf)
-- uiconfig:
--- xtype (extjs xtype of the cf)
--- order (for sorting, highest numbers are at the bottom)
--- group (for grouping boxes)

usage example < Joey (2011/11)

php tine20.php --username tine20admin --method Tinebase.addCustomfield -- application="Addressbook" name="datefield" label="Date" model="Addressbook_Model_Contact" type="datefield"

params < Joey (2011/11)

- application (the application of the cf)
- name (internal name of the cf)
- label (label in the cf panel)
- model (the model which contains the cf, for example Addressbook_Model_Contact)
- type (extjs xtype of the cf)
- value_search (if this is 1, the cf becomes a combobox with a list of all values that are saved in the db for this cf)
- order (for sorting, highest numbers are at the bottom)

supported xtypes

- textfield
- datefield
- datetimefield
- extuxclearabledatefield 
- customfieldsearchcombo

All Applications

appName.updateImportExportDefinition

description

Used to update import/export definitions in the database by reading the configuration from a file.

usage example

php tine20.php --username tine20admin --method Addressbook.updateImportExportDefinition importdefinition.xml

params

(filenames)


appName.import

Several apps support imports via appName.import. Available plugins for the app could be found in the appName/Import directory. In the plugin files you also find an $_options array with a list of possible options.

usage examples

 php tine20.php --method=Calendar.import --username=me -v plugin=Calendar_Import_Ical container_id=362 /path/to/Feiertage_DE.ics
 php tine20.php --method=Addressbook.import --username=me -v definition=adb_tine_import_csv /path/to/contacts.csv

appName.setContainerGrants

This CLI function allows to set the grants of containers. You have to know the id of the container and the account/group or you need to supply a filter string for container names (operator: contains).

usage examples

 php tine20.php --method=Calendar.setContainerGrants containerId=3339 accountId=15 accountType=group grants=readGrant
 php tine20.php --username admin --method=Timetracker.setContainerGrants namefilter="ta title" accountId=3039,3038 accountType=group grants=book_own,manage_billable overwrite=1

params

 containerId / accountId / accountType / grants / overwrite / namefilter


Addressbook

Addressbook.import

description

Imports file with contact data into the addressbook.

usage example

php tine20.php --username tine20admin --method Addressbook.import file.csv adb_tine_import_csv

params

(filenames) (import definition name)


Addressbook.export

description

Exports contacts.

Per default only exports the internal contacts addressbook. You need to set the required container id in the code (Addressbook_Frontend_Cli).

usage example

php tine20.php --username tine20admin --password tine20adminPw --method Addressbook.export > myExport.csv

params

no params

memory limit error

If you run into this problem you might want to try the following:

php -d memory_limit=512M tine20.php --username tine20admin --password tine20adminPw --method Addressbook.export > myExport.csv


Addressbook.removeAutogeneratedContacts

description

Removes contacts that were created from a calendar sync.

usage example

php tine20.php --username tine20admin --method Addressbook.removeAutogeneratedContacts

Admin

Admin.importUser

description

Import new users. Accepts the same params as appName.import.

usage example

php tine20.php --method Admin.importUser --username=me -v definition=admin_user_import_csv /path/to/users.csv


Admin.importGroups

description

Import new Groups.

usage example

php tine20.php --method Admin.importGroups --username=me -v definition=admin_group_import_csv /path/to/group.csv


Admin.createSystemGroupsForAddressbookLists

description

create system groups for addressbook lists that don't have a system group.

usage example

php tine20.php --username "tine20admin" --method Admin.createSystemGroupsForAddressbookLists


Admin.repairGroups

description

Add missing lists and checks if list container has been deleted (hides groups if that's the case)

usage example

php tine20.php --username "tine20admin" --method Admin.repairGroups


Admin.repairUserSambaoptions

description

Overwrite Samba options for users. You may set the Samba options in Admin/Frontend/Cli.php

usage example

php tine20.php --username "tine20admin" --method Admin.repairUserSambaoptions

options

--dry


Admin.shortenLoginnames

description

Shorten loginnmes to fit ad samaccountname (20 Chars). And updates Samba options.

usage example

php tine20.php --username "tine20admin" --method Admin.shortenLoginnames

Calendar

exportICS

Description

Exports all events of a calendar in ICS format.

Usage Example

 php tine20.php --username "tine20admin" --password "tine20password" \
 --method=Calendar.exportICS 123 > calendarWithID123Events.ics

Calendar.import

Description

Import all events of a calendar in ICS format.

Usage Example

 php tine20.php --username "tine20admin" --password "tine20password" \
 --method=Calendar.import plugin=Calendar_Import_Ical importContainerId=123   calendarWithID123Events.ics