source: trunk/scripts/change-special-chars @ 1184

Revision 1074, 972 bytes checked in by gcosmin, 2 years ago (diff)

Standardize the use of commabelow "sh" versus cedille "sh" in textile pages

Solves ticket #379.
Review URL: http://reviewboard.infoarena.ro/r/107/

Script to change all special characters commabelow to cedille in all textblocks.
Modified add_textblock_revision to make this change automatically.

  • Property svn:executable set to *
Line 
1#! /usr/bin/env php
2<?php
3// this script changes all special characters ș, ț, Ș, Ț to ş, ţ, Ş, Ţ
4// (commabelow to cedille) in all texblocks
5
6require_once(dirname($argv[0]) . "/utilities.php");
7require_once(IA_ROOT_DIR . "common/common.php");
8
9db_connect();
10
11function change_special_chars($table) {
12    $res = db_query("SELECT * FROM $table");
13
14    while ($row = db_next_row($res)) {
15        $new_text = text_change_special_chars($row["text"]);
16
17        if ($row["text"] != $new_text) {
18            db_query(sprintf("UPDATE `%s` SET text = %s WHERE name = %s AND
19                timestamp = %s", db_escape($table), db_quote($new_text),
20                db_quote($row["name"]), db_quote($row["timestamp"])));
21
22            log_print(sprintf("Changed special characters from textblock %s".
23                        "from %s", $row["name"], $row["timestamp"]));
24        }
25    }
26}
27
28change_special_chars("ia_textblock");
29change_special_chars("ia_textblock_revision");
30
31?>
Note: See TracBrowser for help on using the repository browser.