-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from dennisinteractive/28103_handle_mutiple_fields
28103 handle mutiple fields
- Loading branch information
Showing
30 changed files
with
1,094 additions
and
521 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/** | ||
* @file | ||
* Database | ||
*/ | ||
namespace Dennis\Link\Checker; | ||
|
||
/** | ||
* Class Database | ||
* @package Dennis\Link\Database | ||
*/ | ||
class Database implements DatabaseInterface { | ||
/** | ||
* How often the DB should be pinged in seconds. | ||
*/ | ||
const interval = 15; | ||
|
||
/** | ||
* @var int last time the DB was pinged. | ||
*/ | ||
protected $pingTime = 0; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function keepConnectionAlive() { | ||
$now = time(); | ||
// If it's been more than 15 seconds... Ping! | ||
if (($now - $this->pingTime) > self::interval) { | ||
db_query('SELECT CURTIME()'); | ||
// Set the ping time. | ||
$this->pingTime = $now; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
/** | ||
* @file | ||
* DatabaseInterface | ||
*/ | ||
namespace Dennis\Link\Checker; | ||
|
||
/** | ||
* Interface DatabaseInterface | ||
* @package Dennis\Link\Checker | ||
*/ | ||
interface DatabaseInterface { | ||
/** | ||
* Keep database connection alive. | ||
*/ | ||
public function keepConnectionAlive(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
/** | ||
* @file | ||
* Entity | ||
*/ | ||
namespace Dennis\Link\Checker; | ||
|
||
/** | ||
* Class Entity | ||
* @package Dennis\Link\Checker | ||
*/ | ||
class Entity implements EntityInterface { | ||
/** | ||
* @var string | ||
*/ | ||
protected $entityType; | ||
|
||
/** | ||
* @var int | ||
*/ | ||
protected $entityId; | ||
|
||
/** | ||
* @var ConfigInterface | ||
*/ | ||
protected $config; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function __construct($config, $entity_type, $entity_id) { | ||
$this->config = $config; | ||
$this->entityType = $entity_type; | ||
$this->entityId = $entity_id; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getConfig() { | ||
return $this->config; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function entityId() { | ||
return $this->entityId; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function entityType() { | ||
return $this->entityType; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getField($field_name) { | ||
return new Field($this, $field_name); | ||
} | ||
} |
Oops, something went wrong.