Example #1
0
 public static function lockTables($value)
 {
     if (self::$dbConnection) {
         throw new Exception("Unable to lock tables, connection already established.");
     }
     self::$lockTables = (bool) $value;
     gfDebug('Tables won\'t be locked');
 }
Example #2
0
 /**
  * Lock the appropriate tables for the script
  * @param Database $db
  * @param string $extraTable The name of any extra tables to lock (eg: text)
  */
 private function lockTables($db, $extraTable = [])
 {
     $tbls = ['page', 'revision', 'redirect'];
     if ($extraTable) {
         $tbls = array_merge($tbls, $extraTable);
     }
     $db->lockTables([], $tbls, __METHOD__, false);
 }
<?php

include '../includes/Setup.php';
include './displayFunctions.php';
// Do not lock tables
Database::lockTables(false);
$deskNumber = gfGetVar('deskNumber');
// Check whether this device needs to be redirected somewhere
$dev = Device::fromDatabaseByIpAddress($_SERVER['REMOTE_ADDR']);
if ($content = getContentForRedirect($dev, (int) $deskNumber)) {
    $output = new JsonOutput();
    $output->setContent($content);
    $output->output();
    exit;
}
// Response is json
$output = new JsonOutput();
$pageTicketCode = gfGetVar('ticketCode', '');
$pageTicketNumber = gfGetVar('ticketNumber', '');
$startTime = time();
while (time() - $startTime < 120) {
    sleep(1);
    // Check every second
    // Update table for session timed out
    $desk = Desk::fromDatabaseByNumber($deskNumber);
    $desk->isOpen();
    $currentTicket = Ticket::fromDatabaseByDesk($deskNumber);
    if (!$currentTicket) {
        if ($pageTicketCode == '' && $pageTicketNumber == '') {
            // Still no ticket
            continue;
Example #4
0
 public function __construct()
 {
     Database::lockTables(false);
 }
Example #5
0
 public function __construct()
 {
     Database::lockTables(false);
     $this->dateFrom = self::$MIN_DATE;
     $this->dateTo = self::$MAX_DATE;
 }