Skip to content

Commit

Permalink
show cachelist names in log watch notifications; updates #895
Browse files Browse the repository at this point in the history
  • Loading branch information
following5 committed Feb 8, 2016
1 parent a6e8d2b commit d855bd2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
8 changes: 8 additions & 0 deletions htdocs/doc/sql/static-data/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2819,6 +2819,8 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2532', '... by
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2533', 'Good and inappropriate reasons to report a cache', '2015-01-20 20:37:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2534', '%1 reports are being processed, %2 reports are pending', '2015-01-20 20:37:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2535', 'estimated queuing time for new reports: about %1 to %2 days', '2015-01-20 20:37:00');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2536', 'Cache list:', '2015-06-17 10:09:14');
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2537', 'Cache lists:', '2015-06-17 10:09:14');

-- Table sys_trans_ref
SET NAMES 'utf8';
Expand Down Expand Up @@ -7367,6 +7369,8 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2533', 'DE', 'Gute und unpassende Gründe für eine Cachemeldung', '2015-01-20 20:37:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2534', 'DE', '%1 Meldungen sind in Bearbeitung, %2 Meldungen sind offen', '2015-01-20 20:37:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2535', 'DE', 'geschätzte Wartezeit für neue Meldungen: ca. %1–%2 Tage', '2015-01-20 20:37:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2536', 'DE', 'Cacheliste:', '2015-06-17 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2537', 'DE', 'Cachelisten:', '2015-06-17 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'EN', 'Reorder IDs', '2010-09-02 00:15:30');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2', 'EN', 'The database could not be reconnected.', '2010-08-28 11:48:07');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('3', 'EN', 'Testing – please do not login', '2010-08-28 11:48:07');
Expand Down Expand Up @@ -9204,6 +9208,8 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2530', 'EN', 'Current new entries', '2015-01-20 20:37:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2531', 'EN', 'All new entries', '2015-01-20 20:37:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2532', 'EN', '... by log date', '2015-01-20 20:37:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2536', 'EN', 'Cache list:', '2015-06-17 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2537', 'EN', 'Cache lists:', '2015-06-17 10:09:14');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2', 'ES', 'La base de datos no se pudo conectar.', '2010-12-09 00:17:55');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('3', 'ES', 'En pruebas - por favor, no entre.', '2010-12-09 00:17:55');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('4', 'ES', 'Usuario', '2010-12-09 00:17:55');
Expand Down Expand Up @@ -12598,6 +12604,8 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2527', 'FR', 'non\ trouvé', '2010-10-04 00:17:39');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2528', 'FR', 'participation', '2010-10-04 00:17:39');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2529', 'FR', 'recommandé', '2010-10-04 00:17:39');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2536', 'FR', 'Liste de cache :', '2015-08-25 01:29:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2537', 'FR', 'Listes de cache :', '2015-08-25 01:29:00');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'IT', 'Riordina gli ID', '2010-10-27 18:49:18');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2', 'IT', 'Impossibile riconnettersi al database', '2010-08-28 20:28:01');
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('3', 'IT', 'Test - per favore non connettersi', '2010-08-28 20:36:53');
Expand Down
12 changes: 12 additions & 0 deletions htdocs/lib/clicompatbase.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,18 @@ function sql_fetch_row($rs)
return mysql_fetch_row($rs);
}

function sql_fetch_column($rs)
{
$col = array();
while ($r = sql_fetch_row($rs))
if (count($r) != 1)
return null;
else
$col[] = $r[0];
sql_free_result($rs);
return $col;
}

function sql_free_result($rs)
{
return mysql_free_result($rs);
Expand Down
18 changes: 17 additions & 1 deletion htdocs/util/watchlist/runwatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,14 +283,30 @@ function process_log_watch($user_id, $log_id)
else
$dateformat = $opt['locale'][$language]['format']['phpdatetime'];

$watchtext = '{date} ' . $translate->t('{user} has logged the cache "{cachename}":', '', basename(__FILE__), __LINE__, '', 1, $language) . ' {action}' . "\n" . '{shortlink_url}{wp_oc}' . "\n\n" . '{text}' . "\n\n\n\n";
$watchtext = '{date} ' . $translate->t('{user} has logged the cache "{cachename}":', '', basename(__FILE__), __LINE__, '', 1, $language) . ' {action}' . "\n" . '{shortlink_url}{wp_oc}' . "\n{cachelists}\n" . '{text}' . "\n\n\n\n";

$watchtext = mb_ereg_replace('{date}', date($dateformat, strtotime($rLog['logdate'])), $watchtext);
$watchtext = mb_ereg_replace('{wp_oc}', $rLog['wp_oc'], $watchtext);
$watchtext = mb_ereg_replace('{text}', $logtext, $watchtext);
$watchtext = mb_ereg_replace('{user}', $rLog['username'], $watchtext);
$watchtext = mb_ereg_replace('{cachename}', $rLog['cachename'], $watchtext);
$watchtext = mb_ereg_replace('{action}', get_logtype_name($rLog['type'], $language), $watchtext);

$rsLists = sql("
SELECT `name` FROM `cache_lists` cl
JOIN `cache_list_watches` clw ON clw.`cache_list_id`=cl.`id` AND clw.`user_id`='&1'
JOIN `cache_list_items` cli ON cli.`cache_list_id`=cl.`id` AND cli.`cache_id`='&2'
ORDER BY `name`",
$user_id, $rLog['cache_id']
);
$cachelist_names = sql_fetch_column($rsLists);
switch (count($cachelist_names))
{
case 0: $cachelists = ''; break;
case 1: $cachelists = $translate->t('Cache list:', '', basename(__FILE__), __LINE__, '', 1, $language) . ' ' . $cachelist_names[0] . "\n"; break;
default: $cachelists = $translate->t('Cache lists:', '', basename(__FILE__), __LINE__, '', 1, $language) . ' ' . implode(', ', $cachelist_names) . "\n";
}
$watchtext = mb_ereg_replace('{cachelists}', $cachelists, $watchtext);

$domain = sqlValue("SELECT `domain` FROM `user` WHERE `user_id`='" . sql_escape($user_id) . "'", null);
$urls = get_site_urls($domain);
Expand Down

0 comments on commit d855bd2

Please sign in to comment.