Adding archive cleanup cron

Since this needs to be done for all payouts, moved into it's own cron.

* Adjusted run-crons.sh to trigger archive cleanup
* Adjusted payouts to remove purgeArchive calls
* Adjusted pps payout, removed old configuration variable

Further addresses #143
This commit is contained in:
Sebastian Grewe 2013-07-09 14:12:54 +02:00
parent ba240000ab
commit 00b3c45d2a
4 changed files with 31 additions and 6 deletions

29
cronjobs/archive_cleanup.php Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/php
<?php
/*
Copyright:: 2013, Sebastian Grewe
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Include all settings and classes
require_once('shared.inc.php');
// If we don't keep archives, delete some now to release disk space
if (!$share->purgeArchive()) {
$log->logError("Failed to delete archived shares, not critical but should be checked!");
}
?>

View File

@ -160,10 +160,6 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
$log->logFatal("Failed to delete accounted shares from $iPreviousShareId to $iCurrentUpstreamId, aborting!");
exit(1);
}
// If we don't keep archives, delete some now to release disk space
if (!$share->purgeArchive()) {
$log->logError("Failed to delete archived shares, not critical but should be checked!");
}
// Mark this block as accounted for
if (!$block->setAccounted($aBlock['id'])) {
$log->logFatal("Failed to mark block as accounted! Aborting!");

View File

@ -120,7 +120,7 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
$log->logError("Failed to update stats for this block on : " . $aData['username']);
}
// Move shares to archive
if ($config['archive_shares'] && $aBlock['share_id'] < $iLastShareId) {
if ($aBlock['share_id'] < $iLastShareId) {
if (!$share->moveArchive($aBlock['share_id'], $aBlock['id'], @$iLastBlockShare))
$log->logError("Archving failed");
}

View File

@ -16,7 +16,7 @@ PIDFILE='/tmp/mmcfe-ng-cron.pid'
CRONHOME='.'
# List of cruns to execute
CRONS="findblock.php proportional_payout.php pplns_payout.php pps_payout.php blockupdate.php auto_payout.php tickerupdate.php notifications.php statistics.php"
CRONS="findblock.php proportional_payout.php pplns_payout.php pps_payout.php blockupdate.php auto_payout.php tickerupdate.php notifications.php statistics.php archive_cleanup.php"
# Additional arguments to pass to cronjobs
CRONARGS="-v"