Skip to content

Instantly share code, notes, and snippets.

@hirbod
Created September 10, 2013 17:04
Show Gist options
  • Save hirbod/6512406 to your computer and use it in GitHub Desktop.
Save hirbod/6512406 to your computer and use it in GitHub Desktop.
Redaxo Prioritäten (Kategorien / Artikel) in allen Sprachen mit CLANG 0 syncen
<?php
// Dieses Skript synced nur Kategorien. Sollen auch Artikel gesynced werden,
// einfach catprior durch prior ersetzen (an allen Stellen)
// Quellsync ist CLANG 0 (Sprache 1)
// Es werden ALLE anderen Sprachen gesynced.
// Falls nur bestimmte Sprachen gesynced werden sollen, einfach Statement anpassen
$query = 'SELECT * FROM rex_article WHERE clang = 0';
$db_conn = rex_sql::factory();
$german_articles = $db_conn->getArray($query);
//$db_conn->debugsql = 1;
foreach($german_articles as $article){
$query = 'UPDATE rex_article SET catprior = '.$article['catprior'].' WHERE clang != 0 AND id = '.$article['id'];
$db_conn->flush();
$db_conn->setQuery($query);
}
?>
// Dieses Skript synced nur Kategorien mittels SQL-Statement. Sollen auch Artikel synced werden,
// einfach catprior durch prior ersetzen (an allen Stellen)
// Quellsync ist CLANG 0 (Sprache 1)
// Es werden ALLE anderen Sprachen gesynced.
// Falls nur bestimmte Sprachen gesynced werden sollen, einfach Statement anpassen
UPDATE rex_article t1 SET catprior = (SELECT catprior FROM rex_article t2 WHERE t2.id = t1.id AND clang = 0) WHERE clang != 0
@hirbod
Copy link
Author

hirbod commented Oct 30, 2013

Hi, der SQL-Code oben war tatsächlich ungetestet. Hast du das ausprobiert? Bist du sicher das es nicht funktioniert?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment