| 1 |
<?php
|
| 2 |
// $Id: plugin_manager.install,v 1.12 2008/08/10 23:07:45 joshuarogers Exp $
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* The installer and uninstaller for plugin manager.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Implementation of hook_schema().
|
| 11 |
*/
|
| 12 |
function plugin_manager_schema() {
|
| 13 |
$schema['plugin_manager_repository'] = array(
|
| 14 |
'description' => t('The table that contains all information gathered from the repository.'),
|
| 15 |
'fields' => array(
|
| 16 |
'title' => array(
|
| 17 |
'description' => 'The full name of the project',
|
| 18 |
'type' => 'varchar',
|
| 19 |
'length' => 255,
|
| 20 |
'not null' => TRUE,
|
| 21 |
),
|
| 22 |
'short_name' => array(
|
| 23 |
'description' => 'The name the project is referred to by the server',
|
| 24 |
'type' => 'varchar',
|
| 25 |
'length' => 255,
|
| 26 |
'not null' => TRUE,
|
| 27 |
),
|
| 28 |
'links' => array(
|
| 29 |
'description' => 'The project url',
|
| 30 |
'type' => 'varchar',
|
| 31 |
'length' => 255,
|
| 32 |
),
|
| 33 |
),
|
| 34 |
'primary key' => array('short_name'),
|
| 35 |
);
|
| 36 |
$schema['plugin_manager_files'] = array(
|
| 37 |
'description' => 'Keeps track of all the files that have been installed by the module.',
|
| 38 |
'fields' => array(
|
| 39 |
'short_name' => array(
|
| 40 |
'description' => 'The name the project is referred to by the server',
|
| 41 |
'type' => 'varchar',
|
| 42 |
'length' => 255,
|
| 43 |
'not null' => TRUE,
|
| 44 |
),
|
| 45 |
'file_path' => array(
|
| 46 |
'description' => 'The path of the file, relative to the drupal installation, that was installed.',
|
| 47 |
'type' => 'varchar',
|
| 48 |
'length' => 255,
|
| 49 |
'not null' => TRUE,
|
| 50 |
),
|
| 51 |
),
|
| 52 |
'primary key' => array('file_path'),
|
| 53 |
);
|
| 54 |
$schema['plugin_manager_taxonomy'] = array(
|
| 55 |
'description' => 'Keeps track of all the files that have been installed by the module.',
|
| 56 |
'fields' => array(
|
| 57 |
'short_name' => array(
|
| 58 |
'description' => 'The name the project is referred to by the server',
|
| 59 |
'type' => 'varchar',
|
| 60 |
'length' => 255,
|
| 61 |
'not null' => TRUE,
|
| 62 |
),
|
| 63 |
'tag' => array(
|
| 64 |
'description' => 'The taxonomy item for the this project.',
|
| 65 |
'type' => 'varchar',
|
| 66 |
'length' => 255,
|
| 67 |
'not null' => TRUE,
|
| 68 |
),
|
| 69 |
),
|
| 70 |
'index' => array('short_name', 'tag'),
|
| 71 |
);
|
| 72 |
return $schema;
|
| 73 |
}
|
| 74 |
|
| 75 |
/**
|
| 76 |
* Implementation of hook_install().
|
| 77 |
*/
|
| 78 |
function plugin_manager_install() {
|
| 79 |
drupal_install_schema('plugin_manager');
|
| 80 |
mkdir(file_directory_path() .'/plugin_manager_extraction/');
|
| 81 |
mkdir(file_directory_path() .'/plugin_manager_cache/');
|
| 82 |
|
| 83 |
$module = $_SERVER['DOCUMENT_ROOT'] . base_path() .'sites/all/modules';
|
| 84 |
if (!is_dir($module) AND !mkdir($module)) {
|
| 85 |
drupal_set_message(t('Could not create directory @dir', array('@dir' => $theme)), 'error');
|
| 86 |
}
|
| 87 |
$theme = $_SERVER['DOCUMENT_ROOT'] . base_path() .'sites/all/themes';
|
| 88 |
if (!is_dir($theme) AND !mkdir($theme)) {
|
| 89 |
drupal_set_message(t('Could not create directory @dir', array('@dir' => $theme)), 'error');
|
| 90 |
}
|
| 91 |
|
| 92 |
}
|
| 93 |
|
| 94 |
/**
|
| 95 |
* Implementation of hook_uninstall().
|
| 96 |
*/
|
| 97 |
function plugin_manager_uninstall() {
|
| 98 |
drupal_uninstall_schema('plugin_manager');
|
| 99 |
variable_del('plugin_manager_last_reload');
|
| 100 |
}
|