XML interface and rating fixes and changes; updates #244
- XML interface update to v1.4 -- added listing_last_modified and log_last_modified fields -- changed and fixed handling of ratings for multiple found logs of one user -- resend log records after editing (only) rating or withdrawing rating via mytop5 -- logtype fix: convert type > 8 to 3 in XML versions < 1.3 - fixed rating handling when deleting one of multiple found logs -- added dbmaintain update procedure for this fix - show only one rating star when a user logged multiple founds - added trigger update function to database versioning
This commit is contained in:
@@ -44,6 +44,20 @@
|
|||||||
} while ($db_version > 0);
|
} while ($db_version > 0);
|
||||||
|
|
||||||
|
|
||||||
|
// Now and then a maintain.php update should be inserted, because multiple
|
||||||
|
// mutations may be run in one batch, and future mutations may depend on
|
||||||
|
// changed triggers, which may not be obvious.
|
||||||
|
// Of course, a trigger update mutation can also be inserted directly before a
|
||||||
|
// mutation which needs it. (But take care that maintain.php at that point does
|
||||||
|
// not depend on database changes which will be done by that mutation ...)
|
||||||
|
|
||||||
|
function update_triggers()
|
||||||
|
{
|
||||||
|
global $opt;
|
||||||
|
system('php ' . $opt['rootpath'] . 'doc/sql/stored-proc/maintain.php');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Database mutations
|
// Database mutations
|
||||||
// - must be consecutively numbered
|
// - must be consecutively numbered
|
||||||
// - should behave well if run multiple times
|
// - should behave well if run multiple times
|
||||||
@@ -246,4 +260,9 @@
|
|||||||
sql("ALTER TABLE `caches` ADD INDEX `wp_gc_maintained` (`wp_gc_maintained`)");
|
sql("ALTER TABLE `caches` ADD INDEX `wp_gc_maintained` (`wp_gc_maintained`)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dbv_113() // preventive trigger update
|
||||||
|
{
|
||||||
|
update_triggers();
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
$procedures[] = 'sp_updateall_cachelog_picturestat';
|
$procedures[] = 'sp_updateall_cachelog_picturestat';
|
||||||
$procedures[] = 'sp_updateall_cache_listingdates';
|
$procedures[] = 'sp_updateall_cache_listingdates';
|
||||||
$procedures[] = 'sp_updateall_cachelog_logdates';
|
$procedures[] = 'sp_updateall_cachelog_logdates';
|
||||||
|
$procedures[] = 'sp_updateall_rating_dates';
|
||||||
|
|
||||||
$tpl->assign('procedures', $procedures);
|
$tpl->assign('procedures', $procedures);
|
||||||
|
|
||||||
@@ -58,6 +59,8 @@
|
|||||||
sql("CALL sp_updateall_cache_listingdates(@c)");
|
sql("CALL sp_updateall_cache_listingdates(@c)");
|
||||||
else if ($proc == 'sp_updateall_cachelog_logdates')
|
else if ($proc == 'sp_updateall_cachelog_logdates')
|
||||||
sql("CALL sp_updateall_cachelog_logdates(@c)");
|
sql("CALL sp_updateall_cachelog_logdates(@c)");
|
||||||
|
else if ($proc == 'sp_updateall_rating_dates')
|
||||||
|
sql("CALL sp_updateall_rating_dates(@c)");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$bError = true;
|
$bError = true;
|
||||||
|
|||||||
@@ -2507,6 +2507,7 @@ INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2086', 'unknown
|
|||||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2087', 'Show on map', '2013-04-25 23:00:00');
|
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2087', 'Show on map', '2013-04-25 23:00:00');
|
||||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2089', 'disabled[pl]', '2013-04-25 23:00:00');
|
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2089', 'disabled[pl]', '2013-04-25 23:00:00');
|
||||||
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2090', 'archived[pl]', '2013-04-25 23:00:00');
|
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2090', 'archived[pl]', '2013-04-25 23:00:00');
|
||||||
|
INSERT INTO `sys_trans` (`id`, `text`, `last_modified`) VALUES ('2091', 'Test for and fix inconsistencies in database tables', '2013-04-25 23:00:00');
|
||||||
|
|
||||||
-- Table sys_trans_ref
|
-- Table sys_trans_ref
|
||||||
SET NAMES 'utf8';
|
SET NAMES 'utf8';
|
||||||
@@ -5496,7 +5497,7 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
|
|||||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('670', 'DE', 'Trefferquote', '2010-08-28 11:48:06');
|
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('670', 'DE', 'Trefferquote', '2010-08-28 11:48:06');
|
||||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('671', 'DE', 'Es können keine Empfehlungen gegeben werden, da keine weiteren Bewertungen vorliegen.', '2010-08-28 11:48:06');
|
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('671', 'DE', 'Es können keine Empfehlungen gegeben werden, da keine weiteren Bewertungen vorliegen.', '2010-08-28 11:48:06');
|
||||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('672', 'DE', 'Datenbankwartung', '2010-08-28 11:48:06');
|
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('672', 'DE', 'Datenbankwartung', '2010-08-28 11:48:06');
|
||||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('673', 'DE', 'DB Maintainance', '2010-08-28 11:48:06');
|
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('673', 'DE', 'Datenbankwartung', '2010-08-28 11:48:06');
|
||||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('674', 'DE', '%1 hat %2 Einträge korrigiert', '2010-08-28 11:48:06');
|
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('674', 'DE', '%1 hat %2 Einträge korrigiert', '2010-08-28 11:48:06');
|
||||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('675', 'DE', 'Ausführen', '2010-08-28 11:48:06');
|
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('675', 'DE', 'Ausführen', '2010-08-28 11:48:06');
|
||||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('676', 'DE', 'Senden', '2010-08-28 11:48:06');
|
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('676', 'DE', 'Senden', '2010-08-28 11:48:06');
|
||||||
@@ -6465,6 +6466,7 @@ INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUE
|
|||||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2087', 'DE', 'auf Karte anzeigen', '2013-04-25 23:00:00');
|
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2087', 'DE', 'auf Karte anzeigen', '2013-04-25 23:00:00');
|
||||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2089', 'DE', 'deaktivierte', '2013-04-25 23:00:00');
|
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2089', 'DE', 'deaktivierte', '2013-04-25 23:00:00');
|
||||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2090', 'DE', 'archivierte', '2013-04-25 23:00:00');
|
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2090', 'DE', 'archivierte', '2013-04-25 23:00:00');
|
||||||
|
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('2091', 'DE', 'Sucht und behebt Inkonsistenzen in Datenbanktabellen', '2013-04-25 23:00:00');
|
||||||
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'EN', 'Reorder IDs \r', '2010-09-02 00:15:30');
|
INSERT INTO `sys_trans_text` (`trans_id`, `lang`, `text`, `last_modified`) VALUES ('1', 'EN', 'Reorder IDs \r', '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 ('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');
|
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');
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
$opt['rootpath'] = '../../../';
|
$opt['rootpath'] = dirname(__FILE__) . '/../../../';
|
||||||
require_once($opt['rootpath'] . 'lib/clicompatbase.inc.php');
|
require_once($opt['rootpath'] . 'lib/clicompatbase.inc.php');
|
||||||
|
|
||||||
if (!file_exists($opt['rootpath'] . 'util/mysql_root/sql_root.inc.php'))
|
if (!file_exists($opt['rootpath'] . 'util/mysql_root/sql_root.inc.php'))
|
||||||
@@ -252,6 +252,17 @@
|
|||||||
SET nModified = nModified + ROW_COUNT();
|
SET nModified = nModified + ROW_COUNT();
|
||||||
END;");
|
END;");
|
||||||
|
|
||||||
|
/* update log modification date when rating changed, so that it is resent via
|
||||||
|
XML interface; see issue #244 */
|
||||||
|
sql_dropProcedure('sp_update_cachelog_rating');
|
||||||
|
sql("CREATE PROCEDURE sp_update_cachelog_rating (IN nCacheId INT, IN nUserID INT, IN dRatingDate DATETIME)
|
||||||
|
BEGIN
|
||||||
|
IF (ISNULL(@XMLSYNC) OR @XMLSYNC!=1) THEN
|
||||||
|
UPDATE `cache_logs` SET `last_modified`=NOW()
|
||||||
|
WHERE `cache_logs`.`cache_id`=nCacheId AND `cache_logs`.`user_id`=nUserID AND `cache_logs`.`date`=dRatingDate;
|
||||||
|
END IF;
|
||||||
|
END;");
|
||||||
|
|
||||||
// set caches.desc_languages of given cacheid and fill cache_desc_prefered
|
// set caches.desc_languages of given cacheid and fill cache_desc_prefered
|
||||||
sql_dropProcedure('sp_update_caches_descLanguages');
|
sql_dropProcedure('sp_update_caches_descLanguages');
|
||||||
sql("CREATE PROCEDURE sp_update_caches_descLanguages (IN nCacheId INT(10) UNSIGNED)
|
sql("CREATE PROCEDURE sp_update_caches_descLanguages (IN nCacheId INT(10) UNSIGNED)
|
||||||
@@ -515,6 +526,19 @@
|
|||||||
SET nModified=nModified+ROW_COUNT();
|
SET nModified=nModified+ROW_COUNT();
|
||||||
END;");
|
END;");
|
||||||
|
|
||||||
|
// Update out-of-sync rating dates. These probably were caused by rating-related
|
||||||
|
// bugs when deleting one of multiple found logs and when changing the log type
|
||||||
|
// (9 mismatches within ~9 months up to June 2013).
|
||||||
|
sql_dropProcedure('sp_updateall_rating_dates');
|
||||||
|
sql("CREATE PROCEDURE sp_updateall_rating_dates (OUT nModified INT)
|
||||||
|
BEGIN
|
||||||
|
UPDATE `cache_rating` SET `rating_date` =
|
||||||
|
(SELECT `date` FROM `cache_logs` WHERE `cache_logs`.`cache_id`=`cache_rating`.`cache_id` AND `cache_logs`.`user_id`=`cache_rating`.`user_id` AND `cache_logs`.`type` IN (1,7) ORDER BY `date` LIMIT 1)
|
||||||
|
WHERE (SELECT COUNT(*) FROM `cache_logs` WHERE `cache_logs`.`cache_id`=`cache_rating`.`cache_id` AND `cache_logs`.`user_id`=`cache_rating`.`user_id` AND `cache_logs`.`date`=`cache_rating`.`rating_date` AND `type` IN (1,7))=0;
|
||||||
|
/* will set rating_date to 0000-00...:00 for orphan records */
|
||||||
|
SET nModified=ROW_COUNT();
|
||||||
|
END;");
|
||||||
|
|
||||||
// notify users with matching watch radius about this cache
|
// notify users with matching watch radius about this cache
|
||||||
sql_dropProcedure('sp_notify_new_cache');
|
sql_dropProcedure('sp_notify_new_cache');
|
||||||
sql("CREATE PROCEDURE sp_notify_new_cache (IN nCacheId INT(10) UNSIGNED, IN nLongitude DOUBLE, IN nLatitude DOUBLE)
|
sql("CREATE PROCEDURE sp_notify_new_cache (IN nCacheId INT(10) UNSIGNED, IN nLongitude DOUBLE, IN nLatitude DOUBLE)
|
||||||
@@ -966,6 +990,7 @@
|
|||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
CALL sp_update_topratingstat(NEW.`cache_id`, FALSE);
|
CALL sp_update_topratingstat(NEW.`cache_id`, FALSE);
|
||||||
|
CALL sp_update_cachelog_rating(NEW.`cache_id`, NEW.`user_id`, NEW.`rating_date`);
|
||||||
END;");
|
END;");
|
||||||
|
|
||||||
sql_dropTrigger('cacheRatingAfterUpdate');
|
sql_dropTrigger('cacheRatingAfterUpdate');
|
||||||
@@ -975,6 +1000,8 @@
|
|||||||
IF NEW.`cache_id`!=OLD.`cache_id` THEN
|
IF NEW.`cache_id`!=OLD.`cache_id` THEN
|
||||||
CALL sp_update_topratingstat(OLD.`cache_id`, TRUE);
|
CALL sp_update_topratingstat(OLD.`cache_id`, TRUE);
|
||||||
CALL sp_update_topratingstat(NEW.`cache_id`, FALSE);
|
CALL sp_update_topratingstat(NEW.`cache_id`, FALSE);
|
||||||
|
CALL sp_update_cachelog_rating(OLD.`cache_id`, OLD.`user_id`, OLD.`rating_date`);
|
||||||
|
CALL sp_update_cachelog_rating(NEW.`cache_id`, NEW.`user_id`, NEW.`rating_date`);
|
||||||
END IF;
|
END IF;
|
||||||
END;");
|
END;");
|
||||||
|
|
||||||
@@ -983,6 +1010,7 @@
|
|||||||
FOR EACH ROW
|
FOR EACH ROW
|
||||||
BEGIN
|
BEGIN
|
||||||
CALL sp_update_topratingstat(OLD.`cache_id`, TRUE);
|
CALL sp_update_topratingstat(OLD.`cache_id`, TRUE);
|
||||||
|
CALL sp_update_cachelog_rating(OLD.`cache_id`, OLD.`user_id`, OLD.`rating_date`);
|
||||||
END;");
|
END;");
|
||||||
|
|
||||||
sql_dropTrigger('cacheVisitsBeforeInsert');
|
sql_dropTrigger('cacheVisitsBeforeInsert');
|
||||||
|
|||||||
@@ -44,9 +44,17 @@
|
|||||||
<li>Das <date>-Element von Logs enthält nun auch die Uhrzeit. 00:00:00 bedeutet, dass keine Uhrzeit geloggt wurde; alles andere bedeutet, dass mit Stunde und Minute geloggt wurde.</li>
|
<li>Das <date>-Element von Logs enthält nun auch die Uhrzeit. 00:00:00 bedeutet, dass keine Uhrzeit geloggt wurde; alles andere bedeutet, dass mit Stunde und Minute geloggt wurde.</li>
|
||||||
<li>Element für Bildeigenschaften von <attributes> in <picattr> umbenannt, um Kollisionen mit dem Cache-Attribut-Element zu vermeiden.</li>
|
<li>Element für Bildeigenschaften von <attributes> in <picattr> umbenannt, um Kollisionen mit dem Cache-Attribut-Element zu vermeiden.</li>
|
||||||
<li>Vorschaubild-Flag (<em>preview</em>) zu <picattr> hinzugefügt.</li>
|
<li>Vorschaubild-Flag (<em>preview</em>) zu <picattr> hinzugefügt.</li>
|
||||||
<li>zusätzliche Logtypen 9 (archiviert), 10 (kann gesucht werden), 11 (momentan nicht verfügbar) und 13 (gesperrt)</li>
|
<li>zusätzliche Logtypen 9 (archiviert), 10 (kann gesucht werden), 11 (momentan nicht verfügbar) und 13 (gesperrt); Ausgabe als Typ 3 (Hinweis) in älteren XML-Versionen</li>
|
||||||
<li><em>teamcomment</em>-Flag zum <logtype> hinzugefügt</li>
|
<li><em>teamcomment</em>-Flag zum <logtype> hinzugefügt</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
<h2>Änderungen in Version 1.4 (Juni 2013)</h2>
|
||||||
|
<ul>
|
||||||
|
<li>Bei Caches wird zusätzlich das Feld <em>listing_lastmodified</em> ausgegeben, das das Gesamt-Änderungsdatum des Listings inklusive hinzugefügten/geänderten/gelöschten Beschreibungen und Bildern enthält. Bei Logs gibt es entsprechend das zusätzliche Feld <em>log_last_modified</em>, das Bilder mit einschließt.</li>
|
||||||
|
<li>Wenn ein User einen Cache empfohlen und diesen mehrfach als "Fund" geloggt hat, wurde bislang bei allen Fundlogs <em>recommended="1"</em> mitgeliefert (allerdings nicht rückwirkend - das war ein Bug. Auch zurückgezogene Empfehlungen wurden nicht immer sofort ausgeliefert).<br>
|
||||||
|
Dieses Verhalten wurde so geändert, dass <em>recommended="1"</em> nur noch bei genau dem Log mitgeliefert wird, mit dem die Empfehlung für den Cache gegeben wurde. Mehrfachempfehlungen sind nicht möglich (und waren es noch nie).<br />
|
||||||
|
Gleichzeitig wurde auch die Darstellung auf opencaching.de geändert: Bei Mehrfach-Fundlogs erscheint der grüne Stern nur noch an einem der Logs.<br />
|
||||||
|
Bei Anwendungen, die das <em>recommended</em>-Flag verwenden wird ein kompletter Neuabruf aller Logs per Version 1.4 empfohlen, weil die alten Daten fehlerhaft sein können. Außerdem sollte die Handhabung von Mehrfachlogs geprüft werden.</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
<p>Der XML-Doctype lautet in allen Versionen "oc11xml".</p>
|
<p>Der XML-Doctype lautet in allen Versionen "oc11xml".</p>
|
||||||
<h2>Ausgabeformat</h2>
|
<h2>Ausgabeformat</h2>
|
||||||
@@ -74,8 +82,9 @@
|
|||||||
<h3>Allgemeine XML-Elemente</h3>
|
<h3>Allgemeine XML-Elemente</h3>
|
||||||
<h4>lastmodified</h4>
|
<h4>lastmodified</h4>
|
||||||
<p>Datum an dem dieser Datensatz zuletzt geändert wurde. Es werden keine
|
<p>Datum an dem dieser Datensatz zuletzt geändert wurde. Es werden keine
|
||||||
Abhängigkeiten berücksichtigt. D.h. Wenn eine Cachebeschreibung geändert wird,
|
Abhängigkeiten berücksichtigt. D.h. Wenn z.B. eine Cachebeschreibung geändert wird,
|
||||||
ändert sich nur deren lastmodified, nicht jedoch das des Caches. Datumsangaben
|
ändert sich nur deren lastmodified, nicht jedoch das des Caches (hierfür gibt es
|
||||||
|
das separate Feld <em>listing_last_modified</em>.) Datumsangaben
|
||||||
sind immer in der Form "yyyy-mm-dd hh:mm:ss" oder "yyyy-mm-dd"</p>
|
sind immer in der Form "yyyy-mm-dd hh:mm:ss" oder "yyyy-mm-dd"</p>
|
||||||
<h4>datecreated</h4>
|
<h4>datecreated</h4>
|
||||||
<p>Datum an dem dieser Datensatz angelegt wurde.</p>
|
<p>Datum an dem dieser Datensatz angelegt wurde.</p>
|
||||||
@@ -146,6 +155,7 @@
|
|||||||
<datehidden>2005-08-01</datehidden><br>
|
<datehidden>2005-08-01</datehidden><br>
|
||||||
<datecreated ispublishdate="0">2005-09-08 15:45:02</datecreated><br>
|
<datecreated ispublishdate="0">2005-09-08 15:45:02</datecreated><br>
|
||||||
<lastmodified>2005-12-20 20:58:41</lastmodified><br>
|
<lastmodified>2005-12-20 20:58:41</lastmodified><br>
|
||||||
|
<listing_lastmodified>2006-04-13 16:31:58</listing_lastmodified><br>
|
||||||
<attributes><br>
|
<attributes><br>
|
||||||
<attribute id="6"><![CDATA[Nur bei Opencaching]]></attribute><br>
|
<attribute id="6"><![CDATA[Nur bei Opencaching]]></attribute><br>
|
||||||
</attributes><br>
|
</attributes><br>
|
||||||
@@ -154,7 +164,7 @@
|
|||||||
<wpt id="26" type="2" typename="Stage or reference point" longitude="8.02333" latitude="50.01544"><![CDATA[Station 1]]></wpt><br />
|
<wpt id="26" type="2" typename="Stage or reference point" longitude="8.02333" latitude="50.01544"><![CDATA[Station 1]]></wpt><br />
|
||||||
</wpts><br />
|
</wpts><br />
|
||||||
</cache></p>
|
</cache></p>
|
||||||
<p><em>lastmodified</em> ist das letzte Änderungsdatum des cache-Datensatzes, ohne Änderungen an Cachebeschreibungen oder Bildern. Für das Gesamt-Änderungsdatum des Listings müssen Letztere also mit "eingerechnet" werden. Ein Gesamt-Änderungsdatum des Listings kann bei Bedarf eingebaut werden.</p>
|
<p><em>lastmodified</em> ist das letzte Änderungsdatum des cache-Datensatzes, ohne Änderungen an Cachebeschreibungen oder Bildern. Das Gesamt-Änderungsdatum steht im Feld <em>listing_lastmodified</em>.</p>
|
||||||
<p><em>datecreated</em> ist bei mit OC Version 1 und 2 angelegten Caches das Datum, an dem das Listing angelegt wurde, bei mit Version 3 angelegten Caches das Veröffentlichungsdatum. Ab Interface Version 1.2 zeigt das Attribut <em>ispublishdate="1"</em> an, dass es sich um das Veröffentlichungsdatum handelt.</p>
|
<p><em>datecreated</em> ist bei mit OC Version 1 und 2 angelegten Caches das Datum, an dem das Listing angelegt wurde, bei mit Version 3 angelegten Caches das Veröffentlichungsdatum. Ab Interface Version 1.2 zeigt das Attribut <em>ispublishdate="1"</em> an, dass es sich um das Veröffentlichungsdatum handelt.</p>
|
||||||
<p>Ab XML-Version 1.2 werden im <em>size</em>-Feld auch Nano-Größen zurückgeliefert. In älteren Interface-Versionen wird stattdessen "micro" ausgegeben.</p>
|
<p>Ab XML-Version 1.2 werden im <em>size</em>-Feld auch Nano-Größen zurückgeliefert. In älteren Interface-Versionen wird stattdessen "micro" ausgegeben.</p>
|
||||||
<p>Es fehlen noch Empfehlungen und zusätzliche Wegpunkte; wird bei Bedarf eingebaut.</p>
|
<p>Es fehlen noch Empfehlungen und zusätzliche Wegpunkte; wird bei Bedarf eingebaut.</p>
|
||||||
@@ -196,8 +206,10 @@
|
|||||||
Volker]]></text><br>
|
Volker]]></text><br>
|
||||||
<datecreated>2005-12-24 06:24:07</datecreated><br>
|
<datecreated>2005-12-24 06:24:07</datecreated><br>
|
||||||
<lastmodified>2005-12-24 06:24:07</lastmodified><br>
|
<lastmodified>2005-12-24 06:24:07</lastmodified><br>
|
||||||
|
<log_lastmodified>2005-12-24 06:41:30</log_lastmodified><br>
|
||||||
</cachelog>
|
</cachelog>
|
||||||
</p>
|
</p>
|
||||||
|
<p><em>lastmodified</em> ist das letzte Änderungsdatum des Log-Datensatzes, ohne Änderungen an Bildern. Das Gesamt-Änderungsdatum steht im Feld <em>log_lastmodified</em>.</p>
|
||||||
<h3>picture (Bilder)</h3>
|
<h3>picture (Bilder)</h3>
|
||||||
<p>
|
<p>
|
||||||
<picture><br>
|
<picture><br>
|
||||||
@@ -271,20 +283,20 @@
|
|||||||
<p>Paramter uuid ... wie cacheid, ausser dass statt der cacheid die UUID des Caches verwendet wird.</p>
|
<p>Paramter uuid ... wie cacheid, ausser dass statt der cacheid die UUID des Caches verwendet wird.</p>
|
||||||
<h3>Beispiele</h3>
|
<h3>Beispiele</h3>
|
||||||
<p>1. Alle Daten inkrementell abrufen<br/>
|
<p>1. Alle Daten inkrementell abrufen<br/>
|
||||||
<a>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=<date>&user=1&cache=1&cachedesc=1&cachelog=1&picture=1&removedobject=1</a></p>
|
<a>http://www.opencaching.de/xml/ocxml14.php?modifiedsince=<date>&user=1&cache=1&cachedesc=1&cachelog=1&picture=1&removedobject=1</a></p>
|
||||||
<p>2. Alle Daten von Deutschland inkrementell abrufen<br/>
|
<p>2. Alle Daten von Deutschland inkrementell abrufen<br/>
|
||||||
<A>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=<date>&cache=1&cachedesc=1&cachelog=1&picture=1&removedobject=0&country=DE&picturefromcachelog=1</a></p>
|
<A>http://www.opencaching.de/xml/ocxml14.php?modifiedsince=<date>&cache=1&cachedesc=1&cachelog=1&picture=1&removedobject=0&country=DE&picturefromcachelog=1</a></p>
|
||||||
<p>3. Alle Caches ohne Logs von Deutschland inkrementell abrufen<br/>
|
<p>3. Alle Caches ohne Logs von Deutschland inkrementell abrufen<br/>
|
||||||
<a>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=<date>&cache=1&cachedesc=1&picture=1&removedobject=0&country=DE</a></p>
|
<a>http://www.opencaching.de/xml/ocxml14.php?modifiedsince=<date>&cache=1&cachedesc=1&picture=1&removedobject=0&country=DE</a></p>
|
||||||
<p>4. Alle Daten im Umkreis von 15 km abrufen<br/>
|
<p>4. Alle Daten im Umkreis von 15 km abrufen<br/>
|
||||||
<a>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=<date>&cache=1&cachedesc=1&cachelog=1&picture=1&removedobject=0&lat=48&lon=9&distance=15&picturefromcachelog=1</a></p>
|
<a>http://www.opencaching.de/xml/ocxml14.php?modifiedsince=<date>&cache=1&cachedesc=1&cachelog=1&picture=1&removedobject=0&lat=48&lon=9&distance=15&picturefromcachelog=1</a></p>
|
||||||
<p>5. Alle Bilder abrufen<br/>
|
<p>5. Alle Bilder abrufen<br/>
|
||||||
<a>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=<date>&picture=1</a></p>
|
<a>http://www.opencaching.de/xml/ocxml14.php?modifiedsince=<date>&picture=1</a></p>
|
||||||
<p>6. Alle Bilder von Caches abrufen die in Deutschland versteckt sind<br/>
|
<p>6. Alle Bilder von Caches abrufen die in Deutschland versteckt sind<br/>
|
||||||
<a>http://www.opencaching.de/xml/ocxml2.php?modifiedsince=<date>&picture=1&country=DE</a></p>
|
<a>http://www.opencaching.de/xml/ocxml2.php?modifiedsince=<date>&picture=1&country=DE</a></p>
|
||||||
<p>7. Alle Bilder von Caches und deren Logs abrufen die in Deutschland versteckt
|
<p>7. Alle Bilder von Caches und deren Logs abrufen die in Deutschland versteckt
|
||||||
sind<br/>
|
sind<br/>
|
||||||
<a>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=<date>&picture=1&country=DE</a>&picturefromcachelog=1</p>
|
<a>http://www.opencaching.de/xml/ocxml14.php?modifiedsince=<date>&picture=1&country=DE</a>&picturefromcachelog=1</p>
|
||||||
<p>Mit ocxml11.php kann stattdessen die Interface-Version 1.1 verwendet werden.</p>
|
<p>Mit ocxml11.php kann stattdessen die Interface-Version 1.1 verwendet werden.</p>
|
||||||
<p>Diese Anfragen werden mit einem kurzen XML-Stream beantwortet, der die
|
<p>Diese Anfragen werden mit einem kurzen XML-Stream beantwortet, der die
|
||||||
XML-Session-Id zurückgibt. Mit dieser Id können dann die Daten abgerufen
|
XML-Session-Id zurückgibt. Mit dieser Id können dann die Daten abgerufen
|
||||||
@@ -300,9 +312,9 @@
|
|||||||
Summe der Datensätze ist in diesem Beispiel 1205 - es werden also 3 Aufrufe
|
Summe der Datensätze ist in diesem Beispiel 1205 - es werden also 3 Aufrufe
|
||||||
benötigt (500, 500, 205 Datensätze).</p>
|
benötigt (500, 500, 205 Datensätze).</p>
|
||||||
<p>Die Daten können dann mit folgender Anfrage abgerufen werden:<br/>
|
<p>Die Daten können dann mit folgender Anfrage abgerufen werden:<br/>
|
||||||
<a>http://www.opencaching.de/xml/ocxml13.php?sessionid=12345&file=1</a><br/>
|
<a>http://www.opencaching.de/xml/ocxml14.php?sessionid=12345&file=1</a><br/>
|
||||||
<a>http://www.opencaching.de/xml/ocxml13.php?sessionid=12345&file=2</a><br/>
|
<a>http://www.opencaching.de/xml/ocxml14.php?sessionid=12345&file=2</a><br/>
|
||||||
<a>http://www.opencaching.de/xml/ocxml13.php?sessionid=12345&file=3</a></p>
|
<a>http://www.opencaching.de/xml/ocxml14.php?sessionid=12345&file=3</a></p>
|
||||||
<p>Die Sessionid ist zwei Stunden lang gültig, wobei sich dieser Zeitraum mit jedem
|
<p>Die Sessionid ist zwei Stunden lang gültig, wobei sich dieser Zeitraum mit jedem
|
||||||
einzelnen Dateiabruf verlängert – zwischen den Einzelabrufen dürfen also
|
einzelnen Dateiabruf verlängert – zwischen den Einzelabrufen dürfen also
|
||||||
maximal zwei Stunden vergehen. Dauert es länger, müsste eine neue sessionid
|
maximal zwei Stunden vergehen. Dauert es länger, müsste eine neue sessionid
|
||||||
@@ -311,14 +323,14 @@
|
|||||||
<p>Um alle Ergebnisse in einer Datei abzurufen muss bei dem Aufruf der Paramter
|
<p>Um alle Ergebnisse in einer Datei abzurufen muss bei dem Aufruf der Paramter
|
||||||
session auf 0 gesetzt werden.</p>
|
session auf 0 gesetzt werden.</p>
|
||||||
<p>Beispeil:<br/>
|
<p>Beispeil:<br/>
|
||||||
<a>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=<date>&user=1&cache=1&cachedesc=1&cachelog=1&picture=1&removedobject=1&session=0</a></p>
|
<a>http://www.opencaching.de/xml/ocxml14.php?modifiedsince=<date>&user=1&cache=1&cachedesc=1&cachelog=1&picture=1&removedobject=1&session=0</a></p>
|
||||||
<h3>Dateikomprimierung einstellen</h3>
|
<h3>Dateikomprimierung einstellen</h3>
|
||||||
<p>Dei Dateikomprimierung kann mit dem Paramter zip eingestellt weren. Mögliche
|
<p>Dei Dateikomprimierung kann mit dem Paramter zip eingestellt weren. Mögliche
|
||||||
Werte sind 0, zip, bzip2, gzip. Null bedeutet hier keine Kompression. Wird
|
Werte sind 0, zip, bzip2, gzip. Null bedeutet hier keine Kompression. Wird
|
||||||
keine Kompression angegeben, wird zip verwendet.</p>
|
keine Kompression angegeben, wird zip verwendet.</p>
|
||||||
<p>Beispeil:<br/>
|
<p>Beispeil:<br/>
|
||||||
<a>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=<date>&user=1&cache=1&cachedesc=1&cachelog=1&picture=1&removedobject=1&session=0&zip=bzip2</a><br/>
|
<a>http://www.opencaching.de/xml/ocxml14.php?modifiedsince=<date>&user=1&cache=1&cachedesc=1&cachelog=1&picture=1&removedobject=1&session=0&zip=bzip2</a><br/>
|
||||||
<a>http://www.opencaching.de/xml/ocxml13.php?sessionid=12345&file=1&zip=gzip</a></p>
|
<a>http://www.opencaching.de/xml/ocxml14.php?sessionid=12345&file=1&zip=gzip</a></p>
|
||||||
<h3>XML-Optionen</h3>
|
<h3>XML-Optionen</h3>
|
||||||
<p>Die folgenden XML-Optionen müssen bei jedem Aufruf übergeben
|
<p>Die folgenden XML-Optionen müssen bei jedem Aufruf übergeben
|
||||||
werden.</p>
|
werden.</p>
|
||||||
@@ -332,8 +344,8 @@
|
|||||||
charset ... (Default) iso-8859-1 / utf-8<br />
|
charset ... (Default) iso-8859-1 / utf-8<br />
|
||||||
attrlist ... (Default) 0 = keine Attributliste übertragen / 1 = Attributliste übertragen</p>
|
attrlist ... (Default) 0 = keine Attributliste übertragen / 1 = Attributliste übertragen</p>
|
||||||
<h4><a>Beispiele</a></h4>
|
<h4><a>Beispiele</a></h4>
|
||||||
<p>http://www.opencaching.de/xml/ocxml13.php?modifiedsince=20060320000000&user=1&cache=1&cachelog=1&cachedesc=1&picture=1&removedobject=1&session=1&charset=utf-8&cdata=1&xmldecl=0&ocxmltag=0&doctype=0<br/>
|
<p>http://www.opencaching.de/xml/ocxml14.php?modifiedsince=20060320000000&user=1&cache=1&cachelog=1&cachedesc=1&picture=1&removedobject=1&session=1&charset=utf-8&cdata=1&xmldecl=0&ocxmltag=0&doctype=0<br/>
|
||||||
http://www.opencaching.de/xml/ocxml13.php?sessionid=4711&file=1&charset=utf-8&cdata=1&xmldecl=0&ocxmltag=0&doctype=0</p>
|
http://www.opencaching.de/xml/ocxml14.php?sessionid=4711&file=1&charset=utf-8&cdata=1&xmldecl=0&ocxmltag=0&doctype=0</p>
|
||||||
<h3>Sonstige Anmerkungen</h3>
|
<h3>Sonstige Anmerkungen</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
require_once('./lib/logtypes.inc.php');
|
require_once('./lib/logtypes.inc.php');
|
||||||
require($stylepath.'/smilies.inc.php');
|
require($stylepath.'/smilies.inc.php');
|
||||||
require_once($opt['rootpath'] . '../lib/htmlpurifier-4.2.0/library/HTMLPurifier.auto.php');
|
require_once($opt['rootpath'] . '../lib/htmlpurifier-4.2.0/library/HTMLPurifier.auto.php');
|
||||||
|
require_once('./lib/recommendation.inc.php');
|
||||||
|
|
||||||
//Preprocessing
|
//Preprocessing
|
||||||
if ($error == false)
|
if ($error == false)
|
||||||
@@ -238,7 +239,14 @@
|
|||||||
|
|
||||||
$log_date = date('Y-m-d H:i:s', mktime($log_time_hour+0, $log_time_minute+0, $log_time_second, $log_date_month, $log_date_day, $log_date_year));
|
$log_date = date('Y-m-d H:i:s', mktime($log_time_hour+0, $log_time_minute+0, $log_time_second, $log_date_month, $log_date_day, $log_date_year));
|
||||||
|
|
||||||
//store changed data
|
// evtl. discard cache recommendation if the log type was changed from
|
||||||
|
// 'found' or 'attended' to something else
|
||||||
|
if (!$top_option)
|
||||||
|
{
|
||||||
|
discard_recommendation($log_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// store changed data
|
||||||
sql("UPDATE `cache_logs` SET `type`='&1',
|
sql("UPDATE `cache_logs` SET `type`='&1',
|
||||||
`oc_team_comment`='&2',
|
`oc_team_comment`='&2',
|
||||||
`date`='&3',
|
`date`='&3',
|
||||||
@@ -264,13 +272,29 @@
|
|||||||
|
|
||||||
// update top-list
|
// update top-list
|
||||||
if ($top_option)
|
if ($top_option)
|
||||||
|
{
|
||||||
if ($top_cache)
|
if ($top_cache)
|
||||||
|
{
|
||||||
sql("INSERT INTO `cache_rating` (`user_id`, `cache_id`, `rating_date`)
|
sql("INSERT INTO `cache_rating` (`user_id`, `cache_id`, `rating_date`)
|
||||||
VALUES('&1', '&2','&3')
|
VALUES('&1','&2','&3')
|
||||||
ON DUPLICATE KEY UPDATE `rating_date`='&3'",
|
ON DUPLICATE KEY UPDATE `rating_date`='&3'",
|
||||||
$usr['userid'], $log_record['cache_id'], $log_date);
|
$usr['userid'], $log_record['cache_id'], $log_date);
|
||||||
|
// cache_rating.rating_date is updated when it already exists, so that
|
||||||
|
// it stays consistent with cache_logs.date when editing a log date.
|
||||||
|
|
||||||
|
// When editing one of multiple found logs, this will move rating_date
|
||||||
|
// to the last edited record. While this may not always be what the user
|
||||||
|
// expects, it makes sense for two reasons:
|
||||||
|
// 1. It is a safeguard for the case that the log date and rating_date
|
||||||
|
// have gotten out of sync for some reason (which has happend in the
|
||||||
|
// past, probably due to a log-deletion related bug).
|
||||||
|
// 2. It can be used as a tweak to control which log's date is relevant
|
||||||
|
// for the rating, e.g. when logging a second found on a recycled or
|
||||||
|
// renewed cache [listing].
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sql("DELETE FROM `cache_rating` WHERE `user_id`='&1' AND `cache_id`='&2'", $usr['userid'], $log_record['cache_id']);
|
sql("DELETE FROM `cache_rating` WHERE `user_id`='&1' AND `cache_id`='&2'", $usr['userid'], $log_record['cache_id']);
|
||||||
|
}
|
||||||
|
|
||||||
// do not use slave server for the next time ...
|
// do not use slave server for the next time ...
|
||||||
db_slave_exclude();
|
db_slave_exclude();
|
||||||
|
|||||||
67
htdocs/lib/recommendation.inc.php
Normal file
67
htdocs/lib/recommendation.inc.php
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
/****************************************************************************
|
||||||
|
For license information see doc/license.txt
|
||||||
|
|
||||||
|
Unicode Reminder メモ
|
||||||
|
|
||||||
|
recommendation-related functions
|
||||||
|
|
||||||
|
This currently is used by lib1 code only but is compatible with lib2 code.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
// If the cache was recommended by this log
|
||||||
|
// - discard the recommendation if there is no other matching found or attended log
|
||||||
|
// - change the "rating date" to the earliest other found/attended log otherwise
|
||||||
|
|
||||||
|
function discard_recommendation($log_id)
|
||||||
|
{
|
||||||
|
$rsLog = sql("
|
||||||
|
SELECT
|
||||||
|
`cache_logs`.`cache_id`,
|
||||||
|
`cache_logs`.`user_id`,
|
||||||
|
`cache_rating`.`rating_date` IS NOT NULL AS `is_rating_log`
|
||||||
|
FROM `cache_logs`
|
||||||
|
LEFT JOIN `cache_rating`
|
||||||
|
ON `cache_rating`.`cache_id`=`cache_logs`.`cache_id`
|
||||||
|
AND `cache_rating`.`user_id`=`cache_logs`.`user_id`
|
||||||
|
AND `cache_rating`.`rating_date`=`cache_logs`.`date`
|
||||||
|
WHERE
|
||||||
|
`cache_logs`.`id`='&1' AND `cache_logs`.`type` IN (1,7)",
|
||||||
|
$log_id);
|
||||||
|
|
||||||
|
if ($rLog = sql_fetch_assoc($rsLog))
|
||||||
|
{
|
||||||
|
$rsFirstOtherFound = sql("
|
||||||
|
SELECT `date` FROM `cache_logs`
|
||||||
|
WHERE `cache_id`='&1' AND `user_id`='&2' AND `id`<>'&3' AND `type` IN (1,7)
|
||||||
|
ORDER BY `date`
|
||||||
|
LIMIT 1",
|
||||||
|
$rLog['cache_id'], $rLog['user_id'], $log_id);
|
||||||
|
$rFirstOtherFound = sql_fetch_assoc($rsFirstOtherFound);
|
||||||
|
sql_free_result($rsFirstOtherFound);
|
||||||
|
|
||||||
|
if ($rLog['is_rating_log'] && $rsFirstOtherFound)
|
||||||
|
{
|
||||||
|
sql("
|
||||||
|
UPDATE `cache_rating`
|
||||||
|
SET `rating_date`='&3'
|
||||||
|
WHERE `cache_id`='&1' AND `user_id`='&2'",
|
||||||
|
$rLog['cache_id'], $rLog['user_id'], $rFirstOtherFound['date']);
|
||||||
|
// This will trigger an cache_logs.last_modified update of the corresponding
|
||||||
|
// log, so that XML interface will resend it with the updated
|
||||||
|
// "recommendation" flag.
|
||||||
|
}
|
||||||
|
else if (!$rsFirstOtherFound)
|
||||||
|
{
|
||||||
|
// This is also called for $rLog['is_rating_log'] == false, so that
|
||||||
|
// even a rating record with inconsistent date gets deleted.
|
||||||
|
sql("
|
||||||
|
DELETE FROM `cache_rating` WHERE `cache_id` = '&1' AND `user_id` = '&2'",
|
||||||
|
$rLog['cache_id'], $rLog['user_id']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sql_free_result($rsLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -334,7 +334,7 @@ class cache
|
|||||||
IF(ISNULL(`cache_rating`.`cache_id`), 0, `cache_logs`.`type` IN (1,7)) AS `recommended`
|
IF(ISNULL(`cache_rating`.`cache_id`), 0, `cache_logs`.`type` IN (1,7)) AS `recommended`
|
||||||
FROM $table AS `cache_logs`
|
FROM $table AS `cache_logs`
|
||||||
INNER JOIN `user` ON `user`.`user_id` = `cache_logs`.`user_id`
|
INNER JOIN `user` ON `user`.`user_id` = `cache_logs`.`user_id`
|
||||||
LEFT JOIN `cache_rating` ON `cache_logs`.`cache_id`=`cache_rating`.`cache_id` AND `cache_logs`.`user_id`=`cache_rating`.`user_id`
|
LEFT JOIN `cache_rating` ON `cache_logs`.`cache_id`=`cache_rating`.`cache_id` AND `cache_logs`.`user_id`=`cache_rating`.`user_id` AND `cache_logs`.`date`=`cache_rating`.`rating_date`
|
||||||
".$addjoin."
|
".$addjoin."
|
||||||
WHERE `cache_logs`.`cache_id`='&1'
|
WHERE `cache_logs`.`cache_id`='&1'
|
||||||
ORDER BY `cache_logs`.`date` DESC, `cache_logs`.`Id` DESC LIMIT &2, &3", $cacheid, $start+0, $count+0);
|
ORDER BY `cache_logs`.`date` DESC, `cache_logs`.`Id` DESC LIMIT &2, &3", $cacheid, $start+0, $count+0);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
require_once('./lib/common.inc.php');
|
require_once('./lib/common.inc.php');
|
||||||
require_once($stylepath . '/lib/icons.inc.php');
|
require_once($stylepath . '/lib/icons.inc.php');
|
||||||
require_once($rootpath . 'lib2/html2text.class.php');
|
require_once($rootpath . 'lib2/html2text.class.php');
|
||||||
|
require_once('./lib/recommendation.inc.php');
|
||||||
|
|
||||||
//Preprocessing
|
//Preprocessing
|
||||||
if ($error == false)
|
if ($error == false)
|
||||||
@@ -182,18 +183,15 @@
|
|||||||
}
|
}
|
||||||
sql_free_result($rs);
|
sql_free_result($rs);
|
||||||
|
|
||||||
|
// evtl. discard cache recommendation
|
||||||
|
discard_recommendation($log_id);
|
||||||
|
|
||||||
// move to archive, even if own log (uuids are used for OKAPI replication)
|
// move to archive, even if own log (uuids are used for OKAPI replication)
|
||||||
sql("INSERT IGNORE INTO `cache_logs_archived` SELECT *, '0' AS `deletion_date`, '&2' AS `deleted_by`, 0 AS `restored_by` FROM `cache_logs` WHERE `cache_logs`.`id`='&1' LIMIT 1", $log_id, $usr['userid']);
|
sql("INSERT IGNORE INTO `cache_logs_archived` SELECT *, '0' AS `deletion_date`, '&2' AS `deleted_by`, 0 AS `restored_by` FROM `cache_logs` WHERE `cache_logs`.`id`='&1' LIMIT 1", $log_id, $usr['userid']);
|
||||||
|
|
||||||
// remove log entry
|
// remove log entry
|
||||||
sql("DELETE FROM `cache_logs` WHERE `cache_logs`.`id`='&1' LIMIT 1", $log_id);
|
sql("DELETE FROM `cache_logs` WHERE `cache_logs`.`id`='&1' LIMIT 1", $log_id);
|
||||||
|
|
||||||
// remove cache from users top caches, if the only found or attended log
|
|
||||||
// of this user was deleted
|
|
||||||
sql("DELETE FROM `cache_rating` WHERE `user_id` = '&1' AND `cache_id` = '&2' AND
|
|
||||||
0 = (SELECT COUNT(*) FROM `cache_logs` WHERE `user_id` = '&1' AND `cache_id` = '&2' AND `type` IN (1,7))",
|
|
||||||
$log_record['log_user_id'], $log_record['cache_id']);
|
|
||||||
|
|
||||||
// now tell OKAPI about the deletion;
|
// now tell OKAPI about the deletion;
|
||||||
// this will trigger an okapi_syncbase update, if OKAPI is installed:
|
// this will trigger an okapi_syncbase update, if OKAPI is installed:
|
||||||
sql("UPDATE `cache_logs_archived` SET `deletion_date`=NOW() WHERE `id`='&1'", $log_id);
|
sql("UPDATE `cache_logs_archived` SET `deletion_date`=NOW() WHERE `id`='&1'", $log_id);
|
||||||
|
|||||||
@@ -10,8 +10,9 @@
|
|||||||
<col width="150">
|
<col width="150">
|
||||||
<col>
|
<col>
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr><td class="header" colspan="2"><img src="resource2/{$opt.template.style}/images/misc/32x32-tools.png" border="0" width="32" height="32" align="middle" /><font size="4"> <b>{t}Database Maintainance{/t}</b></font></td></tr>
|
<tr><td class="header" colspan="2"><img src="resource2/{$opt.template.style}/images/misc/32x32-tools.png" border="0" width="32" height="32" align="middle" /><font size="4"> <b>{t}Database maintainance{/t}</b></font></td></tr>
|
||||||
<tr><td class="spacer" colspan="2"></td></tr>
|
<tr><td colspan="2">{t}Test for and fix inconsistencies in database tables{/t}</td></tr>
|
||||||
|
<tr><td class="spacer" colspan="2"> </td></tr>
|
||||||
|
|
||||||
{foreach from=$procedures item=procItem}
|
{foreach from=$procedures item=procItem}
|
||||||
<tr><td colspan="2"><input id="{$procItem|escape}" type="radio" name="action" value="{$procItem|escape}"> <label for="{$procItem|escape}">{$procItem|escape}</label></td></tr>
|
<tr><td colspan="2"><input id="{$procItem|escape}" type="radio" name="action" value="{$procItem|escape}"> <label for="{$procItem|escape}">{$procItem|escape}</label></td></tr>
|
||||||
|
|||||||
@@ -453,7 +453,7 @@ function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $z
|
|||||||
/* we deliberatly do not use gc_wp_maintained here */
|
/* we deliberatly do not use gc_wp_maintained here */
|
||||||
`caches`.`wp_oc` `wp_oc`, `caches`.`date_hidden` `date_hidden`, `caches`.`date_created` `date_created`, `caches`.`is_publishdate` `is_publishdate`,
|
`caches`.`wp_oc` `wp_oc`, `caches`.`date_hidden` `date_hidden`, `caches`.`date_created` `date_created`, `caches`.`is_publishdate` `is_publishdate`,
|
||||||
`caches`.`last_modified` `last_modified`, `caches`.`status` `status`, `caches`.`node` `node`,
|
`caches`.`last_modified` `last_modified`, `caches`.`status` `status`, `caches`.`node` `node`,
|
||||||
`cache_status`.`allow_user_view`
|
`caches`.`listing_last_modified` `listing_last_modified`, `cache_status`.`allow_user_view`
|
||||||
FROM `tmpxml_caches`
|
FROM `tmpxml_caches`
|
||||||
INNER JOIN `caches` ON `tmpxml_caches`.`id`=`caches`.`cache_id`
|
INNER JOIN `caches` ON `tmpxml_caches`.`id`=`caches`.`cache_id`
|
||||||
INNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id`
|
INNER JOIN `user` ON `caches`.`user_id`=`user`.`user_id`
|
||||||
@@ -486,6 +486,8 @@ function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $z
|
|||||||
else $pd = "";
|
else $pd = "";
|
||||||
fwrite($f, $t2 . '<datecreated' . $pd . '>' . date($sDateformat, strtotime($r['date_created'])) . '</datecreated>' . "\n");
|
fwrite($f, $t2 . '<datecreated' . $pd . '>' . date($sDateformat, strtotime($r['date_created'])) . '</datecreated>' . "\n");
|
||||||
fwrite($f, $t2 . '<lastmodified>' . date($sDateformat, strtotime($r['last_modified'])) . '</lastmodified>' . "\n");
|
fwrite($f, $t2 . '<lastmodified>' . date($sDateformat, strtotime($r['last_modified'])) . '</lastmodified>' . "\n");
|
||||||
|
if ($ocxmlversion >= 14)
|
||||||
|
fwrite($f, $t2 . '<listing_lastmodified>' . date($sDateformat, strtotime($r['listing_last_modified'])) . '</listing_lastmodified>' . "\n");
|
||||||
|
|
||||||
$rsAttributes = sql("SELECT `cache_attrib`.`id`, `cache_attrib`.`name`
|
$rsAttributes = sql("SELECT `cache_attrib`.`id`, `cache_attrib`.`name`
|
||||||
FROM `caches_attributes`
|
FROM `caches_attributes`
|
||||||
@@ -572,12 +574,17 @@ function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $z
|
|||||||
}
|
}
|
||||||
mysql_free_result($rs);
|
mysql_free_result($rs);
|
||||||
|
|
||||||
|
if ($ocxmlversion >= 14)
|
||||||
|
$rating_condition = "AND `cache_logs`.`date`=`cache_rating`.`rating_date`";
|
||||||
|
else
|
||||||
|
$rating_condition = "";
|
||||||
$rs = sql('SELECT SQL_BUFFER_RESULT `cache_logs`.`id` `id`, `cache_logs`.`cache_id` `cache_id`, `cache_logs`.`user_id` `user_id`,
|
$rs = sql('SELECT SQL_BUFFER_RESULT `cache_logs`.`id` `id`, `cache_logs`.`cache_id` `cache_id`, `cache_logs`.`user_id` `user_id`,
|
||||||
`cache_logs`.`type` `type`, `cache_logs`.`date` `date`, `cache_logs`.`text` `text`, `cache_logs`.`text_html` `text_html`,
|
`cache_logs`.`type` `type`, `cache_logs`.`date` `date`, `cache_logs`.`text` `text`, `cache_logs`.`text_html` `text_html`,
|
||||||
`cache_logs`.`oc_team_comment`,
|
`cache_logs`.`oc_team_comment`,
|
||||||
`cache_logs`.`date_created` `date_created`, `cache_logs`.`last_modified` `last_modified`,
|
`cache_logs`.`date_created` `date_created`, `cache_logs`.`last_modified` `last_modified`,
|
||||||
|
`cache_logs`.`log_last_modified` `log_last_modified`,
|
||||||
`cache_logs`.`uuid` `uuid`, `user`.`username` `username`, `caches`.`uuid` `cacheuuid`,
|
`cache_logs`.`uuid` `uuid`, `user`.`username` `username`, `caches`.`uuid` `cacheuuid`,
|
||||||
`user`.`uuid` `useruuid`, `cache_logs`.`node` `node`, IF(NOT ISNULL(`cache_rating`.`cache_id`) AND `cache_logs`.`type`=1, 1, 0) AS `recommended`,
|
`user`.`uuid` `useruuid`, `cache_logs`.`node` `node`, IF(NOT ISNULL(`cache_rating`.`cache_id`) AND `cache_logs`.`type` IN (1,7), 1, 0) AS `recommended`,
|
||||||
`cache_status`.`allow_user_view`,
|
`cache_status`.`allow_user_view`,
|
||||||
`user`.`data_license`,
|
`user`.`data_license`,
|
||||||
`caches`.`country` AS `language` /* hack */
|
`caches`.`country` AS `language` /* hack */
|
||||||
@@ -586,7 +593,7 @@ function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $z
|
|||||||
INNER JOIN `user` ON `cache_logs`.`user_id`=`user`.`user_id`
|
INNER JOIN `user` ON `cache_logs`.`user_id`=`user`.`user_id`
|
||||||
INNER JOIN `caches` ON `caches`.`cache_id`=`cache_logs`.`cache_id`
|
INNER JOIN `caches` ON `caches`.`cache_id`=`cache_logs`.`cache_id`
|
||||||
INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`
|
INNER JOIN `cache_status` ON `caches`.`status`=`cache_status`.`id`
|
||||||
LEFT JOIN `cache_rating` ON `cache_logs`.`cache_id`=`cache_rating`.`cache_id` AND `cache_logs`.`user_id`=`cache_rating`.`user_id`');
|
LEFT JOIN `cache_rating` ON `cache_logs`.`cache_id`=`cache_rating`.`cache_id` AND `cache_logs`.`user_id`=`cache_rating`.`user_id` ' . $rating_condition);
|
||||||
while ($r = sql_fetch_array($rs))
|
while ($r = sql_fetch_array($rs))
|
||||||
{
|
{
|
||||||
$bAllowView = ($r['allow_user_view'] == 1);
|
$bAllowView = ($r['allow_user_view'] == 1);
|
||||||
@@ -601,7 +608,10 @@ function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $z
|
|||||||
if ($ocxmlversion >= 13)
|
if ($ocxmlversion >= 13)
|
||||||
$teamcomment = ' teamcomment="' . $r['oc_team_comment'] . '"';
|
$teamcomment = ' teamcomment="' . $r['oc_team_comment'] . '"';
|
||||||
else
|
else
|
||||||
|
{
|
||||||
$teamcomment = '';
|
$teamcomment = '';
|
||||||
|
if ($r['type'] > 8) $r['type'] = 3;
|
||||||
|
}
|
||||||
fwrite($f, $t1 . '<cachelog>' . "\n");
|
fwrite($f, $t1 . '<cachelog>' . "\n");
|
||||||
fwrite($f, $t2 . '<id id="' . $r['id'] . '" node="' . $r['node'] . '">' . $r['uuid'] . '</id>' . "\n");
|
fwrite($f, $t2 . '<id id="' . $r['id'] . '" node="' . $r['node'] . '">' . $r['uuid'] . '</id>' . "\n");
|
||||||
fwrite($f, $t2 . '<cacheid id="' . $r['cache_id'] . '">' . $r['cacheuuid'] . '</cacheid>' . "\n");
|
fwrite($f, $t2 . '<cacheid id="' . $r['cache_id'] . '">' . $r['cacheuuid'] . '</cacheid>' . "\n");
|
||||||
@@ -611,6 +621,8 @@ function outputXmlFile($sessionid, $filenr, $bXmlDecl, $bOcXmlTag, $bDocType, $z
|
|||||||
fwrite($f, $t2 . '<text html="' . $r['text_html'] . '">' . xmlcdata(($bAllowView ? $r['text'] : '')) . '</text>' . "\n");
|
fwrite($f, $t2 . '<text html="' . $r['text_html'] . '">' . xmlcdata(($bAllowView ? $r['text'] : '')) . '</text>' . "\n");
|
||||||
fwrite($f, $t2 . '<datecreated>' . date($sDateformat, strtotime($r['date_created'])) . '</datecreated>' . "\n");
|
fwrite($f, $t2 . '<datecreated>' . date($sDateformat, strtotime($r['date_created'])) . '</datecreated>' . "\n");
|
||||||
fwrite($f, $t2 . '<lastmodified>' . date($sDateformat, strtotime($r['last_modified'])) . '</lastmodified>' . "\n");
|
fwrite($f, $t2 . '<lastmodified>' . date($sDateformat, strtotime($r['last_modified'])) . '</lastmodified>' . "\n");
|
||||||
|
if ($ocxmlversion >= 14)
|
||||||
|
fwrite($f, $t2 . '<log_lastmodified>' . date($sDateformat, strtotime($r['log_last_modified'])) . '</log_lastmodified>' . "\n");
|
||||||
|
|
||||||
if ($bLicense)
|
if ($bLicense)
|
||||||
{
|
{
|
||||||
|
|||||||
148
htdocs/xml/ocxml14.dtd
Normal file
148
htdocs/xml/ocxml14.dtd
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
<!ELEMENT oc11xml (attrlist*, user*, cache*, cachedesc*, cachelog*, picture*, removedobject*)>
|
||||||
|
<!ATTLIST oc11xml
|
||||||
|
version CDATA #REQUIRED
|
||||||
|
date CDATA #REQUIRED
|
||||||
|
since CDATA #REQUIRED
|
||||||
|
>
|
||||||
|
|
||||||
|
<!ELEMENT attrlist (attr*)>
|
||||||
|
<!ELEMENT user (id, username, pmr, datecreated, lastmodified)>
|
||||||
|
<!ELEMENT cache (id, userid, name, longitude, latitude, type, status, country, size, desclanguages, difficulty, terrain, rating, waypoints, datehidden, datecreated, lastmodified, listing_lastmodified, attributes, wpts)>
|
||||||
|
<!ELEMENT cachedesc (id, cacheid, language, shortdesc, desc, hint, license?, lastmodified)>
|
||||||
|
<!ELEMENT cachelog (id, cacheid, userid, logtype, date, text, license?, datecreated, lastmodified, log_lastmodified)>
|
||||||
|
<!ELEMENT picture (id, url, title, object, picattr, license?, datecreated, lastmodified)>
|
||||||
|
<!ELEMENT removedobject (id, object, removeddate)>
|
||||||
|
|
||||||
|
<!-- common elements -->
|
||||||
|
<!ELEMENT id (#PCDATA)>
|
||||||
|
<!ATTLIST id
|
||||||
|
id CDATA #IMPLIED
|
||||||
|
node CDATA #IMPLIED
|
||||||
|
>
|
||||||
|
<!ELEMENT datecreated (#PCDATA)>
|
||||||
|
<!ATTLIST datecreated
|
||||||
|
ispublishdate CDATA #IMPLIED
|
||||||
|
>
|
||||||
|
<!ELEMENT lastmodified (#PCDATA)>
|
||||||
|
<!ELEMENT license (#PCDATA)>
|
||||||
|
|
||||||
|
<!-- attrlist -->
|
||||||
|
<!ELEMENT attr (#PCDATA)>
|
||||||
|
<!ATTLIST attr
|
||||||
|
id CDATA #REQUIRED
|
||||||
|
icon_large CDATA #REQUIRED
|
||||||
|
icon_no CDATA #REQUIRED
|
||||||
|
icon_undef CDATA #REQUIRED
|
||||||
|
>
|
||||||
|
|
||||||
|
<!-- user -->
|
||||||
|
<!ELEMENT username (#PCDATA)>
|
||||||
|
<!ELEMENT pmr (#PCDATA)>
|
||||||
|
|
||||||
|
<!-- cache -->
|
||||||
|
<!ELEMENT userid (#PCDATA)>
|
||||||
|
<!ATTLIST userid
|
||||||
|
id CDATA #IMPLIED
|
||||||
|
uuid CDATA #REQUIRED
|
||||||
|
>
|
||||||
|
<!ELEMENT name (#PCDATA)>
|
||||||
|
<!ELEMENT latitude (#PCDATA)>
|
||||||
|
<!ELEMENT longitude (#PCDATA)>
|
||||||
|
<!ELEMENT type (#PCDATA)>
|
||||||
|
<!ATTLIST type
|
||||||
|
id CDATA #REQUIRED
|
||||||
|
short CDATA #IMPLIED
|
||||||
|
>
|
||||||
|
<!ELEMENT status (#PCDATA)>
|
||||||
|
<!ATTLIST status
|
||||||
|
id CDATA #REQUIRED
|
||||||
|
>
|
||||||
|
<!ELEMENT country (#PCDATA)>
|
||||||
|
<!ATTLIST country
|
||||||
|
id CDATA #REQUIRED
|
||||||
|
>
|
||||||
|
<!ELEMENT size (#PCDATA)>
|
||||||
|
<!ATTLIST size
|
||||||
|
id CDATA #REQUIRED
|
||||||
|
>
|
||||||
|
<!ELEMENT desclanguages (#PCDATA)>
|
||||||
|
<!ELEMENT difficulty (#PCDATA)>
|
||||||
|
<!ELEMENT terrain (#PCDATA)>
|
||||||
|
<!ELEMENT rating (#PCDATA)>
|
||||||
|
<!ATTLIST rating
|
||||||
|
waylength CDATA #REQUIRED
|
||||||
|
needtime CDATA #REQUIRED
|
||||||
|
>
|
||||||
|
<!ELEMENT waypoints (#PCDATA)>
|
||||||
|
<!ATTLIST waypoints
|
||||||
|
gccom CDATA #IMPLIED
|
||||||
|
nccom CDATA #IMPLIED
|
||||||
|
oc CDATA #REQUIRED
|
||||||
|
>
|
||||||
|
<!ELEMENT datehidden (#PCDATA)>
|
||||||
|
<!ELEMENT attributes (attribute*)>
|
||||||
|
<!ELEMENT attribute (#PCDATA)>
|
||||||
|
<!ATTLIST attribute
|
||||||
|
id CDATA #REQUIRED
|
||||||
|
>
|
||||||
|
<!ELEMENT wpts (wpt*)>
|
||||||
|
<!ELEMENT wpt (#PCDATA)>
|
||||||
|
<!ATTLIST wpt
|
||||||
|
id CDATA #REQUIRED
|
||||||
|
type CDATA #REQUIRED
|
||||||
|
typename CDATA #IMPLIED
|
||||||
|
longitude CDATA #REQUIRED
|
||||||
|
latitude CDATA #REQUIRED
|
||||||
|
>
|
||||||
|
|
||||||
|
<!-- cachedesc -->
|
||||||
|
<!ELEMENT cacheid (#PCDATA)>
|
||||||
|
<!ATTLIST cacheid
|
||||||
|
id CDATA #IMPLIED
|
||||||
|
>
|
||||||
|
<!ELEMENT language (#PCDATA)>
|
||||||
|
<!ATTLIST language
|
||||||
|
id CDATA #REQUIRED
|
||||||
|
>
|
||||||
|
<!ELEMENT shortdesc (#PCDATA)>
|
||||||
|
<!ELEMENT desc (#PCDATA)>
|
||||||
|
<!ATTLIST desc
|
||||||
|
html CDATA #REQUIRED
|
||||||
|
>
|
||||||
|
<!ELEMENT hint (#PCDATA)>
|
||||||
|
|
||||||
|
<!-- cachelog -->
|
||||||
|
<!-- cacheid see cachedesc -->
|
||||||
|
<!-- userid see cache -->
|
||||||
|
<!ELEMENT logtype (#PCDATA)>
|
||||||
|
<!ATTLIST logtype
|
||||||
|
id CDATA #REQUIRED
|
||||||
|
recommended CDATA #IMPLIED
|
||||||
|
teamcomment CDATA #IMPLIED
|
||||||
|
>
|
||||||
|
<!ELEMENT date (#PCDATA)>
|
||||||
|
<!ELEMENT text (#PCDATA)>
|
||||||
|
<!ATTLIST text
|
||||||
|
html CDATA #REQUIRED
|
||||||
|
>
|
||||||
|
|
||||||
|
<!-- picture -->
|
||||||
|
<!ELEMENT url (#PCDATA)>
|
||||||
|
<!ELEMENT title (#PCDATA)>
|
||||||
|
<!ELEMENT object (#PCDATA)>
|
||||||
|
<!ATTLIST object
|
||||||
|
id CDATA #IMPLIED
|
||||||
|
type CDATA #REQUIRED
|
||||||
|
typename CDATA #IMPLIED
|
||||||
|
>
|
||||||
|
<!ELEMENT picattr (#PCDATA)>
|
||||||
|
<!ATTLIST picattr
|
||||||
|
spoiler CDATA #IMPLIED
|
||||||
|
display CDATA #REQUIRED
|
||||||
|
preview CDATA #IMPLIED
|
||||||
|
>
|
||||||
|
|
||||||
|
<!-- removedobject -->
|
||||||
|
|
||||||
|
<!-- object see picture -->
|
||||||
|
<!ELEMENT removeddate (#PCDATA)>
|
||||||
14
htdocs/xml/ocxml14.php
Normal file
14
htdocs/xml/ocxml14.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
/***************************************************************************
|
||||||
|
./xml/ocxml13.php
|
||||||
|
|
||||||
|
For license information see doc/license.txt
|
||||||
|
|
||||||
|
Unicode Reminder メモ
|
||||||
|
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
$ocxmlversion = 14;
|
||||||
|
include("ocxml11.php");
|
||||||
|
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user