Skip to content

Commit

Permalink
Fix erroneous force checkins.
Browse files Browse the repository at this point in the history
  • Loading branch information
olsgreen committed Oct 17, 2016
1 parent 708ed9f commit 12d1b0b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions web/concrete/src/Page/Page.php
Expand Up @@ -401,16 +401,21 @@ public function isCheckedOut()
return $this->isCheckedOutCache;
}

$dh = Core::make('helper/date');

$q = 'select cIsCheckedOut, '.$dh->getOverridableNow(true)." - UNIX_TIMESTAMP(cCheckedOutDatetimeLastEdit) as timeout from Pages where cID = '{$this->cID}'";
$q = "select cIsCheckedOut, cCheckedOutDatetimeLastEdit from Pages where cID = '{$this->cID}'";
$r = $db->executeQuery($q);

// If cCheckedOutDatetimeLastEdit is present, get the time span in seconds since it's last edit.
if (! empty($row['cCheckedOutDatetimeLastEdit'])) {
$dh = Core::make('helper/date');
$timeSinceCheckout = ($dh->getOverridableNow(true) - strtotime($row['cCheckedOutDatetimeLastEdit']));
}

if ($r) {
$row = $r->fetchRow();
if ($row['cIsCheckedOut'] == 0) {
return false;
} else {
if ($row['timeout'] > CHECKOUT_TIMEOUT) {
if (isset($timeSinceCheckout) && $timeSinceCheckout > CHECKOUT_TIMEOUT) {
$this->forceCheckIn();
$this->isCheckedOutCache = false;

Expand Down

0 comments on commit 12d1b0b

Please sign in to comment.