mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 23:29:31 +01:00
refactored account_id change script to use information from app-specific tables_current.inc.php instead of a fixed list
This commit is contained in:
parent
f17e335daa
commit
bb020d37f8
@ -6,7 +6,7 @@
|
||||
* @link http://www.egroupware.org
|
||||
* @package admin
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2006-12 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2006-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
@ -136,10 +136,14 @@ function run_command(admin_cmd $cmd)
|
||||
$cmd->remote_id = admin_cmd::parse_remote(array_shift($arguments));
|
||||
break;
|
||||
|
||||
case '--skip-checks': //do not yet run the checks for scheduled local commands
|
||||
case '--skip-checks': // do not yet run the checks for scheduled local commands
|
||||
$skip_checks = true;
|
||||
break;
|
||||
|
||||
case '--dry-run': // only run checks
|
||||
$dry_run = true;
|
||||
break;
|
||||
|
||||
case '--header-access':
|
||||
if ($cmd instanceof setup_cmd)
|
||||
{
|
||||
@ -155,8 +159,19 @@ function run_command(admin_cmd $cmd)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($dry_run && $skip_checks)
|
||||
{
|
||||
echo lang('You can NOT use --dry-run together with --skip-checks!')."\n\n";
|
||||
usage('', 99);
|
||||
}
|
||||
//_debug_array($cmd);
|
||||
print_r($cmd->run($time,true,$skip_checks));
|
||||
try {
|
||||
print_r($cmd->run($time, true, $skip_checks, $dry_run));
|
||||
}
|
||||
catch (egw_exception_wrong_userinput $e) {
|
||||
echo "\n".$e->getMessage()."\n\n";
|
||||
exit($e->getCode());
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
exit(0);
|
||||
@ -272,20 +287,23 @@ function _check_pw($hash_or_cleartext,$pw)
|
||||
function usage($action=null,$ret=0)
|
||||
{
|
||||
$cmd = basename($_SERVER['argv'][0]);
|
||||
echo "Usage: $cmd --command admin-account[@domain],admin-password,options,... [--schedule {YYYY-mm-dd|+1 week|+5 days}] [--requested 'Name <email>'] [--comment 'comment ...'] [--remote {id|name}] [--skip-checks]\n\n";
|
||||
echo "Usage: $cmd --command admin-account[@domain],admin-password,options,... [--schedule {YYYY-mm-dd|+1 week|+5 days}] [--requested 'Name <email>'] [--comment 'comment ...'] [--remote {id|name}] [--skip-checks] [--dry-run]\n\n";
|
||||
|
||||
echo "\n\t--skip-checks\tdo NOT run checks\n";
|
||||
echo "\t--dry-run\tonly run checks\n";
|
||||
|
||||
echo "\tAlternativly you can also use a setup user and password by prefixing it with 'root_', eg. 'root_admin' for setup user 'admin'.\n\n";
|
||||
|
||||
echo "--edit-user admin-account[@domain],admin-password,account[=new-account-name],first-name,last-name,password,email,expires{never(default)|YYYY-MM-DD|already},can-change-pw{yes(default)|no},anon-user{yes|no(default)},primary-group{Default(default)|...}[,groups,...][,homedirectory,loginshell]\n";
|
||||
echo " Edit or add a user to eGroupWare. If you specify groups, they *replace* the exiting memberships! homedirectory+loginshell are supported only for LDAP and must start with a slash!\n";
|
||||
echo " Edit or add a user to EGroupware. If you specify groups, they *replace* the exiting memberships! homedirectory+loginshell are supported only for LDAP and must start with a slash!\n";
|
||||
echo "--change-pw admin-account[@domain],admin-password,account,password\n";
|
||||
echo " Change/set the password for a given user\n";
|
||||
echo "--delete-user admin-account[@domain],admin-password,account-to-delete[,account-to-move-data]\n";
|
||||
echo " Deletes a user from eGroupWare. It's data can be moved to an other user or it get deleted too.\n";
|
||||
echo " Deletes a user from EGroupware. It's data can be moved to an other user or it get deleted too.\n";
|
||||
echo "--edit-group admin-account[@domain],admin-password,group[=new-group-name],email[,members,...]\n";
|
||||
echo " Edit or add a group to eGroupWare. If you specify members, they *replace* the exiting members!\n";
|
||||
echo " Edit or add a group to EGroupware. If you specify members, they *replace* the exiting members!\n";
|
||||
echo "--delete-group admin-account[@domain],admin-password,group-to-delete\n";
|
||||
echo " Deletes a group from eGroupWare.\n";
|
||||
echo " Deletes a group from EGroupware.\n";
|
||||
echo "--allow-app admin-account[@domain],admin-password,account,application,...\n";
|
||||
echo "--deny-app admin-account[@domain],admin-password,account,application,...\n";
|
||||
echo " Give or deny an account (user or group specified by account name or id) run rights for the given applications.\n";
|
||||
@ -319,7 +337,7 @@ function do_account_app($args,$allow)
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit or add a group to eGroupWare. If you specify members, they *replace* the exiting member!
|
||||
* Edit or add a group to EGroupware. If you specify members, they *replace* the exiting member!
|
||||
* 1: 2: 3: 4: 5:
|
||||
* @param array $args admin-account[@domain],admin-password,group[=new-group-name],email[,members,...]
|
||||
*/
|
||||
@ -365,7 +383,7 @@ function do_change_pw($args)
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit or add a user to eGroupWare. If you specify groups, they *replace* the exiting memberships!
|
||||
* Edit or add a user to EGroupware. If you specify groups, they *replace* the exiting memberships!
|
||||
* 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12
|
||||
* @param array $args admin-account[@domain],admin-password,account[=new-account-name],first-name,last-name,password,email,expires{never(default)|YYYY-MM-DD|already},can-change-pw{true(default)|false},anon-user{true|false(default)},primary-group{Default(default)|...}[,groups,...][,homedirectory,loginshell]
|
||||
* @param boolean $run_addaccount_hook=null default run hook depending on account existence, true=allways run addaccount hook
|
||||
|
@ -5,9 +5,9 @@
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @package admin
|
||||
* @copyright (c) 2007 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2007-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -24,7 +24,7 @@ abstract class admin_cmd
|
||||
|
||||
/**
|
||||
* The status of the command, one of either scheduled, successful, failed or deleted
|
||||
*
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $status;
|
||||
@ -61,44 +61,44 @@ abstract class admin_cmd
|
||||
* @var array
|
||||
*/
|
||||
private $data = array();
|
||||
|
||||
|
||||
/**
|
||||
* Instance of the accounts class, after calling instanciate_accounts!
|
||||
*
|
||||
* @var accounts
|
||||
*/
|
||||
static protected $accounts;
|
||||
|
||||
|
||||
/**
|
||||
* Instance of the acl class, after calling instanciate_acl!
|
||||
*
|
||||
* @var acl
|
||||
*/
|
||||
static protected $acl;
|
||||
|
||||
|
||||
/**
|
||||
* Instance of so_sql for egw_admin_queue
|
||||
*
|
||||
* @var so_sql
|
||||
*/
|
||||
static private $sql;
|
||||
|
||||
|
||||
/**
|
||||
* Instance of so_sql for egw_admin_remote
|
||||
*
|
||||
* @var so_sql
|
||||
*/
|
||||
static private $remote;
|
||||
|
||||
|
||||
/**
|
||||
* Executes the command
|
||||
*
|
||||
*
|
||||
* @param boolean $check_only=false only run the checks (and throw the exceptions), but not the command itself
|
||||
* @return string success message
|
||||
* @throws Exception()
|
||||
*/
|
||||
protected abstract function exec($check_only=false);
|
||||
|
||||
|
||||
/**
|
||||
* Return a title / string representation for a given command, eg. to display it
|
||||
*
|
||||
@ -108,7 +108,7 @@ abstract class admin_cmd
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@ -128,7 +128,7 @@ abstract class admin_cmd
|
||||
}
|
||||
//_debug_array($this); exit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* runs the command either immediatly ($time=null) or shedules it for the given time
|
||||
*
|
||||
@ -137,10 +137,11 @@ abstract class admin_cmd
|
||||
* @param int $time=null timestamp to run the command or null to run it immediatly
|
||||
* @param boolean $set_modifier=null should the current user be set as modifier, default true
|
||||
* @param booelan $skip_checks=false do not yet run the checks for a scheduled command
|
||||
* @param boolean $dry_run=false only run checks, NOT command itself
|
||||
* @return mixed return value of the command
|
||||
* @throws Exceptions on error
|
||||
*/
|
||||
function run($time=null,$set_modifier=true,$skip_checks=false)
|
||||
function run($time=null,$set_modifier=true,$skip_checks=false,$dry_run=false)
|
||||
{
|
||||
if (!is_null($time))
|
||||
{
|
||||
@ -166,11 +167,11 @@ abstract class admin_cmd
|
||||
try {
|
||||
if (!$this->remote_id)
|
||||
{
|
||||
$ret = $this->exec();
|
||||
$ret = $this->exec($dry_run);
|
||||
}
|
||||
else
|
||||
{
|
||||
$ret = $this->remote_exec();
|
||||
$ret = $this->remote_exec($dry_run);
|
||||
}
|
||||
if (is_null($this->status)) $this->status = admin_cmd::successful;
|
||||
}
|
||||
@ -180,7 +181,7 @@ abstract class admin_cmd
|
||||
$this->status = admin_cmd::failed;
|
||||
}
|
||||
}
|
||||
if (!$dont_save && !$this->save($set_modifier))
|
||||
if (!$dont_save && !$dry_run && !$this->save($set_modifier))
|
||||
{
|
||||
throw new egw_exception_db(lang('Error saving the command!'));
|
||||
}
|
||||
@ -190,18 +191,18 @@ abstract class admin_cmd
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Runs a command on a remote install
|
||||
*
|
||||
*
|
||||
* This is a very basic remote procedure call to an other egw instance.
|
||||
* The payload / command data is send as POST request to the remote installs admin/remote.php script.
|
||||
* The remote domain (eGW instance) and the secret authenticating the request are send as GET parameters.
|
||||
*
|
||||
* To authenticate with the installation we use a secret, which is a md5 hash build from the uid
|
||||
* of the command (to not allow to send new commands with an earsdroped secret) and the md5 hash
|
||||
* To authenticate with the installation we use a secret, which is a md5 hash build from the uid
|
||||
* of the command (to not allow to send new commands with an earsdroped secret) and the md5 hash
|
||||
* of the md5 hash of the config password and the install_id (egw_admin_remote.remote_hash)
|
||||
*
|
||||
*
|
||||
* @return string sussess message
|
||||
* @throws Exception(lang('Invalid remote id or name "%1"!',$id_or_name),997) or other Exceptions reported from remote
|
||||
*/
|
||||
@ -216,7 +217,7 @@ abstract class admin_cmd
|
||||
$this->save(); // to get the uid
|
||||
}
|
||||
$secret = md5($this->uid.$remote['remote_hash']);
|
||||
|
||||
|
||||
$postdata = $this->as_array();
|
||||
if (is_object($GLOBALS['egw']->translation))
|
||||
{
|
||||
@ -241,7 +242,7 @@ abstract class admin_cmd
|
||||
throw new egw_exception(lang('Could not remote execute the command').': '.$http_response_header[0]);
|
||||
}
|
||||
//echo "got: $message\n";
|
||||
|
||||
|
||||
if (($value = unserialize($message)) !== false && $message !== serialize(false))
|
||||
{
|
||||
$message = $value;
|
||||
@ -256,7 +257,7 @@ abstract class admin_cmd
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete / canncels a scheduled command
|
||||
*
|
||||
@ -267,10 +268,10 @@ abstract class admin_cmd
|
||||
if ($this->status != admin_cmd::scheduled) return false;
|
||||
|
||||
$this->status = admin_cmd::deleted;
|
||||
|
||||
|
||||
return $this->save();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Saving the object to the database
|
||||
*
|
||||
@ -280,7 +281,7 @@ abstract class admin_cmd
|
||||
function save($set_modifier=true)
|
||||
{
|
||||
admin_cmd::_instanciate_sql();
|
||||
|
||||
|
||||
// check if uid already exists --> set the id to not try to insert it again (resulting in SQL error)
|
||||
if (!$this->id && $this->uid && (list($other) = self::$sql->search(array('cmd_uid' => $this->uid))))
|
||||
{
|
||||
@ -327,11 +328,11 @@ abstract class admin_cmd
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* reading a command from the queue returning the comand object
|
||||
*
|
||||
* @static
|
||||
* @static
|
||||
* @param int/string $id id or uid of the command
|
||||
* @return admin_cmd or null if record not found
|
||||
* @throws Exception(lang('Unknown command %1!',$class),0);
|
||||
@ -347,11 +348,11 @@ abstract class admin_cmd
|
||||
}
|
||||
return admin_cmd::instanciate($data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instanciated the object / subclass using the given data
|
||||
*
|
||||
* @static
|
||||
* @static
|
||||
* @param array $data
|
||||
* @return admin_cmd
|
||||
* @throws egw_exception_wrong_parameter if class does not exist or is no instance of admin_cmd
|
||||
@ -367,18 +368,18 @@ abstract class admin_cmd
|
||||
throw new egw_exception_wrong_parameter(lang('Unknown command %1!',$class),0);
|
||||
}
|
||||
$cmd = new $class($data);
|
||||
|
||||
|
||||
if ($cmd instanceof admin_cmd) // dont allow others classes to be executed that way!
|
||||
{
|
||||
return $cmd;
|
||||
}
|
||||
throw new egw_exception_wrong_parameter(lang('%1 is no command!',$class),0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* calling get_rows of our static so_sql instance
|
||||
*
|
||||
* @static
|
||||
* @static
|
||||
* @param array $query
|
||||
* @param array &$rows
|
||||
* @param array $readonlys
|
||||
@ -398,9 +399,9 @@ abstract class admin_cmd
|
||||
/**
|
||||
* calling search method of our static so_sql instance
|
||||
*
|
||||
* @static
|
||||
* @static
|
||||
* @param array/string $criteria array of key and data cols, OR a SQL query (content for WHERE), fully quoted (!)
|
||||
* @param boolean/string/array $only_keys=true True returns only keys, False returns all cols. or
|
||||
* @param boolean/string/array $only_keys=true True returns only keys, False returns all cols. or
|
||||
* comma seperated list or array of columns to return
|
||||
* @param string $order_by='' fieldnames + {ASC|DESC} separated by colons ',', can also contain a GROUP BY (if it contains ORDER BY)
|
||||
* @param string/array $extra_cols='' string or array of strings to be added to the SELECT, eg. "count(*) as num"
|
||||
@ -421,7 +422,7 @@ abstract class admin_cmd
|
||||
/**
|
||||
* Instanciate our static so_sql object for egw_admin_queue
|
||||
*
|
||||
* @static
|
||||
* @static
|
||||
*/
|
||||
private static function _instanciate_sql()
|
||||
{
|
||||
@ -430,11 +431,11 @@ abstract class admin_cmd
|
||||
admin_cmd::$sql = new so_sql('admin','egw_admin_queue',null,'cmd_');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instanciate our static so_sql object for egw_admin_remote
|
||||
*
|
||||
* @static
|
||||
* @static
|
||||
*/
|
||||
private static function _instanciate_remote()
|
||||
{
|
||||
@ -443,10 +444,10 @@ abstract class admin_cmd
|
||||
admin_cmd::$remote = new so_sql('admin','egw_admin_remote');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* magic method to read a property, all non admin-cmd properties are stored in the data array
|
||||
*
|
||||
*
|
||||
* @param string $property
|
||||
* @return mixed
|
||||
*/
|
||||
@ -467,7 +468,7 @@ abstract class admin_cmd
|
||||
|
||||
/**
|
||||
* magic method to check if a property is set, all non admin-cmd properties are stored in the data array
|
||||
*
|
||||
*
|
||||
* @param string $property
|
||||
* @return boolean
|
||||
*/
|
||||
@ -522,10 +523,10 @@ abstract class admin_cmd
|
||||
}
|
||||
unset($vars['data']);
|
||||
if ($this->data) $vars = array_merge($this->data,$vars);
|
||||
|
||||
|
||||
return $vars;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the creator is still admin and has the neccessary admin rights
|
||||
*
|
||||
@ -576,7 +577,7 @@ abstract class admin_cmd
|
||||
}
|
||||
return $apps;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* parse account name or id
|
||||
*
|
||||
@ -590,7 +591,7 @@ abstract class admin_cmd
|
||||
{
|
||||
admin_cmd::_instanciate_accounts();
|
||||
|
||||
if (!($type = admin_cmd::$accounts->exists($account)) ||
|
||||
if (!($type = admin_cmd::$accounts->exists($account)) ||
|
||||
!is_numeric($id=$account) && !($id = admin_cmd::$accounts->name2id($account)))
|
||||
{
|
||||
throw new egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$account),15);
|
||||
@ -600,10 +601,10 @@ abstract class admin_cmd
|
||||
throw new egw_exception_wrong_userinput(lang("Wrong account type: %1 is NO %2 !!!",$account,$allow_only_user?lang('user'):lang('group')),15);
|
||||
}
|
||||
if ($type == 2 && $id > 0) $id = -$id; // groups use negative id's internally, fix it, if user given the wrong sign
|
||||
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* parse account names or ids
|
||||
*
|
||||
@ -616,7 +617,7 @@ abstract class admin_cmd
|
||||
static function parse_accounts($accounts,$allow_only_user=null)
|
||||
{
|
||||
if (!$accounts) return null;
|
||||
|
||||
|
||||
$ids = array();
|
||||
foreach(is_array($accounts) ? $accounts : explode(',',$accounts) as $account)
|
||||
{
|
||||
@ -624,7 +625,7 @@ abstract class admin_cmd
|
||||
}
|
||||
return $ids;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parses a date into an integer timestamp
|
||||
*
|
||||
@ -639,7 +640,7 @@ abstract class admin_cmd
|
||||
$datein = $date;
|
||||
// convert german DD.MM.YYYY format into ISO YYYY-MM-DD format
|
||||
$date = preg_replace('/^([0-9]{1,2})\.([0-9]{1,2})\.([0-9]{4})$/','\3-\2-\1',$date);
|
||||
|
||||
|
||||
if (($date = strtotime($date)) === false)
|
||||
{
|
||||
throw new egw_exception_wrong_userinput(lang('Invalid formated date "%1"!',$datein),6);
|
||||
@ -647,7 +648,7 @@ abstract class admin_cmd
|
||||
}
|
||||
return (int)$date;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse a boolean value
|
||||
*
|
||||
@ -672,7 +673,7 @@ abstract class admin_cmd
|
||||
}
|
||||
throw new egw_exception_wrong_userinput(lang('Invalid value "%1" use yes or no!',$value),998);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse a remote id or name and return the remote_id
|
||||
*
|
||||
@ -683,7 +684,7 @@ abstract class admin_cmd
|
||||
static function parse_remote($id_or_name)
|
||||
{
|
||||
admin_cmd::_instanciate_remote();
|
||||
|
||||
|
||||
if (!($remotes = admin_cmd::$remote->search(array(
|
||||
'remote_id' => $id_or_name,
|
||||
'remote_name' => $id_or_name,
|
||||
@ -739,7 +740,7 @@ abstract class admin_cmd
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* RFC822 email address of the an account, eg. "Ralf Becker <RalfBecker@egroupware.org>"
|
||||
*
|
||||
@ -761,7 +762,7 @@ abstract class admin_cmd
|
||||
}
|
||||
return $fullname . ($email ? ' <'.$email.'>' : '');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Semaphore to not permanently set new jobs, while we running the current ones
|
||||
*
|
||||
@ -772,9 +773,9 @@ abstract class admin_cmd
|
||||
|
||||
/**
|
||||
* Setup an async job to run the next scheduled command
|
||||
*
|
||||
*
|
||||
* Only needs to be called if a new command gets scheduled
|
||||
*
|
||||
*
|
||||
* @return boolean true if job installed, false if not necessary
|
||||
*/
|
||||
private static function _set_async_job()
|
||||
@ -796,15 +797,15 @@ abstract class admin_cmd
|
||||
}
|
||||
include_once(EGW_API_INC.'/class.asyncservice.inc.php');
|
||||
$async = new asyncservice();
|
||||
|
||||
|
||||
// we cant use this class as callback, as it's abstract and ExecMethod used by the async service instanciated the class!
|
||||
list($app) = explode('_',$class=$next['type']);
|
||||
$callback = $app.'.'.$class.'.run_queued_jobs';
|
||||
|
||||
|
||||
$async->cancel_timer(admin_cmd::async_job_id); // we delete it in case a job already exists
|
||||
return $async->set_timer($time,admin_cmd::async_job_id,$callback,null,$next['creator']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Callback for our async job
|
||||
*
|
||||
@ -840,7 +841,7 @@ abstract class admin_cmd
|
||||
|
||||
return admin_cmd::_set_async_job();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a list of defined remote instances
|
||||
*
|
||||
@ -849,7 +850,7 @@ abstract class admin_cmd
|
||||
static function remote_sites()
|
||||
{
|
||||
admin_cmd::_instanciate_remote();
|
||||
|
||||
|
||||
$sites = array(lang('local'));
|
||||
if ($remote = admin_cmd::$remote->query_list('remote_name','remote_id'))
|
||||
{
|
||||
@ -857,7 +858,7 @@ abstract class admin_cmd
|
||||
}
|
||||
return $sites;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get_rows for remote instances
|
||||
*
|
||||
@ -869,10 +870,10 @@ abstract class admin_cmd
|
||||
static function get_remotes($query,&$rows,&$readonlys)
|
||||
{
|
||||
admin_cmd::_instanciate_remote();
|
||||
|
||||
|
||||
return admin_cmd::$remote->get_rows($query,$rows,$readonlys);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read data of a remote instance
|
||||
*
|
||||
@ -882,10 +883,10 @@ abstract class admin_cmd
|
||||
static function read_remote($keys)
|
||||
{
|
||||
admin_cmd::_instanciate_remote();
|
||||
|
||||
|
||||
return admin_cmd::$remote->read($keys);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Save / adds a remote instance
|
||||
*
|
||||
@ -895,7 +896,7 @@ abstract class admin_cmd
|
||||
static function save_remote(array $data)
|
||||
{
|
||||
admin_cmd::_instanciate_remote();
|
||||
|
||||
|
||||
if ($data['install_id'] && $data['config_passwd']) // calculate hash
|
||||
{
|
||||
$data['remote_hash'] = self::remote_hash($data['install_id'],$data['config_passwd']);
|
||||
@ -906,7 +907,7 @@ abstract class admin_cmd
|
||||
}
|
||||
//_debug_array($data);
|
||||
admin_cmd::$remote->init($data);
|
||||
|
||||
|
||||
// check if a unique key constrain would be violated by saving the entry
|
||||
if (($num = admin_cmd::$remote->not_unique()))
|
||||
{
|
||||
@ -919,7 +920,7 @@ abstract class admin_cmd
|
||||
}
|
||||
return admin_cmd::$remote->data['remote_id'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate the remote hash from install_id and config_passwd
|
||||
*
|
||||
@ -934,13 +935,13 @@ abstract class admin_cmd
|
||||
throw new egw_exception_wrong_parameter(empty($config_passwd)?'Empty config password':'install_id no md5 hash');
|
||||
}
|
||||
if (!self::is_md5($config_passwd)) $config_passwd = md5($config_passwd);
|
||||
|
||||
|
||||
return md5($config_passwd.$install_id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* displays an account specified by it's id or lid
|
||||
*
|
||||
*
|
||||
* We show the value given by the user, plus the full name in brackets.
|
||||
*
|
||||
* @param int/string $account
|
||||
@ -949,10 +950,10 @@ abstract class admin_cmd
|
||||
static function display_account($account)
|
||||
{
|
||||
$id = is_numeric($account) ? $account : $GLOBALS['egw']->accounts->id2name($account);
|
||||
|
||||
|
||||
return $account.' ('.$GLOBALS['egw']->common->grab_owner_name($id).')';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if string is a md5 hash (32 chars of 0-9 or a-f)
|
||||
*
|
||||
@ -963,17 +964,17 @@ abstract class admin_cmd
|
||||
{
|
||||
return preg_match('/^[0-9a-f]{32}$/',$str);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the current command has the right crediential to be excuted remotely
|
||||
*
|
||||
*
|
||||
* Command can reimplement that method, to allow eg. anonymous execution.
|
||||
*
|
||||
* This default implementation use a secret to authenticate with the installation,
|
||||
* which is a md5 hash build from the uid of the command (to not allow to send new
|
||||
* commands with an earsdroped secret) and the md5 hash of the md5 hash of the
|
||||
* This default implementation use a secret to authenticate with the installation,
|
||||
* which is a md5 hash build from the uid of the command (to not allow to send new
|
||||
* commands with an earsdroped secret) and the md5 hash of the md5 hash of the
|
||||
* config password and the install_id (egw_admin_remote.remote_hash)
|
||||
*
|
||||
*
|
||||
* @param string $secret hash used to authenticate the command (
|
||||
* @param string $config_passwd of the current domain
|
||||
* @throws egw_exception_no_permission
|
||||
@ -983,9 +984,9 @@ abstract class admin_cmd
|
||||
// as a security measure remote administration need to be enabled under Admin > Site configuration
|
||||
list(,$remote_admin_install_id) = explode('-',$this->uid);
|
||||
$allowed_remote_admin_ids = $GLOBALS['egw_info']['server']['allow_remote_admin'] ? explode(',',$GLOBALS['egw_info']['server']['allow_remote_admin']) : array();
|
||||
|
||||
// to authenticate with the installation we use a secret, which is a md5 hash build from the uid
|
||||
// of the command (to not allow to send new commands with an earsdroped secret) and the md5 hash
|
||||
|
||||
// to authenticate with the installation we use a secret, which is a md5 hash build from the uid
|
||||
// of the command (to not allow to send new commands with an earsdroped secret) and the md5 hash
|
||||
// of the md5 hash of the config password and the install_id (egw_admin_remote.remote_hash)
|
||||
if (is_null($config_passwd) || is_numeric($this->uid) || !in_array($remote_admin_install_id,$allowed_remote_admin_ids) ||
|
||||
$secret != ($md5=md5($this->uid.$this->remote_hash($GLOBALS['egw_info']['server']['install_id'],$config_passwd))))
|
||||
@ -999,7 +1000,7 @@ abstract class admin_cmd
|
||||
throw new egw_exception_no_permission($msg,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a rand string, eg. to generate passwords
|
||||
*
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @package admin
|
||||
* @copyright (c) 2007 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2007-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
@ -33,150 +33,70 @@ class admin_cmd_change_account_id extends admin_cmd
|
||||
}
|
||||
|
||||
/**
|
||||
* App-, Table- and column-names containing nummeric account-id's
|
||||
* @var array
|
||||
* Query changes from all apps
|
||||
*
|
||||
* Apps mark columns containing account-ids in "meta" attribute as (account|user|group)[-(abs|commasep|serialized)]
|
||||
*
|
||||
* @return array appname => array( table => array(column(s)))
|
||||
*/
|
||||
private $columns2change = array(
|
||||
'phpgwapi' => array(
|
||||
'egw_access_log' => 'account_id',
|
||||
'egw_accounts' => array(array('account_id','.type'=>'abs'),'account_primary_group'),
|
||||
'egw_acl' => array('acl_account','acl_location'),
|
||||
'egw_addressbook' => array('contact_owner','contact_creator','contact_modifier','account_id'),
|
||||
'egw_addressbook2list' => array('list_added_by'),
|
||||
'egw_addressbook_extra' => 'contact_owner',
|
||||
'egw_addressbook_lists' => array('list_owner','list_creator'),
|
||||
'egw_api_content_history' => 'sync_changedby',
|
||||
'egw_applications' => false,
|
||||
'egw_async' => 'async_account_id',
|
||||
'egw_categories' => array(array('cat_owner','.type' => 'comma-sep')),
|
||||
'egw_config' => false,
|
||||
'egw_history_log' => 'history_owner',
|
||||
'egw_hooks' => false,
|
||||
'egw_interserv' => false,
|
||||
'egw_lang' => false,
|
||||
'egw_languages' => false,
|
||||
'egw_links' => 'link_owner',
|
||||
'egw_log' => 'log_user',
|
||||
'egw_log_msg' => false,
|
||||
'egw_nextid' => false,
|
||||
'egw_preferences' => array(array('preference_owner','preference_owner > 0')),
|
||||
'egw_sessions' => false, // only account_lid stored
|
||||
'egw_sqlfs' => array('fs_uid','fs_creator','fs_modifier',array('fs_gid','.type' => 'absgroup')),
|
||||
),
|
||||
'etemplate' => array(
|
||||
'egw_etemplate' => 'et_group',
|
||||
),
|
||||
'bookmarks' => array(
|
||||
'egw_bookmarks' => 'bm_owner',
|
||||
),
|
||||
'calendar' => array(
|
||||
'egw_cal' => array('cal_owner','cal_modifier'),
|
||||
'egw_cal_dates' => false,
|
||||
'egw_cal_extra' => false,
|
||||
'egw_cal_holidays' => false,
|
||||
'egw_cal_repeats' => false,
|
||||
'egw_cal_user' => array(array('cal_user_id','cal_user_type' => 'u')), // cal_user_id for cal_user_type='u'
|
||||
),
|
||||
'emailadmin' => array(
|
||||
'egw_emailadmin' => array(array('ea_user',"ea_user > '0'"),array('ea_group',"ea_group < '0'")),
|
||||
),
|
||||
'felamimail' => array(
|
||||
'egw_felamimail_accounts' => 'fm_owner',
|
||||
'egw_felamimail_displayfilter' => 'fmail_filter_accountid',
|
||||
'egw_felamimail_signatures' => 'fm_accountid',
|
||||
),
|
||||
'infolog' => array(
|
||||
'egw_infolog' => array('info_owner',array('info_responsible','.type' => 'comma-sep'),'info_modifier'),
|
||||
'egw_infolog_extra' => false,
|
||||
),
|
||||
'news_admin' => array(
|
||||
'egw_news' => 'news_submittedby',
|
||||
'egw_news_export' => false,
|
||||
),
|
||||
'projectmanager' => array(
|
||||
'egw_pm_constraints' => false,
|
||||
'egw_pm_elements' => array('pe_modifier',array('pe_resources','.type' => 'comma-sep')),
|
||||
'egw_pm_extra' => false,
|
||||
'egw_pm_members' => 'member_uid',
|
||||
'egw_pm_milestones' => false,
|
||||
'egw_pm_pricelist' => false,
|
||||
'egw_pm_prices' => 'pl_modifier',
|
||||
'egw_pm_projects' => array('pm_creator','pm_modifier'),
|
||||
'egw_pm_roles' => false,
|
||||
),
|
||||
'registration' => array(
|
||||
'egw_reg_accounts' => false,
|
||||
'egw_reg_fields' => false,
|
||||
),
|
||||
'resources' => array(
|
||||
'egw_resources' => false,
|
||||
'egw_resources_extra'=> 'extra_owner',
|
||||
),
|
||||
'sitemgr' => array(
|
||||
'egw_sitemgr_active_modules' => false,
|
||||
'egw_sitemgr_blocks' => false,
|
||||
'egw_sitemgr_blocks_lang' => false,
|
||||
'egw_sitemgr_categories_lang' => false,
|
||||
'egw_sitemgr_categories_state' => false,
|
||||
'egw_sitemgr_content' => false,
|
||||
'egw_sitemgr_content_lang' => false,
|
||||
'egw_sitemgr_modules' => false,
|
||||
'egw_sitemgr_notifications' => false,
|
||||
'egw_sitemgr_notify_messages' => false,
|
||||
'egw_sitemgr_pages' => false,
|
||||
'egw_sitemgr_pages_lang' => false,
|
||||
'egw_sitemgr_properties' => false,
|
||||
'egw_sitemgr_sites' => false,
|
||||
),
|
||||
'syncml' => array(
|
||||
'egw_contentmap' => false,
|
||||
'egw_syncmldeviceowner' => false, // Lars: is owner_devid a account_id???
|
||||
'egw_syncmldevinfo' => false,
|
||||
'egw_syncmlsummary' => false,
|
||||
),
|
||||
'tracker' => array(
|
||||
'egw_tracker' => array('tr_creator','tr_modifier'),
|
||||
'egw_tracker_assignee' => 'tr_assigned',
|
||||
'egw_tracker_bounties' => array('bounty_creator','bounty_confirmer'),
|
||||
'egw_tracker_replies' => array('reply_creator'),
|
||||
'egw_tracker_votes' => array('vote_uid'),
|
||||
),
|
||||
'timesheet' => array(
|
||||
'egw_timesheet' => array('ts_owner','ts_modifier'),
|
||||
'egw_timesheet_extra'=> false,
|
||||
),
|
||||
'wiki' => array(
|
||||
'egw_wiki_interwiki' => false,
|
||||
'egw_wiki_links' => false,
|
||||
'egw_wiki_pages' => array(array('wiki_readable',"wiki_readable < '0'"),array('wiki_writable',"wiki_writable < '0'")), // only groups
|
||||
'egw_wiki_rate' => false,
|
||||
'egw_wiki_remote_pages' => false,
|
||||
'egw_wiki_sisterwiki'=> false,
|
||||
),
|
||||
'phpbrain' => array( // aka knowledgebase
|
||||
'egw_kb_articles' => array('user_id','modified_user_id'),
|
||||
'egw_kb_comment' => 'user_id',
|
||||
'egw_kb_files' => false,
|
||||
'egw_kb_questions' => 'user_id',
|
||||
'egw_kb_ratings' => 'user_id',
|
||||
'egw_kb_related_art' => false,
|
||||
'egw_kb_search' => false,
|
||||
'egw_kb_urls' => false,
|
||||
),
|
||||
'polls' => array(
|
||||
'egw_polls' => false,
|
||||
'egw_polls_answers' => false,
|
||||
'egw_polls_votes' => 'vote_uid',
|
||||
),
|
||||
'gallery' => array(
|
||||
'g2_ExternalIdMap' => array(array('g_externalId',"g_entityType='GalleryUser'")),
|
||||
),
|
||||
'eventmgr' => array(
|
||||
'egw_eventmgr' => array('event_creator', 'event_modifier', 'event_wpm_inhouse', 'event_sales_engineer')
|
||||
),
|
||||
// MyDMS ToDo!!!
|
||||
// VFS2 ToDo!!!
|
||||
);
|
||||
private function get_changes()
|
||||
{
|
||||
$changes = array();
|
||||
foreach($GLOBALS['egw_info']['apps'] as $app => $app_data)
|
||||
{
|
||||
if (!file_exists($path=EGW_SERVER_ROOT.'/'.$app.'/setup/setup.inc.php') || !include($path)) continue;
|
||||
|
||||
foreach((array)$setup_info[$app]['tables'] as $table)
|
||||
{
|
||||
if (!($definition = $GLOBALS['egw']->db->get_table_definitions($app, $table))) continue;
|
||||
|
||||
$cf = array();
|
||||
foreach($definition['fd'] as $col => $data)
|
||||
{
|
||||
if (!empty($data['meta']))
|
||||
{
|
||||
foreach((array)$data['meta'] as $key => $val)
|
||||
{
|
||||
unset($subtype);
|
||||
list($type, $subtype) = explode('-', $val);
|
||||
if (in_array($type, array('account', 'user', 'group')))
|
||||
{
|
||||
if (!is_numeric($key) || !empty($subtype))
|
||||
{
|
||||
$col = array($col);
|
||||
if (!is_numeric($key)) $col[] = $key;
|
||||
if (!empty($subtype)) $col['.type'] = $subtype;
|
||||
}
|
||||
$changes[$app][$table][] = $col;
|
||||
}
|
||||
if (in_array($type, array('cfname', 'cfvalue')))
|
||||
{
|
||||
$cf[$type] = $col;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// we have a custom field table and cfs containing accounts
|
||||
if ($cf && !empty($cf['cfname']) && !empty($cf['cfvalue']) &&
|
||||
($account_cfs = config::get_account_cfs($app == 'phpgwapi' ? 'addressbook' : $app)))
|
||||
{
|
||||
foreach($account_cfs as $type => $names)
|
||||
{
|
||||
unset($subtype);
|
||||
list($type, $subtype) = explode('-', $type);
|
||||
$col = array($cf['cfvalue']);
|
||||
if (!empty($subtype)) $col['.type'] = $subtype;
|
||||
$col[$cf['cfname']] = $names;
|
||||
$changes[$app][$table][] = $col;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($changes[$app])) ksort($changes[$app]);
|
||||
}
|
||||
ksort($changes);
|
||||
//print_r($changes);
|
||||
return $changes;
|
||||
}
|
||||
|
||||
/**
|
||||
* give or remove run rights from a given account and application
|
||||
@ -195,16 +115,32 @@ class admin_cmd_change_account_id extends admin_cmd
|
||||
{
|
||||
throw new egw_exception_wrong_userinput(lang("Account-id's have to be integers!"),16);
|
||||
}
|
||||
if (($from < 0) != ($to < 0))
|
||||
{
|
||||
throw new egw_exception_wrong_userinput(lang("Can NOT change users into groups, same sign required!"),17);
|
||||
}
|
||||
if (!($from_exists = $GLOBALS['egw']->accounts->exists($from)))
|
||||
{
|
||||
throw new egw_exception_wrong_userinput(lang("Source account #%1 does NOT exist!", $from),18);
|
||||
}
|
||||
if ($from_exists !== ($from > 0 ? 1 : 2))
|
||||
{
|
||||
throw new egw_exception_wrong_userinput(lang("Group #%1 must have negative sign!", $from),19);
|
||||
}
|
||||
if ($GLOBALS['egw']->accounts->exists($to) && !isset($this->change[$to]))
|
||||
{
|
||||
throw new egw_exception_wrong_userinput(lang("Destination account #%1 does exist and is NOT renamed itself! Can not merge accounts, it will violate unique contains. Delete with transfer of data instead.", $to),20);
|
||||
}
|
||||
}
|
||||
if ($check_only) return true;
|
||||
|
||||
$columns2change = $this->get_changes();
|
||||
$total = 0;
|
||||
foreach($this->columns2change as $app => $data)
|
||||
foreach($columns2change as $app => $data)
|
||||
{
|
||||
if (!isset($GLOBALS['egw_info']['apps'][$app])) continue; // $app is not installed
|
||||
|
||||
$db = clone($GLOBALS['egw']->db);
|
||||
$db->set_app($app);
|
||||
if ($check_only) $db->log_updates = true;
|
||||
|
||||
foreach($data as $table => $columns)
|
||||
{
|
||||
@ -228,47 +164,62 @@ class admin_cmd_change_account_id extends admin_cmd
|
||||
$column = array_shift($where);
|
||||
}
|
||||
$total += ($changed = self::_update_account_id($this->change,$db,$table,$column,$where,$type));
|
||||
echo "$app: $table.$column $changed id's changed\n";
|
||||
if (!$check_only && $changed) echo "$app:\t$table.$column $changed id's changed\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
return lang("Total of %1 id's changed.",$total)."\n\n";
|
||||
if (!$check_only)
|
||||
{
|
||||
foreach($GLOBALS['egw_info']['apps'] as $app => $data)
|
||||
{
|
||||
$total += ($changed = config::change_account_ids($app, $this->change));
|
||||
if ($changed) echo "$app:\t$changed id's in definition of private custom fields changed\n";
|
||||
}
|
||||
}
|
||||
if ($total) egw_cache::flush(egw_cache::INSTANCE);
|
||||
|
||||
return lang("Total of %1 id's changed.",$total)."\n";
|
||||
}
|
||||
|
||||
private static function _update_account_id($ids2change,$db,$table,$column,$where=null,$type=null)
|
||||
/**
|
||||
* Update DB with changed account ids
|
||||
*
|
||||
* @param array $ids2change from-id => to-id pairs
|
||||
* @param egw_db $db
|
||||
* @param string $table
|
||||
* @param string $column
|
||||
* @param array $where
|
||||
* @param string $type
|
||||
* @return int number of changed ids
|
||||
*/
|
||||
private static function _update_account_id(array $ids2change,egw_db $db,$table,$column,array $where=null,$type=null)
|
||||
{
|
||||
//static $update_sql;
|
||||
//static $update_sql_abs;
|
||||
$update_sql = $update_sql_abs = '';
|
||||
if (is_null($update_sql));
|
||||
$update_sql = '';
|
||||
foreach($ids2change as $from => $to)
|
||||
{
|
||||
foreach($ids2change as $from => $to)
|
||||
{
|
||||
$update_sql .= "WHEN ".$db->quote($from,$db->column_definitions[$column]['type'])." THEN ".$db->quote($to,$db->column_definitions[$column]['type'])." ";
|
||||
//echo "#$column->".$db->column_definitions[$column]['type']."#\n";
|
||||
if ($to < 0 && $from < 0)
|
||||
{
|
||||
$update_sql_abs .= 'WHEN '.$db->quote(abs($from),$db->column_definitions[$column]['type']).' THEN '.$db->quote(abs($to),$db->column_definitions[$column]['type']).' ';
|
||||
}
|
||||
}
|
||||
$update_sql .= 'END';
|
||||
if ($update_sql_abs) $update_sql_abs .= 'END';
|
||||
$update_sql .= "WHEN ".$db->quote($from,$db->column_definitions[$column]['type'])." THEN ".$db->quote($to,$db->column_definitions[$column]['type'])." ";
|
||||
}
|
||||
$update_sql .= 'END';
|
||||
$update_sql_prefs .= 'END';
|
||||
if ($update_sql_abs) $update_sql_abs .= 'END';
|
||||
|
||||
switch($type)
|
||||
{
|
||||
case 'comma-sep':
|
||||
case 'commasep':
|
||||
case 'serialized':
|
||||
if (!$where) $where = array();
|
||||
$where[] = "$column IS NOT NULL";
|
||||
$where[] = "$column != ''";
|
||||
$select = $where;
|
||||
$select[] = "$column IS NOT NULL";
|
||||
$select[] = "$column != ''";
|
||||
$change = array();
|
||||
foreach($db->select($table,'DISTINCT '.$column,$where,__LINE__,__FILE__) as $row)
|
||||
foreach($db->select($table,'DISTINCT '.$column,$select,__LINE__,__FILE__) as $row)
|
||||
{
|
||||
$ids = explode(',',$old_ids=$row[$column]);
|
||||
$ids = $type != 'serialized' ? explode(',',$old_ids=$row[$column]) : unserialize($old_ids=$row[$column]);
|
||||
foreach($ids as $key => $id)
|
||||
{
|
||||
if (isset($ids2change[$id])) $ids[$key] = $ids2change[$id];
|
||||
}
|
||||
$ids = implode(',',$ids);
|
||||
$ids = $type != 'serialized' ? implode(',',$ids) : serialize($ids);
|
||||
if ($ids != $old_ids)
|
||||
{
|
||||
$change[$old_ids] = $ids;
|
||||
@ -282,29 +233,32 @@ class admin_cmd_change_account_id extends admin_cmd
|
||||
}
|
||||
break;
|
||||
|
||||
case 'absgroup':
|
||||
if (!$update_sql_abs) break; // no groups to change
|
||||
if (!$where) $where = array();
|
||||
$where[$column] = array();
|
||||
foreach(array_keys($ids2change) as $id)
|
||||
{
|
||||
if ($id < 0) $where[$column][] = abs($id);
|
||||
}
|
||||
$db->update($table,$column.'= CASE '.$column.' '.$update_sql_abs,$where,__LINE__,__FILE__);
|
||||
$changed = $db->affected_rows();
|
||||
break;
|
||||
|
||||
case 'abs':
|
||||
if (!$where) $where = array();
|
||||
$where[$column] = array();
|
||||
foreach(array_keys($ids2change) as $id)
|
||||
foreach($ids2change as $from => $to)
|
||||
{
|
||||
$where[$column][] = abs($id);
|
||||
$where[$column][] = abs($from);
|
||||
}
|
||||
$db->update($table,$column.'= CASE '.$column.' '.preg_replace('/-([0-9]+)/','\1',$update_sql),$where,__LINE__,__FILE__);
|
||||
$changed = $db->affected_rows();
|
||||
break;
|
||||
|
||||
case 'prefs': // prefs groups are shifted down by 2 as -1 and -2 are for default and forced prefs
|
||||
if (!$where) $where = array();
|
||||
$where[$column] = array();
|
||||
$update_sql = '';
|
||||
foreach($ids2change as $from => $to)
|
||||
{
|
||||
if ($from < 0) $from -= 2;
|
||||
if ($to < 0) $to -= 2;
|
||||
$where[$column][] = $from;
|
||||
$update_sql .= 'WHEN '.$db->quote($from,$db->column_definitions[$column]['type']).' THEN '.$db->quote($to,$db->column_definitions[$column]['type']).' ';
|
||||
}
|
||||
$db->update($table,$column.'= CASE '.$column.' '.$update_sql.'END',$where,__LINE__,__FILE__);
|
||||
$changed = $db->affected_rows();
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!$where) $where = array();
|
||||
$where[$column] = array_keys($ids2change);
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - Setup
|
||||
* EGroupware - Setup
|
||||
*
|
||||
* Created by eTemplates DB-Tools written by ralfbecker@outdoor-training.de
|
||||
*
|
||||
@ -15,16 +15,16 @@
|
||||
$phpgw_baseline = array(
|
||||
'egw_admin_queue' => array(
|
||||
'fd' => array(
|
||||
'cmd_id' => array('type' => 'auto'),
|
||||
'cmd_id' => array('type' => 'auto','nullable' => False),
|
||||
'cmd_uid' => array('type' => 'varchar','precision' => '255','nullable' => False),
|
||||
'cmd_creator' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'cmd_creator' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False),
|
||||
'cmd_creator_email' => array('type' => 'varchar','precision' => '128','nullable' => False),
|
||||
'cmd_created' => array('type' => 'int','precision' => '8','nullable' => False),
|
||||
'cmd_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False),
|
||||
'cmd_type' => array('type' => 'varchar','precision' => '32','nullable' => False,'default' => 'admin_cmd'),
|
||||
'cmd_status' => array('type' => 'int','precision' => '1'),
|
||||
'cmd_scheduled' => array('type' => 'int','precision' => '8'),
|
||||
'cmd_modified' => array('type' => 'int','precision' => '8'),
|
||||
'cmd_modifier' => array('type' => 'int','precision' => '4'),
|
||||
'cmd_scheduled' => array('type' => 'int','meta' => 'timestamp','precision' => '8'),
|
||||
'cmd_modified' => array('type' => 'int','meta' => 'timestamp','precision' => '8'),
|
||||
'cmd_modifier' => array('type' => 'int','meta' => 'user','precision' => '4'),
|
||||
'cmd_modifier_email' => array('type' => 'varchar','precision' => '128'),
|
||||
'cmd_error' => array('type' => 'varchar','precision' => '255'),
|
||||
'cmd_errno' => array('type' => 'int','precision' => '4'),
|
||||
@ -41,7 +41,7 @@ $phpgw_baseline = array(
|
||||
),
|
||||
'egw_admin_remote' => array(
|
||||
'fd' => array(
|
||||
'remote_id' => array('type' => 'auto'),
|
||||
'remote_id' => array('type' => 'auto','nullable' => False),
|
||||
'remote_name' => array('type' => 'varchar','precision' => '64','nullable' => False),
|
||||
'remote_hash' => array('type' => 'varchar','precision' => '32','nullable' => False),
|
||||
'remote_url' => array('type' => 'varchar','precision' => '128','nullable' => False),
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - Calendar setup
|
||||
* EGroupware - Calendar setup
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @package calendar
|
||||
@ -14,27 +14,27 @@ $phpgw_baseline = array(
|
||||
'fd' => array(
|
||||
'cal_id' => array('type' => 'auto','nullable' => False,'comment' => 'calendar id'),
|
||||
'cal_uid' => array('type' => 'varchar','precision' => '255','nullable' => False,'comment' => 'unique id of event(-series)'),
|
||||
'cal_owner' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'event owner / calendar'),
|
||||
'cal_category' => array('type' => 'varchar','precision' => '64','comment' => 'category id(s)'),
|
||||
'cal_modified' => array('type' => 'int','precision' => '8','comment' => 'ts of last modification'),
|
||||
'cal_owner' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'event owner / calendar'),
|
||||
'cal_category' => array('type' => 'varchar','meta' => 'category','precision' => '64','comment' => 'category id(s)'),
|
||||
'cal_modified' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'ts of last modification'),
|
||||
'cal_priority' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '2','comment' => 'priority: 1=Low, 2=Normal, 3=High'),
|
||||
'cal_public' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '1','comment' => '1=public, 0=private event'),
|
||||
'cal_title' => array('type' => 'varchar','precision' => '255','nullable' => False,'comment' => 'title of event'),
|
||||
'cal_description' => array('type' => 'varchar','precision' => '16384','comment' => 'description'),
|
||||
'cal_location' => array('type' => 'varchar','precision' => '255','comment' => 'location'),
|
||||
'cal_reference' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'cal_id of series for exception'),
|
||||
'cal_modifier' => array('type' => 'int','precision' => '4','comment' => 'user who last modified event'),
|
||||
'cal_modifier' => array('type' => 'int','meta' => 'user','precision' => '4','comment' => 'user who last modified event'),
|
||||
'cal_non_blocking' => array('type' => 'int','precision' => '2','default' => '0','comment' => '1 for non-blocking events'),
|
||||
'cal_special' => array('type' => 'int','precision' => '2','default' => '0'),
|
||||
'cal_etag' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'etag for optimistic locking'),
|
||||
'cal_creator' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'creating user'),
|
||||
'cal_created' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'creation time of event'),
|
||||
'cal_recurrence' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0','comment' => 'cal_start of original recurrence for exception'),
|
||||
'cal_creator' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'creating user'),
|
||||
'cal_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'creation time of event'),
|
||||
'cal_recurrence' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0','comment' => 'cal_start of original recurrence for exception'),
|
||||
'tz_id' => array('type' => 'int','precision' => '4','comment' => 'key into egw_cal_timezones'),
|
||||
'cal_deleted' => array('type' => 'int','precision' => '8','comment' => 'ts when event was deleted'),
|
||||
'caldav_name' => array('type' => 'varchar','precision' => '200','comment' => 'name part of CalDAV URL, if specified by client'),
|
||||
'range_start' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'startdate (of range)'),
|
||||
'range_end' => array('type' => 'int','precision' => '8','comment' => 'enddate (of range, UNTIL of RRULE)')
|
||||
'range_start' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'startdate (of range)'),
|
||||
'range_end' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'enddate (of range, UNTIL of RRULE)')
|
||||
),
|
||||
'pk' => array('cal_id'),
|
||||
'fk' => array(),
|
||||
@ -72,9 +72,9 @@ $phpgw_baseline = array(
|
||||
'egw_cal_user' => array(
|
||||
'fd' => array(
|
||||
'cal_id' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'cal_recur_date' => array('type' => 'int','precision' => '8','default' => '0'),
|
||||
'cal_recur_date' => array('type' => 'int','meta' => 'timestamp','precision' => '8','default' => '0'),
|
||||
'cal_user_type' => array('type' => 'varchar','precision' => '1','nullable' => False,'default' => 'u','comment' => 'u=user, g=group, c=contact, r=resource, e=email'),
|
||||
'cal_user_id' => array('type' => 'varchar','precision' => '128','nullable' => False,'comment' => 'id or email-address for type=e'),
|
||||
'cal_user_id' => array('type' => 'varchar','meta' => array("cal_user_type='u'" => 'account'),'precision' => '128','nullable' => False,'comment' => 'id or email-address for type=e'),
|
||||
'cal_status' => array('type' => 'char','precision' => '1','default' => 'A','comment' => 'U=unknown, A=accepted, R=rejected, T=tentative'),
|
||||
'cal_quantity' => array('type' => 'int','precision' => '4','default' => '1','comment' => 'only for certain types (eg. resources)'),
|
||||
'cal_role' => array('type' => 'varchar','precision' => '64','default' => 'REQ-PARTICIPANT','comment' => 'CHAIR, REQ-PARTICIPANT, OPT-PARTICIPANT, NON-PARTICIPANT, X-CAT-$cat_id'),
|
||||
@ -88,8 +88,8 @@ $phpgw_baseline = array(
|
||||
'egw_cal_extra' => array(
|
||||
'fd' => array(
|
||||
'cal_id' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'cal_extra_name' => array('type' => 'varchar','precision' => '40','nullable' => False),
|
||||
'cal_extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '')
|
||||
'cal_extra_name' => array('type' => 'varchar','meta' => 'cfname','precision' => '40','nullable' => False),
|
||||
'cal_extra_value' => array('type' => 'varchar','meta' => 'cfvalue','precision' => '255','nullable' => False,'default' => '')
|
||||
),
|
||||
'pk' => array('cal_id','cal_extra_name'),
|
||||
'fk' => array(),
|
||||
@ -99,8 +99,8 @@ $phpgw_baseline = array(
|
||||
'egw_cal_dates' => array(
|
||||
'fd' => array(
|
||||
'cal_id' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'cal_start' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'starttime in server time'),
|
||||
'cal_end' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'endtime in server time'),
|
||||
'cal_start' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'starttime in server time'),
|
||||
'cal_end' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'endtime in server time'),
|
||||
'recur_exception' => array('type' => 'bool','nullable' => False,'default' => '','comment' => 'date is an exception')
|
||||
),
|
||||
'pk' => array('cal_id','cal_start'),
|
||||
|
@ -4,7 +4,7 @@
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker@outdoor-training.de>
|
||||
* @copyright 2002-9 by RalfBecker@outdoor-training.de
|
||||
* @copyright 2002-13 by RalfBecker@outdoor-training.de
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @subpackage tools
|
||||
@ -71,6 +71,28 @@ class db_tools
|
||||
'bool' => 'boolean',
|
||||
// 'abstime' => 'abstime (mysql:timestamp)',
|
||||
);
|
||||
/**
|
||||
* Available meta-types
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $meta_types = array(
|
||||
'' => '',
|
||||
'account' => 'user or group',
|
||||
'account-commasep' => 'multiple comma-separated users or groups',
|
||||
'account-abs' => 'user or group (with positiv id)',
|
||||
'user' => 'a single user',
|
||||
'user-commasep' => 'multiple comma-separated users',
|
||||
'user-serialized' => 'multiple serialized users or groups (do NOT use!)',
|
||||
'group' => 'a single group',
|
||||
'group-commasep' => 'multiple comma-separated groups',
|
||||
'group-abs' => 'single group (with positive id)',
|
||||
'timestamp' => 'unix timestamp',
|
||||
'category' => 'category id',
|
||||
'percent' => '0 - 100',
|
||||
'cfname' => 'custom field name',
|
||||
'cfvalue' => 'custom field value',
|
||||
);
|
||||
|
||||
/**
|
||||
* constructor of class
|
||||
@ -223,8 +245,32 @@ class db_tools
|
||||
}
|
||||
$sel_options = array(
|
||||
'table_name' => $table_names,
|
||||
'type' => $this->types
|
||||
'type' => $this->types,
|
||||
);
|
||||
foreach(self::$meta_types as $value => $title)
|
||||
{
|
||||
$sel_options['meta'][$value] = $value ? array(
|
||||
'label' => $value,
|
||||
'title' => $title,
|
||||
) : $title;
|
||||
}
|
||||
foreach($this->data[$this->table]['fd'] as $col => $data)
|
||||
{
|
||||
$meta = $title = $data['meta'];
|
||||
if (empty($meta)) continue;
|
||||
if (is_array($meta))
|
||||
{
|
||||
$this->data[$this->table]['fd'][$col]['meta'] = $meta = serialize($meta);
|
||||
$title = $this->write_array($data['meta'], 0);
|
||||
}
|
||||
if (!isset($sel_options['meta'][$meta]))
|
||||
{
|
||||
$sel_options['meta'][$meta] = array(
|
||||
'label' => lang('Custom'),
|
||||
'title' => $title,
|
||||
);
|
||||
}
|
||||
}
|
||||
if ($this->table != '' && isset($this->data[$this->table]))
|
||||
{
|
||||
$content += $this->table2content($this->data[$this->table],$sel_options['Index'],$add_index);
|
||||
@ -492,6 +538,7 @@ class db_tools
|
||||
{
|
||||
case 'default':
|
||||
case 'type': // selectbox ensures type is not empty
|
||||
case 'meta':
|
||||
case 'precision':
|
||||
case 'scale':
|
||||
case 'comment':
|
||||
@ -625,7 +672,20 @@ class db_tools
|
||||
{
|
||||
if (!is_int($key))
|
||||
{
|
||||
$def .= "'$key' => ";
|
||||
if (strpos($key, "'") !== false && strpos($key, '"') === false)
|
||||
{
|
||||
$def .= '"'.$key.'"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$def .= "'".addslashes($key)."'";
|
||||
}
|
||||
$def .= ' => ';
|
||||
}
|
||||
// unserialize custom meta values
|
||||
if ($key === 'meta' && is_string($val) && (($v = @unserialize($val)) !== false || $val === serialize(false)))
|
||||
{
|
||||
$val = $v;
|
||||
}
|
||||
if (is_array($val))
|
||||
{
|
||||
@ -637,9 +697,13 @@ class db_tools
|
||||
{
|
||||
$def .= $val ? 'True' : 'False';
|
||||
}
|
||||
elseif (strpos($val, "'") !== false && strpos($val, '"') === false)
|
||||
{
|
||||
$def .= '"'.$val.'"';
|
||||
}
|
||||
else
|
||||
{
|
||||
$def .= "'$val'";
|
||||
$def .= "'".addslashes($val)."'";
|
||||
}
|
||||
}
|
||||
if ($n < count($arr)-1)
|
||||
@ -1044,6 +1108,7 @@ function $app"."_upgrade$old_version_()
|
||||
'nullable' => !isset($props['nullable']) || !!$props['nullable'],
|
||||
'default' => (string)$props['default'],
|
||||
'comment' => (string)$props['comment'],
|
||||
'meta' => is_array($props['meta']) ? serialize($props['meta']) : $props['meta'],
|
||||
);
|
||||
}
|
||||
return array(
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,12 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* eTemplates - DB schema
|
||||
* EGroupware - eTemplates DB schema
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @package etemplate
|
||||
* @subpackage setup
|
||||
* @copyright (c) 200s-8 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2002-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
@ -19,10 +19,10 @@ $phpgw_baseline = array(
|
||||
'et_lang' => array('type' => 'varchar','precision' => '5','nullable' => False,'default' => ''),
|
||||
'et_group' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
|
||||
'et_version' => array('type' => 'varchar','precision' => '20','nullable' => False,'default' => ''),
|
||||
'et_data' => array('type' => 'longtext','nullable' => True),
|
||||
'et_size' => array('type' => 'varchar','precision' => '128','nullable' => True),
|
||||
'et_style' => array('type' => 'text','nullable' => True),
|
||||
'et_modified' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0')
|
||||
'et_data' => array('type' => 'longtext'),
|
||||
'et_size' => array('type' => 'varchar','precision' => '128'),
|
||||
'et_style' => array('type' => 'text'),
|
||||
'et_modified' => array('type' => 'int','meta' => 'timestamp','precision' => '4','nullable' => False,'default' => '0')
|
||||
),
|
||||
'pk' => array('et_name','et_template','et_lang','et_group','et_version'),
|
||||
'fk' => array(),
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="etemplate.db-tools.cols" template="" lang="" group="0" version="1.7.001">
|
||||
<template id="etemplate.db-tools.cols" template="" lang="" group="0" version="1.9.001">
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
@ -18,12 +18,14 @@
|
||||
<column/>
|
||||
<column/>
|
||||
<column/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="nmh">
|
||||
<description value="#" no_lang="1" align="center"/>
|
||||
<description align="center" value="#" no_lang="1"/>
|
||||
<description value="ColumnName"/>
|
||||
<description value="Type"/>
|
||||
<description value="Meta-type"/>
|
||||
<description value="Precision"/>
|
||||
<description value="Scale"/>
|
||||
<description value="NOT NULL"/>
|
||||
@ -34,25 +36,28 @@
|
||||
<description value="Comment"/>
|
||||
<description value="Indexoptions"/>
|
||||
<description value="Foreign Key"/>
|
||||
<button label="Add Column" align="center" id="add_column" statustext="Add a new column (after the existing ones)"/>
|
||||
<button align="center" statustext="Add a new column (after the existing ones)" label="Add Column" id="add_column"/>
|
||||
</row>
|
||||
<row class="nmr">
|
||||
<description no_lang="1" align="center" id="Row${row}[n]"/>
|
||||
<textbox size="15" no_lang="1" id="Row${row}[name]" statustext="need to be unique in the table and no reseved word from SQL, best prefix all with a common 2-digit short for the app, eg. 'et_'"/>
|
||||
<description align="center" id="Row${row}[n]" no_lang="1"/>
|
||||
<textbox statustext="need to be unique in the table and no reseved word from SQL, best prefix all with a common 2-digit short for the app, eg. 'et_'" id="Row${row}[name]" no_lang="1" size="15"/>
|
||||
<menulist>
|
||||
<menupopup no_lang="1" id="Row${row}[type]" statustext="type of the column"/>
|
||||
<menupopup statustext="type of the column" id="Row${row}[type]" no_lang="1"/>
|
||||
</menulist>
|
||||
<int align="center" id="Row${row}[precision]" statustext="length for char+varchar, precisions int: 2, 4, 8 and float: 4, 8"/>
|
||||
<int id="Row${row}[scale]" statustext="scale for float"/>
|
||||
<checkbox align="center" id="Row${row}[notnull]" statustext="can not have special SQL-value NULL"/>
|
||||
<checkbox align="center" id="Row${row}[pk]" statustext="Primary key for the table, gets automaticaly indexed"/>
|
||||
<checkbox align="center" id="Row${row}[uc]" statustext="DB ensures that every row has a unique value in that column"/>
|
||||
<checkbox align="center" id="Row${row}[ix]" statustext="an indexed column speeds up querys using that column (cost space on the disk !!!)"/>
|
||||
<textbox size="8" id="Row${row}[default]" statustext="enter '' for an empty default, nothing mean no default"/>
|
||||
<textbox size="20" id="Row${row}[comment]"/>
|
||||
<textbox size="8" id="Row${row}[options]" statustext="DB-specific index options (comma-sep.), eg. mysql(FULLTEXT) or mysql(100) for the indexed length of a col"/>
|
||||
<textbox size="8" align="center" id="Row${row}[fk]" statustext="name of other table where column is a key from"/>
|
||||
<button label="Delete Column" align="center" id="delete[$row]" statustext="Deletes this column"/>
|
||||
<menulist class="selectboxFullWidth">
|
||||
<menupopup statustext="meta-type of the column" id="Row${row}[meta]" no_lang="1" options=",,,,,,,0"/>
|
||||
</menulist>
|
||||
<textbox type="integer" align="center" statustext="length for char+varchar, precisions int: 2, 4, 8 and float: 4, 8" id="Row${row}[precision]"/>
|
||||
<textbox type="integer" statustext="scale for float" id="Row${row}[scale]"/>
|
||||
<checkbox align="center" statustext="can not have special SQL-value NULL" id="Row${row}[notnull]"/>
|
||||
<checkbox align="center" statustext="Primary key for the table, gets automaticaly indexed" id="Row${row}[pk]"/>
|
||||
<checkbox align="center" statustext="DB ensures that every row has a unique value in that column" id="Row${row}[uc]"/>
|
||||
<checkbox align="center" statustext="an indexed column speeds up querys using that column (cost space on the disk !!!)" id="Row${row}[ix]"/>
|
||||
<textbox statustext="enter '' for an empty default, nothing mean no default" id="Row${row}[default]" size="8"/>
|
||||
<textbox id="Row${row}[comment]" size="20"/>
|
||||
<textbox statustext="DB-specific index options (comma-sep.), eg. mysql(FULLTEXT) or mysql(100) for the indexed length of a col" id="Row${row}[options]" size="8"/>
|
||||
<textbox align="center" statustext="name of other table where column is a key from" id="Row${row}[fk]" size="8"/>
|
||||
<button align="center" statustext="Deletes this column" label="Delete Column" id="delete[$row]"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
@ -73,10 +78,10 @@
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="th">
|
||||
<description span="all" value="Multicolumn Indices"/>
|
||||
<description value="Multicolumn Indices" span="all"/>
|
||||
</row>
|
||||
<row class="th">
|
||||
<description value="#" no_lang="1" align="center"/>
|
||||
<description align="center" value="#" no_lang="1"/>
|
||||
<description value="ColumnName"/>
|
||||
<description value="ColumnName"/>
|
||||
<description value="ColumnName"/>
|
||||
@ -85,33 +90,33 @@
|
||||
<description value="ColumnName"/>
|
||||
<description value="ColumnName"/>
|
||||
<description value="Unique"/>
|
||||
<button label="Add Index" align="center" id="add_index" statustext="Add a new multi-column index"/>
|
||||
<button align="center" statustext="Add a new multi-column index" label="Add Index" id="add_index"/>
|
||||
</row>
|
||||
<row class="row">
|
||||
<description no_lang="1" align="center" id="Index[$row][n]"/>
|
||||
<description align="center" id="Index[$row][n]" no_lang="1"/>
|
||||
<menulist>
|
||||
<menupopup options="none" no_lang="1" id="Index[$row][0]" statustext="Select the indexed columns in their desired order"/>
|
||||
<menupopup statustext="Select the indexed columns in their desired order" id="Index[$row][0]" no_lang="1" options="none"/>
|
||||
</menulist>
|
||||
<menulist>
|
||||
<menupopup options="none" no_lang="1" align="center" id="Index[$row][1]" statustext="Select the indexed columns in their desired order"/>
|
||||
<menupopup align="center" statustext="Select the indexed columns in their desired order" id="Index[$row][1]" no_lang="1" options="none"/>
|
||||
</menulist>
|
||||
<menulist>
|
||||
<menupopup options="none" no_lang="1" id="Index[$row][2]" statustext="Select the indexed columns in their desired order"/>
|
||||
<menupopup statustext="Select the indexed columns in their desired order" id="Index[$row][2]" no_lang="1" options="none"/>
|
||||
</menulist>
|
||||
<menulist>
|
||||
<menupopup options="none" no_lang="1" align="center" id="Index[$row][3]" statustext="Select the indexed columns in their desired order"/>
|
||||
<menupopup align="center" statustext="Select the indexed columns in their desired order" id="Index[$row][3]" no_lang="1" options="none"/>
|
||||
</menulist>
|
||||
<menulist>
|
||||
<menupopup options="none" no_lang="1" id="Index[$row][4]" statustext="Select the indexed columns in their desired order"/>
|
||||
<menupopup statustext="Select the indexed columns in their desired order" id="Index[$row][4]" no_lang="1" options="none"/>
|
||||
</menulist>
|
||||
<menulist>
|
||||
<menupopup options="none" no_lang="1" id="Index[$row][5]" statustext="Select the indexed columns in their desired order"/>
|
||||
<menupopup statustext="Select the indexed columns in their desired order" id="Index[$row][5]" no_lang="1" options="none"/>
|
||||
</menulist>
|
||||
<menulist>
|
||||
<menupopup options="none" no_lang="1" id="Index[$row][6]" statustext="Select the indexed columns in their desired order"/>
|
||||
<menupopup statustext="Select the indexed columns in their desired order" id="Index[$row][6]" no_lang="1" options="none"/>
|
||||
</menulist>
|
||||
<checkbox align="center" id="Index[$row][unique]" statustext="DB ensures that every row has a unique value in that column"/>
|
||||
<button label="Delete Index" align="center" id="delete_index[$row]" statustext="Deletes this index"/>
|
||||
<checkbox align="center" statustext="DB ensures that every row has a unique value in that column" id="Index[$row][unique]"/>
|
||||
<button align="center" statustext="Deletes this index" label="Delete Index" id="delete_index[$row]"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
@ -129,7 +134,7 @@
|
||||
</columns>
|
||||
<rows>
|
||||
<row disabled="!@msg">
|
||||
<description span="all" class="redItalic" id="msg"/>
|
||||
<description id="msg" span="all" class="redItalic"/>
|
||||
<description/>
|
||||
<description/>
|
||||
<description/>
|
||||
@ -139,22 +144,22 @@
|
||||
</row>
|
||||
<row>
|
||||
<menulist>
|
||||
<menupopup type="select-app" options="Select one ...,,all" label="Application" no_lang="1" id="app" onchange="1" statustext="Select an application, (*) = uninstalled"/>
|
||||
<menupopup type="select-app" statustext="Select an application, (*) = uninstalled" label="Application" id="app" no_lang="1" onchange="1" options="Select one ...,,all"/>
|
||||
</menulist>
|
||||
<menulist>
|
||||
<menupopup label="TableName" no_lang="1" id="table_name" onchange="1" statustext="Select an table of the application"/>
|
||||
<menupopup statustext="Select an table of the application" label="TableName" id="table_name" no_lang="1" onchange="1"/>
|
||||
</menulist>
|
||||
<textbox size="20" align="right" id="new_table_name" statustext="Name of table to add"/>
|
||||
<button label="Add Table" id="add_table" statustext="Create a new table for the application"/>
|
||||
<button label="Import" id="import" statustext="Import table-definitions from existing db-table"/>
|
||||
<button label="Drop Table" id="drop_table" disabled="true" statustext="Drop a table - this can NOT be undone"/>
|
||||
<button label="Write Tables" id="write_tables" statustext="Write <app>/setup/tables_current.inc.php"/>
|
||||
<textbox align="right" statustext="Name of table to add" id="new_table_name" size="20"/>
|
||||
<button statustext="Create a new table for the application" label="Add Table" id="add_table"/>
|
||||
<button statustext="Import table-definitions from existing db-table" label="Import" id="import"/>
|
||||
<button disabled="true" statustext="Drop a table - this can NOT be undone" label="Drop Table" id="drop_table"/>
|
||||
<button statustext="Write <app>/setup/tables_current.inc.php" label="Write Tables" id="write_tables"/>
|
||||
</row>
|
||||
<row>
|
||||
<template span="all" id="etemplate.db-tools.cols"/>
|
||||
<template id="etemplate.db-tools.cols" span="all"/>
|
||||
</row>
|
||||
<row>
|
||||
<template span="all" id="etemplate.db-tools.indices"/>
|
||||
<template id="etemplate.db-tools.indices" span="all"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
@ -1,17 +1,13 @@
|
||||
<?php
|
||||
/**************************************************************************\
|
||||
* eGroupWare - Setup *
|
||||
* http://www.eGroupWare.org *
|
||||
* Created by eTemplates DB-Tools written by ralfbecker@outdoor-training.de *
|
||||
* -------------------------------------------- *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms of the GNU General Public License as published by the *
|
||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
||||
* option) any later version. *
|
||||
\**************************************************************************/
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
/**
|
||||
* EGroupware - Setup
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @package importexport
|
||||
* @subpackage setup
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
$phpgw_baseline = array(
|
||||
'egw_importexport_definitions' => array(
|
||||
@ -21,16 +17,16 @@ $phpgw_baseline = array(
|
||||
'application' => array('type' => 'varchar','precision' => '50'),
|
||||
'plugin' => array('type' => 'varchar','precision' => '100'),
|
||||
'type' => array('type' => 'varchar','precision' => '20'),
|
||||
'allowed_users' => array('type' => 'varchar','precision' => '255'),
|
||||
'allowed_users' => array('type' => 'varchar','meta' => 'account-commasep','precision' => '255'),
|
||||
'plugin_options' => array('type' => 'longtext'),
|
||||
'owner' => array('type' => 'int','precision' => '20'),
|
||||
'owner' => array('type' => 'int','meta' => 'account','precision' => '4'),
|
||||
'description' => array('type' => 'varchar','precision' => '255'),
|
||||
'modified' => array('type' => 'timestamp'),
|
||||
'filter' => array('type' => 'longtext')
|
||||
),
|
||||
'pk' => array('definition_id'),
|
||||
'fk' => array(),
|
||||
'ix' => array('name'),
|
||||
'ix' => array(),
|
||||
'uc' => array('name')
|
||||
)
|
||||
);
|
||||
|
@ -6,7 +6,7 @@
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @package infolog
|
||||
* @subpackage setup
|
||||
* @copyright (c) 2003-11 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2003-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
@ -20,34 +20,34 @@ $phpgw_baseline = array(
|
||||
'info_addr' => array('type' => 'varchar','precision' => '255','comment' => 'textfield for phone-number or email of the primary contact'),
|
||||
'info_subject' => array('type' => 'varchar','precision' => '255','comment' => 'title of the infolog-entry'),
|
||||
'info_des' => array('type' => 'text','comment' => 'desciption of the infolog-entry'),
|
||||
'info_owner' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'owner of the entry, can be account or group'),
|
||||
'info_responsible' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '0','comment' => 'responsible users or groups (multiple)'),
|
||||
'info_owner' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False,'comment' => 'owner of the entry, can be account or group'),
|
||||
'info_responsible' => array('type' => 'varchar','meta' => 'account-commasep','precision' => '255','nullable' => False,'default' => '0','comment' => 'responsible users or groups (multiple)'),
|
||||
'info_access' => array('type' => 'varchar','precision' => '10','default' => 'public','comment' => 'public or privat'),
|
||||
'info_cat' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'category id'),
|
||||
'info_datemodified' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'timestamp of the last mofification'),
|
||||
'info_startdate' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0','comment' => 'timestamp of the startdate'),
|
||||
'info_enddate' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0','comment' => 'timestamp of the enddate'),
|
||||
'info_cat' => array('type' => 'int','meta' => 'category','precision' => '4','nullable' => False,'default' => '0','comment' => 'category id'),
|
||||
'info_datemodified' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'timestamp of the last mofification'),
|
||||
'info_startdate' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0','comment' => 'timestamp of the startdate'),
|
||||
'info_enddate' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'default' => '0','comment' => 'timestamp of the enddate'),
|
||||
'info_id_parent' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'id of the parent infolog'),
|
||||
'info_planned_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'pm-field: planned time'),
|
||||
'info_replanned_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'pm-field: replanned time'),
|
||||
'info_used_time' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'pm-field: used time'),
|
||||
'info_status' => array('type' => 'varchar','precision' => '40','default' => 'done','comment' => 'status e.g. ongoing, done ...'),
|
||||
'info_confirm' => array('type' => 'varchar','precision' => '10','default' => 'not'),
|
||||
'info_modifier' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'account id of the last modifier'),
|
||||
'info_modifier' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'default' => '0','comment' => 'account id of the last modifier'),
|
||||
'info_link_id' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'id of the primary link'),
|
||||
'info_priority' => array('type' => 'int','precision' => '2','default' => '1','comment' => '0=Low, 1=Normal, 2=High, 3=Urgent'),
|
||||
'pl_id' => array('type' => 'int','precision' => '4','comment' => 'pm-field: id of the pricelist'),
|
||||
'info_price' => array('type' => 'float','precision' => '8','comment' => 'pm-field: price-field'),
|
||||
'info_percent' => array('type' => 'int','precision' => '2','default' => '0','comment' => 'percentage of completion'),
|
||||
'info_datecompleted' => array('type' => 'int','precision' => '8','comment' => 'timestamp of completion'),
|
||||
'info_percent' => array('type' => 'int','meta' => 'percent','precision' => '2','default' => '0','comment' => 'percentage of completion'),
|
||||
'info_datecompleted' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'timestamp of completion'),
|
||||
'info_location' => array('type' => 'varchar','precision' => '255','comment' => 'textfield location'),
|
||||
'info_custom_from' => array('type' => 'int','precision' => '1','comment' => 'tick-box to show infolog_from'),
|
||||
'info_uid' => array('type' => 'varchar','precision' => '255','comment' => 'unique id of the infolog-entry'),
|
||||
'info_cc' => array('type' => 'varchar','precision' => '255','comment' => 'textfield for email-adress to be notified via email of changes'),
|
||||
'caldav_name' => array('type' => 'varchar','precision' => '200','comment' => 'name part of CalDAV URL, if specified by client'),
|
||||
'info_etag' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'etag, not yet used'),
|
||||
'info_created' => array('type' => 'int','precision' => '8','comment' => 'timestamp of the creation date'),
|
||||
'info_creator' => array('type' => 'int','precision' => '4','comment' => 'account id of the creator')
|
||||
'info_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'timestamp of the creation date'),
|
||||
'info_creator' => array('type' => 'int','meta' => 'user','precision' => '4','comment' => 'account id of the creator')
|
||||
),
|
||||
'pk' => array('info_id'),
|
||||
'fk' => array(),
|
||||
@ -57,8 +57,8 @@ $phpgw_baseline = array(
|
||||
'egw_infolog_extra' => array(
|
||||
'fd' => array(
|
||||
'info_id' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'info_extra_name' => array('type' => 'varchar','precision' => '64','nullable' => False),
|
||||
'info_extra_value' => array('type' => 'text','nullable' => False)
|
||||
'info_extra_name' => array('type' => 'varchar','meta' => 'cfname','precision' => '64','nullable' => False),
|
||||
'info_extra_value' => array('type' => 'text','meta' => 'cfvalue','nullable' => False)
|
||||
),
|
||||
'pk' => array('info_id','info_extra_name'),
|
||||
'fk' => array(),
|
||||
|
@ -13,9 +13,9 @@ $phpgw_baseline = array(
|
||||
'egw_notificationpopup' => array(
|
||||
'fd' => array(
|
||||
'notify_id' => array('type' => 'auto','nullable' => False,'comment' => 'primary key'),
|
||||
'account_id' => array('type' => 'int','precision' => '20','nullable' => False,'comment' => 'user to notify'),
|
||||
'account_id' => array('type' => 'int','meta' => 'user','precision' => '20','nullable' => False,'comment' => 'user to notify'),
|
||||
'notify_message' => array('type' => 'text','comment' => 'notification message'),
|
||||
'notify_created' => array('type' => 'timestamp','default' => 'current_timestamp','comment' => 'creation time of notification'),
|
||||
'notify_created' => array('type' => 'timestamp','meta' => 'timestamp','default' => 'current_timestamp','comment' => 'creation time of notification'),
|
||||
'notify_type' => array('type' => 'varchar','precision' => '32','comment' => 'notification type')
|
||||
),
|
||||
'pk' => array('notify_id'),
|
||||
|
@ -297,6 +297,63 @@ class config
|
||||
return (boolean) array_intersect($private,$user_and_memberships);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Change account_id's of private custom-fields
|
||||
*
|
||||
* @param string $app
|
||||
* @param array $ids2change from-id => to-id pairs
|
||||
* @return int number of changed ids
|
||||
*/
|
||||
static function change_account_ids($app, array $ids2change)
|
||||
{
|
||||
$changed = 0;
|
||||
if (($cfs = self::get_customfields($app, true)))
|
||||
{
|
||||
foreach($cfs as $name => &$data)
|
||||
{
|
||||
if ($data['private'])
|
||||
{
|
||||
foreach($data['private'] as &$id)
|
||||
{
|
||||
if (isset($ids2change[$id]))
|
||||
{
|
||||
$id = $ids2change[$id];
|
||||
++$changed;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($changed)
|
||||
{
|
||||
self::save_value('customfields', $cfs, $app);
|
||||
}
|
||||
}
|
||||
return $changed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return names of custom fields containing account-ids
|
||||
*
|
||||
* @param string $app
|
||||
* @return array account[-commasep] => array of name(s) pairs
|
||||
*/
|
||||
static function get_account_cfs($app)
|
||||
{
|
||||
$types = array();
|
||||
if (($cfs = self::get_customfields($app, true)))
|
||||
{
|
||||
foreach($cfs as $name => $data)
|
||||
{
|
||||
if ($data['type'] == 'select-account' || $data['type'] == 'home-accounts')
|
||||
{
|
||||
$types['account'.($data['rows'] > 1 ? '-commasep' : '')][] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $types;
|
||||
}
|
||||
|
||||
/**
|
||||
* get_content_types of using application
|
||||
*
|
||||
|
@ -7,7 +7,7 @@
|
||||
* @package api
|
||||
* @subpackage db
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2003-12 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2003-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
@ -113,6 +113,13 @@ class egw_db
|
||||
*/
|
||||
var $Halt_On_Error = 'yes';
|
||||
|
||||
/**
|
||||
* Log update querys to error_log, do not run them
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
var $log_updates = false;
|
||||
|
||||
/**
|
||||
* @var array $Record current record
|
||||
*/
|
||||
@ -642,6 +649,11 @@ class egw_db
|
||||
{
|
||||
$num_rows = $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
|
||||
}
|
||||
if ($this->log_updates && stripos($Query_String, 'SELECT') !== 0)
|
||||
{
|
||||
error_log($Query_String);
|
||||
return 0;
|
||||
}
|
||||
if ($num_rows > 0)
|
||||
{
|
||||
$this->Query_ID = $this->Link_ID->SelectLimit($Query_String,$num_rows,(int)$offset,$inputarr);
|
||||
@ -866,6 +878,8 @@ class egw_db
|
||||
*/
|
||||
function affected_rows()
|
||||
{
|
||||
if ($this->log_updates) return 0;
|
||||
|
||||
if (!$this->Link_ID && !$this->connect())
|
||||
{
|
||||
return False;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - API Setup
|
||||
* EGroupware - API Setup
|
||||
*
|
||||
* Current DB schema
|
||||
*
|
||||
@ -43,8 +43,8 @@ $phpgw_baseline = array(
|
||||
'egw_acl' => array(
|
||||
'fd' => array(
|
||||
'acl_appname' => array('type' => 'varchar','precision' => '50','nullable' => False),
|
||||
'acl_location' => array('type' => 'varchar','precision' => '255','nullable' => False),
|
||||
'acl_account' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'acl_location' => array('type' => 'varchar','meta' => 'account','precision' => '255','nullable' => False),
|
||||
'acl_account' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False),
|
||||
'acl_rights' => array('type' => 'int','precision' => '4')
|
||||
),
|
||||
'pk' => array('acl_appname','acl_location','acl_account'),
|
||||
@ -54,7 +54,7 @@ $phpgw_baseline = array(
|
||||
),
|
||||
'egw_accounts' => array(
|
||||
'fd' => array(
|
||||
'account_id' => array('type' => 'auto','nullable' => False),
|
||||
'account_id' => array('type' => 'auto','meta' => 'account-abs','nullable' => False),
|
||||
'account_lid' => array('type' => 'varchar','precision' => '64','nullable' => False),
|
||||
'account_pwd' => array('type' => 'varchar','precision' => '128','nullable' => False),
|
||||
'account_lastlogin' => array('type' => 'int','precision' => '4'),
|
||||
@ -63,7 +63,7 @@ $phpgw_baseline = array(
|
||||
'account_status' => array('type' => 'char','precision' => '1','nullable' => False,'default' => 'A'),
|
||||
'account_expires' => array('type' => 'int','precision' => '4'),
|
||||
'account_type' => array('type' => 'char','precision' => '1'),
|
||||
'account_primary_group' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0')
|
||||
'account_primary_group' => array('type' => 'int','meta' => 'group','precision' => '4','nullable' => False,'default' => '0')
|
||||
),
|
||||
'pk' => array('account_id'),
|
||||
'fk' => array(),
|
||||
@ -72,7 +72,7 @@ $phpgw_baseline = array(
|
||||
),
|
||||
'egw_preferences' => array(
|
||||
'fd' => array(
|
||||
'preference_owner' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'preference_owner' => array('type' => 'int','meta' => 'account-prefs','precision' => '4','nullable' => False),
|
||||
'preference_app' => array('type' => 'varchar','precision' => '25','nullable' => False),
|
||||
'preference_value' => array('type' => 'text','nullable' => False)
|
||||
),
|
||||
@ -86,13 +86,13 @@ $phpgw_baseline = array(
|
||||
'sessionid' => array('type' => 'auto','nullable' => False,'comment' => 'primary key'),
|
||||
'loginid' => array('type' => 'varchar','precision' => '64','nullable' => False,'comment' => 'username used to login'),
|
||||
'ip' => array('type' => 'varchar','precision' => '40','nullable' => False,'comment' => 'ip of user'),
|
||||
'li' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'TS if login'),
|
||||
'lo' => array('type' => 'int','precision' => '8','comment' => 'TD of logout'),
|
||||
'account_id' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0','comment' => 'numerical account id'),
|
||||
'session_dla' => array('type' => 'int','precision' => '8','comment' => 'TS of last user action'),
|
||||
'li' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'TS if login'),
|
||||
'lo' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'TD of logout'),
|
||||
'account_id' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'default' => '0','comment' => 'numerical account id'),
|
||||
'session_dla' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'TS of last user action'),
|
||||
'session_action' => array('type' => 'varchar','precision' => '64','comment' => 'menuaction or path of last user action'),
|
||||
'session_php' => array('type' => 'varchar','precision' => '64','nullable' => False,'comment' => 'php session-id or error-message'),
|
||||
'notification_heartbeat' => array('type' => 'int','precision' => '8','comment' => 'TS of last notification request')
|
||||
'notification_heartbeat' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'TS of last notification request'),
|
||||
),
|
||||
'pk' => array('sessionid'),
|
||||
'fk' => array(),
|
||||
@ -145,17 +145,17 @@ $phpgw_baseline = array(
|
||||
),
|
||||
'egw_categories' => array(
|
||||
'fd' => array(
|
||||
'cat_id' => array('type' => 'auto','precision' => '4','nullable' => False),
|
||||
'cat_main' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
|
||||
'cat_parent' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
|
||||
'cat_id' => array('type' => 'auto','meta' => 'category','precision' => '4','nullable' => False),
|
||||
'cat_main' => array('type' => 'int','meta' => 'category','precision' => '4','nullable' => False,'default' => '0'),
|
||||
'cat_parent' => array('type' => 'int','meta' => 'category','precision' => '4','nullable' => False,'default' => '0'),
|
||||
'cat_level' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '0'),
|
||||
'cat_owner' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '0'),
|
||||
'cat_owner' => array('type' => 'varchar','meta' => 'account-commasep','precision' => '255','nullable' => False,'default' => '0'),
|
||||
'cat_access' => array('type' => 'varchar','precision' => '7'),
|
||||
'cat_appname' => array('type' => 'varchar','precision' => '50','nullable' => False),
|
||||
'cat_name' => array('type' => 'varchar','precision' => '150','nullable' => False),
|
||||
'cat_description' => array('type' => 'varchar','precision' => '255','nullable' => False),
|
||||
'cat_data' => array('type' => 'text'),
|
||||
'last_mod' => array('type' => 'int','precision' => '8','nullable' => False)
|
||||
'last_mod' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False)
|
||||
),
|
||||
'pk' => array('cat_id'),
|
||||
'fk' => array(),
|
||||
@ -166,7 +166,7 @@ $phpgw_baseline = array(
|
||||
'fd' => array(
|
||||
'log_id' => array('type' => 'auto','precision' => '4','nullable' => False),
|
||||
'log_date' => array('type' => 'timestamp','nullable' => False),
|
||||
'log_user' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'log_user' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False),
|
||||
'log_app' => array('type' => 'varchar','precision' => '50','nullable' => False),
|
||||
'log_severity' => array('type' => 'char','precision' => '1','nullable' => False)
|
||||
),
|
||||
@ -219,7 +219,7 @@ $phpgw_baseline = array(
|
||||
'history_id' => array('type' => 'auto','precision' => '4','nullable' => False),
|
||||
'history_record_id' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'history_appname' => array('type' => 'varchar','precision' => '64','nullable' => False),
|
||||
'history_owner' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'history_owner' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False),
|
||||
'history_status' => array('type' => 'varchar','precision' => '64','nullable' => False),
|
||||
'history_new_value' => array('type' => 'text','nullable' => False),
|
||||
'history_timestamp' => array('type' => 'timestamp','nullable' => False,'default' => 'current_timestamp'),
|
||||
@ -233,11 +233,11 @@ $phpgw_baseline = array(
|
||||
'egw_async' => array(
|
||||
'fd' => array(
|
||||
'async_id' => array('type' => 'varchar','precision' => '255','nullable' => False),
|
||||
'async_next' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'async_times' => array('type' => 'varchar','precision' => '255','nullable' => False),
|
||||
'async_method' => array('type' => 'varchar','precision' => '80','nullable' => False),
|
||||
'async_data' => array('type' => 'text','nullable' => False),
|
||||
'async_account_id' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0')
|
||||
'async_next' => array('type' => 'int','meta' => 'timestamp','precision' => '4','nullable' => False,'comment' => 'timestamp of next run'),
|
||||
'async_times' => array('type' => 'varchar','precision' => '255','nullable' => False,'comment' => 'serialized array with values for keys hour,min,day,month,year'),
|
||||
'async_method' => array('type' => 'varchar','precision' => '80','nullable' => False,'comment' => 'app.class.method class::method to execute'),
|
||||
'async_data' => array('type' => 'text','nullable' => False,'comment' => 'serialized array with data to pass to method'),
|
||||
'async_account_id' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'default' => '0','comment' => 'creator of job')
|
||||
),
|
||||
'pk' => array('async_id'),
|
||||
'fk' => array(),
|
||||
@ -252,7 +252,7 @@ $phpgw_baseline = array(
|
||||
'sync_modified' => array('type' => 'timestamp'),
|
||||
'sync_deleted' => array('type' => 'timestamp'),
|
||||
'sync_id' => array('type' => 'auto','nullable' => False),
|
||||
'sync_changedby' => array('type' => 'int','precision' => '4','nullable' => False)
|
||||
'sync_changedby' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False)
|
||||
),
|
||||
'pk' => array('sync_id'),
|
||||
'fk' => array(),
|
||||
@ -267,8 +267,8 @@ $phpgw_baseline = array(
|
||||
'link_app2' => array('type' => 'varchar','precision' => '25','nullable' => False),
|
||||
'link_id2' => array('type' => 'varchar','precision' => '50','nullable' => False),
|
||||
'link_remark' => array('type' => 'varchar','precision' => '100'),
|
||||
'link_lastmod' => array('type' => 'int','precision' => '8','nullable' => False),
|
||||
'link_owner' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'link_lastmod' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False),
|
||||
'link_owner' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False),
|
||||
'deleted' => array('type' => 'timestamp')
|
||||
),
|
||||
'pk' => array('link_id'),
|
||||
@ -280,9 +280,9 @@ $phpgw_baseline = array(
|
||||
'fd' => array(
|
||||
'contact_id' => array('type' => 'auto','nullable' => False),
|
||||
'contact_tid' => array('type' => 'char','precision' => '1','default' => 'n'),
|
||||
'contact_owner' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'account or group id of the adressbook'),
|
||||
'contact_owner' => array('type' => 'int','meta' => 'account','precision' => '8','nullable' => False,'comment' => 'account or group id of the adressbook'),
|
||||
'contact_private' => array('type' => 'int','precision' => '1','default' => '0','comment' => 'privat or personal'),
|
||||
'cat_id' => array('type' => 'varchar','precision' => '255','comment' => 'Category(s)'),
|
||||
'cat_id' => array('type' => 'varchar','meta' => 'category','precision' => '255','comment' => 'Category(s)'),
|
||||
'n_family' => array('type' => 'varchar','precision' => '64','comment' => 'Family name'),
|
||||
'n_given' => array('type' => 'varchar','precision' => '64','comment' => 'Given Name'),
|
||||
'n_middle' => array('type' => 'varchar','precision' => '64'),
|
||||
@ -331,12 +331,12 @@ $phpgw_baseline = array(
|
||||
'contact_tz' => array('type' => 'varchar','precision' => '8','comment' => 'timezone difference'),
|
||||
'contact_geo' => array('type' => 'varchar','precision' => '32','comment' => 'currently not used'),
|
||||
'contact_pubkey' => array('type' => 'text','comment' => 'public key'),
|
||||
'contact_created' => array('type' => 'int','precision' => '8','comment' => 'timestamp of the creation'),
|
||||
'contact_creator' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'account id of the creator'),
|
||||
'contact_modified' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'timestamp of the last modified'),
|
||||
'contact_modifier' => array('type' => 'int','precision' => '4','comment' => 'account id of the last modified'),
|
||||
'contact_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8','comment' => 'timestamp of the creation'),
|
||||
'contact_creator' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'account id of the creator'),
|
||||
'contact_modified' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'timestamp of the last modified'),
|
||||
'contact_modifier' => array('type' => 'int','meta' => 'user','precision' => '4','comment' => 'account id of the last modified'),
|
||||
'contact_jpegphoto' => array('type' => 'blob','comment' => 'photo of the contact (attachment)'),
|
||||
'account_id' => array('type' => 'int','precision' => '4','comment' => 'account id'),
|
||||
'account_id' => array('type' => 'int','meta' => 'user','precision' => '4','comment' => 'account id'),
|
||||
'contact_etag' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'etag of the changes'),
|
||||
'contact_uid' => array('type' => 'varchar','precision' => '255','comment' => 'unique id of the contact'),
|
||||
'adr_one_countrycode' => array('type' => 'varchar','precision' => '2','comment' => 'countrycode (business)'),
|
||||
@ -351,22 +351,22 @@ $phpgw_baseline = array(
|
||||
'egw_addressbook_extra' => array(
|
||||
'fd' => array(
|
||||
'contact_id' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'contact_owner' => array('type' => 'int','precision' => '8'),
|
||||
'contact_name' => array('type' => 'varchar','precision' => '255','nullable' => False),
|
||||
'contact_value' => array('type' => 'text')
|
||||
'contact_owner' => array('type' => 'int','meta' => 'account','precision' => '8'),
|
||||
'contact_name' => array('type' => 'varchar','meta' => 'cfname','precision' => '255','nullable' => False),
|
||||
'contact_value' => array('type' => 'text','meta' => 'cfvalue')
|
||||
),
|
||||
'pk' => array('contact_id','contact_name'),
|
||||
'fk' => array(),
|
||||
'ix' => array(array('contact_name','contact_value(32)')),
|
||||
'ix' => array('contact_name'),
|
||||
'uc' => array()
|
||||
),
|
||||
'egw_addressbook_lists' => array(
|
||||
'fd' => array(
|
||||
'list_id' => array('type' => 'auto','nullable' => False),
|
||||
'list_name' => array('type' => 'varchar','precision' => '80','nullable' => False),
|
||||
'list_owner' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'list_created' => array('type' => 'int','precision' => '8'),
|
||||
'list_creator' => array('type' => 'int','precision' => '4')
|
||||
'list_owner' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False),
|
||||
'list_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8'),
|
||||
'list_creator' => array('type' => 'int','meta' => 'user','precision' => '4'),
|
||||
),
|
||||
'pk' => array('list_id'),
|
||||
'fk' => array(),
|
||||
@ -377,8 +377,8 @@ $phpgw_baseline = array(
|
||||
'fd' => array(
|
||||
'contact_id' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'list_id' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'list_added' => array('type' => 'int','precision' => '8'),
|
||||
'list_added_by' => array('type' => 'int','precision' => '4')
|
||||
'list_added' => array('type' => 'int','meta' => 'timestamp','precision' => '8'),
|
||||
'list_added_by' => array('type' => 'int','meta' => 'user','precision' => '4')
|
||||
),
|
||||
'pk' => array('contact_id','list_id'),
|
||||
'fk' => array(),
|
||||
@ -391,14 +391,14 @@ $phpgw_baseline = array(
|
||||
'fs_dir' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'fs_name' => array('type' => 'varchar','precision' => '200','nullable' => False),
|
||||
'fs_mode' => array('type' => 'int','precision' => '2','nullable' => False),
|
||||
'fs_uid' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
|
||||
'fs_gid' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
|
||||
'fs_uid' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'default' => '0'),
|
||||
'fs_gid' => array('type' => 'int','meta' => 'group-abs','precision' => '4','nullable' => False,'default' => '0'),
|
||||
'fs_created' => array('type' => 'timestamp','precision' => '8','nullable' => False),
|
||||
'fs_modified' => array('type' => 'timestamp','precision' => '8','nullable' => False),
|
||||
'fs_mime' => array('type' => 'varchar','precision' => '96','nullable' => False),
|
||||
'fs_size' => array('type' => 'int','precision' => '8','nullable' => False),
|
||||
'fs_creator' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'fs_modifier' => array('type' => 'int','precision' => '4'),
|
||||
'fs_creator' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False),
|
||||
'fs_modifier' => array('type' => 'int','meta' => 'user','precision' => '4'),
|
||||
'fs_active' => array('type' => 'bool','nullable' => False,'default' => 't'),
|
||||
'fs_content' => array('type' => 'blob'),
|
||||
'fs_link' => array('type' => 'varchar','precision' => '255')
|
||||
@ -424,7 +424,7 @@ $phpgw_baseline = array(
|
||||
'si_app' => array('type' => 'varchar','precision' => '25','nullable' => False),
|
||||
'si_app_id' => array('type' => 'varchar','precision' => '50','nullable' => False),
|
||||
'si_id' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'si_owner' => array('type' => 'int','precision' => '4','nullable' => False)
|
||||
'si_owner' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False)
|
||||
),
|
||||
'pk' => array('si_app','si_app_id','si_id'),
|
||||
'fk' => array(),
|
||||
@ -435,8 +435,8 @@ $phpgw_baseline = array(
|
||||
'fd' => array(
|
||||
'ce_app' => array('type' => 'varchar','precision' => '25','nullable' => False),
|
||||
'ce_app_id' => array('type' => 'varchar','precision' => '50','nullable' => False),
|
||||
'cat_id' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'ce_owner' => array('type' => 'int','precision' => '4','nullable' => False)
|
||||
'cat_id' => array('type' => 'int','meta' => 'category','precision' => '4','nullable' => False),
|
||||
'ce_owner' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False)
|
||||
),
|
||||
'pk' => array('ce_app','ce_app_id','cat_id'),
|
||||
'fk' => array(),
|
||||
@ -447,13 +447,13 @@ $phpgw_baseline = array(
|
||||
'fd' => array(
|
||||
'lock_token' => array('type' => 'varchar','precision' => '255','nullable' => False),
|
||||
'lock_path' => array('type' => 'varchar','precision' => '255','nullable' => False),
|
||||
'lock_expires' => array('type' => 'int','precision' => '8','nullable' => False),
|
||||
'lock_expires' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False),
|
||||
'lock_owner' => array('type' => 'varchar','precision' => '255'),
|
||||
'lock_recursive' => array('type' => 'bool','nullable' => False,'default' => '0'),
|
||||
'lock_write' => array('type' => 'bool','nullable' => False,'default' => '0'),
|
||||
'lock_exclusive' => array('type' => 'bool','nullable' => False,'default' => '0'),
|
||||
'lock_created' => array('type' => 'int','precision' => '8','default' => '0'),
|
||||
'lock_modified' => array('type' => 'int','precision' => '8','default' => '0')
|
||||
'lock_created' => array('type' => 'int','meta' => 'timestamp','precision' => '8','default' => '0'),
|
||||
'lock_modified' => array('type' => 'int','meta' => 'timestamp','precision' => '8','default' => '0')
|
||||
),
|
||||
'pk' => array('lock_token'),
|
||||
'fk' => array(),
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* eGroupWare - resources
|
||||
* EGroupware - resources
|
||||
* http://www.egroupware.org
|
||||
* Created by eTemplates DB-Tools written by ralfbecker@outdoor-training.de
|
||||
*
|
||||
@ -17,7 +17,7 @@ $phpgw_baseline = array(
|
||||
'res_id' => array('type' => 'auto','nullable' => False),
|
||||
'name' => array('type' => 'varchar','precision' => '100'),
|
||||
'short_description' => array('type' => 'varchar','precision' => '100'),
|
||||
'cat_id' => array('type' => 'int','precision' => '11','nullable' => False),
|
||||
'cat_id' => array('type' => 'int','meta' => 'category','precision' => '11','nullable' => False),
|
||||
'quantity' => array('type' => 'int','precision' => '11','default' => '1'),
|
||||
'useable' => array('type' => 'int','precision' => '11','default' => '1'),
|
||||
'location' => array('type' => 'varchar','precision' => '100'),
|
||||
@ -29,7 +29,7 @@ $phpgw_baseline = array(
|
||||
'accessory_of' => array('type' => 'int','precision' => '11','default' => '-1'),
|
||||
'storage_info' => array('type' => 'varchar','precision' => '200'),
|
||||
'inventory_number' => array('type' => 'varchar','precision' => '20'),
|
||||
'deleted' => array('type' => 'int','precision' => '8')
|
||||
'deleted' => array('type' => 'int','meta' => 'timestamp','precision' => '8')
|
||||
),
|
||||
'pk' => array('res_id'),
|
||||
'fk' => array(),
|
||||
@ -39,9 +39,9 @@ $phpgw_baseline = array(
|
||||
'egw_resources_extra' => array(
|
||||
'fd' => array(
|
||||
'extra_id' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'extra_name' => array('type' => 'varchar','precision' => '40','nullable' => False),
|
||||
'extra_owner' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '-1'),
|
||||
'extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '')
|
||||
'extra_name' => array('type' => 'varchar','meta' => 'cfname','precision' => '40','nullable' => False),
|
||||
'extra_owner' => array('type' => 'int','meta' => 'account','precision' => '4','nullable' => False,'default' => '-1'),
|
||||
'extra_value' => array('type' => 'varchar','meta' => 'cfvalue','precision' => '255','nullable' => False,'default' => '')
|
||||
),
|
||||
'pk' => array('extra_id','extra_name','extra_owner'),
|
||||
'fk' => array(),
|
||||
|
@ -6,7 +6,7 @@
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @package timesheet
|
||||
* @subpackage setup
|
||||
* @copyright (c) 2005-9 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2005-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
@ -18,14 +18,14 @@ $phpgw_baseline = array(
|
||||
'ts_project' => array('type' => 'varchar','precision' => '80','comment' => 'project title'),
|
||||
'ts_title' => array('type' => 'varchar','precision' => '80','nullable' => False,'comment' => 'title of the timesheet entry'),
|
||||
'ts_description' => array('type' => 'text','comment' => 'description of the timesheet entry'),
|
||||
'ts_start' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'timestamp of the startdate'),
|
||||
'ts_start' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'timestamp of the startdate'),
|
||||
'ts_duration' => array('type' => 'int','precision' => '8','nullable' => False,'default' => '0','comment' => 'duration of the timesheet-entry'),
|
||||
'ts_quantity' => array('type' => 'float','precision' => '8','nullable' => False,'comment' => 'quantity'),
|
||||
'ts_unitprice' => array('type' => 'float','precision' => '4','comment' => 'unitprice'),
|
||||
'cat_id' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'category'),
|
||||
'ts_owner' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'owner of the timesheet'),
|
||||
'ts_modified' => array('type' => 'int','precision' => '8','nullable' => False,'comment' => 'date modified ot the timesheet'),
|
||||
'ts_modifier' => array('type' => 'int','precision' => '4','nullable' => False,'comment' => 'account id of the last modifier'),
|
||||
'cat_id' => array('type' => 'int','meta' => 'category','precision' => '4','default' => '0','comment' => 'category'),
|
||||
'ts_owner' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'owner of the timesheet'),
|
||||
'ts_modified' => array('type' => 'int','meta' => 'timestamp','precision' => '8','nullable' => False,'comment' => 'date modified ot the timesheet'),
|
||||
'ts_modifier' => array('type' => 'int','meta' => 'user','precision' => '4','nullable' => False,'comment' => 'account id of the last modifier'),
|
||||
'pl_id' => array('type' => 'int','precision' => '4','default' => '0','comment' => 'id of the linked project'),
|
||||
'ts_status' => array('type' => 'int','precision' => '4','comment' => 'status of the timeshhet-emtry')
|
||||
),
|
||||
@ -37,8 +37,8 @@ $phpgw_baseline = array(
|
||||
'egw_timesheet_extra' => array(
|
||||
'fd' => array(
|
||||
'ts_id' => array('type' => 'int','precision' => '4','nullable' => False),
|
||||
'ts_extra_name' => array('type' => 'varchar','precision' => '32','nullable' => False),
|
||||
'ts_extra_value' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '')
|
||||
'ts_extra_name' => array('type' => 'varchar','meta' => 'cfname','precision' => '32','nullable' => False),
|
||||
'ts_extra_value' => array('type' => 'varchar','meta' => 'cfvalue','precision' => '255','nullable' => False,'default' => '')
|
||||
),
|
||||
'pk' => array('ts_id','ts_extra_name'),
|
||||
'fk' => array(),
|
||||
|
Loading…
Reference in New Issue
Block a user