update to drupal 7.23

This commit is contained in:
Bachir Soussi Chiadmi
2013-09-24 09:05:59 +02:00
parent db5f70501a
commit e539e701f8
247 changed files with 4921 additions and 4058 deletions

View File

@@ -20,12 +20,15 @@
* An array of taxonomy vocabulary objects.
*/
function hook_taxonomy_vocabulary_load($vocabularies) {
foreach ($vocabularies as $vocabulary) {
$vocabulary->synonyms = variable_get('taxonomy_' . $vocabulary->vid . '_synonyms', FALSE);
$result = db_select('mytable', 'm')
->fields('m', array('vid', 'foo'))
->condition('m.vid', array_keys($vocabularies), 'IN')
->execute();
foreach ($result as $record) {
$vocabularies[$record->vid]->foo = $record->foo;
}
}
/**
* Act on taxonomy vocabularies before they are saved.
*
@@ -49,8 +52,8 @@ function hook_taxonomy_vocabulary_presave($vocabulary) {
* A taxonomy vocabulary object.
*/
function hook_taxonomy_vocabulary_insert($vocabulary) {
if ($vocabulary->synonyms) {
variable_set('taxonomy_' . $vocabulary->vid . '_synonyms', TRUE);
if ($vocabulary->machine_name == 'my_vocabulary') {
$vocabulary->weight = 100;
}
}
@@ -63,10 +66,10 @@ function hook_taxonomy_vocabulary_insert($vocabulary) {
* A taxonomy vocabulary object.
*/
function hook_taxonomy_vocabulary_update($vocabulary) {
$status = $vocabulary->synonyms ? TRUE : FALSE;
if ($vocabulary->synonyms) {
variable_set('taxonomy_' . $vocabulary->vid . '_synonyms', $status);
}
db_update('mytable')
->fields(array('foo' => $vocabulary->foo))
->condition('vid', $vocabulary->vid)
->execute();
}
/**
@@ -79,9 +82,9 @@ function hook_taxonomy_vocabulary_update($vocabulary) {
* A taxonomy vocabulary object.
*/
function hook_taxonomy_vocabulary_delete($vocabulary) {
if (variable_get('taxonomy_' . $vocabulary->vid . '_synonyms', FALSE)) {
variable_del('taxonomy_' . $vocabulary->vid . '_synonyms');
}
db_delete('mytable')
->condition('vid', $vocabulary->vid)
->execute();
}
/**
@@ -101,7 +104,10 @@ function hook_taxonomy_vocabulary_delete($vocabulary) {
* An array of term objects, indexed by tid.
*/
function hook_taxonomy_term_load($terms) {
$result = db_query('SELECT tid, foo FROM {mytable} WHERE tid IN (:tids)', array(':tids' => array_keys($terms)));
$result = db_select('mytable', 'm')
->fields('m', array('tid', 'foo'))
->condition('m.tid', array_keys($terms), 'IN')
->execute();
foreach ($result as $record) {
$terms[$record->tid]->foo = $record->foo;
}
@@ -130,18 +136,12 @@ function hook_taxonomy_term_presave($term) {
* A taxonomy term object.
*/
function hook_taxonomy_term_insert($term) {
if (!empty($term->synonyms)) {
foreach (explode ("\n", str_replace("\r", '', $term->synonyms)) as $synonym) {
if ($synonym) {
db_insert('taxonomy_term_synonym')
->fields(array(
'tid' => $term->tid,
'name' => rtrim($synonym),
))
->execute();
}
}
}
db_insert('mytable')
->fields(array(
'tid' => $term->tid,
'foo' => $term->foo,
))
->execute();
}
/**
@@ -153,19 +153,10 @@ function hook_taxonomy_term_insert($term) {
* A taxonomy term object.
*/
function hook_taxonomy_term_update($term) {
hook_taxonomy_term_delete($term);
if (!empty($term->synonyms)) {
foreach (explode ("\n", str_replace("\r", '', $term->synonyms)) as $synonym) {
if ($synonym) {
db_insert('taxonomy_term_synonym')
->fields(array(
'tid' => $term->tid,
'name' => rtrim($synonym),
))
->execute();
}
}
}
db_update('mytable')
->fields(array('foo' => $term->foo))
->condition('tid', $term->tid)
->execute();
}
/**
@@ -178,7 +169,9 @@ function hook_taxonomy_term_update($term) {
* A taxonomy term object.
*/
function hook_taxonomy_term_delete($term) {
db_delete('term_synoynm')->condition('tid', $term->tid)->execute();
db_delete('mytable')
->condition('tid', $term->tid)
->execute();
}
/**

View File

@@ -8,8 +8,8 @@ files[] = taxonomy.module
files[] = taxonomy.test
configure = admin/structure/taxonomy
; Information added by drupal.org packaging script on 2013-04-03
version = "7.22"
; Information added by drupal.org packaging script on 2013-08-08
version = "7.23"
project = "drupal"
datestamp = "1365027012"
datestamp = "1375928238"

View File

@@ -682,6 +682,14 @@ function taxonomy_update_7005(&$sandbox) {
$query->orderBy('tn.vid');
$query->orderBy('td.weight');
$query->orderBy('tn.tid');
// Work around a bug in the PostgreSQL driver that would result in fatal
// errors when this subquery is used in the insert query below. See
// https://drupal.org/node/2057693.
$fields = &$query->getFields();
unset($fields['td.weight']);
unset($fields['tn.tid']);
db_insert('taxonomy_update_7005')
->from($query)
->execute();

View File

@@ -140,7 +140,7 @@ function taxonomy_entity_info() {
}
/**
* Entity URI callback.
* Implements callback_entity_info_uri().
*/
function taxonomy_term_uri($term) {
return array(

View File

@@ -170,7 +170,8 @@ class TaxonomyVocabularyFunctionalTest extends TaxonomyWebTestCase {
// Check the created vocabulary.
$vocabularies = taxonomy_get_vocabularies();
$vid = $vocabularies[count($vocabularies) - 1]->vid;
$vocabularies_keys = array_keys($vocabularies);
$vid = $vocabularies[end($vocabularies_keys)]->vid;
entity_get_controller('taxonomy_vocabulary')->resetCache();
$vocabulary = taxonomy_vocabulary_load($vid);
$this->assertTrue($vocabulary, 'Vocabulary found in database.');