diff options
| author | czaks <marcin@6irc.net> | 2014-03-25 13:03:37 +0100 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2014-03-25 13:03:37 +0100 |
| commit | f0b2240b5f1e67fb9ad4770a3d5b0f298cf4c1d4 (patch) | |
| tree | 3180570731df62be98bd4737c34b5b3ae9ca828e /tools | |
| parent | 15810c9bedb5b7d18baec0f845bb3177f867471e (diff) | |
| parent | 44db8e76d8e21b38f9be4ad9e69f6af19c116fb0 (diff) | |
Merge branch 'master' of github.com:vichan-devel/Tinyboard into br-integration
Diffstat (limited to 'tools')
| -rwxr-xr-x | tools/i18n_extract.php | 5 | ||||
| -rw-r--r-- | tools/recount-bumps.php | 39 |
2 files changed, 42 insertions, 2 deletions
diff --git a/tools/i18n_extract.php b/tools/i18n_extract.php index 4c32b688..fe501a37 100755 --- a/tools/i18n_extract.php +++ b/tools/i18n_extract.php @@ -42,6 +42,7 @@ foreach ($locales as $loc) { xgettext -d tinyboard -L php --from-code utf-8 $join -c $(find ../../../../ -name \*.php)"); // Generate javascript.po - passthru("cd $locdir/LC_MESSAGES; - xgettext -d javascript -L Python --force-po --from-code utf-8 $join -c $(find ../../../../js/ ../../../../templates/ -name \*.js)"); + passthru("cd $locdir/LC_MESSAGES;". + "xgettext -d javascript -L Python --force-po --from-code utf-8 $join -c ". + "$(find ../../../../js/ ../../../../templates/ -not -path \*node_modules\* -name \*.js)"); } diff --git a/tools/recount-bumps.php b/tools/recount-bumps.php new file mode 100644 index 00000000..5adc74d8 --- /dev/null +++ b/tools/recount-bumps.php @@ -0,0 +1,39 @@ +<?php +// A script to recount bumps to recover from a last-page-bump attack +// or to be run after the KusabaX Migration. + +require dirname(__FILE__) . '/inc/cli.php'; + +if(!is_writable($config['file_script'])) { + get_httpd_privileges(); +} + +if (!isset ($argv[1])) { + die("Usage: tools/recount-bumps.php board_uri\n"); +} +$board = $argv[1]; + +$q = query(sprintf("SELECT `id`, `bump`, `time` FROM ``posts_%s`` + WHERE `thread` IS NULL", $board)); +while ($val = $q->fetch()) { + $lc = prepare(sprintf('SELECT MAX(`time`) AS `aq` FROM ``posts_%s`` + WHERE ((`thread` = :thread and + `email` != "sage" ) OR `id` = :thread', $board)); + + $lc->bindValue(":thread", $val['id']); + $lc->execute(); + + $f = $lc->fetch(); + if ($val['bump'] != $f['aq']) { + $query = prepare(sprintf("UPDATE ``posts_%s`` SET `bump`=:bump + WHERE `id`=:id", $board)); + $query->bindValue(":bump", $f['aq']); + $query->bindValue(":id", $val['id']); + echo("Thread $val[id] - to be $val[bump] -> $f[aq]\n"); + } + else { + echo("Thread $val[id] ok\n"); + } +} + +echo("done\n"); |
