UPDATE CREATED DATE AND USER para ACTAS y otros
update node n
inner join content_type_acta cta
on n.nid = cta.nid and n.vid = cta.vid
SET n.created = unix_timestamp(field_fecha_value)
WHERE type = 'acta';
update node n
inner join content_field_acta cfa
on n.nid = cfa.nid inner join node a
on a.nid = cfa.field_acta_nid
SET n.created = a.created;
update node n set uid = 51 where type in ('acta','leccion','sintesis','margen');
GARLAND COLORS FIX
$var_name = 'color_garland_screenshot';
$a = variable_get($var_name,'');
$needle = "/drupal_files/hijosdelamadrededios.com";
$replacement = "sites/www.hijosdelamadrededios.com/files";
if (is_array($a)) {
for($i=0;$i<count($a);$i++) {
$a[$i] = str_replace($needle,$replacement,$a[$i]);
}
} else
{
$a = str_replace($needle,$replacement,$a);
}
variable_set($var_name,$a);
$a = variable_get($var_name,'');
echo '<pre>' . print_r($a,true) . '</pre>';
Regenerar autotitulos
$res = db_query("select nid from node where type = 'pu_override'");
while ($row=db_result($res)) {
drupal_set_message('<pre>' . print_r($row,TRUE) . '</pre>');
$node = node_load($row);
node_save($node);
}
Problemas de indexacion
Invalid argument supplied for foreach() in taxonomy.module
select n.nid from node n left join users u on n.uid=u.uid where u.uid is null
select n.nid from node n left join node_revisions nr on n.vid=nr.vid where nr.vid is null
select nr.vid from node_revisions nr left join node n on nr.nid=n.nid where n.nid is null
select * from term_node where nid = 0 or vid = 0
select t.nid from term_node t left join node n on t.nid = n.nid where n.nid is null
select t.nid from term_node t left join node_revisions nr on t.nid = nr.nid and t.vid = nr.vid where nr.vid is null
Actas sin manuscrito
SELECT field_numero_value FROM `content_type_acta_pendiente` cp inner join content_field_numero cn
on cp.vid = cn.vid and cp.nid = cn.nid
where field_manuscrito_fid is null
order by field_numero_value
drupal_set_message('<pre>' . print_r($view, TRUE) . '</pre>');
Content moderation activate all nodes of a type
$res = db_query("select nid from node where type='page'");
while ($row=db_result($res)) {
drupal_set_message('<pre>' . print_r($row,TRUE) . '</pre>');
$live = _content_moderation_live_revision($row);
if (!$live){
$node = node_load($row);
_content_moderation_set_live($node->vid,$node->nid);
_content_moderation_save_history($node,"none","live",1,"Initial synchronisation");
_content_moderation_update_revision_state($node->vid,$node->nid,"live");
drupal_set_message("{$node->title} with vid {$node->vid} as been put live");
}
}
Reset filesizes
$res = db_query("select f.* from drupal6.files f
WHERE filename like '%.pdf' and filesize = 0
order by f.filename LIMIT 0,1000");
while ($row=db_fetch_object($res)) {
drupal_set_message(print_r(filesize("/etc/drupal/6/" . $row->filepath),TRUE));
$row->filesize = filesize($row->filepath);
drupal_write_record("files",$row,"fid");
//Version 7 file_save($row);
}
$res = db_query("select f.* from espirit3_drpl1.files f LEFT OUTER JOIN
content_type_acta_pendiente c ON CAST(c.`field_manuscrito_fid` as decimal) = CAST(f.fid as decimal)
WHERE c.`field_manuscrito_fid` is not null
order by f.filename");
while ($row=db_fetch_object($res)) {
drupal_set_message('<pre>' . file_check_location($row->filepath) . '</pre>');
if (file_check_location($row->filepath) == '0') {
drupal_set_message('<pre>' . $row->filepath . ' does not exist.</pre>');
}
else
{
if (filesize(file_check_location($row->filepath)) !== $row->filesize)
{
drupal_set_message('<pre>' . print_r($row,TRUE) . '</pre>');
drupal_set_message(print_r(filesize($row->filepath),TRUE));
$row->filesize = filesize($row->filepath);
drupal_write_record("files",$row,"fid");
//Version 7 file_save($row);
}
}
}
