Files
pathfinder/app/main/cron/mapupdate.php
Mark Friedrich e01f299d2b v1.1.1 (#233)
* fixed #194 PHP 5.6 error

* - closed #102 added "set waypoint/destination" context menu to route finder module
- update "Select2" 4.0.0 -> 4.0.3
- update "Font Awesome" 4.6.1 -> 4.6.3

* - added *.js files for develop branch

* - closed #195 fixed "BASE" dir for subDir installations
- fixed "Home" menu link

* -  #195 improved js load path

* - added "clear cache" function for manually cache clearing to /setup #200 #105 #158
- added cache size information to /setup
- added current pathfinder  "VERSION" to /setup
- updated "requireJs" 2.1.20 ->2.2.0
- removed unnecessary page cache timings from static templates (page cache)

* - added "document_root", "port", "protocol" and "PHP framework version" to /setup page
- added new "shattered" wormhole types to "signature table", closed #182, #179

* - added new "delete old signatures" option to "signature reader" dialog, closed #95

* - added new housekeeping cronjob für cached files, closed #200
- added new cache size information to /setup page

* - fixed signature groupId/typeId "overwriting" for already known signatures. closed #207
- improved system search dialog. Added trim(); before "api/signatures-> search" request

* updated README.me

* fixed PHP error "default object from empty value", closed #209

* reduced image file size

* - added local storage (IndexedDB)
- added local storage for map scroll position. closed #69

* - added "notice" panel for upcoming release information
- improved layout for "release dialog" (GitHub API)
- improved pagespeed (removed render blocking javascripts)
- improved map scrollbar configuration
- improved Chrome browser custom scrollbar layout
- removed "sign up" buttons from "map panels", closed #214

* - fixed some session and cookie  bugs

* - added new requirement check for `max_input_vars` to /setup URL, closed #224

* - fixed isWormhole(); bug

* -v1.1.1 added js build files
2016-07-05 20:44:12 +02:00

70 lines
1.9 KiB
PHP

<?php
/**
* Created by PhpStorm.
* User: exodus4d
* Date: 30.07.2015
* Time: 17:54
*/
namespace cron;
use Controller;
use DB;
class MapUpdate {
const LOG_TEXT_MAPS = '%s (%d maps)';
// disabled maps will be fully deleted after (x) days
const DAYS_UNTIL_MAP_DELETION = 30;
/**
* deactivate all "private" maps whose lifetime is over
* >> php index.php "/cron/deactivateMapData"
* @param \Base $f3
*/
function deactivateMapData(\Base $f3){
$pfDB = DB\Database::instance()->getDB('PF');
$sqlDeactivateExpiredMaps = "UPDATE map SET
active = 0
WHERE
map.active = 1 AND
map.typeId = 2 AND
TIMESTAMPDIFF(DAY, map.created, NOW() ) > :lifetime";
$privateMapLifetime = (int)$f3->get('PATHFINDER.MAP.PRIVATE.LIFETIME');
$pfDB->exec($sqlDeactivateExpiredMaps, ['lifetime' => $privateMapLifetime]);
$deactivatedMapsCount = $pfDB->count();
// Log ------------------------
$log = Controller\LogController::getLogger('cron_' . __FUNCTION__);
$log->write( sprintf(self::LOG_TEXT_MAPS, __FUNCTION__, $deactivatedMapsCount) );
}
/**
* delete all deactivated maps
* >> php index.php "/cron/deleteMapData"
* @param \Base $f3
*/
function deleteMapData(\Base $f3){
$pfDB = DB\Database::instance()->getDB('PF');
$sqlDeleteDisabledMaps = "DELETE FROM
map
WHERE
map.active = 0 AND
TIMESTAMPDIFF(DAY, map.updated, NOW() ) > :deletion_time";
$pfDB->exec($sqlDeleteDisabledMaps, ['deletion_time' => self::DAYS_UNTIL_MAP_DELETION]);
$deletedMapsCount = $pfDB->count();
// Log ------------------------
$log = Controller\LogController::getLogger('cron_' . __FUNCTION__);
$log->write( sprintf(self::LOG_TEXT_MAPS, __FUNCTION__, $deletedMapsCount) );
}
}