security update core+modules
This commit is contained in:
@@ -10,9 +10,9 @@ files[] = i18n_sync.install
|
||||
files[] = i18n_sync.module.inc
|
||||
files[] = i18n_sync.node.inc
|
||||
files[] = i18n_sync.test
|
||||
; Information added by drupal.org packaging script on 2013-01-13
|
||||
version = "7.x-1.8"
|
||||
; Information added by Drupal.org packaging script on 2015-01-26
|
||||
version = "7.x-1.12"
|
||||
core = "7.x"
|
||||
project = "i18n"
|
||||
datestamp = "1358075001"
|
||||
datestamp = "1422286982"
|
||||
|
||||
|
@@ -11,8 +11,6 @@
|
||||
*
|
||||
* Notes:
|
||||
* This module needs to run after taxonomy, i18n, translation. Check module weight.
|
||||
*
|
||||
* @ TODO Test with CCK when possible, api may have changed.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -71,25 +69,6 @@ function i18n_sync_field_info_alter(&$fields) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORM_ID_alter().
|
||||
*/
|
||||
function i18n_sync_form_node_admin_content_alter(&$form, &$form_state) {
|
||||
if (!empty($form['operation']) && $form['operation']['#value'] == 'delete') {
|
||||
$form['#submit'] = array_merge(array('i18n_sync_node_delete_submit'), $form['#submit']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORM_ID_alter().
|
||||
*/
|
||||
function i18n_sync_form_node_delete_confirm_alter(&$form, &$form_state) {
|
||||
// Intercept form submission so we can handle uploads, replace callback
|
||||
$form['#submit'] = array_merge(array('i18n_sync_node_delete_submit'), $form['#submit']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Implements hook_form_FORM_ID_alter().
|
||||
*/
|
||||
@@ -145,42 +124,6 @@ function i18n_sync_form_node_type_form_alter(&$form, &$form_state) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Submit callback for
|
||||
* - node delete confirm
|
||||
* - node multiple delete confirm
|
||||
*/
|
||||
function i18n_sync_node_delete_submit($form, $form_state) {
|
||||
if ($form_state['values']['confirm']) {
|
||||
if (!empty($form_state['values']['nid'])) {
|
||||
// Single node
|
||||
i18n_sync_node_delete_prepare($form_state['values']['nid']);
|
||||
}
|
||||
elseif (!empty($form_state['values']['nodes'])) {
|
||||
// Multiple nodes
|
||||
foreach ($form_state['values']['nodes'] as $nid => $value) {
|
||||
i18n_sync_node_delete_prepare($nid);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Then it will go through normal form submission
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare node for deletion, work out synchronization issues
|
||||
*/
|
||||
function i18n_sync_node_delete_prepare($nid) {
|
||||
$node = node_load($nid);
|
||||
// Delete file associations when files are shared with existing translations
|
||||
// so they are not removed by upload module
|
||||
if (!empty($node->tnid) && module_exists('upload')) {
|
||||
$result = db_query('SELECT u.* FROM {upload} u WHERE u.nid = %d AND u.fid IN (SELECT t.fid FROM {upload} t WHERE t.fid = u.fid AND t.nid <> u.nid)', $nid);
|
||||
while ($up = db_fetch_object($result)) {
|
||||
db_query("DELETE FROM {upload} WHERE fid = %d AND vid = %d", $up->fid, $up->vid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether this node is to be synced
|
||||
*/
|
||||
|
@@ -27,6 +27,7 @@
|
||||
* Node operation (insert|update).
|
||||
*/
|
||||
function i18n_sync_node_translation($node, $translations, $field_names, $op) {
|
||||
$total = count($translations);
|
||||
$count = 0;
|
||||
// Disable language selection and synchronization temporarily, enable it again later
|
||||
$i18n_select = i18n_select(FALSE);
|
||||
@@ -34,10 +35,12 @@ function i18n_sync_node_translation($node, $translations, $field_names, $op) {
|
||||
foreach ($translations as $translation) {
|
||||
// If translation is the same node, we cannot synchronize with itself
|
||||
if ($node->nid == $translation->nid) {
|
||||
$total--;
|
||||
continue;
|
||||
}
|
||||
// Load full node, we need all data here.
|
||||
$translation = node_load($translation->nid, NULL, TRUE);
|
||||
entity_get_controller('node')->resetCache(array($translation->nid));
|
||||
$translation = node_load($translation->nid);
|
||||
$i18n_options = i18n_sync_node_options($node->type);
|
||||
// Invoke callback for each field, the default is just copy over
|
||||
foreach ($field_names as $field) {
|
||||
@@ -53,6 +56,13 @@ function i18n_sync_node_translation($node, $translations, $field_names, $op) {
|
||||
module_invoke_all('i18n_sync_translation', 'node', $translation, $translation->language, $node, $node->language, $field_names);
|
||||
node_save($translation);
|
||||
$count++;
|
||||
// Flush each entity from the load cache after processing, to
|
||||
// avoid exceeding PHP memory limits. It should be safe to keep
|
||||
// at least one, however; so we retain the final translation in
|
||||
// the cache after saving it.
|
||||
if ($count < $total) {
|
||||
entity_get_controller('node')->resetCache(array($translation->nid));
|
||||
}
|
||||
}
|
||||
i18n_sync(TRUE);
|
||||
i18n_select($i18n_select);
|
||||
|
Reference in New Issue
Block a user