| 1 |
<?php
|
| 2 |
// $Id: versioncontrol_cvs.install,v 1.30 2009/01/07 00:24:22 jpetso Exp $
|
| 3 |
/**
|
| 4 |
* @file
|
| 5 |
* CVS backend for Version Control API - Provides CVS commit information and
|
| 6 |
* account management as a pluggable backend.
|
| 7 |
*
|
| 8 |
* Copyright 2006 by Karthik ("Zen", http://drupal.org/user/21209)
|
| 9 |
* Copyright 2006, 2007 by Derek Wright ("dww", http://drupal.org/user/46549)
|
| 10 |
* Copyright 2007, 2008, 2009 by Jakob Petsovits ("jpetso", http://drupal.org/user/56020)
|
| 11 |
*/
|
| 12 |
|
| 13 |
/**
|
| 14 |
* Implementation of hook_schema().
|
| 15 |
*/
|
| 16 |
function versioncontrol_cvs_schema() {
|
| 17 |
$schema['versioncontrol_cvs_accounts'] = array(
|
| 18 |
'description' => 'This table extends {versioncontrol_accounts} with a CVS password so that the CVS backend is able to export VCS accounts into a passwd file.',
|
| 19 |
'fields' => array(
|
| 20 |
'uid' => array(
|
| 21 |
'description' => 'Foreign key referring to {versioncontrol_accounts}.uid.',
|
| 22 |
'type' => 'int',
|
| 23 |
'unsigned' => TRUE,
|
| 24 |
'not null' => TRUE,
|
| 25 |
'default' => 0,
|
| 26 |
),
|
| 27 |
'repo_id' => array(
|
| 28 |
'description' => 'Foreign key referring to {versioncontrol_accounts}.repo_id.',
|
| 29 |
'type' => 'int',
|
| 30 |
'unsigned' => TRUE,
|
| 31 |
'not null' => TRUE,
|
| 32 |
'default' => 0,
|
| 33 |
),
|
| 34 |
'password' => array(
|
| 35 |
'description' =>
|
| 36 |
'The CVS password, encrypted with crypt() which is just the way the passwd file requires it. This way, it\'s safe to store the password in the database as it cannot be recovered from this string.',
|
| 37 |
'type' => 'varchar',
|
| 38 |
'length' => 64,
|
| 39 |
'not null' => TRUE,
|
| 40 |
'default' => '',
|
| 41 |
),
|
| 42 |
),
|
| 43 |
'primary key' => array('uid', 'repo_id'),
|
| 44 |
);
|
| 45 |
|
| 46 |
$schema['versioncontrol_cvs_repositories'] = array(
|
| 47 |
'description' => 'This table extends {versioncontrol_repositories} with additional properties specific to CVS repositories.',
|
| 48 |
'fields' => array(
|
| 49 |
'repo_id' => array(
|
| 50 |
'description' => 'The repository identifier referring to {versioncontrol_repositories}.repo_id.',
|
| 51 |
'type' => 'int',
|
| 52 |
'unsigned' => TRUE,
|
| 53 |
'not null' => TRUE,
|
| 54 |
'default' => 0,
|
| 55 |
),
|
| 56 |
'modules' => array(
|
| 57 |
'description' =>
|
| 58 |
'A serialized array of path strings (relative to the root directory, without a leading slash) that will be parsed and recorded by the log parser. Normally this will be used to specify modules, but adding more complex paths like "contributions/modules/versioncontrol_cvs" should work just as well. If the whole repository is to be scanned, this column contains an empty serialized array.',
|
| 59 |
'type' => 'varchar',
|
| 60 |
'length' => 255,
|
| 61 |
'not null' => TRUE,
|
| 62 |
'default' => '',
|
| 63 |
),
|
| 64 |
'update_method' => array(
|
| 65 |
'description' =>
|
| 66 |
'Specifies whether the repository is updated via log parsing on cron runs (VERSIONCONTROL_CVS_UPDATE_CRON) or via hook scripts (VERSIONCONTROL_CVS_UPDATE_XCVS). Updating the repository and fetching new commits into the database are the same thing, by the way.',
|
| 67 |
'type' => 'int',
|
| 68 |
'size' => 'tiny',
|
| 69 |
'unsigned' => TRUE,
|
| 70 |
'not null' => TRUE,
|
| 71 |
'default' => 0,
|
| 72 |
),
|
| 73 |
'updated' => array(
|
| 74 |
'description' =>
|
| 75 |
'Date/time when the repository was last updated, as Unix timestamp. The CVS backend does not only use this for displaying purposes but also as start date for log parsing. 0 if the repository has never been updated at all.',
|
| 76 |
'type' => 'int',
|
| 77 |
'unsigned' => TRUE,
|
| 78 |
'not null' => TRUE,
|
| 79 |
'default' => 0,
|
| 80 |
),
|
| 81 |
'run_as_user' => array(
|
| 82 |
'description' =>
|
| 83 |
'If this is empty, the exported account data will cause server-side CVS to be run with the system user corresponding to the authenticated CVS account name. Otherwise, the exported account data will cause CVS to run as the system user specified by this property.',
|
| 84 |
'type' => 'varchar',
|
| 85 |
'length' => 255,
|
| 86 |
'not null' => TRUE,
|
| 87 |
'default' => '',
|
| 88 |
),
|
| 89 |
),
|
| 90 |
'primary key' => array('repo_id'),
|
| 91 |
);
|
| 92 |
|
| 93 |
return $schema;
|
| 94 |
}
|
| 95 |
|
| 96 |
/**
|
| 97 |
* Implementation of hook_install().
|
| 98 |
*/
|
| 99 |
function versioncontrol_cvs_install() {
|
| 100 |
// Create tables.
|
| 101 |
drupal_install_schema('versioncontrol_cvs');
|
| 102 |
}
|
| 103 |
|
| 104 |
/**
|
| 105 |
* Implementation of hook_uninstall().
|
| 106 |
*/
|
| 107 |
function versioncontrol_cvs_uninstall() {
|
| 108 |
// Make sure we can access the required functions even from the .install file.
|
| 109 |
include_once(drupal_get_path('module', 'versioncontrol') .'/versioncontrol.module');
|
| 110 |
include_once(drupal_get_path('module', 'versioncontrol_cvs') .'/versioncontrol_cvs.module');
|
| 111 |
|
| 112 |
if (db_table_exists('versioncontrol_repositories')) {
|
| 113 |
$result = db_query("SELECT repo_id FROM {versioncontrol_repositories}
|
| 114 |
WHERE vcs = 'cvs'");
|
| 115 |
while ($repository = db_fetch_array($result)) {
|
| 116 |
versioncontrol_delete_repository($repository);
|
| 117 |
}
|
| 118 |
}
|
| 119 |
|
| 120 |
// Remove tables.
|
| 121 |
drupal_uninstall_schema('versioncontrol_cvs');
|
| 122 |
}
|
| 123 |
|
| 124 |
|
| 125 |
// Update functions. To be named versioncontrol_cvs_update_xyzz(), where x is
|
| 126 |
// the major version of Drupal core, y is the major version of the CVS backend
|
| 127 |
// for this version of Drupal core, and zz is a consecutive number.
|
| 128 |
|
| 129 |
// versioncontrol_cvs_update_6() was the last update on Drupal 5.x (-2.x).
|
| 130 |
|
| 131 |
/**
|
| 132 |
* Update 6100: Blah blah blah.
|
| 133 |
*/
|
| 134 |
/* function versioncontrol_cvs_update_6100() {
|
| 135 |
$ret = array();
|
| 136 |
$ret[] = update_sql('UPDATE {versioncontrol_cvs_blah} SET value = othervalue');
|
| 137 |
return $ret;
|
| 138 |
}*/
|