'Update information for project translations.', 'fields' => array( 'name' => array( 'description' => 'A unique short name to identify the project.', 'type' => 'varchar', 'length' => '50', 'not null' => TRUE ), 'project_type' => array( 'description' => 'Project type, may be core, module, theme', 'type' => 'varchar', 'length' => '50', 'not null' => TRUE ), 'core' => array( 'description' => 'Core compatibility string for this project.', 'type' => 'varchar', 'length' => '128', 'not null' => TRUE, 'default' => '', ), 'version' => array( 'description' => 'Human readable name for project used on the interface.', 'type' => 'varchar', 'length' => '128', 'not null' => TRUE, 'default' => '', ), 'l10n_server' => array( 'description' => 'Localization server for this project.', 'type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => '', ), 'l10n_path' => array( 'description' => 'Server path this project updates.', 'type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => '', ), 'status' => array( 'description' => 'Status flag. TBD', 'type' => 'int', 'not null' => TRUE, 'default' => 1, ), ), 'primary key' => array('name'), ); $schema['l10n_update_file'] = array( 'description' => 'File and download information for project translations.', 'fields' => array( 'project' => array( 'description' => 'A unique short name to identify the project.', 'type' => 'varchar', 'length' => '50', 'not null' => TRUE ), 'language' => array( 'description' => 'Reference to the {languages}.language for this translation.', 'type' => 'varchar', 'length' => '12', 'not null' => TRUE ), 'type' => array( 'description' => 'File origin: download or localfile', 'type' => 'varchar', 'length' => '50', 'not null' => TRUE, 'default' => '', ), 'filename' => array( 'description' => 'Link to translation file for download.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'fileurl' => array( 'description' => 'Link to translation file for download.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'filepath' => array( 'description' => 'File system path for importing the file.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'timestamp' => array( 'description' => 'Unix timestamp of the last file downloaded.', 'type' => 'int', 'not null' => FALSE, 'disp-width' => '11', 'default' => 0, ), 'version' => array( 'description' => 'Version tag of the downloaded file.', 'type' => 'varchar', 'length' => '128', 'not null' => TRUE, 'default' => '', ), 'status' => array( 'description' => 'Status flag. TBD', 'type' => 'int', 'not null' => TRUE, 'default' => 1, ), 'last_updated' => array( 'description' => 'Unix timestamp of last time project was updated.', 'type' => 'int', 'not null' => FALSE, 'disp-width' => '11', 'default' => 0, ), 'last_checked' => array( 'description' => 'Unix timestamp of last time project was updated.', 'type' => 'int', 'not null' => FALSE, 'disp-width' => '11', 'default' => 0, ), 'import_date' => array( 'description' => 'Unix timestamp of the last file downloaded.', 'type' => 'int', 'not null' => FALSE, 'disp-width' => '11', 'default' => 0, ), ), 'primary key' => array('project', 'language'), ); return $schema; } /** * Add status field to translations table. */ function l10n_update_schema_alter(&$schema) { $schema['locales_target']['fields']['l10n_status'] = array('type' => 'int', 'not null' => TRUE, 'default' => 0); } /** * Implementation of hook_install(). */ function l10n_update_install() { $ret = array(); drupal_install_schema('l10n_update'); db_add_field($ret, 'locales_target', 'l10n_status', array('type' => 'int', 'not null' => TRUE, 'default' => 0)); variable_set('l10n_update_rebuild_projects', 1); return $ret; } /** * Implementation of hook_uninstall(). */ function l10n_update_uninstall() { $ret = array(); drupal_uninstall_schema('l10n_update'); db_drop_field($ret, 'locales_target', 'l10n_status'); return $ret; } /** * Implementation of hook_requirements(). */ function l10n_update_requirements($phase) { if ($phase == 'runtime') { if (l10n_update_get_projects() && l10n_update_language_list()) { $requirements['l10n_update']['title'] = t('Translation update status'); if (l10n_update_available_updates()) { $requirements['l10n_update']['severity'] = REQUIREMENT_WARNING; $requirements['l10n_update']['value'] = t('There are available updates'); $requirements['l10n_update']['description'] = t('There are new or updated translations available for currently installed modules and themes. To check for updates, you can visit the translation update page.', array( '@check_manually' => url('admin/build/translate/update', array('query' => $destination))) ); } else { $requirements['l10n_update']['severity'] = REQUIREMENT_OK; $requirements['l10n_update']['value'] = t('All your translations are up to date'); } } else { $requirements['l10n_update']['title'] = t('Translation update status'); $requirements['l10n_update']['value'] = t('No update data available'); $requirements['l10n_update']['severity'] = REQUIREMENT_WARNING; //$requirements['update_core']['reason'] = UPDATE_UNKNOWN; $requirements['l10n_update']['description'] = _l10n_update_no_data(); } return $requirements; } // We must always return array, the installer doesn't use module_invoke_all() return array(); } /** * Add status field to locales_target. */ function l10n_update_update_6001() { $ret = array(); db_add_field($ret, 'locales_target', 'l10n_status', array('type' => 'int', 'not null' => TRUE, 'default' => 0)); return $ret; } /** * Add status field to locales_target. */ function l10n_update_update_6002() { $ret = array(); db_change_field($ret, 'locales_target', 'status', 'l10n_status', array('type' => 'int', 'not null' => TRUE, 'default' => 0)); return $ret; }